import React, { PureComponent } from "react";
import { connect } from "dva";
import { Menu, Icon } from "antd";
import styles from "./index.less";
import imgsrc from "./goodsHot.png";
import GoodsBuyIpt from "../GoodsBuyIpt/index.js";

class GoodsSmall extends PureComponent {
  constructor(props) {
    super(props);
  }
  // 购买数量改变
  buyNumChange(key, num) {
    // const { orderCartData } = this.props;
    // orderCartData[key][`buyNum`] = num;
    // this.props.dispatch({
    //   type: "orderEdit/orderCartData",
    //   orderCartData: orderCartData
    // });
  }
  render() {
    const { data } = this.props;
    if (!data) return null;
    return (
      <div className={styles.goodsHot}>
        <div className={styles.imgBox}>
          <img src={data.pictureUrl} alt={{}} className={styles.img} />
        </div>
        {/* 商品信息 */}
        <div className={styles.goodsHotInfobox}>
          <div className={styles.goodsHotTitlebox}>
            <span className={styles.goodsTitle}>{data.name}</span>
          </div>
          <div className={styles.goodsHotCodeBox}>
            <span className={styles.goodsHotPrice}>￥{data.salePrice}</span>
          </div>
        </div>
        {/* 商品信息 --结束 */}
        {/* 鼠标移入 */}
        <div className={styles.goodsHotHoverBox}>
          <div className={styles.goodsCollect}>
            <Icon type="heart-o" className={styles.collectIcon} />
          </div>
          <div className={styles.iptBox}>
            <GoodsBuyIpt onChange={this.buyNumChange.bind(this)} num={0} />
          </div>
          <div className={styles.addCart}>
            <Icon type="shopping-cart" className={styles.cartIcon} />
          </div>
        </div>
        {/* 鼠标移入--结束 */}
        {/* 促销 状态 */}
        <div className={styles.goodsStatusBox}>
          <i className={styles.goodsStatusNew}>新品</i>
          <i className={styles.goodsStatusSale}>促销</i>
        </div>
        {/* 促销 状态 --结束 */}
      </div>
    );
  }
}
export default GoodsSmall;
