ソースを参照

【修复】清楚首次进入热水界面消费记录重复。

程志平 4 年 前
コミット
943ca4c358
1 ファイル変更7 行追加6 行削除
  1. 7 6
      pages/reshui/reshui.vue

+ 7 - 6
pages/reshui/reshui.vue

@@ -197,7 +197,7 @@
 						// console.log('reshui', res);
 						// console.log('reshui', res);
 						if (res.code) {
 						if (res.code) {
 							// 请求服务器,获得openid
 							// 请求服务器,获得openid
-							this.getOpenId(options, res.code)
+							this.getOpenId(options, res.code, param)
 						} else {
 						} else {
 							uni.showToast({
 							uni.showToast({
 								title: res.errMsg,
 								title: res.errMsg,
@@ -210,7 +210,7 @@
 			/**
 			/**
 			 * 请求服务器,获得openid
 			 * 请求服务器,获得openid
 			 */
 			 */
-			async getOpenId(options, param_code) {
+			async getOpenId(options, param_code, param) {
 				const res = await this.$myRequest({
 				const res = await this.$myRequest({
 					host: this.ceshi,
 					host: this.ceshi,
 					url: '/HotWaters/wpget_stu.action',
 					url: '/HotWaters/wpget_stu.action',
@@ -239,8 +239,10 @@
 						// 校区
 						// 校区
 						// this.compus = res.data.info[0].campus
 						// this.compus = res.data.info[0].campus
 
 
-						// 请求选定的月份消费记录
-						this.request_consumption_records()
+						if (param == 'onLoad') {
+							// 请求选定的月份消费记录
+							this.request_consumption_records()
+						}
 					} else {
 					} else {
 						uni.showToast({
 						uni.showToast({
 							title: '学工号不一致!',
 							title: '学工号不一致!',
@@ -294,7 +296,6 @@
 			 */
 			 */
 			async request_consumption_records() {
 			async request_consumption_records() {
 				if (this.stu_number != '' && typeof(this.stu_number) != 'undefined') {
 				if (this.stu_number != '' && typeof(this.stu_number) != 'undefined') {
-					this.xiaofei_items = []
 					const res = await this.$myRequest({
 					const res = await this.$myRequest({
 						host: this.ceshi,
 						host: this.ceshi,
 						url: '/HotWaters/wpqueryConsume.action',
 						url: '/HotWaters/wpqueryConsume.action',
@@ -310,6 +311,7 @@
 
 
 					// console.log(res);
 					// console.log(res);
 					if (res.data.mess == '返回成功') {
 					if (res.data.mess == '返回成功') {
+						this.xiaofei_items = []
 						// 消费记录
 						// 消费记录
 						let items = res.data.data
 						let items = res.data.data
 						for (var i = 0; i < items.length; i++) {
 						for (var i = 0; i < items.length; i++) {
@@ -1089,7 +1091,6 @@
 							success: (res1) => {
 							success: (res1) => {
 								this.use_amount = res.data.use_amount.toFixed(2)
 								this.use_amount = res.data.use_amount.toFixed(2)
 								this.amount = (this.amount - this.use_amount).toFixed(2)
 								this.amount = (this.amount - this.use_amount).toFixed(2)
-
 								// 刷新选定的月份消费记录
 								// 刷新选定的月份消费记录
 								this.request_consumption_records()
 								this.request_consumption_records()
 							}
 							}