From accf5cf1a90488dd280e206bc33d6407e6a60439 Mon Sep 17 00:00:00 2001 From: "3321822538@qq.com" <3321822538@qq.com> Date: Sat, 17 Jan 2026 17:33:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E9=B9=BF=E9=AA=91=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/http.interceptor.js | 2 +- page_fenbao/storedlist/trueorder.vue | 4 +- page_shanghu/gongzuotai/ChargingDetail.vue | 8 + page_shanghu/guanli/device_detail.vue | 6 +- page_shanghu/guanli/order_detail.vue | 761 ++++++++++++++++++++- page_user/hcshenhe.vue | 226 ++++-- page_user/yongche/orderxq.vue | 26 +- pages/index/index.vue | 126 +++- pages/tj.vue | 7 +- 9 files changed, 1031 insertions(+), 135 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index f6f21fb..513850b 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,7 +1,7 @@ const install = (Vue, vm) => { uni.setStorageSync('deptId', 100); Vue.prototype.$u.http.setConfig({ - // baseUrl: 'http://192.168.1.3:4101', //键辉本地 + // baseUrl: 'http://192.168.1.8:4101', //键辉本地 // baseUrl: 'http://192.168.2.221:4101', //景森本地 baseUrl: 'https://ele.ccttiot.com/prod-api', //线上 小鹿appid: wx8a05cf95418a6859 小兔骑骑appid:wx38f96c87621a87ab 遇福兴https://fu.chuantewulian.cn wxcb1d6a5d9dca8bbe // baseUrl: 'https://cc.ccttiot.com/prod-api', //叉车线上 diff --git a/page_fenbao/storedlist/trueorder.vue b/page_fenbao/storedlist/trueorder.vue index 19d3a1d..b45105d 100644 --- a/page_fenbao/storedlist/trueorder.vue +++ b/page_fenbao/storedlist/trueorder.vue @@ -919,7 +919,7 @@ uni.switchTab({ url: '/pages/index/index?orderid=' + this.bstId }) - }else if(res.code == 20001){ + }else if(res.code == 20001 || res.code == 20002 || res.code == 20003){ this.wenbentxtflag = true this.wenbentxt = '蓝牙开锁中...' let that = this @@ -1455,7 +1455,7 @@ }) }, 2000) }) //刷新支付结果 - }else if(res.code == 20001){ + }else if(res.code == 20001 || res.code == 20002 || res.code == 20003){ this.wenbentxtflag = true this.wenbentxt = '蓝牙开锁中...' let that = this diff --git a/page_shanghu/gongzuotai/ChargingDetail.vue b/page_shanghu/gongzuotai/ChargingDetail.vue index 30d8adc..16cacc2 100644 --- a/page_shanghu/gongzuotai/ChargingDetail.vue +++ b/page_shanghu/gongzuotai/ChargingDetail.vue @@ -587,6 +587,14 @@ delete data.startRule; } else { // 普通计费使用startRule + if(this.timeoutPrice == '' || this.timeoutPrice == 0){ + uni.showToast({ + title: '超出价不能为空或者0元', + icon: 'none', + duration: 5000 + }) + return + } data.startRule = { timeoutTime: this.timeoutTime, startingPrice: this.startingPrice, diff --git a/page_shanghu/guanli/device_detail.vue b/page_shanghu/guanli/device_detail.vue index 4613a3c..e46626e 100644 --- a/page_shanghu/guanli/device_detail.vue +++ b/page_shanghu/guanli/device_detail.vue @@ -1424,7 +1424,7 @@ duration: 3000 }) this.jieliuflag = true - }else if(res.code == 20001){ + }else if(res.code == 20001 || res.code == 20002 || res.code == 20003){ uni.showLoading({ title: '蓝牙关锁中...', mask: true @@ -1617,7 +1617,7 @@ duration: 2000 }) this.jieliuflag = true - } else if (res.code == 20001) { + } else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { uni.showLoading({ title: '响铃中...', mask: true @@ -1865,7 +1865,7 @@ duration: 2000 }) this.jieliuflag = true - }else if(res.code == 20001){ + }else if(res.code == 20001 || res.code == 20002 || res.code == 20003){ this.jieliuflag = true uni.showLoading({ title: '重启中...', diff --git a/page_shanghu/guanli/order_detail.vue b/page_shanghu/guanli/order_detail.vue index 544635d..a2b3ffb 100644 --- a/page_shanghu/guanli/order_detail.vue +++ b/page_shanghu/guanli/order_detail.vue @@ -261,6 +261,7 @@ 改价 押金抵扣 改价记录 + 辅助换车 辅助还车 @@ -504,7 +505,7 @@ - @@ -527,6 +528,100 @@ + + + + + 辅助换车 + × + + + + + + + 设备SN + + + + + + + + + + + + + 换车原因* + + + + {{ changeReason ? (changeReason === 'LOW_POWER' ? '电量不足' : '车辆损坏') : '请选择换车原因' }} + + + + + + + + + + + 故障原因 + (可选) + + + + + + 故障图片 + (可选) + + + + + + + + + + + 上传图片 + + + + + + + 取消 + 确定换车 + + + @@ -626,7 +721,21 @@ price:0, youhuiobj:{}, kstime:'', - endtime:'' + endtime:'', + // 换车相关 + showChangeBike: false, + changeDeviceList: [], + selectedDeviceId: '', + selectedDeviceSn: '', + changeReason: '', // LOW_POWER 或 DEVICE_FAULT + faultDetail: '', + faultPicture: '', + reasonOptions: [ + { label: '电量不足', value: 'LOW_POWER' }, + { label: '车辆损坏', value: 'DEVICE_FAULT' } + ], + reasonIndex: -1, + qiniuToken: '' // 七牛云上传token } }, onLoad(e) { @@ -1075,31 +1184,345 @@ }) let data = { orderId: this.orid, - needDispatchFee: flag + requiredIot: false } - this.$u.put(`/bst/order/end`, data).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '辅助还车成功', - icon: 'success', - duration: 2000 + this.$u.put(`/bst/order/finishDevice`, data).then(res =>{ + if(res.code == 200){ + let datas = { + orderId: this.orid, + needDispatchFee: flag + } + this.$u.put(`/bst/order/end`, datas).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '辅助还车成功', + icon: 'success', + duration: 2000 + }) + uni.hideLoading() + this.ddflag = false + setTimeout(() => { + this.deviceInfo() + this.getorderxq() + }, 1500) + } else { + uni.hideLoading() + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } }) - uni.hideLoading() - this.ddflag = false - setTimeout(() => { - this.deviceInfo() - this.getorderxq() - }, 1500) - } else { - uni.hideLoading() + }else{ uni.showToast({ - title: res.msg, + title: '错误' + res.msg, icon: 'none', duration: 2000 }) } }) }, + // 点击辅助换车 + btnhuanbike() { + // 先弹出确认框 + uni.showModal({ + title: '提示', + content: '确定要进行辅助换车操作吗?', + confirmText: '确定', + cancelText: '取消', + success: (res) => { + if (res.confirm) { + // 用户点击确定,执行换车流程 + this.doChangeBike() + } + // 如果用户点击取消,则不执行任何操作 + } + }) + }, + // 执行换车流程 + doChangeBike() { + // 1. 先调用管理员锁车接口(不管成功与否) + uni.showLoading({ + title: '锁车中...', + mask: true + }) + let data = { + orderId:this.orid, + requiredIot:false + } + this.$u.put('/bst/order/finishDevice',data).then((res) => { + if(res.code == 200){ + // 锁车接口调用完成,无论成功与否都继续下一步 + uni.hideLoading() + // 获取七牛云上传token + this.getQiniuToken() + // 2. 显示换车弹窗 + this.showChangeBike = true + }else{ + uni.showToast({ + title: '错误' + res.msg, + icon: 'none', + duration: 5000 + }) + } + }).catch((err) => { + // 即使失败也继续 + uni.hideLoading() + // 获取七牛云上传token + this.getQiniuToken() + this.showChangeBike = true + }) + }, + // 获取七牛云上传token + getQiniuToken() { + this.$u.get('/common/qiniuToken').then((res) => { + if (res.code == 200) { + this.qiniuToken = res.data + } + }).catch((err) => { + console.log('获取七牛云token失败', err) + }) + }, + // 上传故障图片 + uploadFaultImage() { + if (!this.qiniuToken) { + uni.showToast({ + title: '上传token获取失败,请重试', + icon: 'none', + duration: 2000 + }) + this.getQiniuToken() + return + } + let _this = this + let math = 'static/' + _this.$u.guid(20) + uni.chooseImage({ + count: 1, + sizeType: ['compressed'], + sourceType: ['album', 'camera'], + success(res) { + const tempFilePaths = res.tempFilePaths[0] + // 检查文件大小(5MB) + uni.getFileInfo({ + filePath: tempFilePaths, + success(fileInfo) { + if (fileInfo.size > 5 * 1024 * 1024) { + uni.showToast({ + title: '图片大小不能超过5MB', + icon: 'none', + duration: 2000 + }) + return + } + // 显示上传加载提示 + uni.showLoading({ + title: '图片上传中...', + mask: true + }) + // 上传到七牛云 + wx.uploadFile({ + url: 'https://up-z2.qiniup.com', + name: 'file', + filePath: tempFilePaths, + formData: { + token: _this.qiniuToken, + key: 'bike/img/' + math + }, + success: function(res) { + uni.hideLoading() + try { + let str = JSON.parse(res.data) + _this.faultPicture = 'https://api.ccttiot.com/' + str.key + uni.showToast({ + title: '上传成功', + icon: 'success', + duration: 1500 + }) + } catch (e) { + uni.showToast({ + title: '上传失败,请重试', + icon: 'none', + duration: 2000 + }) + } + }, + fail: function(err) { + uni.hideLoading() + uni.showToast({ + title: '上传失败,请重试', + icon: 'none', + duration: 2000 + }) + } + }) + } + }) + }, + fail(err) { + uni.showToast({ + title: '未授权访问相册权限,请授权后使用', + icon: 'none', + duration: 2000 + }) + } + }) + }, + // 预览故障图片 + previewFaultImage() { + if (this.faultPicture) { + uni.previewImage({ + current: this.faultPicture, + urls: [this.faultPicture] + }) + } + }, + // 删除故障图片 + deleteFaultImage() { + uni.showModal({ + title: '提示', + content: '确定要删除这张图片吗?', + success: (res) => { + if (res.confirm) { + this.faultPicture = '' + } + } + }) + }, + // 扫码获取设备SN + scanDeviceSn() { + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: (res) => { + console.log('扫码结果:', res) + // 从二维码中提取SN + function getQueryParam(url, paramName) { + let regex = new RegExp(`[?&]${paramName}=([^&]*)`) + let results = regex.exec(url) + return results ? decodeURIComponent(results[1].replace(/\+/g, ' ')) : null + } + let sceneValue = res.result + let decodedValue = decodeURIComponent(sceneValue) + let sn = getQueryParam(decodedValue, 's') || getQueryParam(decodedValue, 'sn') + + // 如果二维码中不包含参数,尝试直接使用结果 + if (!sn) { + sn = res.result + } + + if (sn) { + this.selectedDeviceSn = sn + uni.showToast({ + title: '扫码成功', + icon: 'success', + duration: 1500 + }) + } else { + uni.showToast({ + title: '未识别到设备SN', + icon: 'none', + duration: 2000 + }) + } + }, + fail: (err) => { + console.error('扫码失败:', err) + uni.showToast({ + title: '扫码失败,请重试', + icon: 'none', + duration: 2000 + }) + } + }) + }, + // 关闭换车弹窗 + closeChangeBike() { + this.showChangeBike = false + this.selectedDeviceSn = '' + this.changeReason = '' + this.faultDetail = '' + this.faultPicture = '' + this.reasonIndex = -1 + }, + // 选择换车原因 + onReasonChange(e) { + const index = e.detail.value + this.reasonIndex = index + this.changeReason = this.reasonOptions[index].value + }, + // 确认换车 + confirmChangeBike() { + // 验证必填字段 + if (!this.changeReason) { + uni.showToast({ + title: '请选择换车原因', + icon: 'none', + duration: 2000 + }) + return + } + if (!this.selectedDeviceSn) { + uni.showToast({ + title: '请输入目标设备SN', + icon: 'none', + duration: 2000 + }) + return + } + + // 3. 调用换车接口 + uni.showLoading({ + title: '换车中...', + mask: true + }) + + let data = { + orderId: this.orid, + reason: this.changeReason, + deviceSn: this.selectedDeviceSn + } + + // 如果是设备故障,添加故障详情和图片 + if (this.changeReason === 'DEVICE_FAULT') { + if (this.faultDetail) { + data.faultDetail = this.faultDetail + } + if (this.faultPicture) { + data.faultPicture = this.faultPicture + } + } + + this.$u.put('/bst/order/changeDevice', data).then((res) => { + uni.hideLoading() + if (res.code === 200) { + uni.showToast({ + title: '换车成功', + icon: 'success', + duration: 2000 + }) + // 关闭弹窗 + this.closeChangeBike() + // 4. 刷新订单数据 + setTimeout(() => { + this.getorderxq() + }, 1500) + } else { + uni.showToast({ + title: res.msg || '换车失败', + icon: 'none', + duration: 2000 + }) + } + }).catch((err) => { + uni.hideLoading() + uni.showToast({ + title: '换车失败', + icon: 'none', + duration: 2000 + }) + }) + }, // 点击辅助还车 btnfuzhu() { let arr = this.devicesList.map(item => { @@ -3075,7 +3498,7 @@ z-index: 200; padding: 40rpx; box-sizing: border-box; - + z-index: 1000; .tops { font-size: 36rpx; font-weight: 600; text-align: center; margin-bottom: 40rpx; } input { width: 100%; @@ -3093,6 +3516,20 @@ margin-bottom: 20rpx; font-size: 28rpx; input { width: 200rpx; margin-bottom: 0; } + picker { + flex: 1; + .picker-view { + width: 200rpx; + height: 80rpx; + line-height: 80rpx; + background: #F5F7FA; + border-radius: 10rpx; + padding: 0 20rpx; + text-align: right; + font-size: 28rpx; + color: #333; + } + } } .anniu { @@ -3112,6 +3549,292 @@ } } + /* 换车弹窗样式 */ + .change-bike-modal { + position: fixed; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 680rpx; + max-height: 90vh; + background: #FFFFFF; + border-radius: 24rpx; + z-index: 1000; + box-shadow: 0 8rpx 32rpx rgba(0, 0, 0, 0.12); + overflow: hidden; + display: flex; + flex-direction: column; + + .modal-header { + display: flex; + justify-content: space-between; + align-items: center; + padding: 32rpx 40rpx; + border-bottom: 1rpx solid #F0F2F5; + + .modal-title { + font-size: 36rpx; + font-weight: 600; + color: #333; + } + + .modal-close { + width: 48rpx; + height: 48rpx; + line-height: 48rpx; + text-align: center; + font-size: 48rpx; + color: #909399; + border-radius: 50%; + transition: all 0.3s; + + &:active { + background: #F5F7FA; + color: #606266; + } + } + } + + .modal-content { + flex: 1; + padding: 40rpx; + overflow-y: auto; + + .form-section { + margin-bottom: 40rpx; + + &:last-child { + margin-bottom: 0; + } + + .section-title { + font-size: 30rpx; + font-weight: 600; + color: #333; + margin-bottom: 24rpx; + display: flex; + align-items: center; + + .required { + color: #FF4444; + margin-left: 4rpx; + } + } + + .form-item { + margin-bottom: 32rpx; + + &:last-child { + margin-bottom: 0; + } + + .form-label { + display: flex; + align-items: center; + margin-bottom: 16rpx; + + .label-text { + font-size: 28rpx; + color: #333; + font-weight: 500; + } + + .label-tip { + font-size: 24rpx; + color: #909399; + margin-left: 8rpx; + } + } + + .form-input { + width: 100%; + height: 88rpx; + background: #F5F7FA; + border-radius: 12rpx; + padding: 0 24rpx; + font-size: 28rpx; + color: #333; + box-sizing: border-box; + + &::placeholder { + color: #C0C4CC; + } + } + + .input-with-scan { + display: flex; + align-items: center; + background: #F5F7FA; + border-radius: 12rpx; + padding: 0 20rpx; + box-sizing: border-box; + + .scan-icon { + width: 48rpx; + height: 48rpx; + display: flex; + align-items: center; + justify-content: center; + flex-shrink: 0; + margin-right: 12rpx; + border-radius: 8rpx; + transition: all 0.3s; + + &:active { + background: rgba(76, 151, 231, 0.1); + } + } + + .form-input-with-icon { + flex: 1; + height: 88rpx; + font-size: 28rpx; + color: #333; + border: none; + background: transparent; + + &::placeholder { + color: #C0C4CC; + } + } + } + + .form-textarea { + width: 100%; + min-height: 160rpx; + background: #F5F7FA; + border-radius: 12rpx; + padding: 20rpx 24rpx; + font-size: 28rpx; + color: #333; + box-sizing: border-box; + line-height: 1.6; + + &::placeholder { + color: #C0C4CC; + } + } + + .picker-item { + display: flex; + justify-content: space-between; + align-items: center; + height: 88rpx; + background: #F5F7FA; + border-radius: 12rpx; + padding: 0 24rpx; + + .picker-text { + font-size: 28rpx; + color: #333; + + &.placeholder { + color: #C0C4CC; + } + } + } + + .upload-container { + .upload-preview { + position: relative; + width: 200rpx; + height: 200rpx; + border-radius: 12rpx; + overflow: hidden; + + .preview-image { + width: 100%; + height: 100%; + } + + .delete-btn { + position: absolute; + top: 8rpx; + right: 8rpx; + width: 40rpx; + height: 40rpx; + background: rgba(0, 0, 0, 0.6); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + } + } + + .upload-btn { + width: 200rpx; + height: 200rpx; + background: #F5F7FA; + border: 2rpx dashed #C0C4CC; + border-radius: 12rpx; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + transition: all 0.3s; + + &:active { + background: #EBEDF0; + border-color: #4C97E7; + } + + .upload-text { + margin-top: 12rpx; + font-size: 24rpx; + color: #4C97E7; + } + } + } + } + + .form-divider { + text-align: center; + color: #909399; + font-size: 24rpx; + margin: 16rpx 0; + } + } + } + + .modal-footer { + display: flex; + padding: 24rpx 40rpx 40rpx; + gap: 24rpx; + border-top: 1rpx solid #F0F2F5; + + .footer-btn { + flex: 1; + height: 88rpx; + line-height: 88rpx; + text-align: center; + border-radius: 44rpx; + font-size: 32rpx; + font-weight: 500; + transition: all 0.3s; + + &.cancel-btn { + background: #F5F7FA; + color: #666; + + &:active { + background: #EBEDF0; + } + } + + &.confirm-btn { + background: linear-gradient(90deg, #4C97E7 0%, #3A7EDB 100%); + color: #fff; + box-shadow: 0 4rpx 12rpx rgba(58, 126, 219, 0.3); + + &:active { + transform: scale(0.98); + box-shadow: 0 2rpx 8rpx rgba(58, 126, 219, 0.2); + } + } + } + } + } + .maskone, .mask { position: fixed; top: 0; left: 0; diff --git a/page_user/hcshenhe.vue b/page_user/hcshenhe.vue index 1858138..be2678e 100644 --- a/page_user/hcshenhe.vue +++ b/page_user/hcshenhe.vue @@ -162,37 +162,53 @@ console.log(this.flag,'222222222222222'); if(this.flag == true){ console.log('121212121121121212121212121212121212121'); - let data = { - orderId:this.orderId, - picture:this.videoUrl, - lon:this.lon, - lat:this.lat, + let finishData = { + orderId: this.orderId, + lon: this.lon, + lat: this.lat, requiredIot: true, - macList:this.scdevlist + macList:this.scdevlist, } - this.$u.put(`/app/order/end`,data).then(res =>{ - if (res.code == 200) { - this.fjflag = false - uni.hideLoading() - uni.showToast({ - title: '还车成功', - icon: 'success', - duration: 2000 - }) - setTimeout(()=>{ - uni.redirectTo({ - url:'/page_user/yongche/orderxq?id=' + this.orderId + this.$u.put(`/app/order/finishDevice`, finishData).then(res => { + if(res.code == 200){ + let data = { + orderId:this.orderId, + picture:this.videoUrl, + lon:this.lon, + lat:this.lat, + macList:this.scdevlist + } + this.$u.put(`/app/order/end`,data).then(res =>{ + if (res.code == 200) { + this.fjflag = false + uni.hideLoading() + uni.showToast({ + title: '还车成功', + icon: 'success', + duration: 2000 + }) + setTimeout(()=>{ + uni.redirectTo({ + url:'/page_user/yongche/orderxq?id=' + this.orderId + }) + },1000) + }else if(res.msg == null) { + uni.hideLoading() + uni.showToast({ + title: '未知错误', + icon: 'none', + duration: 2000 }) - },1000) - }else if(res.msg == null) { - uni.hideLoading() - uni.showToast({ - title: '未知错误', - icon: 'none', - duration: 2000 + } else { + uni.hideLoading() + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } }) - } else { - uni.hideLoading() + }else{ uni.showToast({ title: res.msg, icon: 'none', @@ -201,52 +217,124 @@ } }) }else{ - xBlufi.notifySendCustomData({ - customData: "11closesub300@" - }) - let data = { - orderId:this.orderId, - picture:this.videoUrl, - lon:this.lon, - lat:this.lat, - requiredIot: false, - macList:this.scdevlist + console.log('54654654654654624654654564654654asdasdasd5as4d65as4d65as4d56as4d56as4d56asd4a65s'); + let finishData = { + orderId: this.orderId, + lon: this.lon, + lat: this.lat, + requiredIot: true, + macList:this.scdevlist, } - this.$u.put(`/app/order/end`,data).then(res =>{ - if (res.code == 200) { - this.fjflag = false - let data = { - mac:this.mac, - reason:'还车', - command:'11closesub300@', - longitude:this.lon, - latitude:this.lat, - result:'成功' - } - this.$u.post(`/app/commandLog/bluetooth`,data).then(res => { - console.log(res,'蓝牙') - }) - setTimeout(()=>{ - xBlufi.notifySendCustomData({ - customData: "11reboot@" - }) - setTimeout(()=>{ + this.$u.put(`/app/order/finishDevice`, finishData).then(res => { + if(res.code == 200){ + console.log('55987897857894878787878'); + let data = { + orderId:this.orderId, + picture:this.videoUrl, + lon:this.lon, + lat:this.lat, + macList:this.scdevlist + } + this.$u.put(`/app/order/end`,data).then(res =>{ + if (res.code == 200) { + this.fjflag = false uni.hideLoading() - uni.redirectTo({ - url:'/page_user/yongche/orderxq?id=' + this.orderId + uni.showToast({ + title: '还车成功', + icon: 'success', + duration: 2000 }) - },1000) - },2000) - - }else if(res.msg == null) { - uni.hideLoading() - uni.showToast({ - title: '未知错误', - icon: 'none', - duration: 2000 + setTimeout(()=>{ + uni.redirectTo({ + url:'/page_user/yongche/orderxq?id=' + this.orderId + }) + },1000) + }else if(res.msg == null) { + uni.hideLoading() + uni.showToast({ + title: '未知错误', + icon: 'none', + duration: 2000 + }) + } else { + uni.hideLoading() + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } }) - } else { - uni.hideLoading() + }else if(res.code == 20001 || res.code == 20002 || res.code == 20003){ + xBlufi.notifySendCustomData({ + customData: "11closesub300@" + }) + let finishData = { + orderId: this.orderId, + lon: this.lon, + lat: this.lat, + requiredIot: false, + macList:this.scdevlist, + } + this.$u.put(`/app/order/finishDevice`, finishData).then(res =>{ + if(res.code == 200){ + let data = { + orderId:this.orderId, + picture:this.videoUrl, + lon:this.lon, + lat:this.lat, + macList:this.scdevlist + } + this.$u.put(`/app/order/end`,data).then(res =>{ + if (res.code == 200) { + this.fjflag = false + let data = { + mac:this.mac, + reason:'还车', + command:'11closesub300@', + longitude:this.lon, + latitude:this.lat, + result:'成功' + } + this.$u.post(`/app/commandLog/bluetooth`,data).then(res => { + console.log(res,'蓝牙') + }) + setTimeout(()=>{ + xBlufi.notifySendCustomData({ + customData: "11reboot@" + }) + setTimeout(()=>{ + uni.hideLoading() + uni.redirectTo({ + url:'/page_user/yongche/orderxq?id=' + this.orderId + }) + },1000) + },1000) + }else if(res.msg == null) { + uni.hideLoading() + uni.showToast({ + title: '未知错误', + icon: 'none', + duration: 2000 + }) + } else { + uni.hideLoading() + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }) + } + }) + }else{ uni.showToast({ title: res.msg, icon: 'none', diff --git a/page_user/yongche/orderxq.vue b/page_user/yongche/orderxq.vue index 20b7ea2..1fa6599 100644 --- a/page_user/yongche/orderxq.vue +++ b/page_user/yongche/orderxq.vue @@ -169,6 +169,10 @@ + + + 押金将在订单结束后6小时内退还 + @@ -339,6 +343,16 @@ channelobj:{} } }, + computed: { + // 判断是否显示押金退还提示 + shouldShowDepositTip() { + // 只有订单状态为 FINISHED(交易完成)时才显示,进行中和取消订单不显示 + const isOrderFinished = this.info.status === 'FINISHED'; + // 未退还押金:autoRefunded 为 false 或未设置 + const isNotRefunded = this.info.autoRefunded === false || this.info.autoRefunded === null || this.info.autoRefunded === undefined; + return isOrderFinished && isNotRefunded; + } + }, onLoad(option) { this.id = option.id console.log(option,this.id,'020202020'); @@ -1075,7 +1089,17 @@ box-sizing: border-box; border-bottom: 1px dashed #D8D8D8; } - + .deposit-tip{ + padding: 24rpx 0; + box-sizing: border-box; + .tip-text{ + display: block; + color: #FF9500; + font-size: 26rpx; + text-align: center; + line-height: 1.5; + } + } } .jiaoyi{ width: 702rpx; diff --git a/pages/index/index.vue b/pages/index/index.vue index f2b05a5..9051cb2 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -745,7 +745,7 @@ icon: 'success', duration: 2000 }) - } else if (res.code == 20001) { + } else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { this.wenbentxt = '蓝牙响铃中...' let that = this const findDevice = () => { @@ -1118,7 +1118,7 @@ icon: 'success', duration: 2000 }) - } else if (res.code == 20001) { + } else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { uni.hideLoading() if (that.ver_dataflag != 3) { uni.showLoading({ @@ -1698,30 +1698,46 @@ that.wenbentxtflag = true let data = { orderId: that.orderobj.orderId, - picture: that.imgs, lon: that.lngsc, lat: that.latsc, requiredIot: true, macList:that.scdevlist, - bltRemark:that.bltRemark } - that.$u.put(`/app/order/end`, data).then(res => { - if (res.code == 200) { - that.cheflag = true - that.fjflag = false - that.wenbentxt = '' - that.wenbentxtflag = false - uni.showToast({ - title: '还车成功', - icon: 'success', - duration: 2000 + that.$u.put(`/app/order/finishDevice`, data).then(res =>{ + if(res.code == 200){ + let datas = { + orderId: that.orderobj.orderId, + picture: that.imgs, + lon: that.lngsc, + lat: that.latsc, + macList:that.scdevlist, + bltRemark:that.bltRemark + } + that.$u.put(`/app/order/end`, datas).then(res => { + if (res.code == 200) { + that.cheflag = true + that.fjflag = false + that.wenbentxt = '' + that.wenbentxtflag = false + uni.showToast({ + title: '还车成功', + icon: 'success', + duration: 2000 + }) + setTimeout(() => { + uni.navigateTo({ + url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId + }) + }, 1000) + } else{ + uni.showToast({ + title: '错误' + res.msg, + icon: 'none', + duration: 5000 + }) + } }) - setTimeout(() => { - uni.navigateTo({ - url: '/page_user/yongche/orderxq?id=' +that.orderobj.orderId - }) - }, 1000) - } else if (res.code == 20001) { + }else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { if (that.ver_dataflag == 3) { that.wenbentxt = '蓝牙还车中...' xBlufi.notifySendCustomData({ @@ -1733,16 +1749,26 @@ }) }, 2000) that.fjflag = false - let data = { + // 先调用锁车方法 + let finishData = { orderId: that.orderobj.orderId, - picture: that.imgs, lon: that.lon, lat: that.lat, requiredIot: false, macList:that.scdevlist, - bltRemark:that.bltRemark } - that.$u.put(`/app/order/end`, data).then(res => { + that.$u.put(`/app/order/finishDevice`, finishData).then(finishRes => { + // 锁车成功后再调用结束订单 + let data = { + orderId: that.orderobj.orderId, + picture: that.imgs, + lon: that.lon, + lat: that.lat, + requiredIot: false, + macList:that.scdevlist, + bltRemark:that.bltRemark + } + that.$u.put(`/app/order/end`, data).then(res => { if (res.code == 200) { setTimeout(() => { that.wenbentxt = '' @@ -1778,6 +1804,16 @@ }) } }) + }).catch(err => { + that.wenbentxt = '' + that.wenbentxtflag = false + that.orderflag = true + uni.showToast({ + title: '锁车失败: ' + (err.msg || '未知错误'), + icon: 'none', + duration: 5000 + }) + }) } else { that.wenbentxt = '蓝牙还车中...' const findDevice = () => { @@ -1799,16 +1835,26 @@ setTimeout(() => { if (that.ver_dataflag == 3) { that.fjflag = false - let data = { + // 先调用锁车方法 + let finishData = { orderId: that.orderobj.orderId, - picture: that.imgs, lon: that.lon, lat: that.lat, requiredIot: false, macList:that.scdevlist, - bltRemark:that.bltRemark } - that.$u.put(`/app/order/end`, data).then(res => { + that.$u.put(`/app/order/finishDevice`, finishData).then(finishRes => { + // 锁车成功后再调用结束订单 + let data = { + orderId: that.orderobj.orderId, + picture: that.imgs, + lon: that.lon, + lat: that.lat, + requiredIot: false, + macList:that.scdevlist, + bltRemark:that.bltRemark + } + that.$u.put(`/app/order/end`, data).then(res => { if (res.code == 200) { xBlufi.notifySendCustomData({ customData: "11close@" @@ -1852,6 +1898,16 @@ }) } }) + }).catch(err => { + that.wenbentxt = '' + that.wenbentxtflag = false + that.orderflag = true + uni.showToast({ + title: '锁车失败: ' + (err.msg || '未知错误'), + icon: 'none', + duration: 5000 + }) + }) } else { that.ver_dataflag = 1 that.shibainum = 0 @@ -1978,6 +2034,7 @@ }) } }) + } else if (res.cancel) { that.wenbentxtflag = false that.wenbentxt = '' @@ -2072,7 +2129,6 @@ } } findDevice() - let that = this that.wenbentxt = '车辆锁车中...' that.wenbentxtflag = true @@ -2084,7 +2140,7 @@ macList:that.scdevlist, bltRemark:that.bltRemark } - that.$u.put(`/app/order/closeDevice`,data).then((res) => { + that.$u.put(`/app/order/finishDevice`,data).then((res) => { if (res.code == 200) { that.wenbentxt = '' that.wenbentxtflag = false @@ -2099,7 +2155,7 @@ url: '/page_user/huanbike?sn=' + that.orderobj.deviceSn +'&orderid=' + that.orderobj.orderId + '&deviceid=' + that.deviceid + '&devicename=' + that.devicename + '&macList=' + this.scdevlist }) }, 1000) - } else if (res.code == 20001) { + } else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { if (that.ver_dataflag == 3) { uni.getLocation({ type: 'gcj02', // 国内地图更兼容 @@ -2344,9 +2400,9 @@ that.wenbentxt = '' that.wenbentxtflag = false uni.showToast({ - title: res.msg, + title: '错误.' + res.msg, icon: 'none', - duration: 2000 + duration: 5000 }) } }) @@ -2465,7 +2521,7 @@ duration: 2000 }) that.orderobj.deviceLockStatus = 1 - } else if (res.code == 20001) { + } else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { that.wenbentxt = '蓝牙解锁中...' const findDevice = () => { that.ver_dataflag = 2 @@ -2624,7 +2680,7 @@ duration: 2000 }) that.orderobj.deviceLockStatus = 0 - } else if (res.code == 20001) { + } else if (res.code == 20001 || res.code == 20002 || res.code == 20003) { that.wenbentxt = '蓝牙临时锁车中...' const findDevice = () => { that.ver_dataflag = 2 diff --git a/pages/tj.vue b/pages/tj.vue index 123ec2c..e37b4f1 100644 --- a/pages/tj.vue +++ b/pages/tj.vue @@ -19,17 +19,16 @@ bgc: { backgroundColor: "", }, - }; + } }, methods: {}, - }; + }