1.优化H5 支付

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

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

Loading…
Cancel
Save