Bladeren bron

优化显示

程志平 3 jaren geleden
bovenliggende
commit
2f41bf539c
1 gewijzigde bestanden met toevoegingen van 46 en 25 verwijderingen
  1. 46 25
      pagesAir/shareAir/shareAir.vue

+ 46 - 25
pagesAir/shareAir/shareAir.vue

@@ -748,22 +748,30 @@
 							}
 						});
 					} else {
-						if (res.data.message == '该订单已结算,请勿重复结算') {
+						if (res.data.message.indexOf('已结算') != -1 || res.data.message.indexOf('结算成功') != -1) {
 							// 显示已经关闭图标
 							_this.airs[index].status = '状态:';
-							_this.airs[index].on = false;
 							_this.airs[index].time = '设备已结算';
+
+							setTimeout(() => {
+								uni.hideLoading();
+							}, 1000);
+						} else {
+							// "该空调开启时长超过5天,请联系管理员关闭"
+							uni.showToast({
+								icon: 'none',
+								title: res.data.message,
+								duration: 3000,
+								success() {
+									_this.airs[index].status = '状态:';
+									_this.airs[index].time = _this.time_string;
+
+									setTimeout(() => {
+										uni.hideLoading();
+									}, 1000);
+								}
+							});
 						}
-						uni.showToast({
-							icon: 'none',
-							title: res.data.message,
-							duration: 3000,
-							success() {
-								setTimeout(() => {
-									uni.hideLoading();
-								}, 1000);
-							}
-						})
 					}
 				}
 			},
@@ -783,8 +791,9 @@
 					title: '开启中...',
 					mask: true
 				});
+				var _this = this;
 				const res = await this.$myRequest({
-					host: this.ceshi,
+					host: _this.ceshi,
 					url: '/airManage/consumestart.action',
 					method: 'POST',
 					header: {
@@ -814,9 +823,8 @@
 				} else {
 					// console.log(res.data);
 					if (res.data.code == 200) {
-						let _this = this;
 						// 获取订单号
-						this.airs[index].order_num = res.data.order_num
+						_this.airs[index].order_num = res.data.order_num
 						uni.showToast({
 							title: '开启成功!',
 							duration: 2000,
@@ -831,16 +839,29 @@
 							}
 						});
 					} else {
-						uni.showToast({
-							icon: 'none',
-							title: res.data.message,
-							duration: 2000,
-							success() {
-								setTimeout(() => {
-									uni.hideLoading();
-								}, 1000);
-							}
-						})
+						// "设备已被其他人使用"
+						if (res.data.message.indexOf('已被其他人使用') != -1 || res.data.message.indexOf('请勿重复开启' != -1)) {
+							// 显示已经关闭图标
+							_this.airs[index].status = '状态:';
+							_this.airs[index].time = _this.time_string;
+
+							setTimeout(() => {
+								uni.hideLoading();
+							}, 1000);
+						} else {
+							uni.showToast({
+								icon: 'none',
+								title: res.data.message,
+								duration: 2000,
+								success() {
+									_this.airs[index].status = '状态:';
+									_this.airs[index].time = res.data.message;
+									setTimeout(() => {
+										uni.hideLoading();
+									}, 1000);
+								}
+							});
+						}
 					}
 				}
 			},