Browse Source

说明:界面显示优化、能耗折线图加载数据显示闪动优化。电费充值记录还需要调试,之前未有数据,还需稍加调试。

程志平 4 years ago
parent
commit
f63be7151a
3 changed files with 42 additions and 37 deletions
  1. 14 10
      pages/jiaofei/jiaofei.vue
  2. 8 2
      pages/reshui/reshui.vue
  3. 20 25
      pages/show/show.vue

+ 14 - 10
pages/jiaofei/jiaofei.vue

@@ -64,18 +64,17 @@
 		data() {
 			return {
 				index: 0,
-				roomSelect: '', //房间
+				roomSelect: '', //校区宿舍
 				remainElec: 0.00.toFixed(2), //剩余电量
 				add_class: '', //增加class属性
 				add_class1: '',
 				inputMoney: '', //手动输入增加金额
 				addMoney: 0, //选择充值金额
-				campus: '', //校区
 				sub_appid: '', //商户号
 				xiaofei_items: '', // 消费记录
 				ceshi: 'code',
-				dorm_number: '', //房间
-				compus: '',
+				dorm_number: '', //栋宿舍
+				compus: '', //校区
 				test: this.$store.state.test
 			}
 		},
@@ -84,7 +83,8 @@
 			this.$store.state.building.roomSelect = '';
 			this.$store.state.building.add_class = 0;
 			this.$store.state.building.dorm_number = '';
-
+			
+			// 获得code
 			this.getCode()
 		},
 		onShow() {
@@ -93,7 +93,8 @@
 				this.roomSelect = this.$store.state.building.roomSelect;
 				this.add_class = this.$store.state.building.add_class;
 				this.dorm_number = this.$store.state.building.dorm_number;
-
+				
+				this.add_class = 1
 				if (this.roomSelect != '') {
 					this.getDianLiang()
 				}
@@ -162,19 +163,22 @@
 
 				// console.log('获得openid', res);
 				if (res.data.mess == '返回成功') {
+					// 学号
 					this.$store.state.stu_number = res.data.info[0].stu_number
-					// 宿舍号
+					// 宿舍号
 					this.dorm_number = res.data.info[0].build + res.data.info[0].dom
 					// 校区
 					this.compus = res.data.info[0].campus
-					// 填充校区楼栋号
+					// 填充校区宿舍号 
 					this.roomSelect = this.compus + this.dorm_number.split('栋')[1]
+					// 存储选择
 					this.$store.state.building.roomSelect = this.roomSelect
+					// 样式
 					this.add_class = 1
-
+					
 					// 请求选定的月份消费记录
 					this.getDianLiang()
-
+					
 				} else if (res.data.mess == '未查询到用户信息') {
 					uni.redirectTo({
 						url: '../index/index'

+ 8 - 2
pages/reshui/reshui.vue

@@ -119,6 +119,7 @@
 			}
 		},
 		onLoad() {
+			// 获得code
 			this.getCode()
 		},
 		onShow() {
@@ -175,16 +176,21 @@
 
 				// console.log(res);
 				if (res.data.mess == '返回成功') {
+					// 学号
 					this.$store.state.stu_number = res.data.info[0].stu_number
+					// 剩余金额
 					if (res.data.info[0].balance > 0)
 						this.$store.state.reshui_amount = res.data.info[0].balance
+					// 剩余金额
 					this.amount = this.$store.state.reshui_amount
+					// 组合校区楼栋宿舍号
 					this.dorm_number = res.data.info[0].build + res.data.info[0].dom
+					// 校区
 					this.compus = res.data.info[0].campus
-
+					
 					// 请求选定的月份消费记录
 					this.request_consumption_records()
-
+					
 				} else if (res.data.mess == '未查询到用户信息') {
 					uni.redirectTo({
 						url: '../index/index'

+ 20 - 25
pages/show/show.vue

@@ -68,10 +68,10 @@
 		onLoad() {
 			// 获取学号
 			this.stu_number = this.$store.state.stu_number
-
-			this.get_xiaofeijilu()
-			
+			// 充值记录
 			this.get_chongzhijilu()
+			// 消费记录
+			this.get_xiaofeijilu()
 		},
 		methods: {
 			/**
@@ -80,14 +80,14 @@
 			 */
 			bindDateChange: function(e) {
 				this.date = e.detail.value
-				
+				// 充值记录
 				this.get_chongzhijilu()
 			},
 			/**
 			 * 获取充值记录
 			 */
 			async get_chongzhijilu() {
-				console.log(this.$store.state.stu_number);
+				// console.log(this.$store.state.stu_number);
 				const res = await this.$myRequest({
 					host: this.ceshi,
 					url: '/HotWaters/elqueyRecordEle.action',
@@ -97,19 +97,20 @@
 					},
 					data: {
 						'stu_number': this.$store.state.stu_number,
-						're_time': this.date 
+						're_time': this.date
 					}
 				})
-				
-				console.log(res);				
+
+				console.log(res);
 				if (res.data.mess == '未查到记录') {
 					uni.showToast({
-						title: '该月无充值记录',
+						title: '该月无缴费记录',
 						icon: 'success'
 					});
+				} else {
+					// 充值绑定显示到界面
+					this.list = res.data.data[0].xiaofei
 				}
-				
-				// this.list = this.all_data.data[0].xiaofei
 			},
 			async get_xiaofeijilu() {
 				const res = await this.$myRequest({
@@ -124,28 +125,22 @@
 					}
 				})
 
-				console.log(res);
-				let tmparr_date_time = []
-				let tmparr_use_elec = []
-				for (var i = 0; i < res.data.date_time.length; i++) {
-					tmparr_date_time.push(res.data.date_time[i])
-				}
-				for (var i = 0; i < res.data.use_elc.length; i++) {
-					tmparr_use_elec.push(res.data.use_elc[i])
-				}
-				
+				// console.log(res);
 				let chrt_data = {
 					categories: [],
 					series: [{
 						data: [],
 					}],
 				}
-				chrt_data.categories = tmparr_date_time
-				chrt_data.series[0].data = tmparr_use_elec
-				console.log(chrt_data);
+				for (var i = 0; i < res.data.date_time.length; i++) {
+					chrt_data.categories.push(res.data.date_time[i])
+					chrt_data.series[0].data.push(res.data.use_elc[i])
+				}
+
+				// console.log(chrt_data);
 				setTimeout(() => {
 					this.chartData = chrt_data;
-				}, 30)
+				}, 1000)
 			}
 		}
 	}