| | |
| | | // pages/cart/paymentPage/index.js |
| | | const app = getApp() |
| | | import { getPublicImage } from '../../../assets/js/middleGround/tool'; |
| | | import { |
| | | getPublicImage |
| | | } from '../../../assets/js/middleGround/tool'; |
| | | import drawQrcode from './js/weapp.qrcode' |
| | | Page({ |
| | | |
| | |
| | | orderGoods: '', |
| | | isPaySuccess: false, |
| | | isPayComplete: false, |
| | | type: '' |
| | | }, |
| | | |
| | | /** |
| | |
| | | |
| | | |
| | | getOrderByOrderNumData() { |
| | | console.log(this.data.orderNumber, 'this.data.orderNumber'); |
| | | let query = { |
| | | orderNum: this.data.orderNumber, |
| | | fields: { |
| | |
| | | payPrice: res.payPrice.toFixed(2) |
| | | }) |
| | | res.saleMethodLinks.forEach(item => { |
| | | console.log(item.type, 'item.type'); |
| | | |
| | | const type = item.orderSaleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product'; |
| | | item.type = type; // 将type设置为item对象的属性,而不是使用setData |
| | | item.paymentIcon = getPublicImage(item.orderSaleMethod.product.icon) |
| | | console.log(item.orderSaleMethod.type); |
| | | |
| | | this.setData({ |
| | | productList: res.saleMethodLinks, |
| | | type: item.orderSaleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product' |
| | | }) |
| | | |
| | | console.log(item.type, 'item'); |
| | | }) |
| | | this.setData({ |
| | | productList: res.saleMethodLinks, |
| | | // type: item.orderSaleMethod.type == 'createProductItemSaleMethod' ? 'item' : 'product' |
| | | }) |
| | | }) |
| | | }, |
| | |
| | | app.MG.store.confirmOrder(query).then(res => { |
| | | console.log(res.orderNumber, 'res'); |
| | | if (res.orderNumber) { |
| | | const resOrderNum = { |
| | | let resOrderNum = { |
| | | orderNum: res.orderNumber, |
| | | platform: "WeChatAppCustom" |
| | | }; |
| | | |
| | | console.log(resOrderNum, 'resOrderNum'); |
| | | // 用户未绑定微信 报500 |
| | | app.MG.store.makeWeChatPay(resOrderNum).then(payRes => { |
| | | console.log(payRes, 'payRes'); |
| | | const payVal = JSON.parse(payRes); |
| | | wx.requestPayment({ |
| | | "appId": payVal.appId, |