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 ++++++++++++++++-------------------------- 1 files changed, 16 insertions(+), 26 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 -- Gitblit v1.9.1