From eda41d7e006f7c341306a698dfb9b62907a2f0a9 Mon Sep 17 00:00:00 2001
From: hucan <951870319@qq.com>
Date: Mon, 4 Aug 2025 09:09:17 +0800
Subject: [PATCH] =?UTF-8?q?1=E5=85=85=E5=80=BC=E5=88=B0=E8=B4=A6=E4=BF=AE?=
 =?UTF-8?q?=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
 userinfo.html | 76 ++++++++++++++++++++++++++++++++++++++++-----------
 1 file changed, 60 insertions(+), 16 deletions(-)
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()" >
                         
                           倒计时:
                           {{ props.minutes }} 分
@@ -341,7 +341,10 @@
                         
                           
                         
-                    
+                       
+                        充值成功,请勿重复支付!
+                      
+                    
 
                   
                 
 
@@ -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);
+            }
+          },
         }
       });