|
|
@@ -179,7 +179,7 @@
|
|
|
this.confirmStyle.color = this.vuex_theme.bgColor;
|
|
|
},
|
|
|
onShow() {
|
|
|
- if(this.vuex_isInterval){
|
|
|
+ if(this.vuex_goodsInterval){
|
|
|
this.queryOrder();
|
|
|
}
|
|
|
uni.$on('ADDRESS',(res)=>{
|
|
|
@@ -301,8 +301,8 @@
|
|
|
// uni.navigateTo({
|
|
|
// url: `/pages/webview/payOrder?url=${res.data.data.qrCodeUrl}&orderId=${res.data.data.id}`
|
|
|
// })
|
|
|
- this.$u.vuex('vuex_orderId', res.data.data.id);
|
|
|
- this.$u.vuex('vuex_isInterval', true);
|
|
|
+ this.$u.vuex('vuex_goodsOrder', res.data.data.id);
|
|
|
+ this.$u.vuex('vuex_goodsInterval', true);
|
|
|
window.location.href = res.data.data.qrCodeUrl
|
|
|
}
|
|
|
|
|
|
@@ -314,17 +314,31 @@
|
|
|
//查询订单状态
|
|
|
queryOrder(){
|
|
|
let params = {
|
|
|
- id: this.vuex_orderId
|
|
|
+ id: this.vuex_goodsOrder
|
|
|
}
|
|
|
this.interval = setInterval(async() => {
|
|
|
let res = await this.$api.order.orderDetail(params)
|
|
|
if(res.data.success && res.data.data.payStatus === '付款成功'){
|
|
|
this.$refs.exchangeSuccess.showSuccess(this.detail.imgUrl);
|
|
|
- this.$u.vuex('vuex_isInterval', false);
|
|
|
- this.$u.vuex('vuex_orderId', 0);
|
|
|
+ this.$u.vuex('vuex_goodsInterval', false);
|
|
|
+ this.$u.vuex('vuex_goodsOrder', 0);
|
|
|
clearInterval(this.interval)
|
|
|
}
|
|
|
}, 1500)
|
|
|
+ this.countDown(); //30秒拿不到支付回调抛出异常处理
|
|
|
+ },
|
|
|
+ countDown(){
|
|
|
+ let seconds = 30;
|
|
|
+ let timer = setInterval(() => {
|
|
|
+ seconds--
|
|
|
+ if (seconds == 0) {
|
|
|
+ this.$refs.toast.error('订单回调异常');
|
|
|
+ this.$u.vuex('vuex_goodsInterval', false);
|
|
|
+ this.$u.vuex('vuex_goodsOrder', 0);
|
|
|
+ clearInterval(timer)
|
|
|
+ clearInterval(this.interval) //清除支付回调接口轮询
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
},
|
|
|
cancel(){
|
|
|
this.exchangeShow = false;
|