| | |
| | | isPayComplete: false, |
| | | type: '', |
| | | onNorderSaleMethod: '', |
| | | ImmediatelyReceive: '', |
| | | integral: 0, |
| | | defaultVal: false, |
| | | deductioRate: 0, |
| | |
| | | selectedIds: options.selectedIds, |
| | | onNorderSaleMethod: options.onNorderSaleMethod |
| | | }) |
| | | console.log(this.data.onNorderSaleMethod, 'options'); |
| | | this.getIntegral() |
| | | this.getOrderByOrderNumData() |
| | | this.getDataList() |
| | |
| | | return intPartFormat + floatPart; |
| | | }, |
| | | getOrderByOrderNumData() { |
| | | console.log(this.data.orderNumber, 'this.data.orderNumber'); |
| | | let query = { |
| | | orderNum: this.data.orderNumber, |
| | | fields: { |
| | |
| | | } |
| | | 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; // 将type设置为item对象的属性,而不是使用setData |
| | | 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 = "数字教材" |
| | |
| | | loading: false, |
| | | hidden: false, |
| | | }) |
| | | |
| | | }) |
| | | }, |
| | | getDataList() { |
| | |
| | | } |
| | | } |
| | | 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, |
| | |
| | | integral: this.data.integral - this.data.currentBalance, |
| | | showIntegral: true |
| | | }); |
| | | console.log(this.data.price, this.data.payPrice, 123) |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | payId: this.data.payId, |
| | | } |
| | | app.MG.store.delOrderPay(data).then(res => { |
| | | console.log(res, "取消用积分") |
| | | if (res) { |
| | | this.setData({ |
| | | payPrice: res.payPrice.toFixed(2), |
| | |
| | | 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, |
| | |
| | | "signType": payVal.signType, |
| | | "paySign": payVal.paySign, |
| | | success: function (res) { |
| | | console.log('支付成功'); |
| | | if (res.errMsg == 'requestPayment:ok') { |
| | | that.setData({ |
| | | isPaySuccess: true |