ShopCarCard.jsx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. import React, { Component } from 'react'
  2. import { Card, WhiteSpace } from 'antd-mobile';
  3. import './ShopCarCard.css'
  4. export default class ShopCarCard extends Component {
  5. render() {
  6. const shopCarList=this.props.shopCarList
  7. const deleteCarById=this.props.deleteCarById
  8. return (
  9. <div>
  10. {shopCarList.map((item)=>{
  11. return (
  12. <div key={item.id}>
  13. <Card full>
  14. <Card.Body>
  15. <div className="cardWrap">
  16. <img src={item.product_id.img} alt="img" width="100px" height="100px"/>
  17. <div className="middle">
  18. <div>{item.product_id.name}</div>
  19. <div>{item.product_id.intro}</div>
  20. </div>
  21. <div className="right">
  22. <div>¥{item.product_id.price}</div>
  23. <div>x {item.count}</div>
  24. <button onClick={()=>{deleteCarById(item.id)}} className="deleteButton">删除</button>
  25. </div>
  26. </div>
  27. </Card.Body>
  28. </Card>
  29. </div>
  30. )
  31. })}
  32. </div>
  33. )
  34. }
  35. }
  36. /*
  37. count: 3
  38. createdAt: "2018-12-31"
  39. id: "1542346970055"
  40. product_id: {category: "鲜果", updatedAt: "2018-12-31 11:11:11", unit: Array(3), name: "香蕉", createdAt: "2018-12-31 11:11:11", …}
  41. updatedAt: "2018-11-16 1:42:50"
  42. user_id: null
  43. */