Bläddra i källkod

!106 【功能优化】确认收货添加提示确认,提交售后信息后直接返回到订单详情
Merge pull request !106 from Lcp/pr

芋道源码 1 år sedan
förälder
incheckning
6abad0df4d
3 ändrade filer med 37 tillägg och 14 borttagningar
  1. 1 1
      pages/order/aftersale/apply.vue
  2. 21 7
      pages/order/detail.vue
  3. 15 6
      pages/order/list.vue

+ 1 - 1
pages/order/aftersale/apply.vue

@@ -171,7 +171,7 @@
       uni.showToast({
       uni.showToast({
         title: '申请成功',
         title: '申请成功',
       });
       });
-      sheep.$router.go('/pages/order/aftersale/list');
+      sheep.$router.redirect('/pages/order/aftersale/list');
     }
     }
   }
   }
 
 

+ 21 - 7
pages/order/detail.vue

@@ -260,7 +260,7 @@
 
 
 <script setup>
 <script setup>
   import sheep from '@/sheep';
   import sheep from '@/sheep';
-  import { onLoad } from '@dcloudio/uni-app';
+  import { onLoad, onShow } from '@dcloudio/uni-app';
   import { reactive, ref } from 'vue';
   import { reactive, ref } from 'vue';
   import { isEmpty } from 'lodash-es';
   import { isEmpty } from 'lodash-es';
   import {
   import {
@@ -345,11 +345,20 @@
       return;
       return;
     }
     }
 
 
-    // 正常的确认收货流程
-    const { code } = await OrderApi.receiveOrder(orderId);
-    if (code === 0) {
-      await getOrderDetail(orderId);
-    }
+    uni.showModal({
+      title: '提示',
+      content: '确认收货吗?',
+      success: async function (res) {
+        if (!res.confirm) {
+          return;
+        }
+        // 正常的确认收货流程
+        const { code } = await OrderApi.receiveOrder(orderId);
+        if (code === 0) {
+          await getOrderDetail(orderId);
+        }
+      },
+    });
   }
   }
 
 
   // #ifdef MP-WEIXIN
   // #ifdef MP-WEIXIN
@@ -420,6 +429,11 @@
     }
     }
   }
   }
 
 
+  onShow(async () => {
+    //onShow中获取订单列表,保证跳转后页面为最新状态
+    await getOrderDetail(state.orderInfo.id);
+  })
+
   onLoad(async (options) => {
   onLoad(async (options) => {
     let id = 0;
     let id = 0;
     if (options.id) {
     if (options.id) {
@@ -430,7 +444,7 @@
     if (state.comeinType === 'wechat') {
     if (state.comeinType === 'wechat') {
       state.merchantTradeNo = options.merchant_trade_no;
       state.merchantTradeNo = options.merchant_trade_no;
     }
     }
-    await getOrderDetail(id);
+    state.orderInfo.id = id
   });
   });
 </script>
 </script>
 
 

+ 15 - 6
pages/order/list.vue

@@ -223,12 +223,21 @@
       return;
       return;
     }
     }
 
 
-    // 正常的确认收货流程
-    const { code } = await OrderApi.receiveOrder(order.id);
-    if (code === 0) {
-      resetPagination(state.pagination);
-      await getOrderList();
-    }
+    uni.showModal({
+      title: '提示',
+      content: '确认收货吗?',
+      success: async function (res) {
+        if (!res.confirm) {
+          return;
+        }
+        // 正常的确认收货流程
+        const { code } = await OrderApi.receiveOrder(order.id);
+        if (code === 0) {
+          resetPagination(state.pagination);
+          await getOrderList();
+        }
+      },
+    });
   }
   }
 
 
   // #ifdef MP-WEIXIN
   // #ifdef MP-WEIXIN