From ec77601bd64ab2a61f838607b6b2da5a8c0266fe Mon Sep 17 00:00:00 2001 From: tx <2622874537@qq.com> Date: Mon, 12 Aug 2024 17:52:23 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E9=94=81=E7=AD=89bug=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 6 +- manifest.json | 2 +- page_user/changeCar.vue | 14 +- pages/index/index.vue | 333 ++++++++++++++++------------- pages_admin/admin_order.vue | 40 +++- pages_admin/order/order_detail.vue | 51 ++++- pages_adminSet/shgl.vue | 190 ++++++++++++++++ 7 files changed, 467 insertions(+), 169 deletions(-) create mode 100644 pages_adminSet/shgl.vue diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 02a1480..858f47d 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,13 +1,13 @@ const install = (Vue, vm) => { - uni.setStorageSync('deptId', 100); + uni.setStorageSync('deptId', 101); Vue.prototype.$u.http.setConfig({ // baseUrl: 'http://61.174.243.28:15861', // baseUrl: 'http://192.168.2.46: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: 10000, // 设置自定义头部content-type diff --git a/manifest.json b/manifest.json index 3106710..5b8abf7 100644 --- a/manifest.json +++ b/manifest.json @@ -51,7 +51,7 @@ /* 小程序特有相关 */ "mp-weixin" : { "libVersion" : "latest", - "appid" : "wx3428c498d5061192", + "appid" : "wx4d178f8c80348214", "setting" : { "urlCheck" : false, "minified" : true diff --git a/page_user/changeCar.vue b/page_user/changeCar.vue index e80d35a..e349114 100644 --- a/page_user/changeCar.vue +++ b/page_user/changeCar.vue @@ -597,7 +597,7 @@ icon: 'none', duration: 1000 }); - } else if (this.areainfo.returnVerify === 1 && this.videoUrl === '') { + } else if (this.areainfo.returnVerify == 1 && this.videoUrl == '') { uni.showToast({ title: '请拍摄还车视频', icon: 'none', @@ -624,6 +624,7 @@ duration: 1000 }); } else { + // if(this.) if (num === 0) { this.maskloading = true; this.maskepage = 0; @@ -691,6 +692,12 @@ this.subs(1) } else { + uni.showToast({ + title: '换车关锁失败', + icon: 'none', + duration: 1000 + }); + // 处理接口返回错误的情况 this.mac = this.orderinfo.mac this.buleclose = true @@ -721,6 +728,11 @@ this.subs(1) } else { + uni.showToast({ + title: '换车开锁失败', + icon: 'none', + duration: 1000 + }); this.mac = this.deviceinfo.mac this.buleopen = true this.Binddevice() diff --git a/pages/index/index.vue b/pages/index/index.vue index 4d341d3..0067533 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -280,7 +280,7 @@ - + 可继续行驶{{OrderdeviceInfos.remainingMileage}}公里 @@ -288,11 +288,11 @@ - + NO.{{orderinfo.sn}} - - 换车开锁失败,请点击换车按钮重新换车 + + 换车开锁失败,请点击换车按钮重新换车 @@ -324,20 +324,21 @@ + v-if="orderinfo.sn && (OrderdeviceInfos.status == 3 || OrderdeviceInfos.status == 6)" + @click="taploadmask (2)"> 临时锁车 解锁用车 - + 继续换车 - + 还车 - + 结束订单 @@ -1062,10 +1063,11 @@ showparkinfo: false, parkinfo: {}, netonlines: false, - isqrcode:false, - deviceGps:{ - - } + isqrcode: false, + deviceGps: { + + }, + tozf:false } }, watch: { @@ -1082,8 +1084,8 @@ showdevice(newValue, oldValue) { console.log('showdevice变化了', newValue, oldValue); }, - deviceIndex(newValue, oldValue) { - console.log('deviceIndex变化了', newValue, oldValue); + showtcs(newValue, oldValue) { + console.log('showtcs变化了', newValue, oldValue); }, }, @@ -1144,7 +1146,8 @@ // this.deviceIndex = 1 // this.type = 1 } - }, 700) + }, 500) + } @@ -1194,7 +1197,7 @@ console.log('获取蓝牙状态失败', err); } }); - + console.log(this.seeDetail, 'this.seeDetailthis.seeDetail'); if (this.seeDetail == false) { let that = this uni.getNetworkType({ @@ -1295,8 +1298,8 @@ } else { this.getinfo() - - + + } }, @@ -1365,6 +1368,8 @@ }); }, tochange() { + this.seeDetail = false + this.tozf=true uni.navigateTo({ url: '/page_user/changeCar' }) @@ -1500,7 +1505,7 @@ this.deviceIndex = 0 // this.sn = '' this.type = 0 - this.freeInfo = {} + // this.freeInfo = {} // this.freeListIndex = 0 this.mappolyline = [] // this.showparkinfo=false @@ -1564,7 +1569,7 @@ this.showdevice = false; this.deviceIndex = 0; this.type = 0; - this.freeInfo = {}; + // this.freeInfo = {}; // this.freeListIndex = 0; this.parkinfo = {} this.showparkinfo = false @@ -1583,7 +1588,7 @@ if (markerExists) { this.sn = e.markerId; - this.deviceInfo(1); + this.deviceInfo(0); // Revert the last clicked marker to the default image and zIndex if (this.lastClickedMarkerId !== null) { @@ -1668,7 +1673,7 @@ return R * c; }, - + timestare() { this.timers = setInterval(() => { this.getmarks(); @@ -1676,9 +1681,9 @@ if (this.orderinfo.sn) { this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => { if (res.code === 200) { - this.isqrcode=false + // this.isqrcode=false this.mac = this.OrderdeviceInfos.mac; - + // this.OrderdeviceInfos.onlineStatus = '1' if (this.OrderdeviceInfos.onlineStatus !== res.data.onlineStatus) { this.OrderdeviceInfos = res.data; @@ -2456,6 +2461,7 @@ // 新增的检查函数 checkBeforeUnlock() { + // console.log(this.freeInfo,'this.freeInfothis.freeInfo'); if (!this.freeInfo.ruleId) { uni.hideLoading(); uni.showToast({ @@ -2561,7 +2567,7 @@ }, getmarks() { - if(this.isqrcode){ + if (this.isqrcode) { let data = { areaId: this.areaInfo.areaId }; @@ -2578,14 +2584,15 @@ iconPath: this.defaultMarkerIconPath, isDeviceMarker: true // 区分为设备标记 })); - + // 保留停车标记和特定设备标记 - const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker || marker + const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker || + marker .id === parseFloat(this.OrderdeviceInfos.sn)); - + // 更新markers数组,避免删除已识别的重要标记 let updatedMarkers = [...newDeviceMarkers, ...preservedMarkers]; - + // 确保点击的标记保持其图标 if (this.lastClickedMarkerId != null) { updatedMarkers = updatedMarkers.map(marker => { @@ -2600,83 +2607,85 @@ return marker; }); } - + // 使用this.$set触发Vue的响应式更新 this.$set(this, 'markers', updatedMarkers); - + this.oldMarkers = [...this.markers]; } }).catch(error => { console.error("Error fetching device data:", error); }); } - - }else{ + + } else { let data = { - longitude: this.deviceGps.longitude, - latitude: this.deviceGps.latitude, - deptId :uni.getStorageSync('deptId') - + longitude: this.deviceGps.longitude, + latitude: this.deviceGps.latitude, + deptId: uni.getStorageSync('deptId') + } - - + + this.$u.get(`/app/vehicleLocalization?`, data).then((res) => { - if (res.code === 200) { - if (res.data !== '') { - this.listData = res.data; - const newDeviceMarkers = this.listData.map(item => ({ - id: parseFloat(item.sn), - latitude: parseFloat(item.latitude), - longitude: parseFloat(item.longitude), - width: 40, - height: 28, - iconPath: this.defaultMarkerIconPath, - isDeviceMarker: true // 区分为设备标记 - })); - - // 保留停车标记和特定设备标记 - const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker || marker.id === parseFloat(this.OrderdeviceInfos.sn)); - - // 更新markers数组,避免删除已识别的重要标记 - let updatedMarkers = [...newDeviceMarkers, ...preservedMarkers]; - - // 确保点击的标记保持其图标 - if (this.lastClickedMarkerId != null) { - updatedMarkers = updatedMarkers.map(marker => { - if (marker.id === this.lastClickedMarkerId) { - return { - ...marker, - width: 50, - height: 35, - iconPath: this.clickedMarkerIconPath - }; - } - return marker; - }); - } - - // 使用this.$set触发Vue的响应式更新 - this.$set(this, 'markers', updatedMarkers); - this.oldMarkers = [...this.markers]; - } else { - // 当 res.data 为空时,删除 markers 中对应的设备标记 - this.markers = this.markers.filter(marker => marker.isParkingMarker || marker.id === parseFloat(this.OrderdeviceInfos.sn)); - - // 使用this.$set触发Vue的响应式更新 - this.$set(this, 'markers', this.markers); - } - } + if (res.code === 200) { + if (res.data !== '') { + this.listData = res.data; + const newDeviceMarkers = this.listData.map(item => ({ + id: parseFloat(item.sn), + latitude: parseFloat(item.latitude), + longitude: parseFloat(item.longitude), + width: 40, + height: 28, + iconPath: this.defaultMarkerIconPath, + isDeviceMarker: true // 区分为设备标记 + })); + + // 保留停车标记和特定设备标记 + const preservedMarkers = this.markers.filter(marker => marker.isParkingMarker || + marker.id === parseFloat(this.OrderdeviceInfos.sn)); + + // 更新markers数组,避免删除已识别的重要标记 + let updatedMarkers = [...newDeviceMarkers, ...preservedMarkers]; + + // 确保点击的标记保持其图标 + if (this.lastClickedMarkerId != null) { + updatedMarkers = updatedMarkers.map(marker => { + if (marker.id === this.lastClickedMarkerId) { + return { + ...marker, + width: 50, + height: 35, + iconPath: this.clickedMarkerIconPath + }; + } + return marker; + }); + } + + // 使用this.$set触发Vue的响应式更新 + this.$set(this, 'markers', updatedMarkers); + this.oldMarkers = [...this.markers]; + } else { + // 当 res.data 为空时,删除 markers 中对应的设备标记 + this.markers = this.markers.filter(marker => marker.isParkingMarker || marker + .id === parseFloat(this.OrderdeviceInfos.sn)); + + // 使用this.$set触发Vue的响应式更新 + this.$set(this, 'markers', this.markers); + } + } }).catch(error => { - console.error("Error fetching device data:", error); + console.error("Error fetching device data:", error); }); } - - - + + + }, - - + + onMapRegionChange(event) { // console.log('regionchange', event) if (event.detail.type == 'end') { @@ -3397,28 +3406,31 @@ this.seeDetail = false clearInterval(this.timer) this.timer = null - this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => { - if (res.code === 200) { - this.OrderdeviceInfos = res.data - // this.OrderdeviceInfos.onlineStatus = '1' - this.mac = this.OrderdeviceInfos.mac - if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status != 3) { + if (this.orderinfo.sn) { + this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => { + if (res.code === 200) { + this.OrderdeviceInfos = res.data + // this.OrderdeviceInfos.onlineStatus = '1' + this.mac = this.OrderdeviceInfos.mac + if (this.OrderdeviceInfos.onlineStatus == 0 && this.orderinfo.status != 3) { - if (this.carstause == false) { + if (this.carstause == false) { + + // this.isnoline = true + } - // this.isnoline = true } + + } else { + // 处理接口返回错误的情况 } + }).catch(error => { + // 处理接口请求失败的情况 + }); + } - } else { - // 处理接口返回错误的情况 - } - }).catch(error => { - // 处理接口请求失败的情况 - }); - // 预约中 if (this.orderinfo.status == 0) { @@ -4258,9 +4270,11 @@ clearInterval(this.timer) this.starTime() } - // if (this.areaInfo.areaId != res.data[0].areaId) { - // this.getArea() - // } + if (this.areaInfo.areaId != res.data[0].areaId && this.orderinfo.sn != '') { + this.isqrcode = true + this.getArea() + } + } else { clearInterval(this.timer) this.orderinfo = {} @@ -4277,7 +4291,7 @@ changefree(item, index) { this.freeInfo = item this.freeListIndex = index - + }, getlist() { this.freList = [] @@ -4295,14 +4309,15 @@ } return item; }); - - setTimeout(()=>{ - this.freeInfo = this.freList[0] - this.freeListIndex = 1 - console.log(this.freeListIndex,'this.freeListIndexthis.freeListIndexthis.freeListIndex'); - },300) - - console.log(this.freList, ' this.freList this.freList'); + this.freeInfo = this.freList[0] + this.freeListIndex = 1 + console.log(this.freList, this.freeInfo, ' this.freList this.freList'); + // setTimeout(()=>{ + + // console.log(this.freeListIndex,'this.freeListIndexthis.freeListIndexthis.freeListIndex'); + // },300) + + } else { uni.showToast({ title: '未登录,请登录后尝试', @@ -4406,25 +4421,28 @@ getinfo() { if (uni.getStorageSync('token')) { this.$u.get("/getAppInfo").then((res) => { - + if (res.code == 200) { this.$store.commit('SET_USERID', res.user.userId); this.userinfo = res.user - setTimeout(()=>{ - console.log(this.userinfo.balance,this.deviceIndex,this.showdevice,'this.userinfo.balancethis.userinfo.balancethis.userinfo.balance'); - if(this.userinfo.balance!=0&&this.deviceIndex==1&&this.showdevice==true){ + setTimeout(() => { + console.log(this.userinfo.balance, this.deviceIndex, this.showdevice, + 'this.userinfo.balancethis.userinfo.balancethis.userinfo.balance'); + if (this.userinfo.balance != 0 && this.deviceIndex == 1 && this + .showdevice == true&&this.tozf==true) { + this.tozf=false this.taploadmask(1) } - - },300) + + }, 300) } else { // setTimeout(() => { // this.getinfo() // }, 200) - + } }); - + } @@ -4457,14 +4475,17 @@ this.gps.sn = this.sn } } - if (this.sn != '') { - this.gps.sn = this.sn + if (this.orderinfo.sn != '') { + this.gps.sn = this.orderinfo.sn } - + if (this.deviceInfos.sn) { + this.gps.sn = this.deviceInfos.sn + } + this.$u.get('/app/area/info?', this.gps).then((res) => { // this.showmap = true if (res.code === 200) { - + // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 const polylines = this.convertBoundaryToPolyline(res.data.boundaryStr) // console.log(polylines,'polylinespolylinespolylines'); @@ -4475,11 +4496,11 @@ setTimeout(() => { let abb = this.cleanedText() console.log(abb.length, 'cleanedTextcleanedTextcleanedText'); - + // 计算滚动时间,基于文本宽度 this.duration = abb.length * 0.3; // 50 px/s 的速度 }, 200) - + this.polyline.push(polylines) console.log(); // console.log(this.areaInfo, 'areaInfoareaInfo'); @@ -4490,14 +4511,14 @@ this.getParking() if (uni.getStorageSync('token')) { this.getisInOrder() - + } const hasShownPopup = uni.getStorageSync('hasShownPopup'); console.log(hasShownPopup, 'hasShownPopup'); - + if (hasShownPopup === '' || hasShownPopup === null) { console.log('1111111111'); - + this.showTips = true; this.startCountdown(); uni.setStorageSync('hasShownPopup', true); @@ -4506,21 +4527,27 @@ this.showTips = uni.getStorageSync('hasShownPopup'); console.log(this.showTips, 'this.showTips'); this.startCountdown(); - + } - if (this.sn) { - setTimeout(()=>{ + if (this.gps.sn) { + setTimeout(() => { if (this.orderinfo.status) { - this.showtcs = true - }else{ - this.deviceInfo(1) - this.qParam = null + // this.showtcs = true + } else { + if (this.type == 1 && this.deviceIndex == 1) { + this.deviceInfo(1) + this.qParam = null + }else{ + this.deviceInfo(0) + this.qParam = null + } + } - - },800) - + + }, 200) + } - + // if(!hasShownPopup){ // console.log(typeof(hasShownPopup),'hasShownPopuphasShownPopup'); // this.showTips=uni.getStorageSync('hasShownPopup') @@ -4528,7 +4555,7 @@ // this.showTips=true // uni.setStorageSync('hasShownPopup', true); // } - + // this.$store.commit('SET_SHOWTIPS', true); // console.log(this.polyline); } else { @@ -4541,7 +4568,7 @@ }).catch(error => { console.error("Error fetching area data:", error); }); - + }, convertBoundaryToPolyline(boundary) { @@ -4858,7 +4885,7 @@ this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { if (res.code === 200) { - this.isqrcode=true + this.isqrcode = true this.deviceInfos = res.data; if (!this.orderinfo.sn) { this.mac = res.data.mac @@ -4866,6 +4893,14 @@ if (num == 0) { this.showdevice = true; this.type = 0; + if (this.areaInfo.areaId != res.data.areaId) { + this.getArea() + } + // this.routePlanning(res.data.latitude, res.data.longitude) + // setTimeout(() => { + + // // this.deviceIndex = 1; + // }, 600) } else { // if (this.deviceInfos.onlineStatus == 0) { // wx.showToast({ @@ -4970,7 +5005,7 @@ .then(( res) => { if (res.code === 200) { - this.isqrcode=true + this.isqrcode = true this.deviceInfos = res.data; if (num == 0) { diff --git a/pages_admin/admin_order.vue b/pages_admin/admin_order.vue index 6623d9a..899e45a 100644 --- a/pages_admin/admin_order.vue +++ b/pages_admin/admin_order.vue @@ -53,7 +53,7 @@ 待审核 - + @@ -806,7 +806,7 @@ manageFee:0, ridingFee:0, appointmentFee:0, - + reason:'' } }, @@ -865,7 +865,7 @@ } }); }, - formatDate(value) { + formatDate(value) { if (!value) return ''; let date = new Date(value); let month = date.getMonth() + 1; // 月份从0开始计数,所以加1 @@ -953,13 +953,16 @@ }, // 退款 backMoney() { + uni.showLoading({ + title:'加载中' + }) let data = { orderNo: this.orderInfo.orderNo, - dispatchFee: this.orderInfo.dispatchFee, - manageFee: this.orderInfo.manageFee, - ridingFee: this.orderInfo.ridingFee, - appointmentFee: this.orderInfo.appointmentFee, - reason: this.orderInfo.reason + dispatchFee: this.dispatchFee, + manageFee: this.manageFee, + ridingFee: this.ridingFee, + appointmentFee: this.appointmentFee, + // reason: this.reason } if ( data.dispatchFee > this.orderInfo.dispatchFee || @@ -986,6 +989,11 @@ } else if (this.curtitidx == 3) { this.orderList3() } + uni.showToast({ + title: '退款成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -1013,6 +1021,9 @@ }, // 改价 changeMoney() { + uni.showLoading({ + title:'加载中' + }) let data = { orderNo: this.orderInfo.orderNo, dispatchFee: this.orderInfo.dispatchFee, @@ -1032,6 +1043,11 @@ } else if (this.curtitidx == 2) { this.orderList2() } + uni.showToast({ + title: '改价成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -1055,6 +1071,9 @@ }, // 还车 backDevice() { + uni.showLoading({ + title:'加载中' + }) this.$u.post('/appVerify/device/return?orderNo=' + this.orderInfo.orderNo + '&returnType=2').then(( res) => { if (res.code === 200) { @@ -1067,6 +1086,11 @@ } else if (this.curtitidx == 1) { this.orderList1() } + uni.showToast({ + title: '还车成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, diff --git a/pages_admin/order/order_detail.vue b/pages_admin/order/order_detail.vue index ea36507..f082daf 100644 --- a/pages_admin/order/order_detail.vue +++ b/pages_admin/order/order_detail.vue @@ -704,6 +704,9 @@ }, // 押金抵扣 yjdkBtn(){ + uni.showLoading({ + title:'加载中' + }) let data = { orderNo: this.orderInfo.orderNo, @@ -712,6 +715,11 @@ if (res.code === 200) { // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); this.getOrderDetail() } else { @@ -727,6 +735,9 @@ }, // 改价 changeMoney() { + uni.showLoading({ + title:'加载中' + }) let data = { orderNo: this.orderInfo.orderNo, dispatchFee: this.orderInfo.dispatchFee, @@ -741,6 +752,11 @@ this.showgj = false this.getOrderDetail() + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -758,6 +774,9 @@ // this.orderInfo = {} }, backDevice() { + uni.showLoading({ + title:'加载中' + }) this.$u.post('/appVerify/device/return?orderNo=' + this.orderInfo.orderNo + '&returnType=2').then(( res) => { if (res.code === 200) { @@ -765,6 +784,11 @@ // this.show = false this.showfzhc = false this.getOrderDetail() + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -796,6 +820,11 @@ // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 this.getOrderDetail() this.showck = false + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -831,7 +860,11 @@ uni.hideLoading() // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 this.getOrderDetail() - + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -854,7 +887,11 @@ if (res.code === 200) { // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 this.getOrderDetail() - + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); } else { uni.showToast({ title: res.msg, @@ -1161,11 +1198,11 @@ backMoney() { let data = { orderNo: this.orderInfo.orderNo, - dispatchFee: this.orderInfo.dispatchFee, - manageFee: this.orderInfo.manageFee, - ridingFee: this.orderInfo.ridingFee, - appointmentFee: this.orderInfo.appointmentFee, - reason: this.orderInfo.reason + dispatchFee: this.dispatchFee, + manageFee: this.manageFee, + ridingFee: this.ridingFee, + appointmentFee: this.appointmentFee, + // reason: this.reason } if ( data.dispatchFee > this.orderInfo.dispatchFee || diff --git a/pages_adminSet/shgl.vue b/pages_adminSet/shgl.vue new file mode 100644 index 0000000..e6b73f0 --- /dev/null +++ b/pages_adminSet/shgl.vue @@ -0,0 +1,190 @@ + + + + + \ No newline at end of file