From 4fb815849fb035b895a287debb12a54a3deda85f Mon Sep 17 00:00:00 2001
From: "3321822538@qq.com" <3321822538@qq.com>
Date: Thu, 6 Jun 2024 13:32:16 +0800
Subject: [PATCH] aaa

---
 page_fenbao/chongzhi.vue | 37 ++++++++++++-----------
 page_user/sbdetail.vue   | 65 +++++++++++++++++++++++++++++++++++++---
 2 files changed, 80 insertions(+), 22 deletions(-)

diff --git a/page_fenbao/chongzhi.vue b/page_fenbao/chongzhi.vue
index 6d87b05..e6f0e5e 100644
--- a/page_fenbao/chongzhi.vue
+++ b/page_fenbao/chongzhi.vue
@@ -136,14 +136,14 @@
 						icon: 'none',
 						duration:2000
 					});
-					uni.hideLoading()
+					// uni.hideLoading()
 				} else {
 					xBlufi.notifyConnectBle({
 						isStart: true,
 						deviceId: this.deviceId,
 						name: this.name
 					});
-                    uni.hideLoading()
+                    // uni.hideLoading()
 				}
 				this.status = true
 			}, 2000)
@@ -274,7 +274,7 @@
 							console.log('手机未连接网络');
 						}
 					}
-				});
+				})
 
 
 			},
@@ -342,7 +342,7 @@
 					case xBlufi.XBLUFI_TYPE.TYPE_CONNECTED:
 						console.log("连接回调:" + JSON.stringify(options));
 						if (options.result) {
-							uni.hideLoading();
+							// uni.hideLoading();
 							// uni.showToast({
 							// 	title: '连接成功',
 							// 	icon: 'none'
@@ -373,13 +373,20 @@
 									// })
 								}
 							}
+						}else{
+							uni.hideLoading()
+							uni.showToast({
+								title: '未连接到设备,请靠近设备尝试',
+								icon: 'none'
+							}); 
 						}
 
 						break;
 					case xBlufi.XBLUFI_TYPE.TYPE_RECIEVE_CUSTON_DATA:
 
 						this.ver_data = this.parseCustomData(options.data)
-						// console.log("1收到设备发来的自定义数据结果:", this.ver_data);
+						uni.hideLoading()
+						console.log("1收到设备发来的自定义数据结果:", this.ver_data);
 						break;
 					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
 						if (options.result) {
@@ -452,24 +459,20 @@
 					// 重新搜索
 					// this.startBluetoothDevicesDiscovery()
 					this.statusflag = true
-					this.status = false
 					this.texts = '正在扫描蓝牙设备...'
 					setTimeout(() => {
 						this.statusflag = false
-						this.status = true
 						if (this.searching) {
 							xBlufi.notifyStartDiscoverBle({
 								'isStart': false
 							});
-							// 判断是否存在浇花器设备
-							// if (this.devicesList.length == 0) {
-							// 	uni.showToast({
-							// 		title: '暂无发现对应设备,请靠近设备',
-							// 		icon: 'none'
-							// 	});
-							// } else {
-							// 	this.texts = '扫描到以下设备,请点击连接!'
-							// }
+							// 判断是否存在设备
+							if (this.devicesList.length == 0) {
+								this.tishiflag = true
+								this.texts = '扫描完毕,暂无发现设备'
+							} else {
+								this.texts = '扫描到以下设备,请点击连接!'
+							}
 						} else {
 							xBlufi.notifyStartDiscoverBle({
 								'isStart': true
@@ -477,8 +480,6 @@
 						}
 					}, 2000)
 				}
-
-
 			},
 			
 			// 点击隐藏没有设备提示
diff --git a/page_user/sbdetail.vue b/page_user/sbdetail.vue
index 9e156dd..1bfd195 100644
--- a/page_user/sbdetail.vue
+++ b/page_user/sbdetail.vue
@@ -383,9 +383,7 @@
 						let expireTimeParts = expireTimeStr.split(" ");
 						let expireDateParts = expireTimeParts[0].split("-");
 						let expireTimePartsTime = expireTimeParts[1].split(":");
-						let expireDate = new Date(expireDateParts[0], expireDateParts[1] - 1, expireDateParts[2],
-							expireTimePartsTime[0], expireTimePartsTime[1], expireTimePartsTime[2]
-						); // 注意月份是从0开始的,所以要减1  
+						let expireDate = new Date(expireDateParts[0], expireDateParts[1] - 1, expireDateParts[2],expireTimePartsTime[0], expireTimePartsTime[1], expireTimePartsTime[2])
 						let now = new Date();
 						let differenceInMs = expireDate - now;
 						if (differenceInMs <= 0) {
@@ -471,6 +469,37 @@
 								icon: 'none',
 								duration: 2000
 							})
+							// uni.showLoading({
+							// 	title: '充值中...'
+							// })
+							// let vm = this; // 将外部的 this 绑定到 vm 上
+							// uni.getNetworkType({
+							// 	success(res) {
+							// 		if (res.networkType !== 'none') {
+							// 			uni.getConnectedBluetoothDevices({
+							// 				success(res) {
+							// 					console.log('已连接的蓝牙设备信息:', res);
+							// 					xBlufi.notifySendCustomData({
+							// 						customData: "time@" + 0
+							// 					});
+							// 				},
+							// 				fail(err) {
+							// 					console.error('获取已连接蓝牙设备信息失败:', err);
+							// 				}
+							// 			})
+							// 			// vm.$u.get(`/app/bill/recharge/${vm.billNo}/bluetoothSuccess`).then(res => {
+							// 			// 	if(res.code == 200){
+							// 			// 		setTimeout(()=>{
+							// 			// 			uni.hideLoading()
+							// 			// 			uni.navigateBack()
+							// 			// 		},1000)
+							// 			// 	}
+							// 			// })
+							// 		} else {
+							// 			console.log('手机未连接网络');
+							// 		}
+							// 	}
+							// })
 						}
 					})
 				} else if (num == 2) { //异常
@@ -622,7 +651,35 @@
 							title: res.msg,
 							icon: 'success',
 							duration: 2000
-						})
+						}) 
+						// let vm = this; // 将外部的 this 绑定到 vm 上
+						// uni.getNetworkType({
+						// 	success(res) {
+						// 		if (res.networkType !== 'none') {
+						// 			uni.getConnectedBluetoothDevices({
+						// 				success(res) {
+						// 					console.log('已连接的蓝牙设备信息:', res);
+						// 					xBlufi.notifySendCustomData({
+						// 						customData: "time@" + vm.setMode + vm.cztime
+						// 					});
+						// 				},
+						// 				fail(err) {
+						// 					console.error('获取已连接蓝牙设备信息失败:', err);
+						// 				}
+						// 			})
+						// 			// vm.$u.get(`/app/bill/recharge/${vm.billNo}/bluetoothSuccess`).then(res => {
+						// 			// 	if(res.code == 200){
+						// 			// 		setTimeout(()=>{
+						// 			// 			uni.hideLoading()
+						// 			// 			uni.navigateBack()
+						// 			// 		},1000)
+						// 			// 	}
+						// 			// })
+						// 		} else {
+						// 			console.log('手机未连接网络');
+						// 		}
+						// 	}
+						// })
 					}
 				})
 			},