lhl 2 gadi atpakaļ
vecāks
revīzija
3267ac440a
2 mainītis faili ar 37 papildinājumiem un 24 dzēšanām
  1. 21 10
      src/views/user/rechangeList.vue
  2. 16 14
      src/views/user/setUserinfo.vue

+ 21 - 10
src/views/user/rechangeList.vue

@@ -54,7 +54,7 @@
 			</div>
 		</el-dialog>
 		<!-- 修改地址对话框 -->
-		<el-dialog title="充值" :visible.sync="dialogTableVisible" width="500px">
+		<el-dialog title="充值" :visible.sync="dialogTableVisible" width="500px" @close="closeCz">
 			<div class="biaoti">
 				温馨提示
 			</div>
@@ -162,18 +162,29 @@
 		methods: {
 			...mapMutations(['setBaseInfo', 'setUserInfo']),
 			showTime,
+			closeCz() {
+				clearInterval(this.timer)
+				this.dialogTableVisible = false
+				this.form = {
+					recharge_num: ''
+				}
+			},
 			getInfo() {
-				getrecharge(this.form).then(res => {
+				let that = this
+				clearInterval(that.timer)
+				that.time = {}
+				that.timer = null
+				getrecharge(that.form).then(res => {
 					console.log(res);
-					this.czVisible = false
-					this.dialogTableVisible = true
-					this.form = res.data
-					this.qrCodeText = res.data.address
-					if(this.timer) {
-						clearInterval(this.timer)
+					that.czVisible = false
+					that.dialogTableVisible = true
+					that.form = res.data
+					that.qrCodeText = res.data.address
+					if(that.timer) {
+						clearInterval(that.timer)
 					}
-					this.timer = setInterval(()=>{
-						this.time = timeComputed(res.data.endtime*1000)
+					that.timer = setInterval(()=>{
+						that.time = timeComputed(res.data.endtime*1000)
 					},1000)
 					
 				})

+ 16 - 14
src/views/user/setUserinfo.vue

@@ -109,7 +109,7 @@
 				<el-button type="primary" @click="getInfo">确 定</el-button>
 			</div>
 		</el-dialog>
-		<el-dialog title="充值" :visible.sync="cztVisible" width="500px">
+		<el-dialog title="充值" :visible.sync="cztVisible" width="500px" @close="closeCz()">
 			<div class="biaoti">
 				温馨提示
 			</div>
@@ -448,19 +448,21 @@
 			showTime,
 			...mapMutations(['setUserInfo', 'setBaseInfo']),
 			getInfo() {
-				this.timer = null
-				this.time = {}
-				getrecharge(this.czForm).then(res => {
+				let that = this
+				clearInterval(that.timer)
+				that.timer = null
+				that.time = {}
+				getrecharge(that.czForm).then(res => {
 					console.log(res);
-					this.czVisible = false
-					this.cztVisible = true
-					this.czForm = res.data
-					this.qrCodeText = res.data.address
-					if (this.timer) {
-						clearInterval(this.timer)
+					that.czVisible = false
+					that.cztVisible = true
+					that.czForm = res.data
+					that.qrCodeText = res.data.address
+					if (that.timer) {
+						clearInterval(that.timer)
 					}
-					this.timer = setInterval(() => {
-						this.time = timeComputed(res.data.endtime * 1000)
+					that.timer = setInterval(() => {
+						that.time = timeComputed(res.data.endtime * 1000)
 					}, 1000)
 
 				})
@@ -663,10 +665,10 @@
 			},
 			//关闭充值
 			closeCz() {
-				this.czVisible = false
+				this.cztVisible = false
+				clearInterval(this.timer)
 				this.czForm = {
 					recharge_num: '',
-					image: ''
 				}
 			},
 			// 充值提交