1.优化H5 支付

yj-dev
杨杰 3 years ago
parent 86c053cce5
commit 616d25db44
  1. 21
      pages/pay/payment/payment.vue

@ -111,9 +111,7 @@
orderToPay() {
let that = this;
if (that.paytype == 'wxpay') {
uni.showLoading({
title: '支付中...'
})
let params = {
"orderId": that.orderNo,
"openId": app.globalData.openId,
@ -122,6 +120,9 @@
orderToPay(params).then(res => {
if (res.return_code == '000000') {
// #ifdef MP
uni.showLoading({
title: '支付中...'
})
uni.requestPayment({
"appId": res.return_data.appId,
"nonceStr": res.return_data.nonceStr,
@ -198,22 +199,24 @@
}
},
payRequest: function(self) {
uni.showLoading({
title: '支付中...'
})
jweixin.config({
debug: true, // ,apialertpclogpc
// debug: false, // ,apialertpclogpc
appId: self.return_data.appId, //
timestamp: self.return_data.timeStamp, //
nonceStr: self.return_data.nonceStr, //
signature: self.return_data.sign, // 1
jsApiList: ['chooseWXPay'] // 使JSJS2
});
uni.hideLoading();
jweixin.ready(function() {
jweixin.checkJsApi({
jsApiList: ['chooseWXPay'], // JSJS2,
success: function(res) {
},
fail: function(res) {
}
});
jweixin.chooseWXPay({
@ -225,6 +228,12 @@
paySign: self.return_data.sign, //
success: function(res) {
//
uni.showToast({
title: '支付成功'
})
uni.reLaunch({
url: '../success/success?id=' + that.couponId
});
},
cancel: function(r) {
},

Loading…
Cancel
Save