diff --git a/userinfo.html b/userinfo.html index 79e1888..49fc83d 100644 --- a/userinfo.html +++ b/userinfo.html @@ -330,9 +330,9 @@

主链:{{ rechargeData.blockChain }}

钱包地址: {{ rechargeData.receiveAddress }}

支付金额: {{ rechargeData.amount }} USDT

-

+

+ v-if="rechargeData.status!==2&& rechargeData.expireUnix && (rechargeData.expireUnix * 1000) > Date.now()" > -

+
+ 充值成功,请勿重复支付! +
+
@@ -574,12 +577,14 @@ loadingQr:false, rechargeData:{ platformId:null, + orderNo:undefined, name:null, count:1, amount:null, receiveAddress:null, step:1, - expireUnix:undefined + expireUnix:undefined, + status:undefined, }, // ECharts 图表数据 @@ -587,14 +592,14 @@ xAxisData: [], seriesData: [], receiveAddress: "", - rechargeList:[] + rechargeList:[], + checkOrderTimer: null, }; }, created() { }, mounted() { - console.log(this.$refs.myCountdown) let token = localStorage.getItem("token"); if (token) { this.token = token; @@ -691,7 +696,6 @@ }); }, getUserInfo(token) { - console.log("token", token); let that = this; axios .get("/getinfo", { @@ -700,11 +704,8 @@ }, }) .then((response) => { - console.log(response.data); - console.log("code", response.data.code); if (response.data.code === 200) { that.userInfo = response.data.data; - console.log("userinfo", that.userInfo); } else { localStorage.removeItem("token"); location.href = "login.html"; @@ -762,10 +763,12 @@ amount:null, receiveAddress:null, step:1, - expireUnix:undefined - }; + expireUnix:undefined, + status:undefined, + }; - console.log(this.rechargeData); + this.cleanCheckOrderTimer(); + }, prevStep(){ @@ -781,18 +784,20 @@ axios.post("/tm-member/recharge",this.rechargeData,{headers: { Authorization: `Bearer ${this.token}` }}) .then(res => { - console.log("sss",res); + if(res.data.code===200){ this.rechargeData.step=2; this.rechargeData.amount=res.data.data.amount; this.rechargeData.receiveAddress=res.data.data.receiveAddress; this.rechargeData.blockChain=res.data.data.blockChain; this.rechargeData.expireUnix=res.data.data.expireUnix; + this.rechargeData.orderNo=res.data.data.orderNo; let _that=this; this.$nextTick(() => { _that.generateQRCode(_that.rechargeData.receiveAddress); }) + _that.createCheckOrderTimer(); }else{ layer.msg(res.data.msg); } @@ -835,7 +840,7 @@ .then((response) => { if (response.data.code === 200) { this.userInfo = response.data.data; - console.log("userinfo", this.userInfo); + } else { location.href = "login.html"; } @@ -1068,7 +1073,46 @@ // 如果输入为空,给出提示 qrcodeContainer.innerHTML = ''; // 清空可能存在的旧二维码 } - } + }, + getOrderStatus(orderNo){ + let that=this; + let params={orderNo} + + axios + .get("/tm-member/order", { + headers: { + Authorization: `Bearer ${this.token}`, + }, + params:{orderNo} + }) + .then((response) => { + if (response.data.code === 200) { + if(that.rechargeData.orderNo===response.data.data.orderNo && response.data.data.status===2){ + that.rechargeData.status=response.data.data.status; + + that.cleanCheckOrderTimer(); + } + } else { + // location.href = "login.html"; + } + }); + }, + //定时检查订单状态 + createCheckOrderTimer() { + if (this.checkOrderTimer) { + clearInterval(this.checkOrderTimer); + } + + console.log("createCheckOrderTimer") + this.checkOrderTimer = setInterval(() => { + this.getOrderStatus(this.rechargeData.orderNo); + }, 10000); + }, + cleanCheckOrderTimer() { + if (this.checkOrderTimer) { + clearInterval(this.checkOrderTimer); + } + }, } });