|
@@ -74,7 +74,8 @@ export default {
|
|
|
kwh : 0,
|
|
|
payType: 'weipay',
|
|
|
showAlipay: false,
|
|
|
- qrCodeUrl: ''
|
|
|
+ qrCodeUrl: '',
|
|
|
+ timeoutId : 0
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
@@ -89,6 +90,23 @@ export default {
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
+ queryPayResult(recordId) {
|
|
|
+ remoteApi.queryRechargeRecord(recordId).then((resp)=>{
|
|
|
+ if(resp.result && resp.data.paymentStatus=="20"){
|
|
|
+ this.$router.push({
|
|
|
+ path : '/Paystate',
|
|
|
+ query: {
|
|
|
+ payType : resp.data.buyType
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ this.timeoutId = setTimeout(()=>{
|
|
|
+ this.queryPayResult(recordId);
|
|
|
+ },3000);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
pay() {
|
|
|
var self = this
|
|
|
self.paying = true
|
|
@@ -121,9 +139,11 @@ export default {
|
|
|
});
|
|
|
}
|
|
|
else if(self.payType=='alipay') {
|
|
|
+ var recordId = "";
|
|
|
+
|
|
|
remoteApi.prepareAliPay(self.roomId,self.payType,self.kwh,self.total).then(resp=>{
|
|
|
if(resp.result){
|
|
|
- var recordId = resp.data.recordId;
|
|
|
+ recordId = resp.data.recordId;
|
|
|
return remoteApi.tradePrecreatePay(recordId);
|
|
|
}
|
|
|
else{
|
|
@@ -153,6 +173,11 @@ export default {
|
|
|
correctLevel: QRCode.CorrectLevel.H
|
|
|
})
|
|
|
})
|
|
|
+
|
|
|
+ clearTimeout(this.timeoutId);
|
|
|
+
|
|
|
+ //每隔n秒查询充值是否成功
|
|
|
+ this.queryPayResult(recordId);
|
|
|
}
|
|
|
else{
|
|
|
self.paying = false
|