quanwei
2025-10-31 7a27a1d4d0038abe2115adb1753f897f56d66323
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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
<template>
    <view>
        <view class="top-tabbar">
            <view :class="state_active == 0 ? 'tab-item active' : 'tab-item'" @click="stateFunc(0)">全部订单</view>
            <view :class="state_active == 1 ? 'tab-item active' : 'tab-item'" @click="stateFunc(1)">待付款</view>
            <view :class="state_active == 2 ? 'tab-item active' : 'tab-item'" @click="stateFunc(2)">待发货</view>
            <view :class="state_active == 3 ? 'tab-item active' : 'tab-item'" @click="stateFunc(3)">待收货</view>
            <view :class="state_active == 4 ? 'tab-item active' : 'tab-item'" @click="stateFunc(4)">待评价</view>
        </view>
        <!--列表-->
        <scroll-view scroll-y="true" class="scroll-Y" :style="'height:' + scrollviewHigh + 'px;'" lower-threshold="50"
         @scrolltolower="scrolltolowerFunc">
            <view :class="topRefresh ? 'top-refresh open' : 'top-refresh'">
                <view class="circle" v-for="(circle, n) in 3" :key="n"></view>
            </view>
            <view class="order-list">
                <view class="item" v-for="(item, index) in listData" :key="index">
                    <view class="order-head d-b-c">
                        <view>
                            <text class="state-text">{{ item.order_source_text }}</text>
                            <text class="shop-name flex-1 fb">订单号:{{ item.order_no }}</text>
                        </view>
                        <view class="state">
                            <text class="red">{{ item.state_text }}</text>
                        </view>
                    </view>
                    <!--多个商品显示-->
 
                    <view class="product-list pr" v-if="item.product.length > 1" @click="jumpPage(item.order_id)">
                        <scroll-view scroll-x="true">
                            <view class="list d-s-c pr100">
                                <view class="cover mr10" v-for="(img, num) in item.product" :key="num">
                                    <image :src="img.image.file_path" mode="aspectFit"></image>
                                </view>
                            </view>
                        </scroll-view>
                        <view class="total-count">
                            <view class="left-shadow"></view>
                            <view class="price f22">
                                ¥
                                <text class="f40">{{ item.pay_price}}</text>
                            </view>
                            <view class="count">共{{ item.product.length }}件</view>
                        </view>
                    </view>
                    <!--一个商品显示-->
                    <view class="one-product d-s-c" v-else @click="jumpPage(item.order_id)">
                        <view class="cover" v-for="(img, num) in item.product" :key="num">
                            <image :src="img.image.file_path" mode="aspectFit"></image>
                        </view>
                        <view class="pro-info flex-1">{{ item.product[0].product_name }}</view>
                        <view class="total-count">
                            <view class="left-shadow"></view>
                            <view class="price f22">
                                ¥
                                <text class="f40">{{ item.pay_price }}</text>
                            </view>
                            <view class="count">共{{ item.product[0].total_num }}件</view>
                        </view>
                    </view>
                    <view class="order-bts">
                        <!-- 取消订单 -->
                        <!-- <block v-if="item.pay_status.value == 20 &&item.delivery_status.value==10&&item.order_status.value == 10">
                            <button  @click="openClose(item.order_no)" type="default">取消订单</button>
                        </block> -->
                        <!-- 订单去发货 -->
                        <block v-if="item.pay_status.value == 20 && item.delivery_type.value == 10 && item.order_status.value==10&&item.delivery_status.value == 10">
                            <button class="btn-red-border"  @click="jumpPage(item.order_id)">去发货</button>
                        </block>
                        <block v-if="item.extract_clerk_id==0 && item.pay_status.value == 20 && item.delivery_type.value == 40 && item.order_status.value==10&&item.delivery_status.value == 10">
                            <button class="btn-red-border"  @click="openSelectClerk(item.order_no)">分配配送员</button>
                        </block>
                        <block v-if="item.extract_clerk_id>0 && item.pay_status.value == 20 && item.delivery_type.value == 40 && item.order_status.value==10">
                            <button class="btn-red-border"  @click="openExtractClerk(item.order_no,item.extractClerk)">查看配送员</button>
                        </block>
                        <block v-if="item.pay_status.value == 20 &&item.order_status.value==21">
                            <button class="btn-red-border"  @click="jumpPage(item.order_id)">去审核</button>
                        </block>
                    </view>
                </view>
                <view class="d-c-c p30" v-if="listData.length == 0 && !loading">
                    <text class="iconfont icon-wushuju"></text>
                    <text class="cont">亲,暂无相关记录哦</text>
                </view>
                <uni-load-more v-else :loadingType="loadingType"></uni-load-more>
            </view>
        </scroll-view>
        <Popup :show="isClose" type="middle" @hidePopup="hideClose">
            <view class="ww100 p20 box-s-b">
                <view class="f32 fb mb20">取消订单</view>
                <view class="d-s-c mb20">
                    <view class="w120 f26">订单号:</view>
                    <view>{{order_no}}</view>
                </view>
                <view class="d-s-s mb20">
                    <view class="w120 f26">备注:</view>
                    <textarea v-model="cancel_remark" placeholder="请输入备注" class="border p10 w400" />
                </view>
                <view class="d-c-c">
                    <button class="send_btn btn-gray-border mr30" @click="hideClose">取消</button>
                    <button class="send_btn btn-orange" @click="sendClose()">确定</button>
                </view>
            </view>
        </Popup>
        <Popup :show="isSelectClerk" type="middle" @hidePopup="hideSelectClerk">
            <view class="ww100 box-s-b">
                <view class="f32 tc fb border-b-e pb20 mb30">分配配送员</view>
                <view class="d-s-c mb20">
                    <view class="w120 f26">订单号:</view>
                    <view>{{order_no}}</view>
                </view>
                <view class="d-s-c mb20">
                    <view class="w120 f26">配送员:</view>
                    <view class="d-s-c flex-1">
                        <view class="flex-1 pr20" v-if="selectClerk.clerk_id">
                            {{selectClerk.real_name}} / {{selectClerk.mobile}}
                        </view>
                        <button class="send_btn btn-blue f26" @click="jumpSelect()">{{selectClerk.clerk_id?'重新选择':'选择配送员'}}</button>
                    </view>
                </view>
                <view class="d-c-c mt40">
                    <button class="send_btn btn-gray-border mr30" @click="hideSelectClerk">取消</button>
                    <button class="send_btn btn-red" @click="sendSelectClerk()">确定</button>
                </view>
            </view>
        </Popup>
        <Popup :show="isExtractClerk" type="middle" @hidePopup="hideExtractClerk">
            <view class="ww100 box-s-b">
                <view class="f32 tc fb border-b-e pb20 mb30">查看配送员</view>
                <view class="d-s-c mb20">
                    <view class="w120 f26">订单号:</view>
                    <view>{{order_no}}</view>
                </view>
                <view class="d-s-c mb20">
                    <view class="w120 f26">配送员:</view>
                    <view class="d-s-c flex-1">
                        <view class="flex-1" v-if="extract_clerk.clerk_id">
                            {{extract_clerk.real_name}} / {{extract_clerk.mobile}}
                        </view>
                        <button class="send_btn btn-blue f26" @click="changeCleck">更换配送员</button>
                    </view>
                </view>
                <view class="d-c-c mt40">
                    <button class="send_btn btn-gray-border mr30" @click="hideExtractClerk">取消</button>
                    <button class="send_btn btn-red" @click="callClerk(extract_clerk.mobile)">拨打电话</button>
                </view>
            </view>
        </Popup>
    </view>
</template>
 
<script>
    import uniLoadMore from '@/components/uni-load-more.vue';
    import Popup from '@/components/uni-popup.vue';
    export default {
        components: {
            uniLoadMore,
            Popup
        },
        data() {
            return {
                /*手机高度*/
                phoneHeight: 0,
                /*可滚动视图区域高度*/
                scrollviewHigh: 0,
                /*状态选中*/
                state_active: 0,
                /*顶部刷新*/
                topRefresh: false,
                /*数据*/
                listData: [],
                /*数据类别*/
                dataType: 'all',
                /*订单id*/
                order_id: 0,
                /*最后一页码数*/
                last_page: 0,
                /*当前页面*/
                page: 1,
                /*每页条数*/
                list_rows: 10,
                /*有没有等多*/
                no_more: false,
                /*是否正在加载*/
                loading: true,
                store_id: '',
                isClose:false,
                cancel_remark:'',
                order_no:'',
                isSelectClerk:false,
                selectClerk:{},
                isExtractClerk:false,
                extract_clerk:{}
            };
        },
        computed: {
            /*加载中状态*/
            loadingType() {
                if (this.loading) {
                    return 1;
                } else {
                    if (this.listData.length != 0 && this.no_more) {
                        return 2;
                    } else {
                        return 0;
                    }
                }
            }
        },
        onLoad(e) {
            this.store_id = e.store_id;
            if (typeof e.dataType != 'undefined') {
                this.dataType = e.dataType;
            }
            if (this.dataType == 'payment') {
                this.state_active = 1;
            } else if (this.dataType == 'delivery') {
                this.state_active = 2;
            } else if (this.dataType == 'received') {
                this.state_active = 3;
            }
        },
        mounted() {
            this.init();
            /*获取订单列表*/
            this.getData();
        },
        methods: {
            /*初始化*/
            init() {
                let self = this;
                uni.getSystemInfo({
                    success(res) {
                        self.phoneHeight = res.windowHeight;
                        // 计算组件的高度
                        let view = uni.createSelectorQuery().select('.top-tabbar');
                        view.boundingClientRect(data => {
                            let h = self.phoneHeight - data.height;
                            self.scrollviewHigh = h;
                        }).exec();
                    }
                });
            },
 
            /*状态切换*/
            stateFunc(e) {
                let self = this;
                if (self.state_active != e) {
                    self.page = 1;
                    self.loading = true;
                    self.state_active = e;
                    switch (e) {
                        case 0:
                            self.listData = [];
                            self.dataType = 'all';
                            break;
                        case 1:
                            self.listData = [];
                            self.dataType = 'payment';
                            break;
                        case 2:
                            self.listData = [];
                            self.dataType = 'delivery';
                            break;
                        case 3:
                            self.listData = [];
                            self.dataType = 'received';
                            break;
                        case 4:
                            self.listData = [];
                            self.dataType = 'comment';
                            break;
                    }
                    self.getData();
                }
            },
 
            /*可滚动视图区域到底触发*/
            scrolltolowerFunc() {
                let self = this;
                if (self.no_more) {
                    return;
                }
                self.page++;
                if (self.page <= self.last_page) {
                    self.getData();
                } else {
                    self.no_more = true;
                }
            },
 
            /*获取数据*/
            getData() {
                let self = this;
                self.loading = true;
                let dataType = self.dataType;
                self._get(
                    'store.delivery/order', {
                        store_id: self.store_id,
                        dataType: dataType,
                        page: self.page,
                        list_rows: self.list_rows,
                        pay_source: self.getPlatform()
                    },
                    function(res) {
                        self.loading = false;
                        self.listData = self.listData.concat(res.data.list.data);
                        self.last_page = res.data.list.last_page;
                        if (res.data.list.last_page <= 1) {
                            self.no_more = true;
                        } else {
                            self.no_more = false;
                        }
                    }
                );
            },
            jumpSelect(e) {
                this.gotoPage('/pages2/delivery/clerk?isSelect=1');
            },
            /*跳转页面*/
            jumpPage(e) {
                this.gotoPage('/pages/order/order-detail?source=supplier&order_id=' + e);
            },
            /*关闭取消订单 */
            hideClose(e) {
                this.isClose = false;
            },
            /* 打开取消订单 */
            openClose(e) {
                this.isClose = true;
                this.order_no=e;
            },
            sendClose(){
                let self = this;
                let order_no = self.order_no;
                wx.showModal({
                    title: '提示',
                    content: '您确定要取消订单吗?',
                    success: function(o) {
                        if (o.confirm) {
                            self.isClose = false;
                            uni.showLoading({
                                title: '正在处理'
                            });
                            self._get(
                                'supplier.order/orderCancel', {
                                    order_no: order_no,
                                    cancel_remark:self.cancel_remark
                                },
                                function(res) {
                                    uni.hideLoading();
                                    uni.showToast({
                                        title: '操作成功',
                                        duration: 2000,
                                        icon: 'success'
                                    });
                                    self.listData = [];
                                    self.getData();
                                }
                            );
                        }
                    }
                });
            },
            /*关闭选择配送员 */
            hideSelectClerk(e) {
                this.isSelectClerk = false;
            },
            /* 打开选择配送员 */
            openSelectClerk(e) {
                this.isSelectClerk = true;
                this.order_no=e;
                this.selectClerk={};
            },
            sendSelectClerk(){
                let self = this;
                let order_no = self.order_no;
                if(!self.selectClerk.clerk_id){
                    uni.showToast({
                        title: '请先选择要分配的配送员',
                        duration: 2000,
                        icon: 'none',
                    });
                    return;
                }
                wx.showModal({
                    title: '提示',
                    content: '您确定要分配配送员吗?',
                    success: function(o) {
                        if (o.confirm) {
                            self.isClose = false;
                            uni.showLoading({
                                title: '正在处理'
                            });
                            self._get(
                                'store.delivery/orderselectclerk', {
                                    order_no: order_no,
                                    clerk_id:self.selectClerk.clerk_id
                                },
                                function(res) {
                                    uni.hideLoading();
                                    uni.showToast({
                                        title: '操作成功',
                                        duration: 2000,
                                        icon: 'success'
                                    });
                                    self.listData = [];
                                    self.getData();
                                    setTimeout(function(){
                                        self.hideSelectClerk();
                                    },200);
                                }
                            );
                        }
                    }
                });
            },
            /*关闭查看配送员 */
            hideExtractClerk(e) {
                this.isExtractClerk = false;
            },
            /* 打开选择配送员 */
            openExtractClerk(e,clerk) {
                this.isExtractClerk = true;
                this.order_no=e;
                this.extract_clerk=clerk
            },
            callClerk(phone){
                uni.makePhoneCall({
                    phoneNumber: phone //仅为示例
                });
            },
            // 更换配送员
            changeCleck() {
                this.isExtractClerk = false;
                this.isSelectClerk = true;
                this.selectClerk = this.extract_clerk;
            }
        }
    };
</script>
 
<style lang="scss">
    .order-list .order-head .state-text {
        padding: 4rpx 8rpx;
        margin-right: 10rpx;
        border-radius: 4rpx;
        background: #e2231a;
        color: #ffffff;
    }
 
    .order-list .item {
        margin-top: 30rpx;
        padding: 30rpx;
        background: #ffffff;
    }
 
    .order-list .product-list,
    .order-list .one-product {
        padding: 20rpx 0;
        height: 160rpx;
    }
 
    .one-product .pro-info {
        padding: 0 30rpx;
        display: -webkit-box;
        overflow: hidden;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        font-size: 28rpx;
        color: #666666;
    }
 
    .order-list .cover,
    .order-list .cover image {
        width: 160rpx;
        height: 160rpx;
    }
 
    .order-list .total-count {
        padding-left: 20rpx;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: flex-end;
    }
 
    .total-count .count {
        padding-top: 10rpx;
        color: #666;
        font-size: 28rpx;
    }
 
    .product-list .total-count {
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        background: rgba(255, 255, 255, 0.9);
    }
 
    .product-list .total-count .left-shadow {
        position: absolute;
        top: 0;
        bottom: 0;
        left: -24rpx;
        width: 24rpx;
        overflow: hidden;
    }
 
    .product-list .total-count .left-shadow::after {
        position: absolute;
        top: 0;
        bottom: 0;
        width: 24rpx;
        right: -12rpx;
        display: block;
        content: '';
        background-image: radial-gradient(rgba(0, 0, 0, 0.2) 10%, rgba(0, 0, 0, 0.1) 40%, rgba(0, 0, 0, 0) 80%);
    }
 
    .order-list .order-bts {
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }
 
    .order-list .order-bts button {
        margin: 0;
        padding: 0 30rpx;
        height: 60rpx;
        line-height: 60rpx;
        margin-left: 20rpx;
        border-radius: 30rpx;
        font-size: 24rpx;
        border: 1px solid #cccccc;
        white-space: nowrap;
        background: #ffffff;
    }
 
    .order-list .order-bts button::after {
        display: none;
    }
 
    .order-list .order-bts button.btn-border-red {
        border: 1px solid $dominant-color;
        font-size: 24rpx;
        color: $dominant-color;
    }
 
    .order-list .order-bts button.btn-red {
        background: $dominant-color;
        border: 1px solid $dominant-color;
        font-size: 24rpx;
        color: #ffffff;
    }
 
    .buy-checkout {
        width: 100%;
    }
 
    .buy-checkout .item {
        min-height: 50rpx;
        line-height: 50rpx;
        padding: 20rpx;
        display: flex;
        justify-content: space-between;
        font-size: 28rpx;
    }
 
    .buy-checkout .iconfont.icon-weixin {
        color: #04be01;
        font-size: 50rpx;
    }
 
    .buy-checkout .iconfont.icon-yue {
        color: #f0de7c;
        font-size: 50rpx;
    }
 
    .buy-checkout .item.active .iconfont.icon-xuanze {
        color: #04be01;
    }
 
    .item-dianpu {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 30rpx;
        font-size: 24rpx;
        line-height: 30rpx;
    }
 
    .item-d-l {
        display: flex;
    }
 
    .icon-dianpu1 {
        margin-right: 30rpx;
    }
    
</style>