|
@@ -557,19 +557,21 @@
|
|
|
if(res.status == 200){
|
|
|
res.data.detailList = []
|
|
|
this.$store.state.vuex_tempOrderData = res.data
|
|
|
- // 打开确认付款弹框,这里判断是否开通支付,如果开通
|
|
|
+ // 这里判断是否开通支付,如果开通打开确认付款弹框
|
|
|
if(this.hasPay){
|
|
|
purchasePay({
|
|
|
bizSn:res.data.purchaseSn,
|
|
|
bizNo:res.data.purchaseNo,
|
|
|
bizType:'PURCHASE',
|
|
|
+ payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid')
|
|
|
}).then(res=>{
|
|
|
this.showPay = true
|
|
|
this.payData = res.data
|
|
|
+ this.$store.state.vuex_tempOrderData.billStatus = 'WAIT_PAY'
|
|
|
uni.hideLoading()
|
|
|
})
|
|
|
}else{
|
|
|
- // 创建成功,跳转到订单详情页
|
|
|
+ // 未开通支付,创建成功,跳转到订单详情页
|
|
|
this.showPopu = false
|
|
|
this.submitOk = true
|
|
|
uni.hideLoading()
|
|
@@ -587,8 +589,8 @@
|
|
|
beforeClosePopu(){
|
|
|
console.log(this.showPay,this.submitOk,this.cacelOk)
|
|
|
// 正在支付
|
|
|
- if(this.cacelOk&&!this.submitOk){
|
|
|
- this.cacelOk = false
|
|
|
+ if(this.showPay&&!this.submitOk&&!this.cacelOk){
|
|
|
+ this.showPay = false
|
|
|
this.cancelPay()
|
|
|
}
|
|
|
},
|
|
@@ -634,33 +636,34 @@
|
|
|
// 确认付款
|
|
|
confirmPay(){
|
|
|
const _this = this
|
|
|
- // uni.showLoading({
|
|
|
- // title: '正在支付...',
|
|
|
- // mask: true
|
|
|
- // })
|
|
|
// 确认付款
|
|
|
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)
|
|
|
- }
|
|
|
- });
|
|
|
+ if(data){
|
|
|
+ uni.requestPayment({
|
|
|
+ provider: 'wxpay',
|
|
|
+ timeStamp: data.timeStamp,
|
|
|
+ nonceStr: data.nonceStr,
|
|
|
+ package: data.packageValue,
|
|
|
+ signType: data.signType,
|
|
|
+ paySign: data.paySign,
|
|
|
+ success: (res) =>{
|
|
|
+ _this.payComplete(1,data)
|
|
|
+ _this.$store.state.vuex_tempOrderData.billStatus = 'WAIT_AUDIT'
|
|
|
+ },
|
|
|
+ fail: (err)=> {
|
|
|
+ console.log('fail:',err);
|
|
|
+ _this.payComplete(err.errMsg.indexOf("cancel")>=0 ? 2 : 0,data)
|
|
|
+ _this.$store.state.vuex_tempOrderData.billStatus = 'WAIT_PAY'
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }else{
|
|
|
+ _this.payComplete(0,data)
|
|
|
+ }
|
|
|
},
|
|
|
payComplete(type,data){
|
|
|
uni.showToast({
|
|
|
mask: true,
|
|
|
- title: data==1 ? '支付成功' : (type==2?'支付取消':'支付失败'),
|
|
|
+ title: type==1 ? '支付成功' : (type==2?'支付取消':'支付失败'),
|
|
|
icon: 'none'
|
|
|
})
|
|
|
this.showPopu = false
|