|
@@ -585,9 +585,10 @@
|
|
},
|
|
},
|
|
// 关闭之前
|
|
// 关闭之前
|
|
beforeClosePopu(){
|
|
beforeClosePopu(){
|
|
|
|
+ console.log(this.showPay,this.submitOk,this.cacelOk)
|
|
// 正在支付
|
|
// 正在支付
|
|
- if(this.showPay&&!this.submitOk){
|
|
|
|
- this.showPay = false
|
|
|
|
|
|
+ if(this.cacelOk&&!this.submitOk){
|
|
|
|
+ this.cacelOk = false
|
|
this.cancelPay()
|
|
this.cancelPay()
|
|
}
|
|
}
|
|
},
|
|
},
|
|
@@ -639,13 +640,31 @@
|
|
// })
|
|
// })
|
|
// 确认付款
|
|
// 确认付款
|
|
const data = _this.payData
|
|
const data = _this.payData
|
|
|
|
+ uni.requestPayment({
|
|
|
|
+ provider: 'wxpay',
|
|
|
|
+ timeStamp: data.timeStamp,
|
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
|
+ package: data.packageValue,
|
|
|
|
+ signType: data.signType,
|
|
|
|
+ paySign: data.paySign,
|
|
|
|
+ success: (res) =>{
|
|
|
|
+ console.log('success:', res);
|
|
|
|
+ _this.payComplete(1,data)
|
|
|
|
+ },
|
|
|
|
+ fail: (err)=> {
|
|
|
|
+ console.log('fail:',err);
|
|
|
|
+ _this.payComplete(err.errMsg.indexOf("cancel")>=0 ? 2 : 0,data)
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ payComplete(type,data){
|
|
uni.showToast({
|
|
uni.showToast({
|
|
mask: true,
|
|
mask: true,
|
|
- title: data ? '支付成功' : '支付失败',
|
|
|
|
|
|
+ title: data==1 ? '支付成功' : (type==2?'支付取消':'支付失败'),
|
|
icon: 'none'
|
|
icon: 'none'
|
|
})
|
|
})
|
|
- _this.showPopu = false
|
|
|
|
- _this.submitOk = true
|
|
|
|
|
|
+ this.showPopu = false
|
|
|
|
+ this.submitOk = true
|
|
},
|
|
},
|
|
// 确认取消付款弹框
|
|
// 确认取消付款弹框
|
|
cancelPay(){
|
|
cancelPay(){
|
|
@@ -657,16 +676,20 @@
|
|
cancelText: '取消支付',
|
|
cancelText: '取消支付',
|
|
success(ret) {
|
|
success(ret) {
|
|
// 确定取消,跳转到订单详情页
|
|
// 确定取消,跳转到订单详情页
|
|
- if(!ret.confirm){
|
|
|
|
|
|
+ if(ret.cancel){
|
|
// 支付弹框打开中
|
|
// 支付弹框打开中
|
|
if(_this.showPopu){
|
|
if(_this.showPopu){
|
|
|
|
+ console.log(0)
|
|
_this.showPopu = false
|
|
_this.showPopu = false
|
|
_this.cacelOk = true
|
|
_this.cacelOk = true
|
|
}else{
|
|
}else{
|
|
|
|
+ console.log(1)
|
|
// 未打开直接跳转
|
|
// 未打开直接跳转
|
|
_this.toOrderDetial()
|
|
_this.toOrderDetial()
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ }
|
|
|
|
+ if(ret.confirm){
|
|
|
|
+ console.log(2)
|
|
// 继续支付
|
|
// 继续支付
|
|
_this.showPopu = true
|
|
_this.showPopu = true
|
|
_this.showPay = true
|
|
_this.showPay = true
|