宜呗小程序--微信小程序
Lzk
2025-08-05 b7bcaf556aa2424e808b6e6426ab22df9cfe11c1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<template>
  <view class="product-list">
    <view class="product-grid">
      <view v-for="(item, index) in productList" :key="index" class="product-card">
        <image class="product-image" :src="item.image" mode="aspectFill"></image>
        <view class="product-info">
          <text class="product-title">{{item.title}}</text>
          <view class="product-price-row">
            <text class="product-price">¥{{item.price}}</text>
            <text class="product-original-price">¥{{item.originalPrice}}</text>
            <text class="product-sales">已售{{item.sales}}件</text>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>
 
<script>
export default {
  data() {
    return {
      productList: [
        {
          image: 'http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960',
          title: '商品标题1',
          price: '99.00',
          originalPrice: '199.00',
          sales: 1000
        },
        {
          image: 'http://gips2.baidu.com/it/u=195724436,3554684702&fm=3028&app=3028&f=JPEG&fmt=auto?w=1280&h=960',
          title: '商品标题2',
          price: '88.00',
          originalPrice: '188.00',
          sales: 800
        },
        // 可以添加更多商品数据
      ]
    }
  },
  onLoad() {
    // 这里可以添加获取商品列表数据的逻辑
  }
}
</script>
 
<style lang="scss">
.product-list {
  padding: 20rpx;
  background-color: #f5f5f5;
  min-height: 100vh;
}
 
.product-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
}
 
.product-card {
  width: 48%;
  margin-bottom: 20rpx;
  background-color: #ffffff;
  border-radius: 12rpx;
  overflow: hidden;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}
 
.product-image {
  width: 100%;
  height: 300rpx;
}
 
.product-info {
  padding: 16rpx;
}
 
.product-title {
  font-size: 28rpx;
  color: #333333;
  margin-bottom: 12rpx;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
 
.product-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
 
.product-price {
  font-size: 32rpx;
  color: #ff4d4f;
  font-weight: bold;
}
 
.product-original-price {
  font-size: 24rpx;
  color: #999999;
  text-decoration: line-through;
}
 
.product-sales {
  font-size: 24rpx;
  color: #999999;
}
</style>