diff --git a/page_user/word.vue b/page_user/word.vue index 78c66aa..b3f7922 100644 --- a/page_user/word.vue +++ b/page_user/word.vue @@ -17,7 +17,7 @@ userinfo: {}, areaInfo: {}, content: '', - title:'' + title: '' } }, onLoad(options) { @@ -28,7 +28,9 @@ // 设置数据 this.title = title this.content = content - this.insertPhoneNumberAndDate() + this.content = this.replaceImgWithImage(this.content); + // this.insertPhoneNumberAndDate() + console.log(this.content, 'this.contentthis.contentthis.contentthis.content'); } }, @@ -39,7 +41,8 @@ this.$u.get(`/app/article/list?areaId=${id}&tag=agreement`).then((res) => { if (res.code === 200) { this.info = res.rows[0]; - this.insertPhoneNumberAndDate(); + this.content = this.replaceImgWithImage(this.info.content); + } else { uni.showToast({ title: res.msg, @@ -50,10 +53,18 @@ }); }, - insertPhoneNumberAndDate() { - + replaceImgWithImage(content) { // 替换所有的 为 \u00A0 - this.content = this.content.replace(/ /g, '\u00A0'); + content = content.replace(/ /g, '\u00A0'); + + // 替换 标签的宽度和高度样式 + content = content.replace(/]*)>/g, (match, group1) => { + // 查找并移除可能存在的尾部斜杠 + let cleanedGroup = group1.replace(/\s*\/$/, ''); + return ``; + }); + + return content; } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index f6d4995..6daed64 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -4,7 +4,8 @@ - {{areaInfo.areaName}} + 创享电动车 + 嵛你出行 @@ -641,7 +642,7 @@ 不在停车点 - + @@ -652,9 +653,9 @@ - 继续用车 + 继续用车 - + @@ -662,20 +663,20 @@ - 不在停车点 + 不在停车点 - 未在停车点需支付管理费: {{areaInfo.vehicleManagementFee}} + 未在停车点需支付管理费: {{areaInfo.vehicleManagementFee}} - - 继续用车 + + 继续用车 - + 继续还车 @@ -685,25 +686,26 @@ - 设备离线无法还车 + 设备离线无法解锁 - 需连接蓝牙才可还车,请确保手机蓝牙打开并且授权小程序使用蓝牙权限 + 需连接蓝牙才可解锁,请确保手机蓝牙打开并且授权小程序使用蓝牙权限 - + 点击查看教程 - + - 继续用车 - + 换车解锁 + - + 连接蓝牙 @@ -712,16 +714,16 @@ - {{buletxt}} + {{buletxt}} - 请确保车辆的距离小于3米 + 请确保与车辆的距离小于3米 - + - 蓝牙连接失败 + 蓝牙连接失败 请确保手机蓝牙已经打开 + + 点击查看教程 + - + - 继续用车 - + 继续用车 + 重新连接 @@ -760,7 +766,7 @@ - 您还未充值押金 + 您还未充值押金 @@ -770,10 +776,10 @@ - + - 取消 - + 取消 + 押金充值 @@ -887,9 +893,16 @@ toploadtxt: "开锁中0%", loadimg: 'https://lxnapi.ccttiot.com/bike/img/static/urJQJnOI1DEjWatFqHYh', tiptxt: '请定点停放,规范用车', - maskepage:0, - backgps:{}, - buletxt:'' + maskepage: 0, + backgps: {}, + buletxt: '', + + buleclose:false, + buleopen:false, + buleback:false, + bulepayback:false, + bulebindcar:false, + backfalse:0 } }, watch: { @@ -942,41 +955,78 @@ }, 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) { + this.mac = this.OrderdeviceInfos.mac + if (this.OrderdeviceInfos.onlineStatus != res.data.onlineStatus) { + this.OrderdeviceInfos = res.data + // this.OrderdeviceInfos.onlineStatus ='0' + + // if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status != + // 3) { + + // 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); // 每秒执行一次 + // 检查蓝牙权限状态 + uni.getBluetoothAdapterState({ + success: function (res) { + if (!res.available) { + console.log('蓝牙不可用'); + return; + } + if (!res.discovering) { + console.log('蓝牙正在搜索中'); + // 实际业务中可能需要根据需求处理 + } + if (res.authorized) { + console.log('已授权'); + // 已授权,可以进行蓝牙操作 + } else if (res.authorizing) { + console.log('正在授权'); + // 正在请求授权 + } else { + console.log('未授权'); + // 未授权,需要请求授权 + uni.authorize({ + scope: 'scope.bluetooth', + success() { + console.log('授权成功'); + // 授权成功,可以进行蓝牙操作 + }, + fail() { + console.log('授权失败'); + // 用户拒绝授权或者授权失败 + } + }); + } + }, + fail: function (err) { + console.log('获取蓝牙状态失败', err); + } + }); - if (this.seeDetail == false) { @@ -1125,9 +1175,75 @@ }, }, methods: { + totxtpage(){ + this.seeDetail=true + // uni.navigateTo({ + // url: + // }) + }, + offopencar(){ + this.bulebindcar=true + this.Binddevice() + }, + bluesub1() { + // uni.showLoading({}); + + let data = { + userId: this.userId, + sn: this.sn, + ruleId: this.freeInfo.ruleId, + mark: "确认开锁", + type: '1', + isBluetooth:true, + lon:this.backgps.longitude, + lat:this.backgps.latitude + + }; + + if(this.carstause){ + this.$u.post('/appVerify/device/snSwitch', data).then((res) => { + // uni.hideLoading(); + this.seeDetail = false; + if (res.code === 200) { + this.opencar() + this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + this.toploadtxt = '开锁成功'; + this.buletxt = '开锁成功'; + setTimeout(() => { + this.maskloading = false; + this.getisInOrder(); + }, 800); + } else { + if (res.msg == '您还未充值押金,请先充值押金') { + // this.close(); + // this.maskloading = false; + this.maskepage = 6 + // this.showYjTip = true; + } else if(res.msg=='【扫码/编号开锁骑行】发送开锁命令失败'){ + this.maskepage=3 + } else{ + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + this.toploadtxt = '开锁失败'; + setTimeout(() => { + this.maskloading = false; + + }, 800); + } + } + }); + }else{ + this.bulebindcar=true + this.Binddevice() + } + + }, taploadmask(num) { - this.maskepage=0 - this.loadimg='https://lxnapi.ccttiot.com/bike/img/static/urJQJnOI1DEjWatFqHYh' + this.maskepage = 0 + this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/urJQJnOI1DEjWatFqHYh' if (num == 1) { if (!this.checkBeforeUnlock()) { return; @@ -1157,7 +1273,7 @@ duration: 2000 }); } - }else if(num==2){ + } else if (num == 2) { //临时锁车 this.maskloading = true; let percentage = 0; @@ -1166,6 +1282,7 @@ percentage += 2; // 每次增加的百分比,可以调整 this.toploadtxt = `锁车中${percentage}%`; } else { + console.log('调用了'); clearInterval(interval); this.toploadtxt = "锁车中98%"; } @@ -1173,9 +1290,9 @@ setTimeout(() => { this.loackdevice(); }, 2100); - - }else if(num==3){ - //临时锁车 + + } else if (num == 3) { + //解锁用车 this.maskloading = true; let percentage = 0; const interval = setInterval(() => { @@ -1183,16 +1300,18 @@ percentage += 2; // 每次增加的百分比,可以调整 this.toploadtxt = `开锁中${percentage}%`; } else { + console.log('调用了'); clearInterval(interval); this.toploadtxt = "开锁中98%"; } }, 40); // 每40毫秒更新一次,可以调整 setTimeout(() => { + this.unloackdevices(); }, 2100); - - }else if(num==4){ - //临时锁车 + + } else if (num == 4) { + //还车校验 this.maskloading = true; let percentage = 0; const interval = setInterval(() => { @@ -1203,17 +1322,26 @@ clearInterval(interval); this.toploadtxt = "还车地点校验中98%"; } - }, 20); // 每40毫秒更新一次,可以调整 + }, 40); // 每40毫秒更新一次,可以调整 setTimeout(() => { this.cheackgps(); - }, 1100); - + }, 2100); + } - + }, Binddevice() { - this.maskepage=4 - this.buletxt = '设备连接中' + uni.getBluetoothAdapterState({ + success: function(res) { + console.log('蓝牙状态:', res.available) + }, + fail: function(res) { + console.log('获取蓝牙状态失败') + } + }) + this.devicesList=[] + this.maskepage = 4 + this.buletxt = '蓝牙连接中' // uni.showLoading({ // title: '蓝牙扫描中..' // }) @@ -1223,8 +1351,8 @@ xBlufi.notifyStartDiscoverBle({ 'isStart': true }); - - + + // 两秒后停止蓝牙搜索 setTimeout(() => { xBlufi.notifyStartDiscoverBle({ @@ -1233,14 +1361,15 @@ setTimeout(() => { // uni.hideLoading() if (this.devicesList.length == 0) { - uni.showToast({ - title: '暂无发现对应设备,请靠近设备', - icon: 'none', - duration: 1500 - }); + // uni.showToast({ + // title: '暂无发现对应设备,请靠近设备', + // icon: 'none', + // duration: 1500 + // }); + this.maskepage = 5 } else { let uniqueDevicesList = Array.from(new Set(this.devicesList)); - + // 将去重后的数组重新赋值给 this.devicesList this.devicesList = uniqueDevicesList; console.log(this.devicesList, 'this.devicesListthis.devicesList'); @@ -1257,184 +1386,236 @@ // this.ishave = true; istrue = true this.createBLEConnection(device) - + console.log('对比正确1111111111'); } else { console.log('对比错误'); - + } }); setTimeout(() => { if (!istrue) { this.buletxt = '蓝牙连接失败' - - + + setTimeout(() => { - this.maskepage=5 + this.maskepage = 5 }, 500) } - + }, 500) } - - + + }, 200) // 判断是否存在浇花器设备 - + // this.status = true }, 5000) - + }, - cheackgps(){ + 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.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 parkingReturn = true + // let isInParkingArea = false + let parkingReturn = res.data.parkingReturn /** 强制停车点还车 true:开启,false:关闭*/ let isInParkingArea = res.data.isInParkingArea /** 是否在停车区内*/ if (parkingReturn) { - // 可以在停车点外还车 + // 不可以在停车点外还车 if (isInParkingArea) { // 在停车点内 - if(that.OrderdeviceInfos.onlineStatus == 1){ + if (that.OrderdeviceInfos.onlineStatus == 1&&that.backfalse<1) { // 设备未离线 that.backDevice() - }else{ + } else if(that.OrderdeviceInfos.onlineStatus == 0||that.backfalse>=1) { 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(( + + 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() - + // that.close() + // that.getisInOrder() + that.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + that.toploadtxt = '还车成功!'; + setTimeout(() => { + that.maskloading = false; + that.getisInOrder(); + }, 1000); + } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + that.toploadtxt = '还车失败'; + setTimeout(() => { + that.maskloading = false; + }, 1000); + } }) } else { - + that.buleback=true + that.Binddevice() } } - }else{ - that.maskepage=1 + } else { + that.maskepage = 1 } - }else{ + } else { if (isInParkingArea) { // 在停车点内 - if(that.OrderdeviceInfos.onlineStatus == 1){ + if (that.OrderdeviceInfos.onlineStatus == 1&&that.backfalse<1) { // 设备未离线 that.backDevice() - }else{ + }else if(that.OrderdeviceInfos.onlineStatus == 0||that.backfalse>=1) { if (that.carstause) { - - that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo - .orderNo + '&isBluetooth=true' + '&lon=' + that.backgps.longitude + '&lat=' + that.backgps + + 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() - + that.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + that.toploadtxt = '还车成功!'; + setTimeout(() => { + that.maskloading = false; + that.getisInOrder(); + }, 1000); + + // that.close() + // that.getisInOrder() + } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + that.toploadtxt = '还车失败'; + setTimeout(() => { + that.maskloading = false; + }, 1000); } }) } else { - that.maskepage=3 + that.buleback=true + that.Binddevice() // 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 { + that.maskepage = 2 + // 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.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + // // that.toploadtxt = '还车成功!'; + // // setTimeout(() => { + // // that.maskloading = false; + // // that.getisInOrder(); + // // }, 1000); + // // // 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 - }); + that.toploadtxt = '校验失败'; + setTimeout(() => { + that.maskloading = false; + }, 1000); + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); } }) - - - + + + }, fail: function(error) { - + } - + }) }, - payback(){ - if(this.OrderdeviceInfos.onlineStatus == 1){ + payback() { + console.log(this.OrderdeviceInfos.onlineStatus,'this.OrderdeviceInfosthis.OrderdeviceInfos'); + if (this.OrderdeviceInfos.onlineStatus == 1&&this.backfalse<1) { // 设备未离线 - this.maskepage=0 + console.log('在线还车'); + 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%"; + } + }, 40); // 每40毫秒更新一次,可以调整 + setTimeout(() => { + this.backDevice() + }, 2100); + + } else if(this.OrderdeviceInfos.onlineStatus == 0||this.backfalse>=1) { + console.log('离线还车'); + this.maskepage = 0 this.maskloading = true; let percentage = 0; const interval = setInterval(() => { @@ -1447,17 +1628,60 @@ } }, 20); // 每40毫秒更新一次,可以调整 setTimeout(() => { - this.backDevice() + if (this.carstause==true) { + + this.$u.post('/appVerify/device/return?returnType=1&orderNo=' + this.orderinfo + .orderNo + '&isBluetooth=true' + '&lon=' + this.backgps.longitude + + '&lat=' + this.backgps + .latitude).then(( + res) => { + + if (res.code === 200) { + this.reboot() + this.isbackdevice = false + this.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + this.toploadtxt = '还车成功!'; + this.buletxt = '还车成功!'; + setTimeout(() => { + this.maskloading = false; + this.getisInOrder(); + }, 1000); + + // that.close() + // that.getisInOrder() + + } else { + this.toploadtxt = '还车失败!'; + this.buletxt = '还车失败!'; + setTimeout(() => { + this.maskloading = false; + this.getisInOrder(); + }, 1000); + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + } + }) + } else { + this.bulepayback=true + this.Binddevice() + // this.maskepage = 3 + // that.isbackdevice = false + // that.isnoline = true + } }, 1100); - - }else{ - + } + }, backDevice() { - - this.$u.post('/appVerify/device/return?returnType=1&orderNo=' + this.orderinfo.orderNo).then((res) => { - uni.hideLoading() + + this.$u.post('/appVerify/device/return?returnType=1&orderNo=' + this.orderinfo.orderNo).then(( + res) => { + if (res.code === 200) { this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; this.toploadtxt = '还车成功!'; @@ -1466,32 +1690,32 @@ this.maskloading = false; this.getisInOrder(); }, 800); - + } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + this.backfalse=this.backfalse+1 + this.toploadtxt = '还车失败'; + setTimeout(() => { + this.maskloading = false; + }, 1000); } }) - + }, 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 @@ -1502,14 +1726,15 @@ that.$u.post( '/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo - .orderNo + '&isBluetooth=true' + '&lon=' + lb + .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, @@ -1518,8 +1743,8 @@ }); } }) - - + + } else { uni.showToast({ title: '蓝牙状态异常,请重新链接', @@ -1530,8 +1755,8 @@ that.isnoline = true }, 1300) } - - + + } else { uni.showToast({ title: '停车点外禁止还车,请行驶至停车区内', @@ -1546,14 +1771,15 @@ that.$u.post( '/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo - .orderNo + '&isBluetooth=true' + '&lon=' + lb + .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, @@ -1562,8 +1788,8 @@ }); } }) - - + + } else { uni.showToast({ title: '蓝牙状态异常,请重新链接', @@ -1586,9 +1812,9 @@ }); } }) - - - + + + }, fail: function(error) { // uni.showToast({ @@ -1599,9 +1825,9 @@ // that.getmarks() // 在这里处理获取位置信息失败的情况 } - + }) - + }, // 新增的检查函数 checkBeforeUnlock() { @@ -1640,7 +1866,7 @@ // 确认开锁 sub1() { - uni.showLoading({}); + // uni.showLoading({}); let data = { userId: this.userId, @@ -1651,7 +1877,7 @@ }; this.$u.post('/appVerify/device/snSwitch', data).then((res) => { - uni.hideLoading(); + // uni.hideLoading(); this.seeDetail = false; if (res.code === 200) { this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; @@ -1664,14 +1890,22 @@ if (res.msg == '您还未充值押金,请先充值押金') { // this.close(); // this.maskloading = false; - this.maskepage=6 + this.maskepage = 6 // this.showYjTip = true; - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + } else if(res.msg=='【扫码/编号开锁骑行】发送开锁命令失败'){ + // this.maskepage=3 + this.offopencar() + } else{ + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + this.toploadtxt = '开锁失败'; + setTimeout(() => { + this.maskloading = false; + + }, 800); } } }); @@ -1778,8 +2012,10 @@ } if (that.carstause) { - that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that.orderinfo - .orderNo + '&isBluetooth=true' + '&lon=' + lb.longitude + '&lat=' + lb + that.$u.post('/appVerify/device/return?returnType=1&orderNo=' + that + .orderinfo + .orderNo + '&isBluetooth=true' + '&lon=' + lb.longitude + '&lat=' + + lb .latitude).then(( res) => { uni.hideLoading() @@ -1818,8 +2054,8 @@ }, - - + + // 蓝牙 // Binddevice() { // this.isnoline = false @@ -1975,40 +2211,49 @@ }); }, unloackdevices() { - if (this.OrderdeviceInfos.onlineStatus == 1) { + if (this.OrderdeviceInfos.onlineStatus == 1&&this.backfalse<1) { // uni.showLoading({ // title: '加载中...' // }) - this.$u.post('/appVerify/device/unlock?sn=' + this.OrderdeviceInfos.sn + '&orderNo=' + this.orderinfo + this.$u.post('/appVerify/device/unlock?sn=' + this.OrderdeviceInfos.sn + '&orderNo=' + this + .orderinfo .orderNo).then((res) => { if (res.code === 200) { - this.loadimg = 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + this.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; this.toploadtxt = '开锁成功'; + this.buleopen=false setTimeout(() => { this.maskloading = false; this.getisInOrder(); - }, 800); + }, 1000); + } else { - if (res.msg == '10500-----') { + this.backfalse=this.backfalse+1 + this.toploadtxt = '开锁失败'; + setTimeout(() => { this.maskloading = false; - uni.showToast({ - title: '系统异常,请重新尝试', - icon: 'none', - duration: 2000 - }); - } else { - this.maskloading = false; - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } + }, 1000); + // if (res.msg == '10500-----') { + + // uni.showToast({ + // title: '系统异常,请重新尝试', + // icon: 'none', + // duration: 2000 + // }); + // } else { + + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + // } } }) - } else { + } else if(this.OrderdeviceInfos.onlineStatus == 0||this.backfalse>=1) { if (this.carstause) { @@ -2024,30 +2269,43 @@ areaId: that.areaInfo.areaId } that.$u.post('/appVerify/device/unlock?sn=' + that.OrderdeviceInfos - .sn + '&orderNo=' + - that - .orderinfo - .orderNo + '&isBluetooth=true' + '&lon=' + lb.longitude + - '&lat=' + lb.latitude).then((res) => { + .sn + '&orderNo=' + that.orderinfo.orderNo + + '&isBluetooth=true' + '&lon=' + lb.longitude + '&lat=' + lb + .latitude).then((res) => { if (res.code === 200) { that.opencar() - console.log('发送了离线开锁请求'); - that.getisInOrder() + that.buleopen=false + // console.log('发送了离线开锁请求'); + // that.getisInOrder() + that.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + that.buletxt = '解锁成功'; + that.toploadtxt='解锁成功' + setTimeout(() => { + that.maskloading = false; + that.getisInOrder(); + }, 1000); } else { - if (res.msg == '10500-----') { - uni.showToast({ - title: '系统异常,请重新尝试', - icon: 'none', - duration: 2000 - }); - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } + + that.toploadtxt='开锁失败' + that.buletxt = '开锁失败'; + setTimeout(() => { + that.maskloading = false; + }, 1000); + // if (res.msg == '10500-----') { + // uni.showToast({ + // title: '系统异常,请重新尝试', + // icon: 'none', + // duration: 2000 + // }); + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + // } } }) @@ -2066,8 +2324,9 @@ }) } else { - console.log('蓝牙没了'); - this.isnoline = true + // this.maskepage = 3 + this.buleopen=true + this.Binddevice() } } @@ -2075,39 +2334,48 @@ }, // ;临时锁车 loackdevice() { - if (this.OrderdeviceInfos.onlineStatus == 1) { - uni.showLoading({ - title: '加载中...' - }) - this.$u.post('/appVerify/device/lock?sn=' + this.OrderdeviceInfos.sn + '&orderNo=' + this.orderinfo + if (this.OrderdeviceInfos.onlineStatus == 1&&this.backfalse<1) { + // uni.showLoading({ + // title: '加载中...' + // }) + this.$u.post('/appVerify/device/lock?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.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; this.toploadtxt = '锁车成功'; + this.buleclose=false setTimeout(() => { this.maskloading = false; this.getisInOrder(); - }, 800); + }, 1000); } else { - if (res.msg == '10500-----') { - uni.showToast({ - title: '系统异常,请重新尝试', - icon: 'none', - duration: 2000 - }); - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } + this.backfalse=this.backfalse+1 + this.toploadtxt = '锁车失败'; + setTimeout(() => { + this.maskloading = false; + }, 1000); + + // if (res.msg == '10500-----') { + // uni.showToast({ + // title: '系统异常,请重新尝试', + // icon: 'none', + // duration: 2000 + // }); + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + // } } }) - } else { + } else if(this.OrderdeviceInfos.onlineStatus == 0||this.backfalse>=1) { if (this.carstause) { @@ -2131,22 +2399,38 @@ if (res.code === 200) { that.closecar() - console.log('发送了离线锁车请求'); - that.getisInOrder() + // console.log('发送了离线锁车请求'); + // that.getisInOrder() + that.buleclose=false + that.loadimg = + 'https://lxnapi.ccttiot.com/bike/img/static/upNvRa9ZQMyiwxLliF5z'; + that.buletxt = '锁车成功'; + that.toploadtxt='锁车成功' + setTimeout(() => { + that.maskloading = false; + that.getisInOrder(); + }, 1000); } else { - if (res.msg == '10500-----') { - uni.showToast({ - title: '系统异常,请重新尝试', - icon: 'none', - duration: 2000 - }); - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } + that.toploadtxt='锁车失败' + that.buletxt = '锁车失败'; + setTimeout(() => { + that.maskloading = false; + }, 1000); + + + // if (res.msg == '10500-----') { + // uni.showToast({ + // title: '系统异常,请重新尝试', + // icon: 'none', + // duration: 2000 + // }); + // } else { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // duration: 2000 + // }); + // } } }) @@ -2164,8 +2448,9 @@ }) } else { - console.log('点击了'); - this.isnoline = true + this.buleclose=true + this.Binddevice() + // this.maskepage = 3 } } @@ -2237,13 +2522,15 @@ if (options.result == false) { // this.loadingmask=false this.carstause = false - - this.buletxt = '设备连接失败' + if (this.maskepage == 4) { + this.buletxt = '设备连接失败' - setTimeout(() => { - this.maskepage = 5 - }, 800) + setTimeout(() => { + this.maskepage = 5 + }, 800) + } + // uni.showModal({ // title: '很抱歉提醒你!', // content: '小程序与设备异常断开', @@ -2264,31 +2551,70 @@ if (options.data) { this.carstause = true - this.buletxt = '蓝牙连接成功!' - if (this.maskloading) { - setTimeout(() => { - this.maskloading = false - }, 700) + + if (this.maskloading && this.maskepage == 4) { + // setTimeout(() => { + // this.maskloading = false + // }, 700) + if(this.buleback==false&&this.buleopen==false&&this.buleclose==false&&this.bulebindcar==false){ + if(this.buletxt=='蓝牙连接中'){ + this.buletxt = '蓝牙连接成功!' + } + + } + if(this.buleclose){ + this.buleclose=false + this.loackdevice() + } + if(this.buleopen){ + this.buleopen=false + this.unloackdevices() + } + if(this.buleback){ + this.buleback=false + this.cheackgps() + } + if(this.bulepayback){ + this.bulepayback=false + this.payback() + } + if(this.bulebindcar){ + this.bulebindcar=false + this.bluesub1() + } + } + + } else { this.carstause = false - this.buletxt = '设备连接失败' - - - setTimeout(() => { - this.maskepage = 5 - }, 800) + if (this.maskepage == 4) { + 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 + if (this.maskepage == 4) { + this.buletxt = '设备连接失败' + + + setTimeout(() => { + this.maskepage = 5 + }, 800) + } // uni.showToast({ // title: '设备断开链接,请重新点击蓝牙链接', // icon: 'none' @@ -2313,7 +2639,8 @@ let uniqueDevicesList = Array.from(new Set(this.devicesList)); // 过滤出名称字段的前五个字母为 "CTPOW" 的项 - let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, 4) === + let filteredDevices = uniqueDevicesList.filter(device => device.name.substring(0, + 4) === "BBLE"); // 将过滤后的数组重新赋值给 this.devicesList @@ -2454,10 +2781,10 @@ 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' + this.mac = this.OrderdeviceInfos.mac if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status != 3) { - this.mac = this.OrderdeviceInfos.mac + if (this.carstause == false) { // this.isnoline = true @@ -2810,7 +3137,7 @@ // 套餐取消预约 - + // 套餐直接开锁 sub6() { if (this.orderinfo.ruleId) { @@ -3029,9 +3356,11 @@ sub5() { if (this.orderinfo.ruleId) { - this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + '&ruleId=' + + this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + + '&ruleId=' + this - .orderinfo.ruleId + '&type=2' + '&orderNo=' + this.orderinfo.orderNo).then((res) => { + .orderinfo.ruleId + '&type=2' + '&orderNo=' + this.orderinfo.orderNo).then(( + res) => { if (res.code === 200) { uni.showLoading({ title: '预约中...' @@ -3143,7 +3472,8 @@ } - this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + + this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + + this.sn + '&ruleId=' + this .freeInfo.ruleId).then((res) => { @@ -3196,7 +3526,8 @@ } - this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + + this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this + .sn + '&ruleId=' + this .freeInfo.ruleId).then((res) => { @@ -3309,13 +3640,13 @@ }, getisInOrder() { - uni.showLoading({ + // uni.showLoading({ - }) + // }) this.orderinfo = {} if (this.userId) { this.$u.post('/app/user/isInOrder?userId=' + this.userId, ).then((res) => { - uni.hideLoading() + // uni.hideLoading() if (res.code === 200) { // this.freList=res.rows if (res.data != '') { @@ -3355,7 +3686,8 @@ try { item.ridingRuleJson = JSON.parse(item.ridingRuleJson); } catch (e) { - console.error('Invalid JSON in ridingRuleJson:', item.ridingRuleJson); + console.error('Invalid JSON in ridingRuleJson:', item + .ridingRuleJson); } return item; }); @@ -3483,77 +3815,41 @@ }, - toggleIconAndCallout() { - this.showIconAndCallout = !this.showIconAndCallout; - if (this.showIconAndCallout) { - const newMarkers = []; - this.parkingList.forEach(item => { - newMarkers.push({ - id: parseFloat(item.parkingId), - latitude: parseFloat(item.latitude), - longitude: parseFloat(item.longitude), - width: 20, - height: 28.95, - iconPath: item.type == 1 ? - 'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' : item - .type == 2 ? - 'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t' : - ' https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq', - callout: { - content: item.parkingName, - color: '#ffffff', - fontSize: 14, - borderRadius: 10, - bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? '#FFC107' : - '#FF473E', - padding: 6, - display: 'ALWAYS' - }, - isCalloutVisible: true // 添加标记 - }); - }); - this.$set(this, 'markers', [...this.markers, ...newMarkers]); - } else { - // 过滤掉所有气泡显示的标记 - this.$set(this, 'markers', this.markers.filter(marker => !marker.isCalloutVisible)); - } - - }, + getmarks() { - let data = { - areaId: this.areaInfo.areaId - }; - if (this.areaInfo.areaId) { - this.$u.get(`/app/allVehicleByArea`, data).then((res) => { - if (res.code === 200 && res.data != '') { - this.listData = res.data.filter(item => item.onlineStatus != 0); - const newMarkers = this.listData.map(item => ({ - id: parseFloat(item.sn), - latitude: parseFloat(item.latitude), - longitude: parseFloat(item.longitude), - width: 40, - height: 28, - iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7', - })); - - // 保留显示气泡的标记 - const preservedMarkers = this.markers.filter(marker => marker.isCalloutVisible || - marker.isDeviceMarker); - - // 假设newMarkers是从新数据生成的标记数组 - // 更新markers数组,避免删除已标识的重要标记 - this.markers = [...newMarkers.filter(newMarker => - !preservedMarkers.some(preservedMarker => preservedMarker.id === newMarker - .id) - ), ...preservedMarkers]; - - this.oldMarkers = [...this.markers]; - } - }).catch(error => { - // 处理接口请求失败的情况 - }); - } + let data = { + areaId: this.areaInfo.areaId + }; + if (this.areaInfo.areaId) { + this.$u.get(`/app/allVehicleByArea`, data).then((res) => { + if (res.code === 200 && res.data != '') { + this.listData = res.data + // this.listData[0].onlineStatus=0 + // this.listData = res.data.filter(item => item.onlineStatus != 0); + const newDeviceMarkers = this.listData.map(item => ({ + id: parseFloat(item.sn), + latitude: parseFloat(item.latitude), + longitude: parseFloat(item.longitude), + width: 40, + height: 28, // 确保这里是数字类型 + iconPath: 'https://api.ccttiot.com/smartmeter/img/static/uF9qLejuAZErNTrRuHq7', + isDeviceMarker: true // 区分为设备标记 + })); + + // 保留停车场标记 + const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker); + + // 更新markers数组,避免删除已标识的重要标记 + this.markers = [...newDeviceMarkers, ...preservedMarkers]; + this.$set(this, 'markers', [...this.markers]); + + this.oldMarkers = [...this.markers]; + } + }).catch(error => { + console.error("Error fetching device data:", error); + }); + } }, isMarkersChanged(newMarkers) { if (this.oldMarkers.length !== newMarkers.length) { @@ -3630,34 +3926,34 @@ } }, getSNFromQRCode(url) { - // 解码URL - - let decodedUrl = decodeURIComponent(url); - - // 使用正则表达式提取sn参数 - let snMatch = decodedUrl.match(/[\?&]sn=([^&#]*)/); - if (snMatch) { - return snMatch[1]; - } else { - return null; - } - }, + // 解码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'); + console.log(this.qParam, 'qParamqParamqParamqParam'); this.polyline = [] // if(this.qParam){ - + // } - if(this.qParam!=''&&this.qParam!=null){ - this.sn=this.getSNFromQRCode(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) @@ -3701,9 +3997,9 @@ this.startCountdown(); } - if(this.sn){ + if (this.sn) { this.deviceInfo(0) - this.qParam=null + this.qParam = null } // if(!hasShownPopup){ @@ -3727,51 +4023,104 @@ console.error("Error fetching area data:", error); }); }, - + toggleIconAndCallout() { + this.showIconAndCallout = !this.showIconAndCallout; + this.markers = this.markers.map(marker => { + if (this.showIconAndCallout) { + // 显示气泡 + if (marker.isParkingMarker) { + marker.callout.display = 'ALWAYS'; + marker.isCalloutVisible = true; + } + } else { + // 隐藏气泡 + if (marker.isParkingMarker) { + marker.callout.display = 'BYCLICK'; + marker.isCalloutVisible = false; + } + } + return marker; + }); + // 强制更新markers数组 + this.$set(this, 'markers', [...this.markers]); + }, getParking() { - // 发送请求获取数据 - // this.polyline=[] - let data = { - areaId: this.areaInfo.areaId - } - this.$u.get('/app/parking/list?', data).then((res) => { - if (res.code === 200) { - // 处理接口返回的数据 - const type1Data = []; - const type2Data = []; - const type3Data = []; - - res.rows.forEach(row => { - if (row.type == 1) { - type1Data.push(row); - } else if (row.type == 2) { - type2Data.push(row); - } else if (row.type == 3) { - type3Data.push(row); - } - }); - const validBoundaries = type1Data.map(row => row.boundaryStr).filter(boundary => - typeof boundary === 'string' && boundary.trim() !== ''); - const polylines = this.convertBoundaryToPolylines(validBoundaries, 1); - - - const validBoundaries1 = type2Data.map(row => row.boundaryStr).filter(boundary => - typeof boundary === 'string' && boundary.trim() !== ''); - const polylines1 = this.convertBoundaryToPolylines(validBoundaries1, 2); - - const validBoundaries2 = type3Data.map(row => row.boundaryStr).filter(boundary => - typeof boundary === 'string' && boundary.trim() !== ''); - const polylines2 = this.convertBoundaryToPolylines(validBoundaries2, 3); - // 将处理后的数据添加到 this.polyline 中 - this.polyline = this.polyline.concat(polylines2); - this.polyline = this.polyline.concat(polylines1); - this.polyline = this.polyline.concat(polylines); - this.parkingList = res.rows - // console.log(this.polyline); - } - }).catch(error => { - console.error("Error fetching parking data:", error); - }); + // 发送请求获取数据 + let data = { + areaId: this.areaInfo.areaId + } + this.$u.get('/app/parking/list?', data).then((res) => { + if (res.code === 200) { + // 处理接口返回的数据 + const type1Data = []; + const type2Data = []; + const type3Data = []; + + res.rows.forEach(row => { + if (row.type == 1) { + type1Data.push(row); + } else if (row.type == 2) { + type2Data.push(row); + } else if (row.type == 3) { + type3Data.push(row); + } + }); + const validBoundaries = type1Data.map(row => row.boundaryStr).filter( + boundary => + typeof boundary === 'string' && boundary.trim() !== ''); + const polylines = this.convertBoundaryToPolylines(validBoundaries, 1); + + const validBoundaries1 = type2Data.map(row => row.boundaryStr).filter( + boundary => + typeof boundary === 'string' && boundary.trim() !== ''); + const polylines1 = this.convertBoundaryToPolylines(validBoundaries1, 2); + + const validBoundaries2 = type3Data.map(row => row.boundaryStr).filter( + boundary => + typeof boundary === 'string' && boundary.trim() !== ''); + const polylines2 = this.convertBoundaryToPolylines(validBoundaries2, 3); + // 将处理后的数据添加到 this.polyline 中 + this.polyline = this.polyline.concat(polylines2); + this.polyline = this.polyline.concat(polylines1); + this.polyline = this.polyline.concat(polylines); + this.parkingList = res.rows; + + // 设置停车场标记并区分 + const newParkingMarkers = res.rows.map(item => ({ + id: parseFloat(item.parkingId), + latitude: parseFloat(item.latitude), + longitude: parseFloat(item.longitude), + width: 20, + height: 29, + iconPath: item.type == 1 ? + 'https://lxnapi.ccttiot.com/bike/img/static/up2xXqAgwCX5iER600k3' : item + .type == 2 ? + 'https://lxnapi.ccttiot.com/bike/img/static/u53BAQcFIX3vxsCzEZ7t' : + 'https://lxnapi.ccttiot.com/bike/img/static/uDNY5Q4zOiZTCBTA2Jdq', + callout: { + content: item.parkingName, + color: '#ffffff', + fontSize: 14, + borderRadius: 10, + bgColor: item.type == 1 ? '#3A7EDB' : item.type == 2 ? + '#FFC107' : '#FF473E', + padding: 6, + display: 'BYCLICK' // 初始时不显示气泡 + }, + isCalloutVisible: false, // 初始时不显示气泡 + isParkingMarker: true // 区分为停车场标记 + })); + + // 保留设备标记 + const preservedMarkers = this.markers.filter(marker => marker.isDeviceMarker); + + // 合并停车场标记和设备标记 + this.markers = [...newParkingMarkers, ...preservedMarkers]; + this.$set(this, 'markers', [...this.markers]); + } + }).catch(error => { + console.error("Error fetching parking data:", error); + }); }, convertBoundaryToPolyline(boundary) { if (!boundary) return null; @@ -3884,7 +4233,7 @@ // }) } else if (num == 1) { - this.maskloading=false + this.maskloading = false if (uni.getStorageSync('token')) { if (this.areaInfo.authentication == 1) { this.$u.get("/getAppInfo").then(res => { @@ -3938,7 +4287,8 @@ uni.showLoading({ title: '登录中...' }); - that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId) + that.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + + areaId) .then(res => { uni.hideLoading(); if (res.code == 200) { @@ -3947,9 +4297,11 @@ that.$u.get("/getAppInfo").then(res => { if (res.code == 200) { that.userinfo = res.user; - that.$store.commit('SET_USERID', res + that.$store.commit( + 'SET_USERID', res .user.userId); - if (res.user.isAuthentication == 0) { + if (res.user + .isAuthentication == 0) { uni.hideLoading() that.seeDetail = true; @@ -3962,7 +4314,8 @@ console.log('跳转3'); uni.navigateTo({ url: '/page_user/yj?isback=' + - that.showYjTip + that + .showYjTip }); that.showYjTip = false } @@ -3980,7 +4333,8 @@ uni.hideLoading() console.log('跳转4'); uni.navigateTo({ - url: '/page_user/yj?isback=' + that.showYjTip + url: '/page_user/yj?isback=' + that + .showYjTip }); that.showYjTip = false } @@ -4079,7 +4433,9 @@ this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { if (res.code === 200) { this.deviceInfos = res.data; - + if(!this.orderinfo.sn){ + this.mac=res.data.mac + } if (num == 0) { this.showdevice = true; this.type = 0; @@ -4160,96 +4516,107 @@ }; let areaId = uni.getStorageSync('areaId'); if (areaId) { - this.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId) + this.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + + areaId) .then(( res) => { // uni.hideLoading(); if (res.code == 200) { uni.setStorageSync('token', res.token); this.getinfo() - this.$u.get('/app/device/info?sn=' + this.sn).then(( - res) => { - if (res.code === 200) { - this.deviceInfos = res.data; + this.$u.get('/app/device/info?sn=' + this.sn) + .then(( + res) => { + if (res.code === 200) { + this.deviceInfos = res.data; - if (num == 0) { - this.showdevice = true; - this.type = 0; - } else { - if (this.deviceInfos.onlineStatus == - 0) { - uni.showToast({ - title: '车辆离线中,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 0) { - uni.showToast({ - title: '车辆未上架,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 2) { - uni.showToast({ - title: '车辆预约中,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 3) { - uni.showToast({ - title: '车辆骑行中,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 4) { - uni.showToast({ - title: '车辆临时锁车中,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 8) { - uni.showToast({ - title: '车辆下线中,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 9) { - uni.showToast({ - title: '车辆已废弃,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 7) { - uni.showToast({ - title: '车辆未上线,请使用其他车辆', - icon: 'none', - duration: 4000 - }); - } else if (this.deviceInfos.status == - 1) { + if (num == 0) { this.showdevice = true; - this.type = 1; - this.deviceIndex = 1; + this.type = 0; + } else { + if (this.deviceInfos + .onlineStatus == + 0) { + uni.showToast({ + title: '车辆离线中,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 0) { + uni.showToast({ + title: '车辆未上架,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 2) { + uni.showToast({ + title: '车辆预约中,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 3) { + uni.showToast({ + title: '车辆骑行中,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 4) { + uni.showToast({ + title: '车辆临时锁车中,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 8) { + uni.showToast({ + title: '车辆下线中,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 9) { + uni.showToast({ + title: '车辆已废弃,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 7) { + uni.showToast({ + title: '车辆未上线,请使用其他车辆', + icon: 'none', + duration: 4000 + }); + } else if (this.deviceInfos + .status == + 1) { + this.showdevice = true; + this.type = 1; + this.deviceIndex = 1; + } } + } else { + this.showdevice = false; + this.deviceIndex = 0; + this.type = 0; + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); } - } else { - this.showdevice = false; - this.deviceIndex = 0; - this.type = 0; - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } - }); + }); } else if (res.code == 501) { uni.showToast({ title: res.msg, @@ -4331,26 +4698,27 @@ background: #FFFFFF; border-radius: 40rpx 40rpx 0rpx 0rpx; z-index: 101; - .maskpage0{ + + .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%; @@ -4359,40 +4727,42 @@ 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{ + + .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%; @@ -4401,22 +4771,22 @@ 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{ + + .btn_box { width: 750rpx; padding: 0 36rpx; position: absolute; @@ -4425,7 +4795,8 @@ display: flex; justify-content: space-between; align-items: center; - .btn3{ + + .btn3 { // margin-right: 16rpx; display: flex; align-items: center; @@ -4434,12 +4805,13 @@ height: 90rpx; background: #4C97E7; border-radius: 45rpx 45rpx 45rpx 45rpx; - + font-weight: 500; font-size: 40rpx; color: #FFFFFF; } - .btn4{ + + .btn4 { display: flex; align-items: center; justify-content: center; @@ -4447,14 +4819,14 @@ height: 90rpx; border-radius: 45rpx 45rpx 45rpx 45rpx; border: 2rpx solid #808080; - + font-weight: 500; font-size: 40rpx; color: #808080; } } } - + } .tab_top { @@ -4497,7 +4869,7 @@ align-items: center; justify-content: center; right: 30rpx; - bottom: 520rpx; + top: 220rpx; // background-color: #fff; border-radius: 50%; width: 82rpx; @@ -4516,7 +4888,7 @@ align-items: center; justify-content: center; right: 30rpx; - bottom: 600rpx; + top: 300rpx; // background-color: #fff; border-radius: 50%; width: 82rpx; diff --git a/pages_admin/worke/worke_Operation.vue b/pages_admin/worke/worke_Operation.vue index f82cc35..759a8b5 100644 --- a/pages_admin/worke/worke_Operation.vue +++ b/pages_admin/worke/worke_Operation.vue @@ -40,7 +40,7 @@ 总营收 ¥{{info.income.totalIncome}} - 累计待支付 ¥{{info.income.totalIncome}} + 累计待支付 ¥{{info.income.totalUnpaid}}