Browse Source

修复重复记录的bug

程志平 3 years ago
parent
commit
91775d9eed
2 changed files with 45 additions and 19 deletions
  1. 34 17
      pages/reshui/reshui.vue
  2. 11 2
      pagesAir/accountBalance/accountBalance.vue

+ 34 - 17
pages/reshui/reshui.vue

@@ -47,10 +47,10 @@
 			<view class="start_up_process">
 			<view class="start_up_process">
 				<uni-steps :options="list1" :active-color="colorPrimary" :active="active" />
 				<uni-steps :options="list1" :active-color="colorPrimary" :active="active" />
 			</view>
 			</view>
-			<view class="ad">
+			<!-- <view class="ad">
 				<image src="../../static/images/ad_reshui.jpg" mode="aspectFill" class="ad_img" @tap="ad_redirect">
 				<image src="../../static/images/ad_reshui.jpg" mode="aspectFill" class="ad_img" @tap="ad_redirect">
 				</image>
 				</image>
-			</view>
+			</view> -->
 			<view class="title">
 			<view class="title">
 				消费记录
 				消费记录
 			</view>
 			</view>
@@ -518,35 +518,49 @@
 							}
 							}
 						})
 						})
 					} else {
 					} else {
+						setTimeout(() => {
+							this.isChecked = false
+						}, 200)
+						
 						uni.showToast({
 						uni.showToast({
 							icon: 'none',
 							icon: 'none',
 							title: '先【扫码连接】,后【开启设备】',
 							title: '先【扫码连接】,后【开启设备】',
 							duration: 1500
 							duration: 1500
 						})
 						})
-
+					}
+				} else {
+					if (!(this.deviceId && this.serviceId)) {
+						uni.showToast({
+							icon: 'none',
+							title: '与设备连接中断!请在设备上手动停止即可!',
+							duration: 3000
+						})
+					
 						setTimeout(() => {
 						setTimeout(() => {
-							this.isChecked = false
+							this.setInit()
 						}, 300)
 						}, 300)
+						
+						return
 					}
 					}
-				} else {
+					
 					uni.showModal({
 					uni.showModal({
 						title: '提示',
 						title: '提示',
 						content: '确定要关闭设备?',
 						content: '确定要关闭设备?',
 						success: (res) => {
 						success: (res) => {
 							if (res.confirm) {
 							if (res.confirm) {
-								this.isChecked = false
-
 								if (this.deviceId && this.serviceId) {
 								if (this.deviceId && this.serviceId) {
+									this.isChecked = false
 									this.send('stop')
 									this.send('stop')
 								} else {
 								} else {
 									uni.showToast({
 									uni.showToast({
 										icon: 'none',
 										icon: 'none',
 										title: '与设备连接中断!请在设备上手动停止即可!',
 										title: '与设备连接中断!请在设备上手动停止即可!',
-										duration: 5000
+										duration: 3000
 									})
 									})
 
 
 									setTimeout(() => {
 									setTimeout(() => {
-										this.isChecked = true
+										// this.isChecked = true;
+										this.setInit()
 									}, 300)
 									}, 300)
 								}
 								}
 							} else if (res.cancel) {
 							} else if (res.cancel) {
@@ -1274,8 +1288,8 @@
 
 
 					this.get_Bluetooth_Bevice = false
 					this.get_Bluetooth_Bevice = false
 					this.rooms = [] // 宿舍号,蓝牙连接具有时效性,断开连接后清空
 					this.rooms = [] // 宿舍号,蓝牙连接具有时效性,断开连接后清空
-					// this.start_code = ''
-				})
+					this.start_code = ''
+				}, 200)
 			},
 			},
 
 
 			/**
 			/**
@@ -1338,20 +1352,21 @@
 						// console.log(res)
 						// console.log(res)
 						if (val == 'start') {
 						if (val == 'start') {
 							setTimeout(() => {
 							setTimeout(() => {
-								this.isChecked = true
-								this.isConnected = true
+								this.isChecked = true;
+								this.isConnected = true;
+								this.byte35 = '';
 							}, 300)
 							}, 300)
 
 
 							this.process_control(3)
 							this.process_control(3)
 						} else if (val == 'stop') {
 						} else if (val == 'stop') {
 							setTimeout(() => {
 							setTimeout(() => {
-								this.isChecked = false
+								this.isChecked = false;
 							}, 300)
 							}, 300)
 						}
 						}
 					},
 					},
 					fail: (err) => {
 					fail: (err) => {
 						// console.log(err)
 						// console.log(err)
-						if (err.errCode == 10006) {
+						if (err.errCode !== 0) {
 							setTimeout(() => {
 							setTimeout(() => {
 								this.setInit()
 								this.setInit()
 							}, 300)
 							}, 300)
@@ -1359,12 +1374,14 @@
 							if (this.isConnected) {
 							if (this.isConnected) {
 								uni.showToast({
 								uni.showToast({
 									title: '设备连接已断开!请在水表上手动停止!',
 									title: '设备连接已断开!请在水表上手动停止!',
-									icon: 'none'
+									icon: 'none',
+									duration: 5000
 								})
 								})
 							} else {
 							} else {
 								uni.showToast({
 								uni.showToast({
 									title: '设备连接失败!请重试扫描连接!',
 									title: '设备连接失败!请重试扫描连接!',
-									icon: 'none'
+									icon: 'none',
+									duration: 5000
 								})
 								})
 							}
 							}
 						}
 						}

+ 11 - 2
pagesAir/accountBalance/accountBalance.vue

@@ -32,7 +32,7 @@
 		</view>
 		</view>
 		<view class=" line"></view>
 		<view class=" line"></view>
 		<input class="input-balance" type="text" v-model="amount" @input="onInput" @blur="onBlur"
 		<input class="input-balance" type="text" v-model="amount" @input="onInput" @blur="onBlur"
-			placeholder="请输入充值金额,金额大于10" placeholder-class="pc" />
+			placeholder="请输入充值金额,金额大于10" placeholder-class="pc" maxlength="4" />
 		<view class="line"></view>
 		<view class="line"></view>
 		<view class="btn-pay">
 		<view class="btn-pay">
 			<button class="btn" url="/pagesAir/rechargeRecord/rechargeRecord" @tap="btn_click">
 			<button class="btn" url="/pagesAir/rechargeRecord/rechargeRecord" @tap="btn_click">
@@ -162,7 +162,7 @@
 				if (param_code == '' || this.amount == '' || this.id_card == '') {
 				if (param_code == '' || this.amount == '' || this.id_card == '') {
 					uni.showToast({
 					uni.showToast({
 						icon: 'none',
 						icon: 'none',
-						title: 'code、充值金额或身份证号为空',
+						title: 'code、充值金额  身份证号为空',
 						duration: 3000
 						duration: 3000
 					});
 					});
 					return
 					return
@@ -190,6 +190,15 @@
 						duration: 3000
 						duration: 3000
 					});
 					});
 				} else {
 				} else {
+					if (res.data.code === 205) {
+						uni.showToast({
+							title: '服务器返回:' + res.data.message,
+							icon: 'none',
+							duration: 3000
+						});
+						
+						return
+					}
 					// 调起微信支付
 					// 调起微信支付
 					wx.requestPayment({
 					wx.requestPayment({
 						timeStamp: res.data.timeStamp,
 						timeStamp: res.data.timeStamp,