1充值到账修改
This commit is contained in:
		| @ -330,9 +330,9 @@ | ||||
|                     <p>主链:<strong>{{ rechargeData.blockChain }}</strong></p> | ||||
|                     <p>钱包地址: <strong>{{ rechargeData.receiveAddress }}</strong></p> | ||||
|                     <p>支付金额: <strong>{{ rechargeData.amount }} USDT</strong></p> | ||||
|                     <p> | ||||
|                     <div> | ||||
|                       <countdown  :time="(rechargeData.expireUnix * 1000) - Date.now()" | ||||
|                         v-if="rechargeData.expireUnix && (rechargeData.expireUnix * 1000) > Date.now()" > | ||||
|                         v-if="rechargeData.status!==2&& rechargeData.expireUnix && (rechargeData.expireUnix * 1000) > Date.now()" > | ||||
|                         <template slot-scope="props"> | ||||
|                           倒计时: | ||||
|                           <span v-if="props.minutes>0||props.hours>0||props.days>0">{{ props.minutes }} 分</span> | ||||
| @ -341,7 +341,10 @@ | ||||
|                         </template> | ||||
|                            | ||||
|                         </countdown> | ||||
|                     </p> | ||||
|                        <div v-else-if="rechargeData.status===2" style="color: green"> | ||||
|                         充值成功,请勿重复支付! | ||||
|                       </div> | ||||
|                     </div> | ||||
|                   </div> | ||||
|                 </div> | ||||
|  | ||||
| @ -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); | ||||
|             } | ||||
|           }, | ||||
|         } | ||||
|       }); | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user