Browse Source

售后修改

cr 4 years ago
parent
commit
b661e14eb8
5 changed files with 443 additions and 102 deletions
  1. 12 1
      a.txt
  2. 345 79
      src/pages/index/index.vue
  3. 73 20
      src/pages/index/refund.vue
  4. 12 2
      src/pages/manage/index.vue
  5. 1 0
      src/pages/manage/statistics/order.vue

+ 12 - 1
a.txt

@@ -4,4 +4,15 @@ VUE_APP_API_BASE_URL = https://delivery.ixiaokejia.com
4
 三方门店ID:5424_2705880
4
 三方门店ID:5424_2705880
5
 门店名称:t_pK0XCn0TDQ
5
 门店名称:t_pK0XCn0TDQ
6
 商家端登录账号:M35PJ_2705880
6
 商家端登录账号:M35PJ_2705880
7
-商家端登录密码:lqHtOkG3b3
7
+商家端登录密码:lqHtOkG3b3
8
+
9
+
10
+05caf6e0-9069-4da0-9d7e-92d27ce2b7be 配送员 门店下的配送人员,该人员可登录配送助手  
11
+26b2d3be-be4a-489f-839b-d50fdac0f2f4 客服 客服人员  
12
+50c41c5d-b54c-43ed-b587-10dcb60e72e5 店铺管理员 店铺管理员用户  (切换们门店)
13
+731d7667-d68c-4b15-9080-4a96775a5606 门店管理员 门店管理员用户  
14
+75b71b24-25de-40ac-a866-c8f5555b8b92 系统管理员 管理整个系统的用户  (切换们门店) 
15
+bfbde5df-9922-410f-bab2-158402d3d98d 财务 财务工作人员  
16
+c67011ac-f79c-4d0b-a7c3-24e5b8319056 运营 运营工作人员  
17
+cab1e08c-c0ca-4485-9bc9-658f866be9ae 配送员 门店下的配送人员,该人员可登录配送助手  
18
+f68b8e48-c681-467b-af76-e1612c26d62e 主播 主播人员  

+ 345 - 79
src/pages/index/index.vue

@@ -36,55 +36,133 @@
36
                                 v-for="(order, oindex) of orderList"
36
                                 v-for="(order, oindex) of orderList"
37
                                 :key="oindex"
37
                                 :key="oindex"
38
                             >
38
                             >
39
-                                <div class="apply">
40
-                                    <div class="head">
41
-                                        <div class="tit">退款</div>
42
-                                    </div>
43
-                                    <section class="info-item">
44
-                                        <div class="coll">
45
-                                            <div class="coll-l coll-tit">
46
-                                                顾客申请部分退款
47
-                                            </div>
48
-                                            <div class="date coll-r">
49
-                                                11-24 10:43
50
-                                            </div>
51
-                                        </div>
52
-                                        <div class="coll">
53
-                                            <div class="coll-l">
54
-                                                金额:<span class="money-red">¥0.5</span>
55
-                                            </div>
56
-                                            <div class="date coll-r"></div>
39
+                                <black
40
+                                    v-if="
41
+                                        order.afterSaleList &&
42
+                                        order.afterSaleList.length
43
+                                    "
44
+                                >
45
+                                    <div
46
+                                        class="apply"
47
+                                        :class="{
48
+                                            showAll: order.showAllAfterSale,
49
+                                        }"
50
+                                    >
51
+                                        <div class="head">
52
+                                            <div class="tit">退款</div>
57
                                         </div>
53
                                         </div>
58
-                                        <div class="coll">
59
-                                            <div class="coll-l">
60
-                                                商品:xxxx商品
54
+                                        <section
55
+                                            class="info-item"
56
+                                            v-for="afterSale of order.afterSaleList"
57
+                                            :key="afterSale._id"
58
+                                        >
59
+                                            <div class="coll">
60
+                                                <div class="coll-l coll-tit">
61
+                                                    {{
62
+                                                        afterSale.applyUser ===
63
+                                                        0
64
+                                                            ? "顾客申请"
65
+                                                            : ""
66
+                                                    }}
67
+                                                    {{
68
+                                                        afterSale.refundType ===
69
+                                                        0
70
+                                                            ? "全部退款"
71
+                                                            : "部分退款"
72
+                                                    }}
73
+
74
+                                                    <span class="status"
75
+                                                        >({{
76
+                                                            afterSale.status
77
+                                                                | afterSaleStatus
78
+                                                        }})</span
79
+                                                    >
80
+                                                </div>
81
+                                                <div class="date coll-r">
82
+                                                    {{
83
+                                                        afterSale.createdTime
84
+                                                            | timestampToDate(
85
+                                                                "MM-dd hh:mm"
86
+                                                            )
87
+                                                    }}
88
+                                                </div>
61
                                             </div>
89
                                             </div>
62
-                                            <div class="good-r coll-r">
63
-                                                <span class="num">x1</span>
64
-                                                <span class="money">¥0.5</span>
90
+                                            <div class="coll">
91
+                                                <div class="coll-l">
92
+                                                    金额:<span
93
+                                                        class="money-red"
94
+                                                        >¥{{
95
+                                                            afterSale.refundAmount
96
+                                                                | minuteToRmb2
97
+                                                        }}</span
98
+                                                    >
99
+                                                </div>
100
+                                                <div class="date coll-r"></div>
65
                                             </div>
101
                                             </div>
66
-                                        </div>
67
-                                        <div class="coll">
68
-                                            <div class="coll-l">
69
-                                                商品:xxxx商品
102
+                                            <div class="coll">
103
+                                                <div class="coll-l">
104
+                                                    商品:{{
105
+                                                        afterSale.productInfo
106
+                                                            .name
107
+                                                    }}
108
+                                                </div>
109
+                                                <div class="good-r coll-r">
110
+                                                    <span class="num">x1</span>
111
+                                                    <span class="money"
112
+                                                        >¥{{
113
+                                                            afterSale
114
+                                                                .productInfo
115
+                                                                .price
116
+                                                                | minuteToRmb2
117
+                                                        }}</span
118
+                                                    >
119
+                                                </div>
70
                                             </div>
120
                                             </div>
71
-                                            <div class="good-r coll-r">
72
-                                                <span class="num">x1</span>
73
-                                                <span class="money">¥0.5</span>
121
+                                            <div
122
+                                                class="coll"
123
+                                                v-if="afterSale.applyReason"
124
+                                            >
125
+                                                <div class="coll-l">
126
+                                                    理由:{{
127
+                                                        afterSale.applyReason
128
+                                                    }}
129
+                                                </div>
130
+                                                <div class="coll-r"></div>
74
                                             </div>
131
                                             </div>
75
-                                        </div>
76
-                                        <div class="coll">
77
-                                            <div class="coll-l">
78
-                                                理由:计划有变,不想要了计划有变,不想要了计划有变,不想要了计划有变,不想要了计划有变,不想要了计划有变,不想要了
132
+                                            <div
133
+                                                class="btns"
134
+                                                v-if="afterSale.status === 1"
135
+                                            >
136
+                                                <span
137
+                                                    class="btn"
138
+                                                    @click="applyNo(afterSale)"
139
+                                                    >拒绝</span
140
+                                                >
141
+                                                <span
142
+                                                    class="btn ok"
143
+                                                    @click="applyOk(afterSale)"
144
+                                                    >同意</span
145
+                                                >
79
                                             </div>
146
                                             </div>
80
-                                            <div class="coll-r"></div>
147
+                                        </section>
148
+                                        <div
149
+                                            class="toggle"
150
+                                            v-if="
151
+                                                order.afterSaleList &&
152
+                                                order.afterSaleList.length > 1
153
+                                            "
154
+                                        >
155
+                                            <span
156
+                                                @click="afterSaleToggle(order)"
157
+                                                >{{
158
+                                                    order.showAllAfterSale
159
+                                                        ? "收起信息"
160
+                                                        : "展开完整售后信息"
161
+                                                }}</span
162
+                                            >
81
                                         </div>
163
                                         </div>
82
-                                    </section>
83
-                                    <div class="btns">
84
-                                        <span class="btn" @click="applyNo(order)">拒绝</span>
85
-                                        <span class="btn ok" @click="applyOk(order)">同意</span>
86
                                     </div>
164
                                     </div>
87
-                                </div>
165
+                                </black>
88
                                 <div class="order__main">
166
                                 <div class="order__main">
89
                                     <div class="order__top">
167
                                     <div class="order__top">
90
                                         <div class="des">
168
                                         <div class="des">
@@ -117,6 +195,10 @@
117
                                                 "
195
                                                 "
118
                                                 >复制</span
196
                                                 >复制</span
119
                                             >
197
                                             >
198
+                                            <span class="order-status">{{
199
+                                                order.orderInfo.status
200
+                                                    | orderStatus
201
+                                            }}</span>
120
                                         </div>
202
                                         </div>
121
                                     </div>
203
                                     </div>
122
                                     <div class="tags">
204
                                     <div class="tags">
@@ -193,8 +275,18 @@
193
                                     备注:{{ order.orderInfo.description }}
275
                                     备注:{{ order.orderInfo.description }}
194
                                 </div>
276
                                 </div>
195
                                 <div class="tools">
277
                                 <div class="tools">
196
-                                    <div class="oper">
197
-                                        <span class="oper-btn">取消订单</span>
278
+                                    <!-- afterSaleStatus 根据售后信息里RefundType字段判断手动加的值 -->
279
+                                    <div
280
+                                        class="oper"
281
+                                        v-if="order.afterSaleStatus !== 'all'"
282
+                                    >
283
+                                        <!-- 只要有一条售后就不能申请取消订单 -->
284
+                                        <span
285
+                                            class="oper-btn"
286
+                                            @click="cancelOrder(order)"
287
+                                            v-if="!order.noShowCancelOrder"
288
+                                            >取消订单</span
289
+                                        >
198
                                         <span
290
                                         <span
199
                                             class="oper-btn"
291
                                             class="oper-btn"
200
                                             @click="refund(order)"
292
                                             @click="refund(order)"
@@ -219,18 +311,14 @@
219
                                                 <div class="goods__left">
311
                                                 <div class="goods__left">
220
                                                     <my-image
312
                                                     <my-image
221
                                                         class="goods__img"
313
                                                         class="goods__img"
222
-                                                        :src="
223
-                                                            good.orderItem
224
-                                                                .productImage
225
-                                                        "
314
+                                                        :src="good.productImage"
226
                                                     ></my-image>
315
                                                     ></my-image>
227
                                                     <div class="goods__info">
316
                                                     <div class="goods__info">
228
                                                         <div
317
                                                         <div
229
                                                             class="goods__title"
318
                                                             class="goods__title"
230
                                                         >
319
                                                         >
231
                                                             {{
320
                                                             {{
232
-                                                                good.orderItem
233
-                                                                    .productName ||
321
+                                                                good.productName ||
234
                                                                 ""
322
                                                                 ""
235
                                                             }}
323
                                                             }}
236
                                                         </div>
324
                                                         </div>
@@ -238,8 +326,7 @@
238
                                                             class="goods__spec"
326
                                                             class="goods__spec"
239
                                                         >
327
                                                         >
240
                                                             {{
328
                                                             {{
241
-                                                                good.orderItem
242
-                                                                    .skuName ||
329
+                                                                good.skuName ||
243
                                                                 ""
330
                                                                 ""
244
                                                             }}
331
                                                             }}
245
                                                         </div>
332
                                                         </div>
@@ -248,15 +335,14 @@
248
                                                 <div class="goods__right">
335
                                                 <div class="goods__right">
249
                                                     <div class="goods__price">
336
                                                     <div class="goods__price">
250
                                                         ¥{{
337
                                                         ¥{{
251
-                                                            good.orderItem.price
338
+                                                            good.price
252
                                                                 | minuteToRmb
339
                                                                 | minuteToRmb
253
                                                         }}
340
                                                         }}
254
                                                     </div>
341
                                                     </div>
255
                                                     <div class="goods__num">
342
                                                     <div class="goods__num">
256
                                                         {{
343
                                                         {{
257
                                                             "X" +
344
                                                             "X" +
258
-                                                            (good.orderItem
259
-                                                                .count || "0")
345
+                                                            (good.count || "0")
260
                                                         }}
346
                                                         }}
261
                                                     </div>
347
                                                     </div>
262
                                                 </div>
348
                                                 </div>
@@ -413,6 +499,64 @@ export default {
413
             sTime += instantDelivery + reserveReceivingOrdersTime;
499
             sTime += instantDelivery + reserveReceivingOrdersTime;
414
             return fn.getDateFormat(new Date(sTime), "MM-dd hh:mm");
500
             return fn.getDateFormat(new Date(sTime), "MM-dd hh:mm");
415
         },
501
         },
502
+
503
+        afterSaleStatus(v) {
504
+            switch (v) {
505
+                case 1:
506
+                    return "退款审核中";
507
+                case 2:
508
+                    return "等待商家退款";
509
+                case 3:
510
+                    return "退款完成";
511
+                case 4:
512
+                    return "退款取消";
513
+                case 5:
514
+                    return "退货审核中";
515
+                case 6:
516
+                    return "退货取消";
517
+                case 7:
518
+                    return "退货完成";
519
+                case 8:
520
+                    return "等待买家退货";
521
+                case 9:
522
+                    return "等待确认收货";
523
+                case 10:
524
+                    return "已拒绝";
525
+                default:
526
+                    return "未知";
527
+            }
528
+        },
529
+
530
+        orderStatus(v) {
531
+            let obj = {
532
+                2: "待支付",
533
+                3: "待发货",
534
+                4: "待收货",
535
+                5: "拼团中",
536
+                6: "已取消",
537
+                7: "售后中",
538
+                8: "已删除",
539
+                9: "已完成",
540
+                10: "已评价",
541
+                11: "已售后",
542
+                12: "已退款",
543
+                20: "待接单",
544
+                21: "拣货中",
545
+                22: "拣货完成",
546
+                23: "待配送",
547
+                24: "配送中",
548
+                25: "已送达",
549
+                26: "待提货",
550
+                27: "已提货",
551
+                31: "订单已推单",
552
+                32: "订单已被骑手接单",
553
+                33: "骑手已到店",
554
+                34: "骑手已取餐",
555
+                35: "订单完成",
556
+                36: "订单失败",
557
+            };
558
+            return obj[v] || "未知";
559
+        },
416
     },
560
     },
417
 
561
 
418
     async onShow() {
562
     async onShow() {
@@ -484,6 +628,7 @@ export default {
484
                     // self.list[1].num = data.countInfo.unpaidOrderCount
628
                     // self.list[1].num = data.countInfo.unpaidOrderCount
485
                     // self.list[2].num = data.countInfo.waitShippedOrderCount
629
                     // self.list[2].num = data.countInfo.waitShippedOrderCount
486
                     // self.list[3].num = data.countInfo.waitReceivedOrderCount
630
                     // self.list[3].num = data.countInfo.waitReceivedOrderCount
631
+                    data = this.afterSaleFactory(data);
487
                     self.list[self.tab].list = data;
632
                     self.list[self.tab].list = data;
488
                     self.loading = true;
633
                     self.loading = true;
489
                     uni.hideLoading();
634
                     uni.hideLoading();
@@ -505,7 +650,7 @@ export default {
505
                     if (data.length) {
650
                     if (data.length) {
506
                         self.list[self.tab].page++;
651
                         self.list[self.tab].page++;
507
                     }
652
                     }
508
-
653
+                    data = this.afterSaleFactory(data);
509
                     // self.list[1].num = data.countInfo.unpaidOrderCount;
654
                     // self.list[1].num = data.countInfo.unpaidOrderCount;
510
                     // self.list[2].num = data.countInfo.waitShippedOrderCount;
655
                     // self.list[2].num = data.countInfo.waitShippedOrderCount;
511
                     // self.list[3].num = data.countInfo.waitReceivedOrderCount;
656
                     // self.list[3].num = data.countInfo.waitReceivedOrderCount;
@@ -515,6 +660,26 @@ export default {
515
                 });
660
                 });
516
         },
661
         },
517
 
662
 
663
+        // 售后处理
664
+        afterSaleFactory(data) {
665
+            for (let item of data) {
666
+                //判断是否有售货
667
+                if (item.afterSaleList && item.afterSaleList.length) {
668
+                    let obj = {
669
+                        expire: [],
670
+                        now: [],
671
+                    };
672
+                    item.noShowCancelOrder = true;
673
+                    for (let afterSale of item.afterSaleList) {
674
+                        if (afterSale.refundType === 0) {
675
+                            item.afterSaleStatus = "all";
676
+                        }
677
+                    }
678
+                }
679
+            }
680
+            return data;
681
+        },
682
+
518
         // 打电话
683
         // 打电话
519
         makePhone(val) {
684
         makePhone(val) {
520
             if (!val.orderInfo.mobile) {
685
             if (!val.orderInfo.mobile) {
@@ -540,8 +705,8 @@ export default {
540
                 .then((res) => {
705
                 .then((res) => {
541
                     if (res.success) {
706
                     if (res.success) {
542
                         this.fn.showToast("接单成功");
707
                         this.fn.showToast("接单成功");
543
-                        this.orderList.splice(index, 1);
544
-                        this.orderList = [...this.orderList];
708
+                        this.list[this.tab].list.splice(index, 1);
709
+                        this.list = [...this.list];
545
                     } else {
710
                     } else {
546
                         this.fn.showToast("接单失败:" + res.message);
711
                         this.fn.showToast("接单失败:" + res.message);
547
                     }
712
                     }
@@ -562,8 +727,8 @@ export default {
562
                 .then((res) => {
727
                 .then((res) => {
563
                     if (res.success) {
728
                     if (res.success) {
564
                         this.fn.showToast("打包完成功");
729
                         this.fn.showToast("打包完成功");
565
-                        this.orderList.splice(index, 1);
566
-                        this.orderList = [...this.orderList];
730
+                        this.list[this.tab].list.splice(index, 1);
731
+                        this.list = [...this.list];
567
                     } else {
732
                     } else {
568
                         this.fn.showToast("打包完失败:" + res.message);
733
                         this.fn.showToast("打包完失败:" + res.message);
569
                     }
734
                     }
@@ -584,8 +749,8 @@ export default {
584
                 .then((res) => {
749
                 .then((res) => {
585
                     if (res.success) {
750
                     if (res.success) {
586
                         this.fn.showToast("提货成功");
751
                         this.fn.showToast("提货成功");
587
-                        this.orderList.splice(index, 1);
588
-                        this.orderList = [...this.orderList];
752
+                        this.list[this.tab].list.splice(index, 1);
753
+                        this.list = [...this.list];
589
                     } else {
754
                     } else {
590
                         this.fn.showToast("提货失败:" + res.message);
755
                         this.fn.showToast("提货失败:" + res.message);
591
                     }
756
                     }
@@ -606,8 +771,8 @@ export default {
606
                 .then((res) => {
771
                 .then((res) => {
607
                     if (res.success) {
772
                     if (res.success) {
608
                         this.fn.showToast("配送中成功");
773
                         this.fn.showToast("配送中成功");
609
-                        this.orderList.splice(index, 1);
610
-                        this.orderList = [...this.orderList];
774
+                        this.list[this.tab].list.splice(index, 1);
775
+                        this.list = [...this.list];
611
                     } else {
776
                     } else {
612
                         this.fn.showToast("配送中失败:" + res.message);
777
                         this.fn.showToast("配送中失败:" + res.message);
613
                     }
778
                     }
@@ -628,8 +793,8 @@ export default {
628
                 .then((res) => {
793
                 .then((res) => {
629
                     if (res.success) {
794
                     if (res.success) {
630
                         this.fn.showToast("送达成功");
795
                         this.fn.showToast("送达成功");
631
-                        this.orderList.splice(index, 1);
632
-                        this.orderList = [...this.orderList];
796
+                        this.list[this.tab].list.splice(index, 1);
797
+                        this.list = [...this.list];
633
                     } else {
798
                     } else {
634
                         this.fn.showToast("送达失败:" + res.message);
799
                         this.fn.showToast("送达失败:" + res.message);
635
                     }
800
                     }
@@ -676,19 +841,98 @@ export default {
676
             });
841
             });
677
         },
842
         },
678
 
843
 
679
-        // 拒绝退款
680
-        applyNo(val){
844
+        // 取消订单
845
+        cancelOrder(val) {
846
+            if (val.loading) {
847
+                return;
848
+            }
849
+            val.loading = true;
850
+            uni.showLoading({
851
+                title: "提交中...",
852
+                mask: true,
853
+            });
854
+            this.api
855
+                .post(
856
+                    "/Order/Refund",
857
+                    {
858
+                        query: true,
859
+                        orderId: val.orderInfo.id,
860
+                    },
861
+                    { pass: true }
862
+                )
863
+                .then((res) => {
864
+                    uni.hideLoading();
865
+                    val.loading = false;
866
+                    if (res.success) {
867
+                        this.fn.showToast("取消成功");
868
+                        this.list[this.tab].list.splice(index, 1);
869
+                        this.list = [...this.list];
870
+                    } else {
871
+                        this.fn.showToast("取消失败:" + res.message);
872
+                    }
873
+                });
874
+        },
681
 
875
 
876
+        // 拒绝退款
877
+        applyNo(val) {
878
+            if (val.loading) {
879
+                return;
880
+            }
881
+            val.loading = true;
882
+            this.api
883
+                .post(
884
+                    "/Order/RejectRefund",
885
+                    {
886
+                        query: true,
887
+                        orderId: val.id,
888
+                    },
889
+                    { pass: true }
890
+                )
891
+                .then((res) => {
892
+                    val.loading = false;
893
+                    if (res.success) {
894
+                        this.fn.showToast("操作成功");
895
+                        this.getList();
896
+                    } else {
897
+                        this.fn.showToast("操作失败:" + res.message);
898
+                    }
899
+                });
682
         },
900
         },
683
 
901
 
684
         // 同意退款
902
         // 同意退款
685
-        applyOk(val){
686
-
903
+        applyOk(val) {
904
+            if (val.loading) {
905
+                return;
906
+            }
907
+            val.loading = true;
908
+            this.api
909
+                .post(
910
+                    "/Order/AgreeRefund",
911
+                    {
912
+                        query: true,
913
+                        orderId: val.id,
914
+                    },
915
+                    { pass: true }
916
+                )
917
+                .then((res) => {
918
+                    val.loading = false;
919
+                    if (res.success) {
920
+                        this.fn.showToast("操作成功");
921
+                        this.getList();
922
+                    } else {
923
+                        this.fn.showToast("操作失败:" + res.message);
924
+                    }
925
+                });
687
         },
926
         },
688
 
927
 
689
         goShopSelect() {
928
         goShopSelect() {
690
             this.router.push("/pages/index/select");
929
             this.router.push("/pages/index/select");
691
         },
930
         },
931
+
932
+        afterSaleToggle(val) {
933
+            val.showAllAfterSale = !val.showAllAfterSale;
934
+            this.list = [...this.list];
935
+        },
692
     },
936
     },
693
 
937
 
694
     // 数据计算
938
     // 数据计算
@@ -864,6 +1108,7 @@ page {
864
         align-items: center;
1108
         align-items: center;
865
         .des {
1109
         .des {
866
             font-size: px(40);
1110
             font-size: px(40);
1111
+            width: 100%;
867
             span {
1112
             span {
868
                 color: #666;
1113
                 color: #666;
869
             }
1114
             }
@@ -889,6 +1134,9 @@ page {
889
             border-radius: px(5);
1134
             border-radius: px(5);
890
         }
1135
         }
891
     }
1136
     }
1137
+    .order-status {
1138
+        float: right;
1139
+    }
892
     .tags {
1140
     .tags {
893
         margin-top: px(20);
1141
         margin-top: px(20);
894
         .tag {
1142
         .tag {
@@ -1207,7 +1455,12 @@ page {
1207
 .apply {
1455
 .apply {
1208
     padding: px(40);
1456
     padding: px(40);
1209
     border-bottom: 1px dashed #f1f1f1;
1457
     border-bottom: 1px dashed #f1f1f1;
1210
-    background-color: #f6f6f6;
1458
+    background-color: #fcfcfc;
1459
+    &.showAll {
1460
+        .info-item {
1461
+            display: block !important;
1462
+        }
1463
+    }
1211
     .head {
1464
     .head {
1212
         display: flex;
1465
         display: flex;
1213
         justify-content: space-between;
1466
         justify-content: space-between;
@@ -1218,8 +1471,11 @@ page {
1218
         }
1471
         }
1219
     }
1472
     }
1220
     .info-item {
1473
     .info-item {
1221
-        border-bottom: 1px solid #e9e9e9;
1474
+        border-bottom: 1px solid #f1f1f1;
1222
         padding: px(15) 0;
1475
         padding: px(15) 0;
1476
+        & ~ .info-item {
1477
+            display: none;
1478
+        }
1223
         .coll {
1479
         .coll {
1224
             display: flex;
1480
             display: flex;
1225
             justify-content: space-between;
1481
             justify-content: space-between;
@@ -1229,41 +1485,51 @@ page {
1229
             padding: px(0) px(30);
1485
             padding: px(0) px(30);
1230
             margin-top: px(20);
1486
             margin-top: px(20);
1231
         }
1487
         }
1232
-        .coll-tit{
1488
+        .coll-tit {
1233
             color: #333;
1489
             color: #333;
1234
             font-size: px(44);
1490
             font-size: px(44);
1491
+            .status {
1492
+                display: inline-flexbox;
1493
+                margin-left: px(30);
1494
+            }
1235
         }
1495
         }
1236
-        .good-r{
1237
-            .money{
1496
+        .good-r {
1497
+            .money {
1238
                 display: inline-flex;
1498
                 display: inline-flex;
1239
                 width: px(200);
1499
                 width: px(200);
1240
                 justify-content: flex-end;
1500
                 justify-content: flex-end;
1241
             }
1501
             }
1242
         }
1502
         }
1243
     }
1503
     }
1244
-    .btns{
1504
+    .btns {
1245
         display: flex;
1505
         display: flex;
1246
         justify-content: space-between;
1506
         justify-content: space-between;
1247
         align-items: center;
1507
         align-items: center;
1248
         margin-top: px(30);
1508
         margin-top: px(30);
1249
-        .btn{
1509
+        .btn {
1250
             width: 45%;
1510
             width: 45%;
1251
             height: px(100);
1511
             height: px(100);
1252
-            border:1px solid #cacaca;
1512
+            border: 1px solid #cacaca;
1253
             border-radius: px(50);
1513
             border-radius: px(50);
1254
             font-size: px(44);
1514
             font-size: px(44);
1255
             text-align: center;
1515
             text-align: center;
1256
             line-height: px(100);
1516
             line-height: px(100);
1257
             background-color: #fff;
1517
             background-color: #fff;
1258
         }
1518
         }
1259
-        .ok{
1519
+        .ok {
1260
             background-color: #ff4b26;
1520
             background-color: #ff4b26;
1261
             border-color: #ff4b26;
1521
             border-color: #ff4b26;
1262
             color: #fff;
1522
             color: #fff;
1263
         }
1523
         }
1264
     }
1524
     }
1525
+    .toggle {
1526
+        margin-top: px(20);
1527
+        font-size: px(40);
1528
+        text-align: right;
1529
+        color: #3582fb;
1530
+    }
1265
 }
1531
 }
1266
-.money-red{
1532
+.money-red {
1267
     color: #ff475f;
1533
     color: #ff475f;
1268
 }
1534
 }
1269
 </style>
1535
 </style>

+ 73 - 20
src/pages/index/refund.vue

@@ -8,28 +8,29 @@
8
                     class="item"
8
                     class="item"
9
                     v-for="(item, index) of orderData.orderItems"
9
                     v-for="(item, index) of orderData.orderItems"
10
                     :key="index"
10
                     :key="index"
11
+                    :class="{ invalid: item.invalid }"
11
                 >
12
                 >
12
                     <div class="check">
13
                     <div class="check">
13
-                        <checkbox class="checkbox" :value="item.orderItem.id" />
14
+                        <checkbox
15
+                            v-if="!item.invalid"
16
+                            class="checkbox"
17
+                            :value="item.id"
18
+                        />
14
                     </div>
19
                     </div>
15
                     <div class="info">
20
                     <div class="info">
16
                         <my-image
21
                         <my-image
17
-                            :src="item.orderItem.productImage"
22
+                            :src="item.productImage"
18
                             class="img"
23
                             class="img"
19
                         ></my-image>
24
                         ></my-image>
20
                         <div class="data">
25
                         <div class="data">
21
                             <div class="tit">
26
                             <div class="tit">
22
-                                {{ item.orderItem.productName }}
27
+                                {{ item.productName }}
23
                             </div>
28
                             </div>
24
                             <div class="des">
29
                             <div class="des">
25
                                 <span class="price"
30
                                 <span class="price"
26
-                                    >¥{{
27
-                                        item.orderItem.price | minuteToRmb
28
-                                    }}</span
29
-                                >
30
-                                <span class="num"
31
-                                    >x {{ item.orderItem.count }}</span
31
+                                    >¥{{ item.price | minuteToRmb }}</span
32
                                 >
32
                                 >
33
+                                <span class="num">x {{ item.count }}</span>
33
                             </div>
34
                             </div>
34
                         </div>
35
                         </div>
35
                     </div>
36
                     </div>
@@ -39,7 +40,7 @@
39
         <div class="refund-info">
40
         <div class="refund-info">
40
             <div class="head">
41
             <div class="head">
41
                 <div class="tit">退款金额</div>
42
                 <div class="tit">退款金额</div>
42
-                <div class="money">¥0</div>
43
+                <div class="money">¥{{ refundNum | minuteToRmb}}</div>
43
             </div>
44
             </div>
44
             <!-- <div class="des">
45
             <!-- <div class="des">
45
                 备注:
46
                 备注:
@@ -70,7 +71,7 @@ export default {
70
     // 数据
71
     // 数据
71
     data() {
72
     data() {
72
         return {
73
         return {
73
-            orderData: null,
74
+            orderData: {},
74
             radioList: [
75
             radioList: [
75
                 { key: "商品已售完", value: "商品已售完" },
76
                 { key: "商品已售完", value: "商品已售完" },
76
                 { key: "店铺太忙", value: "店铺太忙" },
77
                 { key: "店铺太忙", value: "店铺太忙" },
@@ -78,12 +79,13 @@ export default {
78
             ],
79
             ],
79
             curReason: "",
80
             curReason: "",
80
             curGoodItemIds: [],
81
             curGoodItemIds: [],
82
+            submitLoading: false,
81
         };
83
         };
82
     },
84
     },
83
 
85
 
84
     onLoad() {
86
     onLoad() {
85
         let curOrder = this.$store.state.common.curOrder;
87
         let curOrder = this.$store.state.common.curOrder;
86
-        this.orderData = curOrder;
88
+        this.orderData = this.initData(curOrder);
87
         console.log(curOrder);
89
         console.log(curOrder);
88
         this.$store.commit("common/update", {
90
         this.$store.commit("common/update", {
89
             curOrder: null,
91
             curOrder: null,
@@ -95,6 +97,30 @@ export default {
95
     async onShow() {},
97
     async onShow() {},
96
     // 函数
98
     // 函数
97
     methods: {
99
     methods: {
100
+        // 初始化订单数据
101
+        initData(data) {
102
+            let d = JSON.parse(JSON.stringify(data));
103
+            console.log(d);
104
+            //没有现有售后则不处理
105
+            if (!d.afterSaleList) {
106
+                return d;
107
+            }
108
+            // 判断订单项是否已经申请过
109
+            let num = 0;
110
+            for (let orderItem of d.orderItems) {
111
+                for (let afterSale of d.afterSaleList) {
112
+                    if (afterSale.orderInfo.orderItemId === orderItem.id) {
113
+                        orderItem.invalid = true;
114
+                        num += 1;
115
+                    }
116
+                }
117
+            }
118
+            d.validItemNum = d.orderItems.length - num;
119
+            console.log(d.validItemNum);
120
+            d.orderItems.sort((a, b) => (a.invalid ? 1 : -1));
121
+            return d;
122
+        },
123
+
98
         radioChange(e) {
124
         radioChange(e) {
99
             this.curReason = e.detail.value;
125
             this.curReason = e.detail.value;
100
         },
126
         },
@@ -103,23 +129,36 @@ export default {
103
         },
129
         },
104
 
130
 
105
         submit() {
131
         submit() {
132
+            if (this.submitLoading) {
133
+                return;
134
+            }
106
             if (this.curGoodItemIds.length === 0) {
135
             if (this.curGoodItemIds.length === 0) {
107
                 return this.fn.showToast("请选择退货项");
136
                 return this.fn.showToast("请选择退货项");
108
             }
137
             }
109
-            if (this.curGoodItemIds.length === this.orderData.orderItems.length) {
138
+            if (this.curGoodItemIds.length === this.orderData.validItemNum) {
110
                 return this.fn.showToast("全部退款请选择取消订单");
139
                 return this.fn.showToast("全部退款请选择取消订单");
111
             }
140
             }
112
             if (!this.curReason) {
141
             if (!this.curReason) {
113
                 return this.fn.showToast("请选择退货原因");
142
                 return this.fn.showToast("请选择退货原因");
114
             }
143
             }
115
             let sendData = {
144
             let sendData = {
116
-                orderItemIds:this.curGoodItemIds,
117
-                reason:this.curReason,
118
-                remark:this.curReason,
119
-            }
120
-            this.api.post('/order/PartialRefundApply',sendData).then(res=>{
121
-
122
-            })
145
+                orderItemIds: this.curGoodItemIds,
146
+                reason: this.curReason,
147
+                remark: this.curReason,
148
+            };
149
+            this.submitLoading = true;
150
+            uni.showLoading({
151
+                title: "提交中...",
152
+                mask:true
153
+            });
154
+            this.api.post("/order/PartialRefundApply", sendData,{pass: true}).then((res) => {
155
+                uni.hideLoading();
156
+                this.submitLoading = false;
157
+                if (res.success) {
158
+                    this.fn.showToast('提交成功');
159
+                    this.router.back();
160
+                }
161
+            });
123
         },
162
         },
124
     },
163
     },
125
 
164
 
@@ -128,6 +167,17 @@ export default {
128
         user() {
167
         user() {
129
             return this.$store.state.user.user;
168
             return this.$store.state.user.user;
130
         },
169
         },
170
+        refundNum(){
171
+            let num = 0;
172
+            for(let id of this.curGoodItemIds){
173
+                for(let item of this.orderData.orderItems){
174
+                    if(item.id === id ){
175
+                        num+=item.price;
176
+                    }
177
+                }
178
+            }
179
+            return num;
180
+        }
131
     },
181
     },
132
 
182
 
133
     // 数据监听
183
     // 数据监听
@@ -179,6 +229,9 @@ export default {
179
         align-items: center;
229
         align-items: center;
180
         padding: px(40) 0;
230
         padding: px(40) 0;
181
         border-bottom: 1px solid #f1f1f1;
231
         border-bottom: 1px solid #f1f1f1;
232
+        &.invalid {
233
+            background-color: #efefef;
234
+        }
182
     }
235
     }
183
     .check {
236
     .check {
184
         width: px(100);
237
         width: px(100);

+ 12 - 2
src/pages/manage/index.vue

@@ -1,6 +1,6 @@
1
 <template>
1
 <template>
2
     <div class="page">
2
     <div class="page">
3
-        <div class="page__top" v-if="user.isAdmin">
3
+        <div class="page__top" v-if="isAdmin">
4
             <div class="name">当前门店:</div>
4
             <div class="name">当前门店:</div>
5
             <div class="shop" v-if="!hideShop" @click="goShopSelect">
5
             <div class="shop" v-if="!hideShop" @click="goShopSelect">
6
                 <div class="shop__name">
6
                 <div class="shop__name">
@@ -76,7 +76,7 @@ export default {
76
     onLoad() {},
76
     onLoad() {},
77
     async onShow() {
77
     async onShow() {
78
         console.log(this.user);
78
         console.log(this.user);
79
-        if (this.user.isAdmin) {
79
+        if (this.isAdmin) {
80
             this.curShop = {
80
             this.curShop = {
81
                 name: this.user.storeName,
81
                 name: this.user.storeName,
82
                 id: this.user.storeId,
82
                 id: this.user.storeId,
@@ -143,6 +143,16 @@ export default {
143
         user() {
143
         user() {
144
             return this.$store.state.user.user;
144
             return this.$store.state.user.user;
145
         },
145
         },
146
+        isAdmin() {
147
+            if (
148
+                this.user.roleId === "50c41c5d-b54c-43ed-b587-10dcb60e72e5" ||
149
+                this.user.roleId === "75b71b24-25de-40ac-a866-c8f5555b8b92"
150
+            ) {
151
+                return true;
152
+            } else {
153
+                return false;
154
+            }
155
+        },
146
     },
156
     },
147
 
157
 
148
     // 数据监听
158
     // 数据监听

+ 1 - 0
src/pages/manage/statistics/order.vue

@@ -171,6 +171,7 @@ export default {
171
                 .then((res) => {
171
                 .then((res) => {
172
                     uni.hideLoading();
172
                     uni.hideLoading();
173
                     for (let item of res.data) {
173
                     for (let item of res.data) {
174
+                        item.refundAmount /= 100;
174
                         item.saleAmount /= 100;
175
                         item.saleAmount /= 100;
175
                     }
176
                     }
176
                     this.dataList = res.data;
177
                     this.dataList = res.data;