shish 4 лет назад
Родитель
Сommit
1902377f1f
1 измененных файлов с 16 добавлено и 4 удалено
  1. 16 4
      hdPad/src/pages/home/components/toPay.vue

+ 16 - 4
hdPad/src/pages/home/components/toPay.vue

@@ -32,7 +32,8 @@ export default {
     },
     },
     data(){
     data(){
         return {
         return {
-            showSuccess:false
+            showSuccess:false,
+            T:null
         }
         }
     },
     },
 	props: {
 	props: {
@@ -53,23 +54,25 @@ export default {
         //查询付款结果
         //查询付款结果
         checkPay(){
         checkPay(){
             let that = this
             let that = this
-            uni.showLoading({title: '查询中',mask:true})
             codePayCheck({id:this.orderId}).then(res=>{
             codePayCheck({id:this.orderId}).then(res=>{
                 uni.hideLoading()
                 uni.hideLoading()
                 if(res.code == 1){
                 if(res.code == 1){
                     if(res.data.returnStatus == 'SUCCESS'){
                     if(res.data.returnStatus == 'SUCCESS'){
                         that.showSuccess = true
                         that.showSuccess = true
+                        clearInterval(that.T)
                         setTimeout(function(){
                         setTimeout(function(){
                             that.payFinish()
                             that.payFinish()
                         },1500)
                         },1500)
+                        return
                     }
                     }
+                    uni.showLoading({title: res.msg})
                 }
                 }
             })
             })
         },
         },
         //付款
         //付款
         requestCodePay(authCode){
         requestCodePay(authCode){
             let that = this
             let that = this
-            uni.showLoading({title: '正在付款',mask:true})
+            uni.showLoading({title: '正在付款'})
             codePay({id:this.orderId,authCode:authCode}).then(res=>{
             codePay({id:this.orderId,authCode:authCode}).then(res=>{
                 uni.hideLoading()
                 uni.hideLoading()
                 if(res.code == 1){
                 if(res.code == 1){
@@ -78,7 +81,15 @@ export default {
                         setTimeout(function(){
                         setTimeout(function(){
                             that.payFinish()
                             that.payFinish()
                         },1500)
                         },1500)
+                    }else{
+                        that.T = setInterval(function(){
+                            that.checkPay()
+                        }, 1000);      
                     }
                     }
+                }else{
+                    that.T = setInterval(function(){
+                        that.checkPay()
+                    }, 1000);
                 }
                 }
             })
             })
         },
         },
@@ -87,7 +98,7 @@ export default {
         },
         },
         cancelPayFn(){
         cancelPayFn(){
             let that = this
             let that = this
-            uni.showLoading({title: '确认中',mask:true})
+            uni.showLoading({title: '确认中'})
             codePayCheck({id:this.orderId}).then(res=>{
             codePayCheck({id:this.orderId}).then(res=>{
                 uni.hideLoading()
                 uni.hideLoading()
                 if(res.code == 1){
                 if(res.code == 1){
@@ -104,6 +115,7 @@ export default {
             },1500)
             },1500)
         },
         },
         confirmToCancel(){
         confirmToCancel(){
+            clearInterval(this.T)
             this.$emit('cancelPay')
             this.$emit('cancelPay')
         }
         }
     }
     }