From d6d60bac0dae17c6e69ad32d8b839382fd7d1520 Mon Sep 17 00:00:00 2001
From: Sliverber <2622874537@qq.com>
Date: Fri, 28 Jun 2024 18:08:22 +0800
Subject: [PATCH] 11

---
 common/http.interceptor.js |    8 +-
 manifest.json              |    2 +-
 page_user/yj.vue           |    5 +
 pages/index/index.vue      | 1595 +++++++++++++++++++++++++-----------
 4 files changed, 1132 insertions(+), 478 deletions(-)

diff --git a/common/http.interceptor.js b/common/http.interceptor.js
index 9a9d3b7..c8c80c1 100644
--- a/common/http.interceptor.js
+++ b/common/http.interceptor.js
@@ -10,7 +10,7 @@ const install = (Vue, vm) => {
 	// 	dataType: 'json',  
 	// 	showLoading: true, // 是否显示请求中的loading
 	// 	loadingText: '...', // 请求loading中的文字提示
-		loadingTime: 1000, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
+		// loadingTime: 1000, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms
 	// 	originalData: false, // 是否在拦截器中返回服务端的原始数据
 	// 	loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透
 	// 	// 配置请求头信息 
@@ -19,13 +19,13 @@ const install = (Vue, vm) => {
 			
 	// 	},
 	// }); 
-	uni.setStorageSync('deptId', 101);
+	uni.setStorageSync('deptId', 100);
 	Vue.prototype.$u.http.setConfig({
 			// baseUrl: 'http://61.174.243.28:15861',
 			// baseUrl: 'http://192.168.2.14:8080',
 			// baseUrl: 'http://124.221.246.124:2289',
-			baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
-			// baseUrl: 'https://dche.ccttiot.com/prod-api',
+			// baseUrl: 'https://dianche.chuantewulian.cn/prod-api',
+			baseUrl: 'https://dche.ccttiot.com/prod-api',
 			loadingText: '努力加载中~',
 			// loadingTime: 2000,
 			// 设置自定义头部content-type
diff --git a/manifest.json b/manifest.json
index 8d15cb5..cad1f86 100644
--- a/manifest.json
+++ b/manifest.json
@@ -51,7 +51,7 @@
     /* 小程序特有相关 */
     "mp-weixin" : {
         "libVersion" : "latest",
-        "appid" : "wx4d178f8c80348214",
+        "appid" : "wx3428c498d5061192",
         "setting" : {
             "urlCheck" : false
         },
diff --git a/page_user/yj.vue b/page_user/yj.vue
index 02aeef1..5d3cd82 100644
--- a/page_user/yj.vue
+++ b/page_user/yj.vue
@@ -370,6 +370,11 @@
 									
 									that.check()
 									
+								}, 2000)
+								setTimeout(() => {
+									
+									that.check()
+									
 								}, 4000)
 
 							},
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 9e3be78..f6d4995 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -229,7 +229,7 @@
 							我已同意并阅读 <span @click.stop="toxy()">《电动车租赁协议》</span>
 						</view>
 					</view>
-					<view class="btn" @click="sub1()" v-if="type==1">
+					<view class="btn" @click="taploadmask(1)" v-if="type==1">
 						确认开锁
 					</view>
 
@@ -294,14 +294,14 @@
 
 
 						<view class="btn" style="	margin-right: 16rpx;" v-if="OrderdeviceInfos.status==3"
-							@click="loackdevice()">
+							@click="taploadmask (2)">
 							临时锁车
 						</view>
 						<view class="btn" style="	margin-right: 16rpx;" v-if="OrderdeviceInfos.status==4"
-							@click="unloackdevices()">
+							@click=" taploadmask(3)">
 							解锁用车
 						</view>
-						<view class="btn1" @click="backDevicecar()">
+						<view class="btn1" @click=" taploadmask(4)">
 							还车
 						</view>
 					</view>
@@ -550,7 +550,7 @@
 		<u-mask :show="isnoline" :z-index='100' duration='0' />
 		<view class="pops" v-if="isnoline">
 			<view class="tit" style="font-weight: 600;">
-				设备异常离线 
+				设备异常离线
 			</view>
 			<view class="cont_box" style="text-align: center;color: #808080;justify-content: center;font-size: 36rpx;">
 				请使用蓝牙连接辅助操作,请确保手机蓝牙权限已授权
@@ -619,6 +619,168 @@
 				</view> -->
 			</view>
 		</view>
+		<u-mask :show="maskloading" :z-index='100' duration='0' />
+		<view class="maskload" v-if="maskloading">
+			<view class="maskpage0" v-if="maskepage==0">
+				<view class="top_info">
+					<image :src="loadimg" mode=""></image>
+					<view class="masktxt">
+						{{toploadtxt}}
+					</view>
+				</view>
+				<view class="masktips">
+					{{tiptxt}}
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
+				</view>
+			</view>
+			<!-- 不允许停车点外还车 -->
+			<view class="maskpage1" v-if="maskepage==1" style="display: flex; justify-content: center;flex-wrap: wrap;">
+				<view class="top_info">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ufkol3nMNJw4v1kHLFcH" mode=""></image>
+					<view class="masktxt">
+						不在停车点
+						
+					</view>
+				</view>
+				<view class="masktips" style="width: 70%;">
+					无法在停车点外继续还车,请行驶至附近停车点
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ur95KSdL2SBEojQHzyEv" mode=""></image>
+				</view>
+				<view class="btn_box" style="justify-content: center;">
+					<view class="btn3" @click="maskloading=false" style="width: 600rpx;">
+						继续用车 
+					</view>
+					
+				</view>
+			</view>
+			<!-- 允许停车点外还车 -->
+			<view class="maskpage1" v-if="maskepage==2">
+				<view class="top_info">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ufkol3nMNJw4v1kHLFcH" mode=""></image>
+					<view class="masktxt">
+					不在停车点
+					</view>
+				</view>
+				<view class="masktips" style="width: 100%;">
+					未在停车点需支付管理费: <span style="color: red;">{{areaInfo.vehicleManagementFee}}</span> <!-- ,你可查看最近 停车点 -->
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ur95KSdL2SBEojQHzyEv" mode=""></image>
+				</view>
+				<view class="btn_box">
+					<view class="btn3" @click="maskloading=false">
+						继续用车 
+					</view>
+					<view class="btn4" @click="payback()">
+						继续还车
+					</view>
+				</view>
+			</view>
+			<!-- 提示设备离线 使用蓝牙连接 -->
+			<view class="maskpage1" v-if="maskepage==3">
+				<view class="top_info">
+					<image :src="loadimg" mode=""></image>
+					<view class="masktxt">
+					设备离线无法还车
+					</view>
+				</view>
+				<view class="masktips" style="width: 100%;">
+					需连接蓝牙才可还车,请确保手机蓝牙打开并且授权小程序使用蓝牙权限
+				</view>
+				<view class="masktips" style="width: 100%;color: #4C97E7;text-decoration-line: underline;margin-top: 0; font-size: 28rpx;" >
+					点击查看教程
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
+				</view>
+				<view class="btn_box">
+					
+					<view class="btn4" @click="maskloading=false">
+						继续用车 
+					
+					</view>
+					<view class="btn3" @click="Binddevice">
+						连接蓝牙
+					</view>
+				</view>
+			</view>
+			<view class="maskpage1" v-if="maskepage==4">
+				<view class="top_info">
+					<image :src="loadimg" mode=""></image>
+					<view class="masktxt">
+					{{buletxt}}
+					</view>
+				</view>
+				<view class="masktips" style="width: 100%;">
+					请确保车辆的距离小于3米
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
+				</view>
+				<view class="btn_box">
+					
+					<view class="btn4" @click="maskloading=false">
+						继续用车 
+					
+					</view>
+					<view class="btn3" @click="Binddevice">
+						连接蓝牙
+					</view>
+				</view>
+			</view>
+			<view class="maskpage1" v-if="maskepage==5">
+				<view class="top_info">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/uG3cbPgvPDzwlq6IHHxK" mode=""></image>
+					<view class="masktxt">
+					蓝牙连接失败
+					</view>
+				</view>
+				<view class="masktips" style="width: 100%;">
+					请确保手机蓝牙已经打开
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
+				</view>
+				<view class="btn_box">
+					
+					<view class="btn4" @click="maskloading=false">
+						继续用车 
+					
+					</view>
+					<view class="btn3" @click="Binddevice">
+						重新连接
+					</view>
+				</view>
+			</view>
+			<view class="maskpage1" v-if="maskepage==6">
+				<view class="top_info">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/uG3cbPgvPDzwlq6IHHxK" mode=""></image>
+					<view class="masktxt">
+					您还未充值押金
+					</view>
+				</view>
+				<view class="masktips" style="width: 100%;">
+					需充值押金后方可骑行
+				</view>
+				<view class="tipsimg">
+					<image src="https://lxnapi.ccttiot.com/bike/img/static/ugvqmfB3QYujZ6SnfTia" mode=""></image>
+				</view>
+				<view class="btn_box">
+					
+					<view class="btn4" @click="maskloading=false">
+						取消 
+					
+					</view>
+					<view class="btn3" @click="topage(1)">
+						押金充值
+					</view>
+				</view>
+			</view>
+		</view>
 	</view>
 </template>
 
@@ -718,8 +880,16 @@
 
 				isbackdevice: false,
 				isbackcar: false,
-				loadingmask:false,
-				loadingtxt:'设备连接中...'
+				loadingmask: false,
+				loadingtxt: '设备连接中...',
+
+				maskloading: false,
+				toploadtxt: "开锁中0%",
+				loadimg: 'https://lxnapi.ccttiot.com/bike/img/static/urJQJnOI1DEjWatFqHYh',
+				tiptxt: '请定点停放,规范用车',
+				maskepage:0,
+				backgps:{},
+				buletxt:''
 			}
 		},
 		watch: {
@@ -772,39 +942,41 @@
 			}, 500)
 		},
 		onShow() {
-			this.timers = setInterval(() => {
-				// console.log('定时器运行中...');
-				this.getmarks()
-				// 在这里执行你的逻辑
-				if(this.orderinfo.sn){
+			// this.timers = setInterval(() => {
+			// 	// console.log('定时器运行中...');
+			// 	this.getmarks()
+			// 	// 在这里执行你的逻辑
+			// 	if (this.orderinfo.sn) {
 
-					this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
-						if (res.code === 200) {
-							if(this.OrderdeviceInfos.onlineStatus!=res.data.onlineStatus){
-								this.OrderdeviceInfos = res.data
-								// this.OrderdeviceInfos.onlineStatus ='0'
+			// 		this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
+			// 			if (res.code === 200) {
+			// 				if (this.OrderdeviceInfos.onlineStatus != res.data.onlineStatus) {
+			// 					this.OrderdeviceInfos = res.data
+			// 					// this.OrderdeviceInfos.onlineStatus ='0'
 
-								if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status != 3) {
-									this.mac = this.OrderdeviceInfos.mac
-									if (this.carstause == false) {
+			// 					if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status !=
+			// 						3) {
+			// 						this.mac = this.OrderdeviceInfos.mac
+			// 						if (this.carstause == false) {
 
-										this.isnoline = true
-									}
+			// 							this.isnoline = true
+			// 						}
 
-								}
-							}
+			// 					}
+			// 				}
 
 
-						} else {
-							// 处理接口返回错误的情况
-						}
-					}).catch(error => {
-						// 处理接口请求失败的情况
-					});
-				}
+			// 			} else {
+			// 				// 处理接口返回错误的情况
+			// 			}
+			// 		}).catch(error => {
+			// 			// 处理接口请求失败的情况
+			// 		});
+			// 	}
 
-			}, 3000); // 每秒执行一次
+			// }, 3000); // 每秒执行一次
 
+		
 			if (this.seeDetail == false) {
 
 
@@ -822,8 +994,8 @@
 						that.gps.latitude = lb.latitude;
 						that.gps.longitude = lb.longitude;
 
-						that.latitude = Number(lb.latitude.toFixed(5)) - 0.005
-						that.longitude = Number(lb.longitude.toFixed(5)) + 0.005
+						that.latitude = lb.latitude;
+						that.longitude = lb.longitude;
 
 
 						console.log(that.areaInfo, 'that.areaInfo');
@@ -953,6 +1125,558 @@
 			},
 		},
 		methods: {
+			taploadmask(num) {
+				this.maskepage=0
+				this.loadimg='https://lxnapi.ccttiot.com/bike/img/static/urJQJnOI1DEjWatFqHYh'
+				if (num == 1) {
+					if (!this.checkBeforeUnlock()) {
+						return;
+					}
+
+					if (this.showxy) {
+						if (this.areaInfo.authentication == 1) {
+							this.maskloading = true;
+							let percentage = 0;
+							const interval = setInterval(() => {
+								if (percentage < 98) {
+									percentage += 2; // 每次增加的百分比,可以调整
+									this.toploadtxt = `开锁中${percentage}%`;
+								} else {
+									clearInterval(interval);
+									this.toploadtxt = "开锁中98%";
+								}
+							}, 40); // 每40毫秒更新一次,可以调整
+							setTimeout(() => {
+								this.sub1();
+							}, 2100);
+						}
+					} else {
+						uni.showToast({
+							title: '请勾选协议',
+							icon: 'none',
+							duration: 2000
+						});
+					}
+				}else if(num==2){
+					//临时锁车
+					this.maskloading = true;
+					let percentage = 0;
+					const interval = setInterval(() => {
+						if (percentage < 98) {
+							percentage += 2; // 每次增加的百分比,可以调整
+							this.toploadtxt = `锁车中${percentage}%`;
+						} else {
+							clearInterval(interval);
+							this.toploadtxt = "锁车中98%";
+						}
+					}, 40); // 每40毫秒更新一次,可以调整
+					setTimeout(() => {
+						this.loackdevice();
+					}, 2100);
+					
+				}else if(num==3){
+					//临时锁车
+					this.maskloading = true;
+					let percentage = 0;
+					const interval = setInterval(() => {
+						if (percentage < 98) {
+							percentage += 2; // 每次增加的百分比,可以调整
+							this.toploadtxt = `开锁中${percentage}%`;
+						} else {
+							clearInterval(interval);
+							this.toploadtxt = "开锁中98%";
+						}
+					}, 40); // 每40毫秒更新一次,可以调整
+					setTimeout(() => {
+						this.unloackdevices();
+					}, 2100);
+					
+				}else if(num==4){
+					//临时锁车
+					this.maskloading = true;
+					let percentage = 0;
+					const interval = setInterval(() => {
+						if (percentage < 98) {
+							percentage += 2; // 每次增加的百分比,可以调整
+							this.toploadtxt = `还车地点校验中${percentage}%`;
+						} else {
+							clearInterval(interval);
+							this.toploadtxt = "还车地点校验中98%";
+						}
+					}, 20); // 每40毫秒更新一次,可以调整
+					setTimeout(() => {
+						this.cheackgps();
+					}, 1100);
+					
+				}
+				
+			},
+			Binddevice() {
+				this.maskepage=4
+				this.buletxt = '设备连接中'
+				// uni.showLoading({
+				// 	title: '蓝牙扫描中..'
+				// })
+				xBlufi.initXBlufi(1);
+				console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
+				xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
+				xBlufi.notifyStartDiscoverBle({
+					'isStart': true
+				});
+			
+			
+				// 两秒后停止蓝牙搜索
+				setTimeout(() => {
+					xBlufi.notifyStartDiscoverBle({
+						'isStart': false
+					});
+					setTimeout(() => {
+						// uni.hideLoading()
+						if (this.devicesList.length == 0) {
+							uni.showToast({
+								title: '暂无发现对应设备,请靠近设备',
+								icon: 'none',
+								duration: 1500
+							});
+						} else {
+							let uniqueDevicesList = Array.from(new Set(this.devicesList));
+			
+							// 将去重后的数组重新赋值给 this.devicesList
+							this.devicesList = uniqueDevicesList;
+							console.log(this.devicesList, 'this.devicesListthis.devicesList');
+							let istrue = false
+							this.devicesList.forEach(device => {
+								// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
+								let macFromName = device.name.substring(device.name.length - 12);
+								console.log(macFromName, 'macFromNamemacFromName');
+								// 与 this.mac 进行比较
+								if (macFromName == this.mac) {
+									// 如果相同,则将 this.ishave 设置为 true
+									console.log(device);
+									this.deviceInfoss = device
+									// this.ishave = true;
+									istrue = true
+									this.createBLEConnection(device)
+			
+									console.log('对比正确1111111111');
+								} else {
+									console.log('对比错误');
+			
+								}
+							});
+							setTimeout(() => {
+								if (!istrue) {
+									this.buletxt = '蓝牙连接失败'
+			
+			
+									setTimeout(() => {
+										this.maskepage=5
+									}, 500)
+								}
+			
+							}, 500)
+						}
+			
+			
+					}, 200)
+					// 判断是否存在浇花器设备
+			
+					// this.status = true
+				}, 5000)
+			
+			},
+			cheackgps(){
+				let that = this
+				uni.getLocation({
+					type: 'gcj02',
+					success: function(lb) {
+							
+							
+						let data = {
+							latitude: lb.latitude,
+							longitude: lb.longitude,
+							areaId: that.areaInfo.areaId
+						}
+						that.backgps.latitude=lb.latitude
+						that.backgps.longitude=lb.longitude
+						that.$u.get('/appVerify/isInParkingArea?', data).then((res) => {
+							
+							if (res.code == 200) {
+								
+								let parkingReturn = res.data.parkingReturn   /** 停车点还车 true:开启,false:关闭*/
+								let isInParkingArea = res.data.isInParkingArea   /** 是否在停车区内*/
+								if (parkingReturn) {
+									// 可以在停车点外还车
+									if (isInParkingArea) {
+										// 在停车点内
+										if(that.OrderdeviceInfos.onlineStatus == 1){
+											// 设备未离线
+											that.backDevice()
+										}else{
+											if (that.carstause) {
+											
+												that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo.orderNo + '&isBluetooth=true' + '&lon=' + that.backgps.longitude + '&lat=' + that.backgps.latitude).then((
+													res) => {
+													
+													if (res.code === 200) {
+														that.reboot()
+														that.isbackdevice = false
+														that.close()
+														that.getisInOrder()
+											
+													} else {
+														uni.showToast({
+															title: res.msg,
+															icon: 'none',
+															duration: 2000
+														});
+													}
+												})
+											} else {
+												
+												
+											}
+										}
+									}else{
+										that.maskepage=1
+									}
+								}else{
+									if (isInParkingArea) {
+										// 在停车点内
+										if(that.OrderdeviceInfos.onlineStatus == 1){
+											// 设备未离线
+											that.backDevice()
+										}else{
+											if (that.carstause) {
+											
+												that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo
+													.orderNo + '&isBluetooth=true' + '&lon=' + that.backgps.longitude + '&lat=' + that.backgps
+													.latitude).then((
+													res) => {
+													
+													if (res.code === 200) {
+														that.reboot()
+														that.isbackdevice = false
+														
+														
+														that.close()
+														that.getisInOrder()
+											
+													} else {
+														uni.showToast({
+															title: res.msg,
+															icon: 'none',
+															duration: 2000
+														});
+													}
+												})
+											} else {
+												that.maskepage=3
+												// that.isbackdevice = false
+												// that.isnoline = true
+											}
+										}
+									}else{
+										if(that.OrderdeviceInfos.onlineStatus == 1){
+											// 设备未离线
+											that.maskepage=2
+										}else{
+											if (that.carstause) {
+											
+												that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo
+													.orderNo + '&isBluetooth=true' + '&lon=' + that.backgps.longitude + '&lat=' + that.backgps
+													.latitude).then((
+													res) => {
+													
+													if (res.code === 200) {
+														that.reboot()
+														that.isbackdevice = false
+														
+														
+														that.close()
+														that.getisInOrder()
+											
+													} else {
+														uni.showToast({
+															title: res.msg,
+															icon: 'none',
+															duration: 2000
+														});
+													}
+												})
+											} else {
+												that.maskepage=3
+												// that.isbackdevice = false
+												// that.isnoline = true
+											}
+										}
+										
+									}
+								}
+							} else {
+								uni.showToast({
+									title: res.msg,
+									icon: 'none',
+									duration: 2000
+								});
+							}
+						})
+							
+							
+							
+					},
+					fail: function(error) {
+						
+					}
+							
+				})
+			},
+			payback(){
+				if(this.OrderdeviceInfos.onlineStatus == 1){
+					// 设备未离线
+					this.maskepage=0
+					this.maskloading = true;
+					let percentage = 0;
+					const interval = setInterval(() => {
+						if (percentage < 98) {
+							percentage += 2; // 每次增加的百分比,可以调整
+							this.toploadtxt = `还车中${percentage}%`;
+						} else {
+							clearInterval(interval);
+							this.toploadtxt = "还车中98%";
+						}
+					}, 20); // 每40毫秒更新一次,可以调整
+					setTimeout(() => {
+						this.backDevice()
+					}, 1100);
+					
+				}else{
+					
+				}
+			},
+			backDevice() {
+				
+				this.$u.post('/appVerify/device/return?returnType=1&orderNo=' + this.orderinfo.orderNo).then((res) => {
+					uni.hideLoading()
+					if (res.code === 200) {
+						this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z';
+						this.toploadtxt = '还车成功!';
+						setTimeout(() => {
+							this.close()
+							this.maskloading = false;
+							this.getisInOrder();
+						}, 800);
+						
+					} else {
+						uni.showToast({
+							title: res.msg,
+							icon: 'none',
+							duration: 2000
+						});
+					}
+				})
+			
+			},
+			onlinebackDevice() {
+				let that = this
+				uni.getLocation({
+					type: 'gcj02',
+					success: function(lb) {
+			
+			
+						let data = {
+							latitude: lb.latitude,
+							longitude: lb.longitude,
+							areaId: that.areaInfo.areaId
+						}
+			
+						that.$u.get('/appVerify/isInParkingArea?', data).then((res) => {
+			
+							if (res.code == 200) {
+								let parkingReturn = res.data.parkingReturn
+								let isInParkingArea = res.data.isInParkingArea
+								if (parkingReturn) {
+									if (isInParkingArea) {
+										if (that.carstause) {
+											that.reboot()
+											that.$u.post(
+												'/appVerify/device/return?returnType=1&orderNo=' +
+												that.orderinfo
+												.orderNo + '&isBluetooth=true' + '&lon=' + lb
+												.longitude + '&lat=' + lb.latitude).then((
+												res) => {
+												uni.hideLoading()
+												if (res.code === 200) {
+													that.close()
+													that.getisInOrder()
+			
+												} else {
+													uni.showToast({
+														title: res.msg,
+														icon: 'none',
+														duration: 2000
+													});
+												}
+											})
+			
+			
+										} else {
+											uni.showToast({
+												title: '蓝牙状态异常,请重新链接',
+												icon: 'none',
+												duration: 1000
+											});
+											setTimeout(() => {
+												that.isnoline = true
+											}, 1300)
+										}
+			
+			
+									} else {
+										uni.showToast({
+											title: '停车点外禁止还车,请行驶至停车区内',
+											icon: 'none',
+											duration: 2000
+										});
+									}
+								} else {
+									if (isInParkingArea) {
+										if (that.carstause) {
+											that.reboot()
+											that.$u.post(
+												'/appVerify/device/return?returnType=1&orderNo=' +
+												that.orderinfo
+												.orderNo + '&isBluetooth=true' + '&lon=' + lb
+												.longitude + '&lat=' + lb.latitude).then((
+												res) => {
+												uni.hideLoading()
+												if (res.code === 200) {
+													that.close()
+													that.getisInOrder()
+			
+												} else {
+													uni.showToast({
+														title: res.msg,
+														icon: 'none',
+														duration: 2000
+													});
+												}
+											})
+			
+			
+										} else {
+											uni.showToast({
+												title: '蓝牙状态异常,请重新链接',
+												icon: 'none',
+												duration: 1000
+											});
+											setTimeout(() => {
+												that.isnoline = true
+											}, 1300)
+										}
+									} else {
+										that.isbackdevice = true
+									}
+								}
+							} else {
+								uni.showToast({
+									title: res.msg,
+									icon: 'none',
+									duration: 2000
+								});
+							}
+						})
+			
+			
+			
+					},
+					fail: function(error) {
+						// uni.showToast({
+						// 	title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能',
+						// 	icon: 'none',
+						// 	duration: 2000
+						// });
+						// that.getmarks()
+						// 在这里处理获取位置信息失败的情况
+					}
+			
+				})
+			
+			},
+			// 新增的检查函数
+			checkBeforeUnlock() {
+				if (!this.freeInfo.ruleId) {
+					uni.hideLoading();
+					uni.showToast({
+						title: '请选择套餐',
+						icon: 'none',
+						duration: 2000
+					});
+					return false;
+				}
+				if (!this.showxy) {
+					uni.showToast({
+						title: '请勾选协议',
+						icon: 'none',
+						duration: 2000
+					});
+					return false;
+				}
+
+				if (this.areaInfo.authentication == 1 && this.userinfo.isAuthentication == 0) {
+					uni.hideLoading();
+					this.maskloading = false;
+					this.seeDetail = true;
+					uni.navigateTo({
+						url: "/page_user/idcard_test"
+					});
+					return false;
+				}
+
+
+
+				return true;
+			},
+
+			// 确认开锁
+			sub1() {
+				uni.showLoading({});
+
+				let data = {
+					userId: this.userId,
+					sn: this.sn,
+					ruleId: this.freeInfo.ruleId,
+					mark: "确认开锁",
+					type: '1'
+				};
+
+				this.$u.post('/appVerify/device/snSwitch', data).then((res) => {
+					uni.hideLoading();
+					this.seeDetail = false;
+					if (res.code === 200) {
+						this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z';
+						this.toploadtxt = '开锁成功';
+						setTimeout(() => {
+							this.maskloading = false;
+							this.getisInOrder();
+						}, 800);
+					} else {
+						if (res.msg == '您还未充值押金,请先充值押金') {
+							// this.close();
+							// this.maskloading = false;
+							this.maskepage=6
+							// this.showYjTip = true;
+						} else {
+							uni.showToast({
+								title: res.msg,
+								icon: 'none',
+								duration: 2000
+							});
+						}
+					}
+				});
+			},
+
 			backDevicecar() {
 				this.isbackcar = true
 			},
@@ -972,7 +1696,7 @@
 
 
 			onMapRegionChange(event) {
-				console.log('regionchange', event)
+				// console.log('regionchange', event)
 				if (event.detail.type == 'end') {
 					// this.getCenterLanLat()
 				}
@@ -1053,7 +1777,7 @@
 							areaId: that.areaInfo.areaId
 						}
 						if (that.carstause) {
-							
+
 							that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo
 								.orderNo + '&isBluetooth=true' + '&lon=' + lb.longitude + '&lat=' + lb
 								.latitude).then((
@@ -1074,9 +1798,9 @@
 								}
 							})
 						} else {
-							
-						that.isbackdevice = false
-						that.isnoline = true
+
+							that.isbackdevice = false
+							that.isnoline = true
 						}
 
 					},
@@ -1094,208 +1818,84 @@
 
 
 			},
-			onlinebackDevice() {
-				let that = this
-				uni.getLocation({
-					type: 'gcj02',
-					success: function(lb) {
-
-
-						let data = {
-							latitude: lb.latitude,
-							longitude: lb.longitude,
-							areaId: that.areaInfo.areaId
-						}
-
-						that.$u.get('/appVerify/isInParkingArea?', data).then((res) => {
-
-							if (res.code == 200) {
-								let parkingReturn = res.data.parkingReturn
-								let isInParkingArea = res.data.isInParkingArea
-								if (parkingReturn) {
-									if (isInParkingArea) {
-										if (that.carstause) {
-											that.reboot()
-											that.$u.post(
-												'/appVerify/device/return?returnType=1&orderNo=' +
-												that.orderinfo
-												.orderNo + '&isBluetooth=true' + '&lon=' + lb
-												.longitude + '&lat=' + lb.latitude).then((
-												res) => {
-												uni.hideLoading()
-												if (res.code === 200) {
-													that.close()
-													that.getisInOrder()
-
-												} else {
-													uni.showToast({
-														title: res.msg,
-														icon: 'none',
-														duration: 2000
-													});
-												}
-											})
-
-
-										} else {
-											uni.showToast({
-												title: '蓝牙状态异常,请重新链接',
-												icon: 'none',
-												duration: 1000
-											});
-											setTimeout(() => {
-												that.isnoline = true
-											}, 1300)
-										}
-
-
-									} else {
-										uni.showToast({
-											title: '停车点外禁止还车,请行驶至停车区内',
-											icon: 'none',
-											duration: 2000
-										});
-									}
-								} else {
-									if (isInParkingArea) {
-										if (that.carstause) {
-											that.reboot()
-											that.$u.post(
-												'/appVerify/device/return?returnType=1&orderNo=' +
-												that.orderinfo
-												.orderNo + '&isBluetooth=true' + '&lon=' + lb
-												.longitude + '&lat=' + lb.latitude).then((
-												res) => {
-												uni.hideLoading()
-												if (res.code === 200) {
-													that.close()
-													that.getisInOrder()
-
-												} else {
-													uni.showToast({
-														title: res.msg,
-														icon: 'none',
-														duration: 2000
-													});
-												}
-											})
-
-
-										} else {
-											uni.showToast({
-												title: '蓝牙状态异常,请重新链接',
-												icon: 'none',
-												duration: 1000
-											});
-											setTimeout(() => {
-												that.isnoline = true
-											}, 1300)
-										}
-									} else {
-										that.isbackdevice = true
-									}
-								}
-							} else {
-								uni.showToast({
-									title: res.msg,
-									icon: 'none',
-									duration: 2000
-								});
-							}
-						})
-
-
-
-					},
-					fail: function(error) {
-						// uni.showToast({
-						// 	title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能',
-						// 	icon: 'none',
-						// 	duration: 2000
-						// });
-						// that.getmarks()
-						// 在这里处理获取位置信息失败的情况
-					}
-
-				})
-
-			},
+			
+			
 			// 蓝牙
-			Binddevice() {
-				this.isnoline = false
-				this.loadingmask=true
-				this.loadingtxt='设备连接中...'
-				// uni.showLoading({
-				// 	title: '蓝牙扫描中..'
-				// })
-				xBlufi.initXBlufi(1);
-				console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
-				xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
-				xBlufi.notifyStartDiscoverBle({
-					'isStart': true
-				});
+			// Binddevice() {
+			// 	this.isnoline = false
+			// 	this.loadingmask = true
+			// 	this.loadingtxt = '设备连接中...'
+			// 	// uni.showLoading({
+			// 	// 	title: '蓝牙扫描中..'
+			// 	// })
+			// 	xBlufi.initXBlufi(1);
+			// 	console.log("xBlufi", xBlufi.XMQTT_SYSTEM);
+			// 	xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvent);
+			// 	xBlufi.notifyStartDiscoverBle({
+			// 		'isStart': true
+			// 	});
 
 
-				// 两秒后停止蓝牙搜索
-				setTimeout(() => {
-					xBlufi.notifyStartDiscoverBle({
-						'isStart': false
-					});
-					setTimeout(() => {
-						// uni.hideLoading()
-						if (this.devicesList.length == 0) {
-							uni.showToast({
-								title: '暂无发现对应设备,请靠近设备',
-								icon: 'none',
-								duration: 1500
-							});
-						} else {
-							let uniqueDevicesList = Array.from(new Set(this.devicesList));
+			// 	// 两秒后停止蓝牙搜索
+			// 	setTimeout(() => {
+			// 		xBlufi.notifyStartDiscoverBle({
+			// 			'isStart': false
+			// 		});
+			// 		setTimeout(() => {
+			// 			// uni.hideLoading()
+			// 			if (this.devicesList.length == 0) {
+			// 				uni.showToast({
+			// 					title: '暂无发现对应设备,请靠近设备',
+			// 					icon: 'none',
+			// 					duration: 1500
+			// 				});
+			// 			} else {
+			// 				let uniqueDevicesList = Array.from(new Set(this.devicesList));
 
-							// 将去重后的数组重新赋值给 this.devicesList
-							this.devicesList = uniqueDevicesList;
-							console.log(this.devicesList, 'this.devicesListthis.devicesList');
-							let istrue = false
-							this.devicesList.forEach(device => {
-								// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
-								let macFromName = device.name.substring(device.name.length - 12);
-								console.log(macFromName, 'macFromNamemacFromName');
-								// 与 this.mac 进行比较
-								if (macFromName == this.mac) {
-									// 如果相同,则将 this.ishave 设置为 true
-									console.log(device);
-									this.deviceInfoss = device
-									// this.ishave = true;
-									istrue = true
-									this.createBLEConnection(device)
+			// 				// 将去重后的数组重新赋值给 this.devicesList
+			// 				this.devicesList = uniqueDevicesList;
+			// 				console.log(this.devicesList, 'this.devicesListthis.devicesList');
+			// 				let istrue = false
+			// 				this.devicesList.forEach(device => {
+			// 					// 从设备名称中提取 MAC 地址(假设 MAC 地址是设备名称的后6个字符)
+			// 					let macFromName = device.name.substring(device.name.length - 12);
+			// 					console.log(macFromName, 'macFromNamemacFromName');
+			// 					// 与 this.mac 进行比较
+			// 					if (macFromName == this.mac) {
+			// 						// 如果相同,则将 this.ishave 设置为 true
+			// 						console.log(device);
+			// 						this.deviceInfoss = device
+			// 						// this.ishave = true;
+			// 						istrue = true
+			// 						this.createBLEConnection(device)
 
-									console.log('对比正确1111111111');
-								} else {
-									console.log('对比错误');
+			// 						console.log('对比正确1111111111');
+			// 					} else {
+			// 						console.log('对比错误');
 
-								}
-							});
-							setTimeout(() => {
-								if (!istrue) {
-									this.loadingtxt='设备连接失败...'
-									
-										
-									setTimeout(()=>{
-										this.loadingmask=false
-									},500)
-								}
-
-							}, 500)
-						}
+			// 					}
+			// 				});
+			// 				setTimeout(() => {
+			// 					if (!istrue) {
+			// 						this.loadingtxt = '设备连接失败...'
 
 
-					}, 200)
-					// 判断是否存在浇花器设备
+			// 						setTimeout(() => {
+			// 							this.loadingmask = false
+			// 						}, 500)
+			// 					}
 
-					// this.status = true
-				}, 5000)
+			// 				}, 500)
+			// 			}
 
-			},
+
+			// 		}, 200)
+			// 		// 判断是否存在浇花器设备
+
+			// 		// this.status = true
+			// 	}, 5000)
+
+			// },
 			reboot() {
 				let vm = this; // 将外部的 this 绑定到 vm 上
 				uni.getNetworkType({
@@ -1376,22 +1976,29 @@
 			},
 			unloackdevices() {
 				if (this.OrderdeviceInfos.onlineStatus == 1) {
-					uni.showLoading({
-						title: '加载中...'
-					})
+					// uni.showLoading({
+					// 	title: '加载中...'
+					// })
 					this.$u.post('/appVerify/device/unlock?sn=' + this.OrderdeviceInfos.sn + '&orderNo=' + this.orderinfo
 						.orderNo).then((res) => {
 
 						if (res.code === 200) {
-							this.getisInOrder()
+							this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z';
+							this.toploadtxt = '开锁成功';
+							setTimeout(() => {
+								this.maskloading = false;
+								this.getisInOrder();
+							}, 800);
 						} else {
 							if (res.msg == '10500-----') {
+								this.maskloading = false;
 								uni.showToast({
 									title: '系统异常,请重新尝试',
 									icon: 'none',
 									duration: 2000
 								});
 							} else {
+								this.maskloading = false;
 								uni.showToast({
 									title: res.msg,
 									icon: 'none',
@@ -1403,14 +2010,14 @@
 					})
 				} else {
 					if (this.carstause) {
-						
+
 
 						let that = this
 						uni.getLocation({
 							type: 'gcj02',
 							success: function(lb) {
-						
-						
+
+
 								let data = {
 									latitude: lb.latitude,
 									longitude: lb.longitude,
@@ -1422,7 +2029,7 @@
 									.orderinfo
 									.orderNo + '&isBluetooth=true' + '&lon=' + lb.longitude +
 									'&lat=' + lb.latitude).then((res) => {
-						
+
 									if (res.code === 200) {
 										that.opencar()
 										console.log('发送了离线开锁请求');
@@ -1435,16 +2042,16 @@
 												duration: 2000
 											});
 										} else {
-											uni.showToast({	
+											uni.showToast({
 												title: res.msg,
 												icon: 'none',
 												duration: 2000
 											});
 										}
-						
+
 									}
 								})
-						
+
 							},
 							fail: function(error) {
 								// uni.showToast({
@@ -1455,9 +2062,9 @@
 								// that.getmarks()
 								// 在这里处理获取位置信息失败的情况
 							}
-						
+
 						})
-						
+
 					} else {
 						console.log('蓝牙没了');
 						this.isnoline = true
@@ -1476,7 +2083,13 @@
 						.orderNo).then((res) => {
 
 						if (res.code === 200) {
-							this.getisInOrder()
+							// this.getisInOrder()
+							this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z';
+							this.toploadtxt = '锁车成功';
+							setTimeout(() => {
+								this.maskloading = false;
+								this.getisInOrder();
+							}, 800);
 						} else {
 							if (res.msg == '10500-----') {
 								uni.showToast({
@@ -1496,14 +2109,14 @@
 					})
 				} else {
 					if (this.carstause) {
-						
+
 
 						let that = this
 						uni.getLocation({
 							type: 'gcj02',
 							success: function(lb) {
-						
-						
+
+
 								let data = {
 									latitude: lb.latitude,
 									longitude: lb.longitude,
@@ -1515,7 +2128,7 @@
 									.orderinfo
 									.orderNo + '&isBluetooth=true' + '&lon=' + lb.longitude +
 									'&lat=' + lb.latitude).then((res) => {
-						
+
 									if (res.code === 200) {
 										that.closecar()
 										console.log('发送了离线锁车请求');
@@ -1534,10 +2147,10 @@
 												duration: 2000
 											});
 										}
-						
+
 									}
 								})
-						
+
 							},
 							fail: function(error) {
 								// uni.showToast({
@@ -1548,7 +2161,7 @@
 								// that.getmarks()
 								// 在这里处理获取位置信息失败的情况
 							}
-						
+
 						})
 					} else {
 						console.log('点击了');
@@ -1595,13 +2208,13 @@
 						if (options.result) {
 							// uni.hideLoading();
 
-							
+
 							xBlufi.notifyInitBleEsp32({
 								deviceId: options.data.deviceId
 							});
-							
+
 							// xBlufi.listenDeviceMsgEvent(true, this.funListenDeviceMsgEvents);
-							
+
 							// this.deviceIds = options.data.deviceId
 							// this.name = options.data.name
 							// 连接成功绑定设备
@@ -1612,7 +2225,7 @@
 							let systemInfo = uni.getSystemInfoSync();
 							if (systemInfo.platform === 'android') {
 								// 当前设备是 Android  
-							
+
 							} else if (systemInfo.platform === 'ios') {
 								// 当前设备是 iOS  
 								// uni.navigateTo({
@@ -1624,13 +2237,13 @@
 						if (options.result == false) {
 							// this.loadingmask=false
 							this.carstause = false
-							
-							this.loadingtxt='设备连接失败...'
-							
-								
-							setTimeout(()=>{
-								this.loadingmask=false
-							},500)
+
+							this.buletxt = '设备连接失败'
+
+
+							setTimeout(() => {
+								this.maskepage = 5
+							}, 800)
 							// uni.showModal({
 							// 	title: '很抱歉提醒你!',
 							// 	content: '小程序与设备异常断开',
@@ -1650,51 +2263,51 @@
 						// this.ver_data = this.parseCustomData(options.data)
 						if (options.data) {
 							this.carstause = true
-							
-							this.loadingtxt='设备连接成功!'
-							if(this.loadingmask){
-								setTimeout(()=>{
-									this.loadingmask=false
-								},700)
+
+							this.buletxt = '蓝牙连接成功!'
+							if (this.maskloading) {
+								setTimeout(() => {
+									this.maskloading = false
+								}, 700)
 							}
-							
-								
-							
-							
-						}else{
+
+
+
+
+						} else {
 							this.carstause = false
-							this.loadingtxt='设备链接失败'
-							if(this.loadingmask){
-								setTimeout(()=>{
-									this.loadingmask=false
-								},700)
-							}
+							this.buletxt = '设备连接失败'
+							
+							
+							setTimeout(() => {
+								this.maskepage = 5
+							}, 800)
 						}
-						// console.log("1收到设备发来的自定义数据结果:",options.data);
+						console.log("1收到设备发来的自定义数据结果:",options.data);
 						break;
-						case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
-							console.log('状态', options.result)
-							if (options.result == false) {
-								this.carstause = false
-								// uni.showToast({
-								// 	title: '设备断开链接,请重新点击蓝牙链接',
-								// 	icon: 'none'
-								// });
-								// uni.showModal({
-								// 	title: '很抱歉提醒你!',
-								// 	content: '小程序与设备异常断开',
-								// 	showCancel: false,
-								// 	success: function(res) {
-								// 		// uni.navigateBack({
-								// 		// 	url: '../search/search'
-								// 		// });
-								// 	}
-								// });
-								// this.statusflag = false
-								// uni.hideLoading();
-							}
+					case xBlufi.XBLUFI_TYPE.TYPE_STATUS_CONNECTED: {
+						console.log('状态', options.result)
+						if (options.result == false) {
+							this.carstause = false
+							// uni.showToast({
+							// 	title: '设备断开链接,请重新点击蓝牙链接',
+							// 	icon: 'none'
+							// });
+							// uni.showModal({
+							// 	title: '很抱歉提醒你!',
+							// 	content: '小程序与设备异常断开',
+							// 	showCancel: false,
+							// 	success: function(res) {
+							// 		// uni.navigateBack({
+							// 		// 	url: '../search/search'
+							// 		// });
+							// 	}
+							// });
+							// this.statusflag = false
+							// uni.hideLoading();
 						}
-						break;
+					}
+					break;
 					case xBlufi.XBLUFI_TYPE.TYPE_GET_DEVICE_LISTS_STOP:
 						if (options.result) {
 							let uniqueDevicesList = Array.from(new Set(this.devicesList));
@@ -1723,8 +2336,8 @@
 
 			//4、建立连接
 			createBLEConnection(e) {
-				this.loadingmask=true
-				
+				// this.loadingmask = true
+
 				// uni.showLoading({
 				// 	title: '绑定中..'
 				// })
@@ -1841,13 +2454,13 @@
 				this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => {
 					if (res.code === 200) {
 						this.OrderdeviceInfos = res.data
-						// this.OrderdeviceInfos.onlineStatus = '0'
+						this.OrderdeviceInfos.onlineStatus = '0'
 
 						if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status != 3) {
 							this.mac = this.OrderdeviceInfos.mac
 							if (this.carstause == false) {
 
-								this.isnoline = true
+								// this.isnoline = true
 							}
 
 						}
@@ -2011,8 +2624,8 @@
 					const createTimeTimestamp = new Date(this.orderinfo.createTime).getTime();
 
 					// 定义定时器
-
-					const currentTime = Date.now();
+					const currentTime = new Date(this.orderinfo.returnTime).getTime();;
+					// const currentTime = Date.now();
 					const timePassed = currentTime - createTimeTimestamp;
 					const secondsPassed = Math.floor(timePassed / 1000);
 
@@ -2107,6 +2720,7 @@
 				});
 			},
 			async setMapScale(e, val) {
+				console.log('调用了');
 				let mapContext = uni.createMapContext('map', this);
 				let setScale = () => {
 					return new Promise((resolve, reject) => {
@@ -2196,31 +2810,7 @@
 
 			// 套餐取消预约
 
-			backDevice() {
-				if (this.OrderdeviceInfos.onlineStatus == 1) {
-					uni.showLoading({
-						title: '加载中...'
-					})
-					this.$u.post('/appVerify/device/return?returnType=1&orderNo=' + this.orderinfo.orderNo).then((res) => {
-						uni.hideLoading()
-						if (res.code === 200) {
-							this.close()
-							this.getisInOrder()
-
-						} else {
-							uni.showToast({
-								title: res.msg,
-								icon: 'none',
-								duration: 2000
-							});
-						}
-					})
-
-				} else {
-					this.onlinebackDevice()
-				}
-
-			},
+			
 			// 套餐直接开锁
 			sub6() {
 				if (this.orderinfo.ruleId) {
@@ -2311,24 +2901,24 @@
 				}
 
 			},
-				lockDevice() {
-							if (this.orderinfo.status) {
-								this.showtcs = true
-							} else {
-								if (this.deviceInfos.status != 1) {
-									uni.showToast({
-										title: '车辆正在使用中,请使用其他车辆',
-										icon: 'none',
-										duration: 2000
-									});
-								} else {
-									this.showdevice = true;
-									this.type = 1;
-									this.deviceIndex = 1;
-								}
-							}
-			
-						},
+			lockDevice() {
+				if (this.orderinfo.status) {
+					this.showtcs = true
+				} else {
+					if (this.deviceInfos.status != 1) {
+						uni.showToast({
+							title: '车辆正在使用中,请使用其他车辆',
+							icon: 'none',
+							duration: 2000
+						});
+					} else {
+						this.showdevice = true;
+						this.type = 1;
+						this.deviceIndex = 1;
+					}
+				}
+
+			},
 
 			// 取消预约支付
 			topay() {
@@ -2469,116 +3059,8 @@
 				}
 
 			},
-			// 确认开锁
-			sub1() {
-				if (this.showxy) {
-					uni.showLoading({
-
-					})
-					if (this.areaInfo.authentication == 1) {
-
-						if (this.userinfo.isAuthentication == 0) {
-							uni.hideLoading()
-							this.seeDetail = true
-							uni.navigateTo({
-								url: "/page_user/idcard_test"
-							})
-						} else {
-							if (this.freeInfo.ruleId) {
-								let data = {
-									userId: this.userId,
-									sn: this.sn,
-									ruleId: this.freeInfo.ruleId,
-									// money: this.freeInfo.fee,
-									mark: "确认开锁",
-									type: '1'
 
 
-								}
-								this.$u.post('/appVerify/device/snSwitch', data).then((res) => {
-									uni.hideLoading()
-									this.seeDetail = false
-									if (res.code === 200) {
-										this.getisInOrder()
-
-									} else {
-
-
-										if (res.msg == '您还未充值押金,请先充值押金') {
-											// this.close()
-											this.showYjTip = true
-										} else {
-											uni.showToast({
-												title: res.msg,
-												icon: 'none',
-												duration: 2000
-											});
-										}
-									}
-								})
-							} else {
-								uni.hideLoading()
-								uni.showToast({
-									title: '请选择套餐',
-									icon: 'none',
-									duration: 2000
-								});
-							}
-						}
-					} else {
-
-						if (this.freeInfo.ruleId) {
-							let data = {
-								userId: this.userId,
-								sn: this.sn,
-								ruleId: this.freeInfo.ruleId,
-								// money: this.freeInfo.fee,
-								mark: "确认开锁",
-								type: '1'
-
-
-							}
-							this.$u.post('/appVerify/device/snSwitch', data).then((res) => {
-								uni.hideLoading()
-								this.seeDetail = false
-								if (res.code === 200) {
-									this.getisInOrder()
-
-								} else {
-
-
-									if (res.msg == '您还未充值押金,请先充值押金') {
-										this.close()
-										this.showYjTip = true
-									} else {
-										uni.showToast({
-											title: res.msg,
-											icon: 'none',
-											duration: 2000
-										});
-									}
-								}
-							})
-						} else {
-							uni.hideLoading()
-							uni.showToast({
-								title: '请选择套餐',
-								icon: 'none',
-								duration: 2000
-							});
-						}
-					}
-				} else {
-					uni.showToast({
-						title: '请勾选协议',
-						icon: 'none',
-						duration: 2000
-					});
-				}
-
-
-
-			},
 			// 开锁购买套餐
 			sub2() {
 				if (this.freeInfo.ruleId) {
@@ -2680,6 +3162,7 @@
 
 
 										if (res.msg == '您还未充值押金,请先充值押金') {
+
 											this.close()
 											this.showYjTip = true
 										} else {
@@ -3146,14 +3629,38 @@
 
 				}
 			},
+			getSNFromQRCode(url) {
+			        // 解码URL
+					
+			       let decodedUrl = decodeURIComponent(url);
+			       
+			               // 使用正则表达式提取sn参数
+			               let snMatch = decodedUrl.match(/[\?&]sn=([^&#]*)/);
+			               if (snMatch) {
+			                   return snMatch[1];
+			               } else {
+			                   return null;
+			               }
+			    },
 			getArea() {
 				this.showmap = false
 				// 发送请求获取数据
 				this.areaInfo = {}
+				console.log(this.qParam,'qParamqParamqParamqParam');
 				this.polyline = []
-				if (this.sn != 0 && this.sn != '' && this.sn != null) {
-					this.gps.sn = this.sn
+				// if(this.qParam){
+					
+				// }
+				if(this.qParam!=''&&this.qParam!=null){
+					this.sn=this.getSNFromQRCode(this.qParam);
+					if (this.sn != 0 && this.sn != '' && this.sn != null) {
+						this.gps.sn = this.sn
+					}
 				}
+				
+				setTimeout(() => {
+					this.setMapScale()
+				}, 300)
 
 				this.$u.get('/app/area/info?', this.gps).then((res) => {
 					this.showmap = true
@@ -3194,8 +3701,11 @@
 							this.startCountdown();
 
 						}
+						if(this.sn){
+							this.deviceInfo(0)
+							this.qParam=null
+						}
 
-						this.setMapScale()
 						// if(!hasShownPopup){
 						// 	console.log(typeof(hasShownPopup),'hasShownPopuphasShownPopup');
 						// 	this.showTips=uni.getStorageSync('hasShownPopup')
@@ -3374,9 +3884,7 @@
 					// })
 				} else if (num == 1) {
 
-					uni.showLoading({
-
-					})
+					this.maskloading=false
 					if (uni.getStorageSync('token')) {
 						if (this.areaInfo.authentication == 1) {
 							this.$u.get("/getAppInfo").then(res => {
@@ -3813,6 +4321,142 @@
 	.page {
 		width: 750rpx;
 
+		.maskload {
+
+			position: fixed;
+			padding: 46rpx;
+			bottom: 0;
+			width: 752rpx;
+			height: 780rpx;
+			background: #FFFFFF;
+			border-radius: 40rpx 40rpx 0rpx 0rpx;
+			z-index: 101;
+			.maskpage0{
+				.top_info {
+					width: 100%;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+				
+					image {
+						margin-right: 16rpx;
+						width: 50rpx;
+						height: 50rpx;
+					}
+				
+					.masktxt {
+						font-weight: 500;
+						font-size: 44rpx;
+						color: #3D3D3D;
+					}
+				}
+				
+				.masktips {
+					margin-top: 20rpx;
+					width: 100%;
+					text-align: center;
+					font-weight: 400;
+					font-size: 32rpx;
+					color: #3D3D3D;
+				}
+				
+				.tipsimg {
+					margin-top: 60rpx;
+					display: flex;
+					// align-items: center;
+					justify-content: center;
+					width: 100%;
+				
+					image {
+						width: 554rpx;
+						height: 262rpx;
+				
+					}
+				}
+			}
+			.maskpage1{
+				.top_info {
+					width: 100%;
+					display: flex;
+					align-items: center;
+					justify-content: center;
+				
+					image {
+						margin-right: 16rpx;
+						width: 50rpx;
+						height: 50rpx;
+					}
+				
+					.masktxt {
+						font-weight: 500;
+						font-size: 44rpx;
+						color: #3D3D3D;
+					}
+				}
+				.masktips {
+					margin-top: 20rpx;
+					width: 100%;
+					text-align: center;
+					font-weight: 400;
+					font-size: 32rpx;
+					color: #3D3D3D;
+				}
+				
+				.tipsimg {
+					margin-top: 60rpx;
+					display: flex;
+					// align-items: center;
+					justify-content: center;
+					width: 100%;
+				
+					image {
+						width: 554rpx;
+						height: 262rpx;
+				
+					}
+				}
+					
+				.btn_box{
+					width: 750rpx;
+					padding: 0 36rpx;
+					position: absolute;
+					bottom: 60rpx;
+					left: 0;
+					display: flex;
+					justify-content: space-between;
+					align-items: center;
+					.btn3{
+						// margin-right: 16rpx;
+						display: flex;
+						align-items: center;
+						justify-content: center;
+						width: 300rpx;
+						height: 90rpx;
+						background: #4C97E7;
+						border-radius: 45rpx 45rpx 45rpx 45rpx;
+						
+						font-weight: 500;
+						font-size: 40rpx;
+						color: #FFFFFF;
+					}
+					.btn4{
+						display: flex;
+						align-items: center;
+						justify-content: center;
+						width: 300rpx;
+						height: 90rpx;
+						border-radius: 45rpx 45rpx 45rpx 45rpx;
+						border: 2rpx solid #808080;
+						
+						font-weight: 500;
+						font-size: 40rpx;
+						color: #808080;
+					}
+				}
+			}
+			
+		}
+
 		.tab_top {
 			position: fixed;
 			top: 0rpx;
@@ -4488,9 +5132,10 @@
 					// background: #fff;
 					// box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
 					border-radius: 50rpx 50rpx 0 0;
-					padding-left: 10rpx;	
+					padding-left: 10rpx;
+
 					.info {
-						
+
 						// margin-top: 20rpx;
 
 						padding: 0 60rpx;
@@ -4504,7 +5149,7 @@
 						background: #FFFFFF;
 						border-radius: 20rpx 20rpx 20rpx 20rpx;
 						box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08);
-												// margin: 0 auto;
+						// margin: 0 auto;
 					}
 
 
@@ -4777,16 +5422,19 @@
 					height: 80rpx;
 				}
 			}
-			.loading_box{
+
+			.loading_box {
 				width: 100%;
 				// height: 200rpx;
 				display: flex;
 				align-items: center;
 				justify-content: center;
-				image{
+
+				image {
 					width: 336rpx;
 					height: 154rpx;
 				}
+
 				// .loader {
 				//   width: 120rpx;
 				//   aspect-ratio: 1;
@@ -4796,7 +5444,7 @@
 				//   transform: translateY(-60rpx); /* 4倍的比例调整 */
 				//   animation: l19 1s infinite linear;
 				// }
-				
+
 				// @keyframes l19 {
 				//   16.67% {box-shadow:-240rpx 60rpx,-240rpx 60rpx,  76rpx 60rpx} /* 4倍的比例调整 */
 				//   33.33% {box-shadow:-240rpx 60rpx,    0px 60rpx,  76rpx 60rpx} /* 4倍的比例调整 */
@@ -4807,6 +5455,7 @@
 				// }
 
 			}
+
 			.btn_box {
 				margin-top: 80rpx;
 				display: flex;
@@ -4962,7 +5611,7 @@
 			}
 		}
 
-		
+
 		.bottom_more {
 			position: fixed;