quanwei
2 days ago 04102f7237efefa744090ed7c25f7b5d0807b679
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
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
<template>
    <view class="order-vip">
        <view class="order-tabs">
            <view class="tab-item" :class="{ active: currentTab === -1 }" @click="switchTab(-1)">
                全部
            </view>
            <view class="tab-item" :class="{ active: currentTab === 0 }" @click="switchTab(0)">
                未结算
            </view>
            <view class="tab-item" :class="{ active: currentTab === 1 }" @click="switchTab(1)">
                已结算
            </view>
        </view>
        
        <view class="order-list">
            <view class="order-item" v-for="item in orderList" :key="item.id">
                <view class="order-header">
                    <view class="order-no">订单号:{{ item.orderMaster.order_no }}</view>
                    <view class="order-status" :class="{ 'settled': item.is_settled }">
                        {{ item.is_settled ? '已结算' : '未结算' }}
                    </view>
                </view>
                
                <view class="order-content">
                    <view class="goods-info">
                        <view class="goods-img">
                            <image :src="item.orderMaster.product[0].image.file_path" mode="aspectFill"></image>
                        </view>
                        <view class="goods-desc">
                            <view class="goods-name">{{ item.orderMaster.product[0].product_name }}</view>
                            <view class="goods-spec">{{ item.orderMaster.product[0].spec_sku.spec_attr }}</view>
                        </view>
                    </view>
                    
                    <view class="order-price">
                        <view class="price">¥{{ item.order_price }}</view>
                        <view class="commission">佣金:¥{{ item.vip_area_money }}</view>
                        <!-- <view class="commission" v-if="item.vip_area_type==30">下级收益:¥{{ item.subordinate_money }}</view> -->
                    </view>
                </view>
                
                <view class="order-footer">
                    <view class="order-time">{{ item.create_time }}</view>
                    <view class="order-type">{{ item.vip_area_type_text }}</view>
                </view>
            </view>
            
            <view class="no-data" v-if="orderList.length === 0">
                暂无订单记录
            </view>
        </view>
        
        <!-- 加载更多 -->
        <view class="load-more" v-if="orderList.length > 0 && hasMore">
            <view @click="loadMore">点击加载更多</view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                titel: 'VIP订单',
                currentTab: -1, // -1: 全部, 0: 未结算, 1: 已结算
                page: 1,
                hasMore: true,
                orderList: []
            };
        },
        onLoad() {
            this.loadData();
        },
        methods: {
            // 加载数据
            loadData() {
                let self = this;
                uni.showLoading({ title: '加载中' });
                
                let params = {
                    page: self.page
                };
                
                if (self.currentTab !== -1) {
                    params.is_settled = self.currentTab;
                }
                
                self._get('plus.vip.order/lists', params, function(res) {
                    uni.hideLoading();
                    
                    if (self.page === 1) {
                        self.orderList = res.data.list.data;
                    } else {
                        self.orderList = [...self.orderList, ...res.data.list.data];
                    }
                    
                    // 判断是否还有更多数据
                    self.hasMore = res.data.list.last_page > res.data.list.current_page;
                });
            },
            
            // 切换标签页
            switchTab(tab) {
                if (this.currentTab !== tab) {
                    this.currentTab = tab;
                    this.page = 1;
                    this.hasMore = true;
                    this.loadData();
                }
            },
            
            // 加载更多
            loadMore() {
                if (this.hasMore) {
                    this.page++;
                    this.loadData();
                }
            },
            
            goback() {
                uni.navigateBack();
            }
        }
    }
</script>
 
<style lang="scss">
    .order-vip {
        min-height: 100vh;
        background: #f5f5f5;
    }
    
    .head_top {
        position: absolute;
        width: 100%;
        padding-top: var(--status-bar-height);
        height: 30px;
        line-height: 30px;
        color: #FFFFFF;
        font-size: 32rpx;
        z-index: 2;
    }
    
    .reg180 {
        padding-right: 20rpx;
        text-align: right;
        transform: rotateY(180deg);
        position: absolute;
        bottom: 0;
    }
    
    .icon-jiantou {
        color: #FFFFFF;
        font-size: 30rpx;
    }
    
    .order-tabs {
        display: flex;
        background: #fff;
        margin-bottom: 20rpx;
        
        .tab-item {
            flex: 1;
            text-align: center;
            padding: 30rpx 0;
            font-size: 30rpx;
            color: #666;
            position: relative;
            
            &.active {
                color: #FF5649;
                font-weight: bold;
                
                &::after {
                    content: '';
                    position: absolute;
                    bottom: 0;
                    left: 50%;
                    transform: translateX(-50%);
                    width: 60rpx;
                    height: 6rpx;
                    background: #FF5649;
                    border-radius: 3rpx;
                }
            }
        }
    }
    
    .order-list {
        .order-item {
            background: #fff;
            margin-bottom: 20rpx;
            
            .order-header {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 20rpx 30rpx;
                border-bottom: 1rpx solid #f5f5f5;
                
                .order-no {
                    font-size: 26rpx;
                    color: #999;
                }
                
                .order-status {
                    font-size: 26rpx;
                    color: #FF9900;
                    
                    &.settled {
                        color: #07c160;
                    }
                }
            }
            
            .order-content {
                display: flex;
                padding: 30rpx;
                border-bottom: 1rpx solid #f5f5f5;
                
                .goods-info {
                    display: flex;
                    flex: 1;
                    
                    .goods-img {
                        width: 120rpx;
                        height: 120rpx;
                        border-radius: 10rpx;
                        overflow: hidden;
                        margin-right: 20rpx;
                        
                        image {
                            width: 100%;
                            height: 100%;
                        }
                    }
                    
                    .goods-desc {
                        flex: 1;
                        
                        .goods-name {
                            font-size: 28rpx;
                            color: #333;
                            margin-bottom: 10rpx;
                            display: -webkit-box;
                            -webkit-box-orient: vertical;
                            -webkit-line-clamp: 2;
                            overflow: hidden;
                        }
                        
                        .goods-spec {
                            font-size: 24rpx;
                            color: #999;
                        }
                    }
                }
                
                .order-price {
                    text-align: right;
                    
                    .price {
                        font-size: 30rpx;
                        color: #333;
                        font-weight: bold;
                        margin-bottom: 10rpx;
                    }
                    
                    .commission {
                        font-size: 24rpx;
                        color: #FF5649;
                    }
                }
            }
            
            .order-footer {
                display: flex;
                justify-content: space-between;
                align-items: center;
                padding: 20rpx 30rpx;
                
                .order-time {
                    font-size: 24rpx;
                    color: #999;
                }
                
                .order-type {
                    font-size: 24rpx;
                    color: #666;
                }
            }
        }
        
        .no-data {
            text-align: center;
            padding: 100rpx 0;
            color: #999;
            font-size: 28rpx;
        }
    }
    
    .load-more {
        text-align: center;
        padding: 30rpx;
        
        view {
            display: inline-block;
            padding: 15rpx 30rpx;
            background: #f5f5f5;
            border-radius: 30rpx;
            font-size: 28rpx;
            color: #666;
        }
    }
</style>