From 56b70cdad0a96691eaf37e04a79ef5e92b892480 Mon Sep 17 00:00:00 2001
From: yiming <m13691596795@163.com>
Date: 星期五, 19 四月 2024 11:14:40 +0800
Subject: [PATCH] bug1

---
 packagePersonal/pages/myOrder/index.js |  143 ++++++++++++++++++-----------------------------
 1 files changed, 55 insertions(+), 88 deletions(-)

diff --git a/packagePersonal/pages/myOrder/index.js b/packagePersonal/pages/myOrder/index.js
index 0559897..1ad1223 100644
--- a/packagePersonal/pages/myOrder/index.js
+++ b/packagePersonal/pages/myOrder/index.js
@@ -40,7 +40,9 @@
     isBackTop: false,
     setScrollValue: 0,
     skeletonLoding: true,
-    queryFilter: []
+    queryFilter: [],
+    isPaySuccess: false,
+    isPayComplete: false,
   },
 
   /**
@@ -78,7 +80,6 @@
 
   getDataList(isReachBottom) {
     var searchArr = [];
-    console.log(this.data.searchText, "earch")
     if (this.data.searchText != undefined && this.data.searchText != "") {
       searchArr.push({
         compareType: "Contains",
@@ -155,7 +156,6 @@
           })
         } else {
           this.setData({
-            list: [],
             skeletonLoding: false,
             loading: false
           })
@@ -171,7 +171,26 @@
     })
     this.getDataList(false);
   },
+  async goBookDetails(e) {
 
+    console.log(e.currentTarget.dataset);
+    const {
+      book,
+      remarks
+    } = e.currentTarget.dataset;
+    let parentData = null;
+    let bookId = book.orderSaleMethod.product.id;
+
+    parentData = await app.MG.store.getProductBySaleMethod({
+      'saleMethodId': book.orderSaleMethod.id
+    })
+    if (parentData.parentProduct.length > 0) {
+      bookId = parentData.parentProduct[parentData.parentProduct.length - 1].id;
+    }
+    wx.navigateTo({
+      url: `/packageBookService/pages/bookServices/detail/index?id=${bookId}&name=${book.name}`,
+    });
+  },
 
   /**
    * 椤甸潰鐩稿叧浜嬩欢澶勭悊鍑芥暟--鐩戝惉鐢ㄦ埛涓嬫媺鍔ㄤ綔
@@ -261,93 +280,41 @@
       orderNum: orderNum,
     };
     app.MG.store.getOrderByOrderNum(data).then(res => {
-      if (res && res.state != "WaitPay") {
-        app.MG.store.confirmOrder(data).then(conRes => {
-          if (conRes.orderNumber) {
-            const resOrderNum = {
-              orderNum: conRes.orderNumber,
-            };
-            if (conRes.payPrice != 0) {
-              app.MG.store.makeWeChatPay(resOrderNum).then(payRes => {
-                const payVal = JSON.parse(payRes);
-                wx.requestPayment({
-                  "appId": payVal.appId,
-                  "timeStamp": payVal.timeStamp,
-                  "nonceStr": payVal.nonceStr,
-                  "package": payVal.package,
-                  "signType": payVal.signType,
-                  "paySign": payVal.paySign,
-                  "success": function (res) {
-                    if (res.errMsg == 'requestPayment:ok') {
-                      that.setData({
-                        isPaySuccess: true
-                      })
-                    }
-                    console.log(res, "鎴愬姛")
-                  },
-                  "fail": function (res) {
-                    console.log(res, "澶辫触")
-                  },
-                  "complete": function (res) {
-                    if (res.errMsg == 'requestPayment:ok') {
-                      that.setData({
-                        isPayComplete: true
-                      })
-                    }
-                    if (that.data.isPaySuccess && that.data.isPayComplete) {
-                      that.navToBack()
-                    }
-                  }
+      app.MG.store.makeWeChatPay({
+          orderNum: res.orderNumber,
+          platform: "WeChatAppCustom"
+        })
+        .then(payRes => {
+          const payVal = JSON.parse(payRes);
+          wx.requestPayment({
+            "appId": payVal.appId,
+            "timeStamp": payVal.timeStamp,
+            "nonceStr": payVal.nonceStr,
+            "package": payVal.package,
+            "signType": payVal.signType,
+            "paySign": payVal.paySign,
+            "success": function (res) {
+              if (res.errMsg == 'requestPayment:ok') {
+                that.setData({
+                  isPaySuccess: true
                 })
-              });
-            } else {
-              wx.showToast({
-                title: '棰嗗彇鎴愬姛',
-              })
-              // 鍙坊鍔犺繑鍥炰笂绾�
-              setTimeout(() => {
-                that.navToBack()
-              }, 2000);
-            }
-          }
-        });
-      } else {
-        app.MG.store
-          .makeWeChatPay({
-            orderNum: orderNum
-          })
-          .then(payRes => {
-            const payVal = JSON.parse(payRes);
-            wx.requestPayment({
-              "appId": payVal.appId,
-              "timeStamp": payVal.timeStamp,
-              "nonceStr": payVal.nonceStr,
-              "package": payVal.package,
-              "signType": payVal.signType,
-              "paySign": payVal.paySign,
-              "success": function (res) {
-                if (res.errMsg == 'requestPayment:ok') {
-                  that.setData({
-                    isPaySuccess: true
-                  })
-                }
-              },
-              "fail": function (res) {
-                console.log(res, "澶辫触")
-              },
-              "complete": function (res) {
-                if (res.errMsg == 'requestPayment:ok') {
-                  that.setData({
-                    isPayComplete: true
-                  })
-                }
-                if (that.data.isPaySuccess && that.data.isPayComplete) {
-                  that.navToBack()
-                }
               }
-            })
-          });
-      }
+            },
+            "fail": function (res) {
+              console.log(res, "澶辫触")
+            },
+            "complete": function (res) {
+              if (res.errMsg == 'requestPayment:ok') {
+                that.setData({
+                  isPayComplete: true
+                })
+              }
+              if (that.data.isPaySuccess && that.data.isPayComplete) {
+                that.navToBack()
+              }
+            }
+          })
+        });
     });
 
   },

--
Gitblit v1.9.1