quanwei
2026-01-17 e1e2fe5710a5b5cd9c19bd3aa99c998a1a613ca8
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
<template>
    <view class="groupbuy-active-detail" :data-theme='theme()'>
        <view class="banner">
            <image :src="detail.cover_images[0]" mode="widthFix" style="width: 100%;"></image>
        </view>
        
        <view class="content">
            <view class="active-info">
                <view class="active-title">{{ detail.active_name }}</view>
                <view class="active-subtitle">{{ detail.description }}</view>
                
                <view class="active-stats">
                    <view class="stat-item">
                        <text class="stat-num">{{ detail.join_num }}</text>
                        <text class="stat-label">已团</text>
                    </view>
                    <view class="stat-item">
                        <text class="stat-num">{{ detail.group_num }}</text>
                        <text class="stat-label">成团人数</text>
                    </view>
                    <view class="stat-item">
                        <text class="stat-num">{{ detail.time_left }}</text>
                        <text class="stat-label">剩余时间</text>
                    </view>
                </view>
                
                <view class="time-info">
                    <text class="time-label">活动时间:</text>
                    <text class="time-value">{{ detail.start_time }} 至 {{ detail.end_time }}</text>
                </view>
            </view>
            
            <view class="product-section">
                <view class="section-header">
                    <text class="section-title">团购商品</text>
                </view>
                
                <view class="product-list">
                    <view class="product-item" v-for="(product, index) in productList" :key="index" @click="goToProduct(product.product_id)">
                        <image :src="product.product_image" class="product-image" mode="aspectFill"></image>
                        <view class="product-info">
                            <view class="product-name">{{ product.product_name }}</view>
                            <view class="product-price">
                                <text class="now-price">¥{{ product.groupbuy_price }}</text>
                                <text class="origin-price">¥{{ product.origin_price }}</text>
                            </view>
                            <view class="product-stats">
                                <text class="sold-count">已售{{ product.sales }}件</text>
                                <text class="group-status">{{ product.group_status }}</text>
                            </view>
                        </view>
                    </view>
                </view>
            </view>
        </view>
        
        <view class="footer">
            <button class="btn-join" @click="joinGroupbuy">立即参团</button>
        </view>
    </view>
</template>
 
<script>
export default {
    data() {
        return {
            activeId: null,
            detail: {},
            productList: []
        };
    },
    onLoad(options) {
        this.activeId = options.id;
        this.loadData();
    },
    methods: {
        loadData() {
            // 加载团购活动详情
            this._get('plus.groupbuy.active/detail', {
                groupbuy_active_id: this.activeId
            }, (res) => {
                this.detail = res.data.detail;
            });
            
            // 加载团购商品列表
            this._get('plus.groupbuy.product/lists', {
                groupbuy_active_id: this.activeId
            }, (res) => {
                this.productList = res.data.list.data;
            });
        },
        goToProduct(productId) {
            this.gotoPage(`/pages/product/detail/detail?product_id=${productId}`);
        },
        joinGroupbuy() {
            if (this.productList.length > 0) {
                // 跳转到第一个商品的团购详情
                this.goToProduct(this.productList[0].product_id);
            } else {
                uni.showToast({
                    title: '暂无可团商品',
                    icon: 'none'
                });
            }
        }
    }
};
</script>
 
<style lang="scss">
.groupbuy-active-detail {
    background: #f5f5f5;
    min-height: 100vh;
    
    .banner {
        width: 100%;
    }
    
    .content {
        padding: 20rpx;
        
        .active-info {
            background: #fff;
            border-radius: 20rpx;
            padding: 30rpx;
            margin-bottom: 20rpx;
            
            .active-title {
                font-size: 36rpx;
                font-weight: bold;
                color: #333;
                margin-bottom: 10rpx;
            }
            
            .active-subtitle {
                font-size: 28rpx;
                color: #666;
                margin-bottom: 30rpx;
            }
            
            .active-stats {
                display: flex;
                justify-content: space-around;
                margin-bottom: 30rpx;
                
                .stat-item {
                    text-align: center;
                    
                    .stat-num {
                        display: block;
                        font-size: 36rpx;
                        font-weight: bold;
                        color: #e74748;
                    }
                    
                    .stat-label {
                        font-size: 24rpx;
                        color: #999;
                    }
                }
            }
            
            .time-info {
                display: flex;
                align-items: center;
                padding: 20rpx;
                background: #f9f9f9;
                border-radius: 10rpx;
                
                .time-label {
                    font-size: 26rpx;
                    color: #666;
                    margin-right: 10rpx;
                }
                
                .time-value {
                    font-size: 26rpx;
                    color: #333;
                }
            }
        }
        
        .product-section {
            background: #fff;
            border-radius: 20rpx;
            padding: 30rpx;
            
            .section-header {
                margin-bottom: 30rpx;
                
                .section-title {
                    font-size: 32rpx;
                    font-weight: bold;
                    color: #333;
                }
            }
            
            .product-list {
                .product-item {
                    display: flex;
                    margin-bottom: 30rpx;
                    
                    .product-image {
                        width: 180rpx;
                        height: 180rpx;
                        border-radius: 10rpx;
                        margin-right: 20rpx;
                    }
                    
                    .product-info {
                        flex: 1;
                        display: flex;
                        flex-direction: column;
                        justify-content: space-between;
                        
                        .product-name {
                            font-size: 28rpx;
                            color: #333;
                            margin-bottom: 10rpx;
                        }
                        
                        .product-price {
                            display: flex;
                            align-items: center;
                            margin-bottom: 10rpx;
                            
                            .now-price {
                                font-size: 32rpx;
                                color: #e74748;
                                font-weight: bold;
                                margin-right: 20rpx;
                            }
                            
                            .origin-price {
                                font-size: 24rpx;
                                color: #999;
                                text-decoration: line-through;
                            }
                        }
                        
                        .product-stats {
                            display: flex;
                            justify-content: space-between;
                            font-size: 24rpx;
                            color: #999;
                        }
                    }
                }
            }
        }
    }
    
    .footer {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        padding: 20rpx;
        background: #fff;
        border-top: 1rpx solid #eee;
        
        .btn-join {
            width: 100%;
            height: 80rpx;
            background: linear-gradient(to right, #e74748, #f17a5f);
            color: #fff;
            border-radius: 40rpx;
            border: none;
            font-size: 32rpx;
            font-weight: bold;
        }
    }
}
</style>