|
@@ -174,48 +174,48 @@ Page({
|
|
|
title: "加载中...",
|
|
|
});
|
|
|
try {
|
|
|
- // const { salePrice, shopId, name, id, orderNo } = goodsInfo
|
|
|
- // const { data } = await api_executeOrder({
|
|
|
- // "orderType": "WECHAT_MINI",
|
|
|
- // "paymentType": this.data.paymentType,
|
|
|
- // "paymentCashAmount": salePrice,
|
|
|
- // "paymentCouponAmount": 0,
|
|
|
- // "shopId": shopId,
|
|
|
- // "openId": app.globalData.userInfo?.liteOpenid,
|
|
|
- // "goodsInfos": [{
|
|
|
- // "goodsId": id,
|
|
|
- // "goodsNum": 1,
|
|
|
- // "goodsType": "ACTIVATION_CODE",
|
|
|
- // "paymentCashAmount": salePrice,
|
|
|
- // "paymentCouponAmount": 0
|
|
|
- // }],
|
|
|
- // "orderName": name,
|
|
|
- // "orderDesc": name
|
|
|
- // })
|
|
|
- // if (data.code === 200) {
|
|
|
- // const { paymentConfig, paymentType, orderNo } = data.data
|
|
|
+ const { salePrice, shopId, name, id, orderNo } = goodsInfo
|
|
|
+ const { data } = await api_executeOrder({
|
|
|
+ "orderType": "WECHAT_MINI",
|
|
|
+ "paymentType": this.data.paymentType,
|
|
|
+ "paymentCashAmount": salePrice,
|
|
|
+ "paymentCouponAmount": 0,
|
|
|
+ "shopId": shopId,
|
|
|
+ "openId": app.globalData.userInfo?.liteOpenid,
|
|
|
+ "goodsInfos": [{
|
|
|
+ "goodsId": id,
|
|
|
+ "goodsNum": 1,
|
|
|
+ "goodsType": "ACTIVATION_CODE",
|
|
|
+ "paymentCashAmount": salePrice,
|
|
|
+ "paymentCouponAmount": 0
|
|
|
+ }],
|
|
|
+ "orderName": name,
|
|
|
+ "orderDesc": name
|
|
|
+ })
|
|
|
+ if (data.code === 200) {
|
|
|
+ const { paymentConfig, paymentType, orderNo } = data.data
|
|
|
// 测试h5页面支付流程
|
|
|
const params = {
|
|
|
- // paymentType: paymentType, //'adapay-cooleshow-6560',
|
|
|
- // pay_channel: 'wx_pub',
|
|
|
- // wxAppId: paymentConfig.wxAppId, //'wxbde13f59d40cb4f2',
|
|
|
- // body: paymentConfig.body, //'aaa',
|
|
|
- // price: paymentConfig.price, // '0.01',
|
|
|
- // orderNo: paymentConfig.merOrderNo,
|
|
|
- // userId: paymentConfig.userId
|
|
|
+ paymentType: paymentType, //'adapay-cooleshow-6560',
|
|
|
+ pay_channel: 'wx_pub',
|
|
|
+ wxAppId: paymentConfig.wxAppId, //'wxbde13f59d40cb4f2',
|
|
|
+ body: paymentConfig.body, //'aaa',
|
|
|
+ price: paymentConfig.price, // '0.01',
|
|
|
+ orderNo: paymentConfig.merOrderNo,
|
|
|
+ userId: paymentConfig.userId
|
|
|
}
|
|
|
wx.navigateTo({
|
|
|
url: '../order-webview/order-webview?orderInfo=' + encodeURIComponent(JSON.stringify(params))
|
|
|
})
|
|
|
|
|
|
wx.hideLoading()
|
|
|
- // } else {
|
|
|
- // wx.hideLoading()
|
|
|
- // wx.showToast({
|
|
|
- // title: '购买失败',
|
|
|
- // icon: 'none'
|
|
|
- // })
|
|
|
- // }
|
|
|
+ } else {
|
|
|
+ wx.hideLoading()
|
|
|
+ wx.showToast({
|
|
|
+ title: '购买失败',
|
|
|
+ icon: 'none'
|
|
|
+ })
|
|
|
+ }
|
|
|
} catch {
|
|
|
wx.hideLoading()
|
|
|
}
|