程志平 3 лет назад
Родитель
Сommit
ea1b944c11
2 измененных файлов с 13 добавлено и 10 удалено
  1. 9 5
      pages/recharge/recharge.vue
  2. 4 5
      pages/reshui/reshui.vue

+ 9 - 5
pages/recharge/recharge.vue

@@ -51,7 +51,7 @@
 				uni.redirectTo({
 					url: '../index/index'
 				})
-				
+
 				return;
 			}
 			// 测试环境
@@ -144,10 +144,14 @@
 						success: (res) => {
 							// console.log(res);
 							if (res.errMsg == 'requestPayment:ok') {
-								this.$store.state.payInfo.from = 'reshui_pay'
-								this.$store.state.payInfo.resultMsg = '支付成功'
-								this.$store.state.reshui_amount = this.amount
-								
+								this.$store.state.payInfo.from = 'reshui_pay';
+								this.$store.state.payInfo.resultMsg = '支付成功';
+								this.$store.state.reshui_amount = this.amount;
+
+								uni.$emit('update_reshui_amount', {
+									msg: '充值成功,刷新金额!'
+								});
+
 								uni.navigateBack({
 									delta: 1
 								});

+ 4 - 5
pages/reshui/reshui.vue

@@ -200,11 +200,10 @@
 			let _this = this;
 			// 充值后更新金额
 			this.amount = this.$store.state.reshui_amount
-
-			if (this.stu_number && typeof(this.stu_number) != 'undefined') {
-				// 获取基本信息
-				this.get_base_info('options', 'onShow')
-			}
+			// 刷新充值后的金额
+			uni.$once('update_reshui_amount', (data) => {
+				this.get_base_info('options', 'onShow');
+			});
 
 			if (this.timer > -1) {
 				clearInterval(this.timer)