zhangwei
2024-08-28 91a6d368073912a2e54bbd8c8a39c44d783881d8
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
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
<template>
    <view>
        <view class="wrap">
            <view class="u-tabs-box">
                <up-tabs activeColor="#f29100" ref="tabs" :list="list" :current="current" @change="change" :is-scroll="false" swiperWidth="750"></up-tabs>
            </view>
            <swiper class="swiper-box" :current="swiperCurrent" @transition="transition" @animationfinish="animationfinish">
                <swiper-item class="swiper-item">
                    <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
                        <view class="page-box">
                            <view class="order" v-for="(res, index) in orderList[0]" :key="res.id">
                                <view class="top">
                                    <view class="left">
                                        <up-icon name="home" :size="30" color="rgb(94,94,94)"></up-icon>
                                        <view class="store">{{ res.store }}</view>
                                        <up-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></up-icon>
                                    </view>
                                    <view class="right">{{ res.deal }}</view>
                                </view>
                                <view class="item" v-for="(item, index) in res.goodsList" :key="index">
                                    <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
                                    <view class="content">
                                        <view class="title u-line-2">{{ item.title }}</view>
                                        <view class="type">{{ item.type }}</view>
                                        <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
                                    </view>
                                    <view class="right">
                                        <view class="price">
                                            ¥{{ priceInt(item.price) }}
                                            <text class="decimal">.{{ priceDecimal(item.price) }}</text>
                                        </view>
                                        <view class="number">x{{ item.number }}</view>
                                    </view>
                                </view>
                                <view class="total">
                                    共{{ totalNum(res.goodsList) }}件商品 合计:
                                    <text class="total-price">
                                        ¥{{ priceInt(totalPrice(res.goodsList)) }}.
                                        <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
                                    </text>
                                </view>
                                <view class="bottom">
                                    <view class="more"><up-icon name="more-dot-fill" color="rgb(203,203,203)"></up-icon></view>
                                    <view class="logistics btn">查看物流</view>
                                    <view class="exchange btn">卖了换钱</view>
                                    <view class="evaluate btn">评价</view>
                                </view>
                            </view>
                            <up-loadmore :status="loadStatus[0]" bgColor="#f2f2f2"></up-loadmore>
                        </view>
                    </scroll-view>
                </swiper-item>
                <swiper-item class="swiper-item">
                    <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
                        <view class="page-box">
                            <view class="order" v-for="(res, index) in  orderList[1]" :key="res.id">
                                <view class="top">
                                    <view class="left">
                                        <up-icon name="home" :size="30" color="rgb(94,94,94)"></up-icon>
                                        <view class="store">{{ res.store }}</view>
                                        <up-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></up-icon>
                                    </view>
                                    <view class="right">{{ res.deal }}</view>
                                </view>
                                <view class="item" v-for="(item, index) in res.goodsList" :key="index">
                                    <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
                                    <view class="content">
                                        <view class="title u-line-2">{{ item.title }}</view>
                                        <view class="type">{{ item.type }}</view>
                                        <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
                                    </view>
                                    <view class="right">
                                        <view class="price">
                                            ¥{{ priceInt(item.price) }}
                                            <text class="decimal">.{{ priceDecimal(item.price) }}</text>
                                        </view>
                                        <view class="number">x{{ item.number }}</view>
                                    </view>
                                </view>
                                <view class="total">
                                    共{{ totalNum(res.goodsList) }}件商品 合计:
                                    <text class="total-price">
                                        ¥{{ priceInt(totalPrice(res.goodsList)) }}.
                                        <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
                                    </text>
                                </view>
                                <view class="bottom">
                                    <view class="more"><up-icon name="more-dot-fill" color="rgb(203,203,203)"></up-icon></view>
                                    <view class="logistics btn">查看物流</view>
                                    <view class="exchange btn">卖了换钱</view>
                                    <view class="evaluate btn">评价</view>
                                </view>
                            </view>
                            <up-loadmore :status="loadStatus[1]" bgColor="#f2f2f2"></up-loadmore>
                        </view>
                    </scroll-view>
                </swiper-item>
                <swiper-item class="swiper-item">
                    <scroll-view scroll-y style="height: 100%;width: 100%;">
                        <view class="page-box">
                            <view>
                                <view class="centre">
                                    <image src="https://cdn.uviewui.com/uview/template/taobao-order.png" mode=""></image>
                                    <view class="explain">
                                        您还没有相关的订单
                                        <view class="tips">可以去看看有那些想买的</view>
                                    </view>
                                    <view class="btn">随便逛逛</view>
                                </view>
                            </view>
                        </view>
                    </scroll-view>
                </swiper-item>
                <swiper-item class="swiper-item">
                    <scroll-view scroll-y style="height: 100%;width: 100%;" @scrolltolower="reachBottom">
                        <view class="page-box">
                            <view class="order" v-for="(res, index) in  orderList[3]" :key="res.id">
                                <view class="top">
                                    <view class="left">
                                        <up-icon name="home" :size="30" color="rgb(94,94,94)"></up-icon>
                                        <view class="store">{{ res.store }}</view>
                                        <up-icon name="arrow-right" color="rgb(203,203,203)" :size="26"></up-icon>
                                    </view>
                                    <view class="right">{{ res.deal }}</view>
                                </view>
                                <view class="item" v-for="(item, index) in res.goodsList" :key="index">
                                    <view class="left"><image :src="item.goodsUrl" mode="aspectFill"></image></view>
                                    <view class="content">
                                        <view class="title u-line-2">{{ item.title }}</view>
                                        <view class="type">{{ item.type }}</view>
                                        <view class="delivery-time">发货时间 {{ item.deliveryTime }}</view>
                                    </view>
                                    <view class="right">
                                        <view class="price">
                                            ¥{{ priceInt(item.price) }}
                                            <text class="decimal">.{{ priceDecimal(item.price) }}</text>
                                        </view>
                                        <view class="number">x{{ item.number }}</view>
                                    </view>
                                </view>
                                <view class="total">
                                    共{{ totalNum(res.goodsList) }}件商品 合计:
                                    <text class="total-price">
                                        ¥{{ priceInt(totalPrice(res.goodsList)) }}.
                                        <text class="decimal">{{ priceDecimal(totalPrice(res.goodsList)) }}</text>
                                    </text>
                                </view>
                                <view class="bottom">
                                    <view class="more"><up-icon name="more-dot-fill" color="rgb(203,203,203)"></up-icon></view>
                                    <view class="logistics btn">查看物流</view>
                                    <view class="exchange btn">卖了换钱</view>
                                    <view class="evaluate btn">评价</view>
                                </view>
                            </view>
                            <up-loadmore :status="loadStatus[3]" bgColor="#f2f2f2"></up-loadmore>
                        </view>
                    </scroll-view>
                </swiper-item>
            </swiper>
        </view>
    </view>
</template>
 
<script>
export default {
    data() {
        return {
            orderList: [[], [], [], []],
            dataList: [
                {
                    id: 1,
                    store: '夏日流星限定贩卖',
                    deal: '交易成功',
                    goodsList: [
                        {
                            goodsUrl: '//img13.360buyimg.com/n7/jfs/t1/103005/7/17719/314825/5e8c19faEb7eed50d/5b81ae4b2f7f3bb7.jpg',
                            title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
                            type: '灰色;M',
                            deliveryTime: '付款后30天内发货',
                            price: '348.58',
                            number: 2
                        },
                        {
                            goodsUrl: '//img12.360buyimg.com/n7/jfs/t1/102191/19/9072/330688/5e0af7cfE17698872/c91c00d713bf729a.jpg',
                            title: '【葡萄藤】现货 小清新学院风制服格裙百褶裙女短款百搭日系甜美风原创jk制服女2020新款',
                            type: '45cm;S',
                            deliveryTime: '付款后30天内发货',
                            price: '135.00',
                            number: 1
                        }
                    ]
                },
                {
                    id: 2,
                    store: '江南皮革厂',
                    deal: '交易失败',
                    goodsList: [
                        {
                            goodsUrl: '//img14.360buyimg.com/n7/jfs/t1/60319/15/6105/406802/5d43f68aE9f00db8c/0affb7ac46c345e2.jpg',
                            title: '【冬日限定】现货 原创jk制服女2020冬装新款小清新宽松软糯毛衣外套女开衫短款百搭日系甜美风',
                            type: '粉色;M',
                            deliveryTime: '付款后7天内发货',
                            price: '128.05',
                            number: 1
                        }
                    ]
                },
                {
                    id: 3,
                    store: '三星旗舰店',
                    deal: '交易失败',
                    goodsList: [
                        {
                            goodsUrl: '//img11.360buyimg.com/n7/jfs/t1/94448/29/2734/524808/5dd4cc16E990dfb6b/59c256f85a8c3757.jpg',
                            title: '三星(SAMSUNG)京品家电 UA65RUF70AJXXZ 65英寸4K超高清 HDR 京东微联 智能语音 教育资源液晶电视机',
                            type: '4K,广色域',
                            deliveryTime: '保质5年',
                            price: '1998',
                            number: 3
                        },
                        {
                            goodsUrl: '//img14.360buyimg.com/n7/jfs/t6007/205/4099529191/294869/ae4e6d4f/595dcf19Ndce3227d.jpg!q90.jpg',
                            title: '美的(Midea)639升 对开门冰箱 19分钟急速净味 一级能效冷藏双开门杀菌智能家用双变频节能 BCD-639WKPZM(E)',
                            type: '容量大,速冻',
                            deliveryTime: '保质5年',
                            price: '2354',
                            number: 1
                        }
                    ]
                },
                {
                    id: 4,
                    store: '三星旗舰店',
                    deal: '交易失败',
                    goodsList: [
                        {
                            goodsUrl: '//img10.360buyimg.com/n7/jfs/t22300/31/1505958241/171936/9e201a89/5b2b12ffNe6dbb594.jpg!q90.jpg',
                            title: '法国进口红酒 拉菲(LAFITE)传奇波尔多干红葡萄酒750ml*6整箱装',
                            type: '4K,广色域',
                            deliveryTime: '珍藏10年好酒',
                            price: '1543',
                            number: 3
                        },
                        {
                            goodsUrl: '//img10.360buyimg.com/n7/jfs/t1/107598/17/3766/525060/5e143aacE9a94d43c/03573ae60b8bf0ee.jpg',
                            title: '蓝妹(BLUE GIRL)酷爽啤酒 清啤 原装进口啤酒 罐装 500ml*9听 整箱装',
                            type: '一打',
                            deliveryTime: '口感好',
                            price: '120',
                            number: 1
                        }
                    ]
                },
                {
                    id: 5,
                    store: '三星旗舰店',
                    deal: '交易成功',
                    goodsList: [
                        {
                            goodsUrl: '//img12.360buyimg.com/n7/jfs/t1/52408/35/3554/78293/5d12e9cfEfd118ba1/ba5995e62cbd747f.jpg!q90.jpg',
                            title: '企业微信 中控人脸指纹识别考勤机刷脸机 无线签到异地多店打卡机WX108',
                            type: '识别效率高',
                            deliveryTime: '使用方便',
                            price: '451',
                            number: 9
                        }
                    ]
                }
            ],
            list: [
                {
                    name: '待付款'
                },
                {
                    name: '待发货'
                },
                {
                    name: '待收货'
                },
                {
                    name: '待评价',
                    count: 12
                }
            ],
            current: 0,
            swiperCurrent: 0,
            tabsHeight: 0,
            dx: 0,
            loadStatus: ['loadmore','loadmore','loadmore','loadmore'],
        };
    },
    onLoad() {
        this.getOrderList(0);
        this.getOrderList(1);
        this.getOrderList(3);
    },
    computed: {
        // 价格小数
        priceDecimal() {
            return val => {
                if (val !== parseInt(val)) return val.slice(-2);
                else return '00';
            };
        },
        // 价格整数
        priceInt() {
            return val => {
                if (val !== parseInt(val)) return val.split('.')[0];
                else return val;
            };
        }
    },
    methods: {
        reachBottom() {
            // 此tab为空数据
            if(this.current != 2) {
                this.loadStatus.splice(this.current,1,"loading")
                setTimeout(() => {
                    this.getOrderList(this.current);
                }, 1200);
            }
        },
        // 页面数据
        getOrderList(idx) {
            for(let i = 0; i < 5; i++) {
                let index = this.$u.random(0, this.dataList.length - 1);
                let data = JSON.parse(JSON.stringify(this.dataList[index]));
                data.id = this.$u.guid();
                this.orderList[idx].push(data);
            }
            this.loadStatus.splice(this.current,1,"loadmore")
        },
        // 总价
        totalPrice(item) {
            let price = 0;
            item.map(val => {
                price += parseFloat(val.price);
            });
            return price.toFixed(2);
        },
        // 总件数
        totalNum(item) {
            let num = 0;
            item.map(val => {
                num += val.number;
            });
            return num;
        },
        // tab栏切换
        change(e) {
            this.swiperCurrent = e.index;
            this.getOrderList(e.index);
        },
        transition({ detail: { dx } }) {
            // this.$refs.tabs.setDx(dx);
        },
        animationfinish({ detail: { current } }) {
            this.swiperCurrent = current;
            this.current = current;
        }
    }
};
</script>
 
<style>
/* #ifndef H5 */
page {
    height: 100%;
    background-color: #f2f2f2;
}
/* #endif */
</style>
 
<style lang="scss" scoped>
.order {
    width: 710rpx;
    background-color: #ffffff;
    margin: 20rpx auto;
    border-radius: 20rpx;
    box-sizing: border-box;
    padding: 20rpx;
    font-size: 28rpx;
    .top {
        display: flex;
        justify-content: space-between;
        .left {
            display: flex;
            align-items: center;
            .store {
                margin: 0 10rpx;
                font-size: 32rpx;
                font-weight: bold;
            }
        }
        .right {
            color: $u-warning-dark;
        }
    }
    .item {
        display: flex;
        margin: 20rpx 0 0;
        .left {
            margin-right: 20rpx;
            image {
                width: 200rpx;
                height: 200rpx;
                border-radius: 10rpx;
            }
        }
        .content {
            .title {
                font-size: 28rpx;
                line-height: 50rpx;
            }
            .type {
                margin: 10rpx 0;
                font-size: 24rpx;
                color: $u-tips-color;
            }
            .delivery-time {
                color: #e5d001;
                font-size: 24rpx;
            }
        }
        .right {
            margin-left: 10rpx;
            padding-top: 20rpx;
            text-align: right;
            .decimal {
                font-size: 24rpx;
                margin-top: 4rpx;
            }
            .number {
                color: $u-tips-color;
                font-size: 24rpx;
            }
        }
    }
    .total {
        margin-top: 20rpx;
        text-align: right;
        font-size: 24rpx;
        .total-price {
            font-size: 32rpx;
        }
    }
    .bottom {
        display: flex;
        margin-top: 40rpx;
        padding: 0 10rpx;
        justify-content: space-between;
        align-items: center;
        .btn {
            line-height: 52rpx;
            width: 160rpx;
            border-radius: 26rpx;
            border: 2rpx solid $u-border-color;
            font-size: 26rpx;
            text-align: center;
            color: $u-info-dark;
        }
        .evaluate {
            color: $u-warning-dark;
            border-color: $u-warning-dark;
        }
    }
}
.centre {
    text-align: center;
    margin: 200rpx auto;
    font-size: 32rpx;
    image {
        width: 164rpx;
        height: 164rpx;
        border-radius: 50%;
        margin-bottom: 20rpx;
    }
    .tips {
        font-size: 24rpx;
        color: #999999;
        margin-top: 20rpx;
    }
    .btn {
        margin: 80rpx auto;
        width: 200rpx;
        border-radius: 32rpx;
        line-height: 64rpx;
        color: #ffffff;
        font-size: 26rpx;
        background: linear-gradient(270deg, rgba(249, 116, 90, 1) 0%, rgba(255, 158, 1, 1) 100%);
    }
}
.wrap {
    display: flex;
    flex-direction: column;
    height: calc(100vh - var(--window-top));
    width: 100%;
}
.swiper-box {
    flex: 1;
}
.swiper-item {
    height: 100%;
}
</style>