index.jsx 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. import { View, Text, Image } from "@tarojs/components";
  2. import "./index.less";
  3. import joinStoreBg from '../../../images/index/jionStore.png'
  4. import saveMoneyBg from '../../../images/index/save-money.png'
  5. import shareEarnBg from '../../../images/index/share-earn.png'
  6. const ProductList = () => {
  7. // 模拟商品数据
  8. const products = [
  9. {
  10. id: 1,
  11. image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
  12. name: "这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称",
  13. price: 99.99,
  14. originalPrice: 199.99,
  15. saveMoney: 10,
  16. shareEarn: 20
  17. },
  18. {
  19. id: 1,
  20. image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
  21. name: "这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称",
  22. price: 99.99,
  23. originalPrice: 199.99,
  24. saveMoney: 10,
  25. shareEarn: 20
  26. },
  27. {
  28. id: 1,
  29. image: "https://img-s-msn-com.akamaized.net/tenant/amp/entityid/AA1saL6x.img?w=768&h=411&m=6",
  30. name: "这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称这是一个商品名称",
  31. price: 99.99,
  32. originalPrice: 199.99,
  33. saveMoney: 10,
  34. shareEarn: 20
  35. },
  36. // ... 其他商品数据
  37. ];
  38. return (
  39. <View className="product-list-wrap">
  40. {products.map((product, index) => (
  41. <View key={product.id}>
  42. <View className="product-item">
  43. <Image className="product-img" src={product.image} mode="aspectFill" />
  44. <View className="product-info">
  45. <View className="product-name" style={{"WebkitBoxOrient": "vertical"}}>
  46. <Text className="self-tag">自营</Text>
  47. {product.name}
  48. </View>
  49. <View className="price-line">
  50. <View className="price-info">
  51. <Text className="symbol">¥</Text>
  52. <Text className="price">{product.price}</Text>
  53. <Text className="original-price">¥{product.originalPrice}</Text>
  54. </View>
  55. <View className="add-btn">
  56. <Image
  57. className="join-store-bg"
  58. src={joinStoreBg}
  59. mode="aspectFit"
  60. />
  61. <Text className="btn-text">加入小店</Text>
  62. </View>
  63. </View>
  64. <View className="profit-line">
  65. <View className="save-money">
  66. <Image className="bg" src={saveMoneyBg} mode="aspectFit" />
  67. <View className="content">
  68. <Text className="label">自购省</Text>
  69. <Text className="money">¥{product.saveMoney}</Text>
  70. </View>
  71. </View>
  72. <View className="share-earn">
  73. <Image className="bg" src={shareEarnBg} mode="aspectFit" />
  74. <View className="content">
  75. <Text className="label">分享赚</Text>
  76. <Text className="money">¥{product.shareEarn}</Text>
  77. </View>
  78. </View>
  79. </View>
  80. </View>
  81. </View>
  82. {index !== products.length - 1 && <View className="divider"></View>}
  83. </View>
  84. ))}
  85. </View>
  86. );
  87. };
  88. export default ProductList;