Kaynağa Gözat

订单状态与订单配送状态及时影响更新

shizhongqi 8 ay önce
ebeveyn
işleme
d218325850

+ 1 - 1
hdApp/src/admin/delivery/allDelivery.vue

@@ -415,7 +415,7 @@ export default {
       }).then(res => {
         if (res && res.code === 1) {
           this.$msg('下单成功');
-          uni.$emit('updateOrderStatus', this.orderId);
+          uni.$emit('updateOrderStatus', this.orderId, 3, 0);
           //this.pageTo({url: '/pagesOrder/detail?id=' + this.orderId, type: 2 }); 
           // 为了能正常返回,需要使用navigateBack
           uni.navigateBack({ delta: 1 });

+ 14 - 6
hdApp/src/admin/home/order.vue

@@ -266,8 +266,13 @@ export default {
     if (this.customId !== 0) {
       this.clearFn()
     }
+
+    this.getOrderList();
   },
   methods: {
+    init () {
+      //this.getOrderList();
+    },
     // 面板相关
     openFilterPanel () {
       this.showFilterPanel = true
@@ -440,9 +445,6 @@ export default {
         }
       })
     },
-    init () {
-      this.getOrderList();
-    },
     getOrderList () {
       let status = JSON.parse(JSON.stringify(this.tabIndex));
       return getListB({
@@ -477,12 +479,18 @@ export default {
         this.getOrderList();
       }
     },
-    updateOrderStatus(orderId) {
+    /**
+     * 更新订单状态及配送状态
+     * @param orderId 订单ID
+     * @param orderStatus 订单状态 
+     * @param sendStatus 配送状态
+     */
+    updateOrderStatus(orderId, orderStatus, sendStatus) {
       if (this.list && this.list.data) {
         const item = this.list.data.find(item => item.id == orderId);
         if (item) {
-          item.status = 3;
-          item.sendStatus = 0;
+          item.status = orderStatus;
+          item.sendStatus = String(sendStatus);
         }
       }
     },

+ 3 - 0
hdApp/src/admin/order/detail.vue

@@ -656,6 +656,7 @@ export default {
               if (res.code === 1) {
                 this.$msg('取消成功')
                 this.init()
+                uni.$emit('updateOrderStatus', orderId, 2, -1);
               }
             })
           }
@@ -696,6 +697,7 @@ export default {
             if (res.code === 1) {
               this.$msg('取消成功')
               this.init()
+              uni.$emit('updateOrderStatus', orderId, 2, -1);
             }
         })
       }
@@ -740,6 +742,7 @@ export default {
           this.$msg('取消成功');
           this.closeCancelReasonPopup();
           this.init();
+          uni.$emit('updateOrderStatus', this.currentExpressInfo.orderId, 2, -1);
         } else {
           this.$msg(res.msg || '取消失败');
         }