cartItem.js 1.6 KB
Newer Older
.  
baiguangyao committed
1 2 3
import React, { Component } from 'react';
import { Checkbox } from 'antd-mobile';
import OrderList from '@/common/OrderList';
xuzhenghua committed
4
import {Link} from "react-router-dom";
.  
baiguangyao committed
5 6


zhanghaozhe committed
7
class CartItem extends Component {
.  
baiguangyao committed
8 9 10 11 12 13 14 15 16
    // 构造函数
    constructor(props) {
        super(props)
        this.state = {
            val: props.item.value
        }
    }
    // 改变选择
    onChange(e, id) {
xuzhenghua committed
17
        let checked = e.target.checked
.  
baiguangyao committed
18 19 20 21 22 23 24
        this.props.checkChange(id, checked)
    }

    render() {
        let item = this.props.item
        const Info = (
            <div className="order-info">
xuzhenghua committed
25 26 27
                <p className='order-title text-overflow-one'>
                    <Link to={`/detail?id=${item.course_id}`}>{item.course_title}</Link>
                </p>
xuzhenghua committed
28
                <p className='order-content text-overflow-2'>{item.simpledescription}</p>
.  
baiguangyao committed
29
                <p className='order-des'>
xuzhenghua committed
30 31
                    <span className='order-newprice'>¥{item.price1}</span>
                    <span className='order-price'>¥{item.price0}</span>
.  
baiguangyao committed
32 33 34 35 36 37 38 39
                </p>
            </div>
        )

        return (
                <div className="cart-c-item" >
                    <div className="cart-c-check">
                        <Checkbox checked={item.check} onChange={(e) => {
xuzhenghua committed
40
                            this.onChange(e, item.course_id)
.  
baiguangyao committed
41 42 43
                        }} />
                    </div>

xuzhenghua committed
44
                    <div className="card-wrap">
xuzhenghua committed
45
                        <OrderList info={Info} src={item.image_name} id={item.course_id}></OrderList>
xuzhenghua committed
46
                    </div>
.  
baiguangyao committed
47 48 49 50 51
                </div>

        )
    }
}
zhanghaozhe committed
52
export default CartItem;