[更新]
This commit is contained in:
@@ -97,35 +97,55 @@ Page({
|
||||
* 支付提交
|
||||
*/
|
||||
orderPay(e) {
|
||||
let url = ''
|
||||
let orderid = e.currentTarget.dataset.id
|
||||
wx.$api.exchange.payments(orderid).then(res=>{
|
||||
wx.$api.index.wechat(res.data.trade_no).then(res=>{
|
||||
let payInfo = JSON.parse(res.data)
|
||||
wx.requestPayment({
|
||||
timeStamp: payInfo.timeStamp,
|
||||
nonceStr : payInfo.nonceStr,
|
||||
package : payInfo.package,
|
||||
paySign : payInfo.paySign,
|
||||
signType : payInfo.signType,
|
||||
success : res=>{
|
||||
if(res.errMsg == "requestPayment:ok"){
|
||||
wx.showToast({
|
||||
title: '支付成功',
|
||||
icon : 'success'
|
||||
})
|
||||
setTimeout(()=>{
|
||||
wx.reLaunch({
|
||||
url: '/pages/coupon/coupon?type=couponPublic'
|
||||
if(this.data.orderType == 'welfare' || this.data.orderType == 'welfareGoods') url = wx.$api.exchange.welfarePay
|
||||
if(this.data.orderType == 'rights' || this.data.orderType == 'rightsCoupons') url = wx.$api.exchange.rightsPay
|
||||
url(orderid).then(res=>{
|
||||
// payTips为1的时候为微信支付
|
||||
if(this.data.pay.payTips == 1) {
|
||||
let wechaUrl = ''
|
||||
if(this.data.orderType == 'welfare' || this.data.orderType == 'welfareGoods') wechaUrl = wx.$api.index.fridayPay
|
||||
if(this.data.orderType == 'rights' || this.data.orderType == 'rightsCoupons') wechaUrl = wx.$api.index.wechat
|
||||
wechaUrl(res.data.trade_no).then(res=>{
|
||||
let payInfo = JSON.parse(res.data)
|
||||
wx.requestPayment({
|
||||
timeStamp: payInfo.timeStamp,
|
||||
nonceStr : payInfo.nonceStr,
|
||||
package : payInfo.package,
|
||||
paySign : payInfo.paySign,
|
||||
signType : payInfo.signType,
|
||||
success : res=>{
|
||||
if(res.errMsg == "requestPayment:ok"){
|
||||
wx.showToast({
|
||||
title: '支付成功',
|
||||
icon : 'success'
|
||||
})
|
||||
},2000)
|
||||
setTimeout(()=>{
|
||||
// 获取商品活动订单
|
||||
this.orderInfo();
|
||||
},2000)
|
||||
}
|
||||
},
|
||||
fail : res=>{
|
||||
// 获取商品活动订单
|
||||
this.orderInfo();
|
||||
}
|
||||
},
|
||||
fail : res=>{
|
||||
wx.reLaunch({
|
||||
url: '/pages/order/order?stateType=unpay'
|
||||
})
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
// payTips为2的时候为沃钱包支付
|
||||
if(this.data.pay.payTips == 2) {
|
||||
const newUrl = "https://lifetest.ysd-bs.com/unicom/payment?trade_no=" + res.data.trade_no
|
||||
let url= encodeURIComponent(newUrl)
|
||||
wx.navigateTo({
|
||||
// 跳转到webview页面
|
||||
url: `/pages/webView/webView?url=${url}`
|
||||
});
|
||||
}
|
||||
|
||||
this.setData({
|
||||
['pay.payState']: false
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user