payFor(item) {
this.api.pay({
type: 1,
out_trade_no: item.out_trade_no
})
.then(res => {
console.log(res.data, 11);
this.data = res.data.data
this.api.payment({
out_trade_no: this.data
})
.then(res => {
console.log(res.data, 21);
this.json = res.data.json
let param = JSON.parse(res.data.json)
uni.requestPayment({
timeStamp: param.timeStamp, //记住,这边的timeStamp一定要是字符串类型的,不然会报错
nonceStr: param.nonceStr,
package: param.package,
signType: 'MD5',
paySign: param.paySign,
appId: param.appId,
success: function(event) {
wx.showToast({
title: '支付成功',
icon: 'success',
duration: 2000
});
setTimeout(() => {
uni.navigateBack({
delta: 1
})
}, 1000)
},
fail: function(error) {
},
complete: function() {
}
});
})
.catch(err => {
})
})
.catch(err => {
})
},
uni中支付的方法
猜你喜欢
转载自blog.csdn.net/qq_45894929/article/details/111693234
今日推荐
周排行