From 3ec10b0c2654e1243e42a5ad563d088ac89c87fe Mon Sep 17 00:00:00 2001
From: litian <C21AF165>
Date: 星期五, 27 九月 2024 14:06:56 +0800
Subject: [PATCH] zf

---
 pages/cart/paymentPage/index.js   |   42 ++++++++++++++++--------------------------
 pages/cart/paymentPage/index.wxml |    5 ++---
 2 files changed, 18 insertions(+), 29 deletions(-)

diff --git a/pages/cart/paymentPage/index.js b/pages/cart/paymentPage/index.js
index 3a3b727..a9e402d 100644
--- a/pages/cart/paymentPage/index.js
+++ b/pages/cart/paymentPage/index.js
@@ -28,7 +28,6 @@
     isPayComplete: false,
     type: '',
     onNorderSaleMethod: '',
-    ImmediatelyReceive: '',
     integral: 0,
     defaultVal: false,
     deductioRate: 0,
@@ -54,7 +53,6 @@
       selectedIds: options.selectedIds,
       onNorderSaleMethod: options.onNorderSaleMethod
     })
-    console.log(this.data.onNorderSaleMethod, 'options');
     this.getIntegral()
     this.getOrderByOrderNumData()
     this.getDataList()
@@ -144,7 +142,6 @@
     return intPartFormat + floatPart;
   },
   getOrderByOrderNumData() {
-    console.log(this.data.orderNumber, 'this.data.orderNumber');
     let query = {
       orderNum: this.data.orderNumber,
       fields: {
@@ -154,20 +151,17 @@
     }
     app.MG.store.getOrderByOrderNum(query).then(res => {
       this.setData({
-        orderGoods: res.orderNumber
-      })
-      this.setData({
-        price: res.payPrice.toFixed(2),
+        orderGoods: res.orderNumber,
+        price: res.totalPrice.toFixed(2),
         payPrice: res.payPrice.toFixed(2),
-        ImmediatelyReceive: res.payPrice
       })
+      if (Number(this.data.payPrice) < Number(this.data.price)) {
+        this.handleChange()
+      }
       res.saleMethodLinks.forEach(item => {
         const type = item.orderSaleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product';
         item.type = type; // 灏唗ype璁剧疆涓篿tem瀵硅薄鐨勫睘鎬э紝鑰屼笉鏄娇鐢╯etData
         item.paymentIcon = getPublicImage(item.orderSaleMethod.product.icon)
-        item.payPrice = this.numFormat(item.payPrice)
-        item.orderSaleMethod.price = this.numFormat(item.orderSaleMethod.price)
-        // 
         if (item.orderSaleMethod.product.cmsTypeRefCode == 'jsek_digitalTextbooks') {
           item.typeTxt = '鏁板瓧鏁欐潗'
           item.productType = "鏁板瓧鏁欐潗"
@@ -189,7 +183,6 @@
         loading: false,
         hidden: false,
       })
-
     })
   },
   getDataList() {
@@ -206,21 +199,25 @@
       }
     }
     app.MG.store.getUserOrderList(data).then((res) => {
-
       res.datas.forEach((item) => {
         this.data.myOrderOrderNumber.push(item.saleMethodLinks[0].orderSaleMethod.id)
-        console.log(this.data.myOrderOrderNumber);
       })
     })
   },
 
   handleChange(e) {
-    this.setData({
-      defaultVal: e.detail.value,
-    });
-    console.log(this.data.defaultVal)
+    if (e) {
+      this.setData({
+        defaultVal: e.detail.value,
+      });
+    } else {
+      this.setData({
+        defaultVal: true,
+      });
+    }
+
     if (this.data.defaultVal) {
-      let useBalance = Math.floor(this.data.payPrice * this.data.deductioRate);
+      let useBalance = Math.round(Number(this.data.payPrice) * Number(this.data.deductioRate));
       if (useBalance >= this.data.integral) {
         this.setData({
           currentBalance: this.data.integral,
@@ -245,7 +242,6 @@
             integral: this.data.integral - this.data.currentBalance,
             showIntegral: true
           });
-          console.log(this.data.price, this.data.payPrice, 123)
         }
       })
     } else {
@@ -254,7 +250,6 @@
         payId: this.data.payId,
       }
       app.MG.store.delOrderPay(data).then(res => {
-        console.log(res, "鍙栨秷鐢ㄧН鍒�")
         if (res) {
           this.setData({
             payPrice: res.payPrice.toFixed(2),
@@ -282,19 +277,15 @@
         orderNum: this.data.orderGoods
       }
       app.MG.store.confirmOrder(query).then(res => {
-        console.log(res.orderNumber, 'res');
         if (res.orderNumber) {
           let resOrderNum = {
             orderNum: res.orderNumber,
             platform: "WeChatAppCustom"
           };
-          console.log(resOrderNum, 'resOrderNum');
           // 鐢ㄦ埛鏈粦瀹氬井淇� 鎶�500
           app.MG.store.makeWeChatPay(resOrderNum).then(payRes => {
-            console.log(payRes, 'payRes');
             if (payRes) {
               const payVal = JSON.parse(payRes);
-              console.log(payVal);
               wx.requestPayment({
                 "appId": payVal.appId,
                 "timeStamp": payVal.timeStamp,
@@ -303,7 +294,6 @@
                 "signType": payVal.signType,
                 "paySign": payVal.paySign,
                 success: function (res) {
-                  console.log('鏀粯鎴愬姛');
                   if (res.errMsg == 'requestPayment:ok') {
                     that.setData({
                       isPaySuccess: true
diff --git a/pages/cart/paymentPage/index.wxml b/pages/cart/paymentPage/index.wxml
index 3e2dc5d..a221fde 100644
--- a/pages/cart/paymentPage/index.wxml
+++ b/pages/cart/paymentPage/index.wxml
@@ -37,7 +37,7 @@
               </view> -->
             </view>
             <view class="textBox">{{item.productType}}</view>
-            <view class="priceBox">锟{item.orderSaleMethod.price}}</view>
+            <view class="priceBox">锟{price}}</view>
           </view>
         </view>
       </view>
@@ -48,7 +48,6 @@
             鎴戠殑绉垎锛歿{integral}}
           </view>
           <t-switch defaultValue="{{defaultVal}}" slot="note" bindchange="handleChange" />
-
         </view>
       </view>
       <view class="priceBreakdown">
@@ -73,7 +72,7 @@
     <view class="paymentBox">
       <view class="residue">寰呮敮浠橈細<text class="residueTextBox">锟{payPrice}}</text></view>
       <view>
-        <t-button wx:if="{{payPrice === 0}}" class="buttonBox" shape="round" catch:tap="onReceive">绔嬪嵆棰嗗彇</t-button>
+        <t-button wx:if="{{payPrice === '0.00'}}" class="buttonBox" shape="round" catch:tap="onReceive">绔嬪嵆棰嗗彇</t-button>
         <t-button wx:else class="buttonBox" shape="round" catch:tap="confirmOrderGet">寰俊鏀粯</t-button>
       </view>
     </view>

--
Gitblit v1.9.1