Explorar el Código

【订单】确认收货时没有二次确认

张田田 hace 9 meses
padre
commit
e34379c123

+ 14 - 17
miniprogram/module/article/pages/confirm-receiving/confirm-receiving.ts

@@ -19,22 +19,7 @@ Page({
   },
   data: {
     id: '',
-    goodsList: [
-      // {
-      //   id: 1,
-      //   img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
-      //   name: '元气茶',
-      //   count: 3,
-      //   expressNo: '00385322232830'
-      // },
-      // {
-      //   id: 2,
-      //   img: 'https://pic.nximg.cn/file/20190718/28170468_214109363000_2.jpg',
-      //   name: '芡实米仁燕麦粥',
-      //   count: 21,
-      //   expressNo: '00385322290821'
-      // }
-    ]
+    goodsList: []
   },
     async load(id:string) {
       wx.showLoading({ title: '加载中' });
@@ -64,9 +49,21 @@ Page({
     },
     // 确认收货逻辑
     async onConfirmReceiving() {
+      let that = this;
+      wx.showModal({
+        title: '提示',
+        content: '确认收货后,订单将无法修改,请确认无误后再进行操作',
+        success: (res) => {
+          if (res.confirm) {
+            that.confirmReceiving();
+          }
+        }
+      });
+    },
+    async confirmReceiving() {
       try {
         await orderConfirmMethod(this.data.id);
-        wx.showToast({ title: '确认收货成功', icon: 'success' });
+        // wx.showToast({ title: '确认收货成功', icon: 'success' });
         wx.navigateTo({
           url: "/module/article/pages/success-page/success-page?title=确认收货成功",
         });

+ 31 - 4
miniprogram/module/article/pages/order-detail/order-detail.ts

@@ -106,16 +106,27 @@ Page({
     // 点击确定取消订单按钮
     const that = this;
     /* 取消订单逻辑 */
+    wx.showModal({
+      title: "提示",
+      content: "确认取消该订单吗?",
+      success: (res) => {
+        if (res.confirm) {
+          that.cancelOrdering();
+        }
+      },
+    });
+  },
+  // 取消订单
+  async cancelOrdering() {
     try {
-      console.log("cancelOrder", that.data.id);
-      await orderCancelMethod(that.data.id);
+      await orderCancelMethod(this.data.id);
       /* 取消订单逻辑 */
-      that.setData({ showConfirm: false });
+      this.setData({ showConfirm: false });
       wx.navigateTo({
         url: "/module/article/pages/success-page/success-page?title=订单取消成功",
       });
     } catch (error: any) {
-      getTickleContext.call(that).showWarnMessage(error.errMsg);
+      getTickleContext.call(this).showWarnMessage(error.errMsg);
     }
   },
   // 取消订单
@@ -134,6 +145,22 @@ Page({
   },
   // 确认收货
   async confirmReceipt() {
+    const orderId = this.data.id;
+    wx.navigateTo({
+      url: `/module/article/pages/confirm-receiving/confirm-receiving?orderId=${orderId}`,
+    });
+    // let that = this;
+    // wx.showModal({
+    //   title: "提示",
+    //   content: "确认收货后,订单将无法修改,请确认无误后再进行操作",
+    //   success: (res) => {
+    //     if (res.confirm) {
+    //       that.confirmReceiving();
+    //     }
+    //   },
+    // });
+  },
+  async confirmReceiving() {
     try {
       await orderConfirmMethod(this.data.id);
       wx.navigateTo({