Browse Source

水电页面偶尔宿舍为空问题

soft5566 3 years ago
parent
commit
9b25175bab

+ 6 - 6
pages.json

@@ -37,23 +37,23 @@
 	"subPackages": [{
 			"root": "pagesElectric",
 			"pages": [{
-					"path": "dfxq/dfxq",
+					"path": "jiaofei/jiaofei",
 					"style": {
-						"navigationBarTitleText": "电费详情",
+						"navigationBarTitleText": "水电充值",
 						"enablePullDownRefresh": false
 					}
 				},
 				{
-					"path": "sfxq/sfxq",
+					"path": "dfxq/dfxq",
 					"style": {
-						"navigationBarTitleText": "费详情",
+						"navigationBarTitleText": "费详情",
 						"enablePullDownRefresh": false
 					}
 				},
 				{
-					"path": "jiaofei/jiaofei",
+					"path": "sfxq/sfxq",
 					"style": {
-						"navigationBarTitleText": "水电充值",
+						"navigationBarTitleText": "水费详情",
 						"enablePullDownRefresh": false
 					}
 				},

+ 4 - 4
pagesAir/shareAir/shareAir.vue

@@ -176,10 +176,10 @@
 				console.log('读取空调相关信息:' + e.message);
 			}
 
-			_this._freshing = false;
-			setTimeout(() => {
-				_this.triggered = true;
-			}, 500);
+			// _this._freshing = false;
+			// setTimeout(() => {
+			// 	_this.triggered = true;
+			// }, 500);
 		},
 		onShow() {
 			var _this = this;

+ 14 - 19
pagesElectric/dfxq/dfxq.vue

@@ -4,8 +4,7 @@
 		<view class="same-month">
 			<view class="title">
 				<view class="vertical-line"></view>
-				<view class="title-txt"><text class="caption">当月详情</text><text
-						class="hah">/</text>时间更新到{{sameMonthData.dataTime}}</view>
+				<view class="title-txt"><text class="caption">当月详情</text><text class="hah">/</text>时间更新到{{sameMonthData.dataTime}}</view>
 			</view>
 			<view class="content-details">
 				<view class="item">
@@ -76,17 +75,13 @@
 				dom: ''
 			}
 		},
-		onLoad() {
+		onLoad(options) {
 			try {
-				const eventChannel = this.getOpenerEventChannel();
-				// 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
-				let _this = this;
-				eventChannel.on('params', function(data) {
-					// console.log(data)
-					// 获取学号
-					_this.stu_number = data.data.card_number
-					_this.roomSelect = data.data.roomSelect
-				})
+				// console.log(options);
+				this.stu_number = options.card_number;
+				this.roomSelect = options.roomSelect;
+				// this.stu_number = this.$store.state.userInfo.card_number
+				// this.roomSelect = this.$store.state.building.roomSelect
 
 				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
 						.roomSelect) == 'undefined') {
@@ -123,10 +118,10 @@
 					uni.showToast({
 						title: '宿舍号为空',
 						icon: 'success'
-					})
+					});
 				}
 			} catch (e) {
-				console.log(e.message)
+				console.log(e.message);
 			}
 		},
 		methods: {
@@ -134,7 +129,9 @@
 			 * 判断是否选择了宿舍号
 			 */
 			haveSelectRoom() {
-				if (this.roomSelect != '' && typeof(this.roomSelect) != 'undefined') {
+				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
+					return true
+				} else {
 					// 当月详情
 					try {
 						this.get_sameMonthDetails()
@@ -151,8 +148,6 @@
 							title: '每月账单异常'
 						})
 					}
-				} else {
-					return true
 				}
 			},
 			/**
@@ -176,7 +171,7 @@
 					if (res.data.data.length == 0) {
 						return
 					}
-					
+
 					let zongEnd = res.data.data[0].zongEnd
 					let zongMoney = res.data.data[0].zongMoney
 					let zongPower = res.data.data[0].zongPower
@@ -370,4 +365,4 @@
 			}
 		}
 	}
-</style>
+</style>

+ 62 - 59
pagesElectric/jiaofei/jiaofei.vue

@@ -36,34 +36,28 @@
 			</view>
 			<view class="add-money-list">
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="10" @tap="add_money"
-						:class="{selStyle:amount == 10}">10元</button>
+					<button class="select-submit" :data-item="10" @tap="add_money" :class="{selStyle:amount == 10}">10元</button>
 				</view>
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="20" @tap="add_money"
-						:class="{selStyle:amount == 20}">20元</button>
+					<button class="select-submit" :data-item="20" @tap="add_money" :class="{selStyle:amount == 20}">20元</button>
 				</view>
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="30" @tap="add_money"
-						:class="{selStyle:amount == 30}">30元</button>
+					<button class="select-submit" :data-item="30" @tap="add_money" :class="{selStyle:amount == 30}">30元</button>
 				</view>
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="50" @tap="add_money"
-						:class="{selStyle:amount == 50}">50元</button>
+					<button class="select-submit" :data-item="50" @tap="add_money" :class="{selStyle:amount == 50}">50元</button>
 				</view>
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="100" @tap="add_money"
-						:class="{selStyle:amount == 100}">100元</button>
+					<button class="select-submit" :data-item="100" @tap="add_money" :class="{selStyle:amount == 100}">100元</button>
 				</view>
 				<view class="add-money-button">
-					<button class="select-submit" :data-item="200" @tap="add_money"
-						:class="{selStyle:amount == 200}">200元</button>
+					<button class="select-submit" :data-item="200" @tap="add_money" :class="{selStyle:amount == 200}">200元</button>
 				</view>
 			</view>
 		</view>
 		<view class="show-item jine">
-			<input type="number" class="input-money" maxlength="4" placeholder="请输入金额(10-200)"
-				placeholder-class="input-ph-color" v-model:value="amount" @input="onInput" @blur="onBlur" />
+			<input type="number" class="input-money" maxlength="4" placeholder="请输入金额(10-200)" placeholder-class="input-ph-color" v-model:value="amount"
+				@input="onInput" @blur="onBlur" />
 		</view>
 		<view class="submit-item" v-if="true">
 			<button class="submit" :data-rooms='room' @tap="input_money">充值</button>
@@ -97,23 +91,22 @@
 		},
 		onLoad(options) {
 			// console.log(options);
-			// if (typeof(options.from) != 'undefined' && options.from == 2) {
-			// 	uni.navigateTo({
-			// 		url: '../../pages/index/index?from=' + options.from
-			// 	})
-			// 	return
-			// }
+			if (typeof(options.from) != 'undefined' && options.from == 2) {
+				uni.navigateTo({
+					url: '../../pages/index/index?from=' + options.from
+				});
+				return;
+			}
 			// 系统正在维护...
 			if (this.test == 'weihuzhong') {
 				uni.redirectTo({
 					url: '../../pages/index/index'
-				})
-
+				});
 				return;
 			}
 			// 测试环境
 			if (this.test) {
-				this.amount = 0.01
+				this.amount = 0.01;
 			}
 			// 获取基本信息
 			this.get_base_info(options, 'onLoad');
@@ -129,16 +122,16 @@
 				this.add_class = this.$store.state.building.add_class;
 				this.dorm_number = this.$store.state.building.dorm_number;
 
-				this.add_class = 1
+				this.add_class = 1;
 				if (this.roomSelect && typeof(this.roomSelect) != 'undefined') {
-					this.getDianLiang()
+					this.getDianLiang();
 				}
 
 				// 初始化参数
 				this.$store.state.building.add_class = 0;
 
 				// 获取code
-				this.getCode('options', 'onShow')
+				this.getCode('options', 'onShow');
 			}
 		},
 		methods: {
@@ -170,7 +163,7 @@
 				if (typeof res.data.data == 'undefined' || res.data.data.length == 0) {
 					return
 				}
-				
+
 				if (res.data.code == 200) {
 					let tf = false;
 					let tmpData = res.data.data;
@@ -202,42 +195,43 @@
 			 */
 			dfxq_click() {
 				if (this.haveSelectRoom()) {
-					return
+					return;
 				}
-				
-				let _this = this;				
-				uni.navigateTo({
-					url: '../dfxq/dfxq',
-					success: function(res) {
-						res.eventChannel.emit('params', {
-							data: {
-								roomSelect: _this.roomSelect,
-								card_number: _this.stu_number
-							}
-						})
-					}
-				})
+
+				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
+					uni.showToast({
+						title: '请再次选择宿舍号',
+						icon: 'success'
+					})
+				} else {
+					uni.navigateTo({
+						url: '../dfxq/dfxq?rooSelect=' + this.roomSelect + '&card_number=' + this.stu_number,
+						success: function(res) {
+						}
+					});
+				}
+
 			},
 			/**
 			 * 水费详情页面
 			 */
 			sfxq_click() {
 				if (this.haveSelectRoom()) {
-					return
+					return;
 				}
 
-				let _this = this;
-				uni.navigateTo({
-					url: '../sfxq/sfxq',
-					success: function(res) {
-						res.eventChannel.emit('params', {
-							data: {
-								roomSelect: _this.roomSelect,
-								card_number: _this.stu_number
-							}
-						})
-					}
-				})
+				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
+					uni.showToast({
+						title: '请再次选择宿舍号',
+						icon: 'success'
+					})
+				} else {
+					uni.navigateTo({
+						url: '../sfxq/sfxq?rooSelect=' + this.roomSelect + '&card_number=' + this.stu_number,
+						success: function(res) {
+						}
+					});
+				}
 			},
 			/**
 			 * 跳转到ad页面
@@ -376,7 +370,7 @@
 						}
 					}
 
-					if (!this.roomSelect || this.roomSelect == '' || typeof(this.roomSelect) == 'undefined') {
+					if (this.roomSelect == '' || typeof this.roomSelect == 'undefined' || !this.roomSelect) {
 						const userinfo = uni.getStorageSync('userinfo_storage_key')
 						if (userinfo && typeof(userinfo) != 'undefined' && typeof(userinfo.campus) != 'undefined' &&
 							typeof(userinfo.dorm_number) != 'undefined' && userinfo.campus != '' && userinfo
@@ -453,9 +447,18 @@
 					return
 				}
 
-				uni.navigateTo({
-					url: '../show/show',
-				});
+				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
+					uni.showToast({
+						title: '请再次选择宿舍号',
+						icon: 'success'
+					})
+				} else {
+					uni.navigateTo({
+						url: '../show/show?rooSelect=' + this.roomSelect + '&card_number=' + this.stu_number,
+						success: function(res) {
+						}
+					});
+				}
 			},
 
 			/**
@@ -650,4 +653,4 @@
 
 <style>
 	@import url("jiaofei.css");
-</style>
+</style>

+ 10 - 13
pagesElectric/sfxq/sfxq.vue

@@ -75,17 +75,13 @@
 				dom: ''
 			}
 		},
-		onLoad() {
+		onLoad(options) {
 			try {
-				// const eventChannel = this.getOpenerEventChannel();
-				// // 监听acceptDataFromOpenerPage事件,获取上一页面通过eventChannel传送到当前页面的数据
-				// let _this = this;
-				// eventChannel.on('params', function(data) {
-				// 	console.log('eventChannel', data);
-				// 	// 获取学号
-				// 	_this.stu_number = data.data.card_number;
-				// 	_this.roomSelect = data.data.roomSelect;
-				// });
+				// console.log(options);
+				this.stu_number = options.card_number;
+				this.roomSelect = options.roomSelect;
+				// this.stu_number = this.$store.state.userInfo.card_number
+				// this.roomSelect = this.$store.state.building.roomSelect
 
 				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this.roomSelect) == 'undefined') {
 					// 获取学号
@@ -130,7 +126,7 @@
 			 * 判断是否选择了宿舍号
 			 */
 			haveSelectRoom() {
-				if (this.roomSelect == '' || typeof(this.roomSelect) == 'undefined') {
+				if (this.roomSelect == '' || typeof this.roomSelect == 'undefined') {
 					return true
 				} else {
 					// 当月详情
@@ -188,7 +184,7 @@
 					this.sameMonthData.zongStart = zongStart.toFixed(2)
 				} else {
 					uni.showToast({
-						title: '加载数据异常',
+						title: '月详情加载异常',
 						duration: 1500
 					})
 
@@ -224,7 +220,7 @@
 
 				if (typeof res.data.rows === 'undefined') {
 					uni.showToast({
-						title: '加载数据异常',
+						title: '月账单加载异常',
 						duration: 1500
 					});
 
@@ -263,6 +259,7 @@
 							totalMoney
 						});
 					}
+					
 					this.tableData = tableData.filter(function(item, index, self) {
 						return index === self.findIndex(function(t) {
 							return t.dataTime === item.dataTime && t.totalPower === item.totalPower && t.totalMoney === item.totalMoney;

+ 22 - 20
pagesElectric/show/show.vue

@@ -101,14 +101,16 @@
 				changeDate: false // 是否是手动选择日期
 			}
 		},
-		onLoad() {
+		onLoad(options) {
 			try {
+				// console.log(options);
 				// 获取学号
-				this.stu_number = this.$store.state.userInfo.card_number
-				this.roomSelect = this.$store.state.building.roomSelect
+				this.roomSelect = options.rooSelect;
+				this.stu_number = options.card_number;
+				// this.stu_number = this.$store.state.userInfo.card_number
+				// this.roomSelect = this.$store.state.building.roomSelect
 
-				if (this.stu_number == '' || this.roomSelect == '' || typeof(this.stu_number) == 'undefined' || typeof(this
-						.roomSelect) == 'undefined') {
+				if (this.stu_number == '' || this.roomSelect == '' || typeof this.stu_number == 'undefined' || typeof this.roomSelect == 'undefined') {
 					const userinfo = uni.getStorageSync('userinfo_storage_key')
 					if (userinfo) {
 						this.stu_number = userinfo.card_number
@@ -209,12 +211,13 @@
 				var reg = /[\u4e00-\u9fa5]/g;
 				var str = this.roomSelect;
 				var dom = str.replace(reg, "");
-				if (dom != '' && typeof(dom) != 'undefined') {
+				var _this = this;
+				if (dom != '' && typeof dom != 'undefined') {
 					let res = null;
 					if (dayOrMonth == 'month') {
-						this.btn = true
-						res = await this.$myRequest({
-							host: this.ceshi,
+						_this.btn = true
+						res = await _this.$myRequest({
+							host: _this.ceshi,
 							// url: '/HotWaters/elqueryDayPower.action',
 							url: '/HotWaters/elMonthlist.action',
 							method: 'POST',
@@ -270,18 +273,17 @@
 						// console.log(chrt_data);
 						if (elc_max == 0.0) {
 							setTimeout(() => {
-								this.chartOpts.yAxis.data[0].max = parseInt(10)
-								this.chartData = chrt_data;
+								_this.chartOpts.yAxis.data[0].max = parseInt(10)
+								_this.chartData = chrt_data;
 							}, 500);
 						} else {
 							setTimeout(() => {
-								this.chartOpts.yAxis.data[0].max = parseInt(m + 10)
-								this.chartData = chrt_data;
+								_this.chartOpts.yAxis.data[0].max = parseInt(m + 10)
+								_this.chartData = chrt_data;
 							}, 500);
 						}
 					} else {
-						this.btn = false
-						let _this = this
+						_this.btn = false
 						uni.showToast({
 							mask: true,
 							title: '年消费更新中…',
@@ -290,15 +292,15 @@
 							}
 						})
 						return
-						res = await this.$myRequest({
-							host: this.ceshi,
+						res = await _this.$myRequest({
+							host: _this.ceshi,
 							url: '/HotWaters/buildgetMonthBill.action',
 							method: 'POST',
 							header: {
 								'content-type': 'application/x-www-form-urlencoded'
 							},
 							data: {
-								'roomSelect': this.roomSelect
+								'roomSelect': _this.roomSelect
 							}
 						})
 
@@ -323,8 +325,8 @@
 						let m = parseFloat(Math.abs(elc_max))
 						// console.log(chrt_data);
 						setTimeout(() => {
-							this.chartOpts.yAxis.data[0].max = parseInt(m + (m / 4.0))
-							this.chartData = chrt_data;
+							_this.chartOpts.yAxis.data[0].max = parseInt(m + (m / 4.0))
+							_this.chartData = chrt_data;
 						}, 1000);
 					}
 				} else {