diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 9898003..55129ad 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -1,152 +1,139 @@ const install = (Vue, vm) => { - - // Vue.prototype.$u.http.setConfig({ - - // baseURL: 'https://yruibao.com/admin', - - // // baseUrl: 'http://192.168.10.104:8088', - // method: 'POST', - // // 设置为json,返回后会对数据进行一次JSON.parse() - // dataType: 'json', - // showLoading: true, // 是否显示请求中的loading - // loadingText: '请求加载中...', // 请求loading中的文字提示 - // loadingTime: 10000, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms - // originalData: false, // 是否在拦截器中返回服务端的原始数据 - // loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透 - // // 配置请求头信息 - // header: { - // 'content-type': 'application/json;charset=UTF-8', - - // }, - // }); - uni.setStorageSync('deptId', 100); - 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', - loadingText: '努力加载中~', - loadingTime: 50000, - - // 设置自定义头部content-type - header: { - 'content-type': 'application/json;charset=UTF-8', - - }, - // ...... - }); - // 创享 wx3428c498d5061192 - // 嵛山岛 wx4d178f8c80348214 -// 请求拦截部分,如配置,每次请求前都会执行 - Vue.prototype.$u.http.interceptor.request = (config) => { - // 引用token - // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式 - // 见:https://uviewui.com/components/globalVariable.html - // config.header.token = vm.token; - - // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 - // config.header.token = vm.$store.state.token; - - // 方式三,如果token放在了globalData,通过getApp().globalData获取 + // Vue.prototype.$u.http.setConfig({ + // baseURL: 'https://yruibao.com/admin', + // // baseUrl: 'http://192.168.10.104:8088', + // method: 'POST', + // // 设置为json,返回后会对数据进行一次JSON.parse() + // dataType: 'json', + // showLoading: true, // 是否显示请求中的loading + // loadingText: '请求加载中...', // 请求loading中的文字提示 + // loadingTime: 10000, // 在此时间内,请求还没回来的话,就显示加载中动画,单位ms + // originalData: false, // 是否在拦截器中返回服务端的原始数据 + // loadingMask: true, // 展示loading的时候,是否给一个透明的蒙层,防止触摸穿透 + // // 配置请求头信息 + // header: { + // 'content-type': 'application/json;charset=UTF-8', + // }, + // }); - // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 - // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 - const token = uni.getStorageSync('token'); + uni.setStorageSync('deptId', 100); + 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', + loadingText: '努力加载中~', + loadingTime: 10000, + // 设置自定义头部content-type + header: { + 'content-type': 'application/json;charset=UTF-8', + }, + }); - // const token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQ0ZDljYzBlLThjZjEtNGFkOC05OGFjLThlNThjMWIxYjQ3OSJ9.v-aMkp9t7Z_QfjfsZy6d_1Ng76hPYa0A--SWScMJY9to7UlNv9IxHQnTJylLKdYKGrr8fRZ47Bu12UPm1DgMQg" + // 请求拦截部分 + Vue.prototype.$u.http.interceptor.request = (config) => { + // 引用token + // 方式一,存放在vuex的token,假设使用了uView封装的vuex方式 + // 见:https://uviewui.com/components/globalVariable.html + // config.header.token = vm.token; - // console.log("我是token", token) - config.header.Authorization = token; - // config.header.Tenant-Id=1 - // #ifdef H5 - config.header.Authorization = 'Bearer '+token; - // #endif - // 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值 - if(config.url == '/user/login') config.header.noToken = true; - // 最后需要将config进行return - return config; - - // 如果return一个false值,则会取消本次请求 - // if(config.url == '/user/rest') return false; // 取消某次请求 - } - - // 响应拦截,如配置,每次请求结束都会执行本方法 - Vue.prototype.$u.http.interceptor.response = (res) => { - // if(res.code == 10022 || res.code == 10023) { - // // res为服务端返回值,可能有code,result等字段 - // // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 - // // 如果配置了originalData为true,请留意这里的返回值 - // uni.redirectTo({ - // url:"/pages/login/login", - // fail:function(mes){ - // console.log(mes) - // }, - // success:function(mes){ - // console.log(mes) - // } - // }) - // // return res.result; - // } - if(res.code == 401) { - - wx.login({ - success(res) { - if (res.code) { - console.log('登录!', res); - let data = { - wxOpenId: res.code, - - }; - let areaId=uni.getStorageSync('areaId'); - if(areaId){ - vm.$u.post('/loginByopenid?jsCode='+res.code+'&areaId='+areaId).then(res=>{ - uni.hideLoading(); - if (res.code == 200) { - uni.setStorageSync('token', res.token); - // uni.navigateTo({ - // url:'/pages/index/index' - // }) - - - }else if(res.code == 501){ - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - }else { - // console.log("老用户登录",res.data) - uni.navigateTo({ - url:'/pages/login/login' - }) - } - }); - } - - } - }, - - }); - - } - return res; - // else if(res.code == 201) { - // // 假设201为token失效,这里跳转登录 - // vm.$u.toast('验证失败,请重新登录'); - // setTimeout(() => { - // // 此为uView的方法,详见路由相关文档 - // vm.$u.route('/pages/user/login') - // }, 1500) - // return false; - // } else { - // // 如果返回false,则会调用Promise的reject回调, - // // 并将进入this.$u.post(url).then().catch(res=>{})的catch回调中,res为服务端的返回值 - // return false; - // } - } + // 方式二,如果没有使用uView封装的vuex方法,那么需要使用$store.state获取 + // config.header.token = vm.$store.state.token; + + // 方式三,如果token放在了globalData,通过getApp().globalData获取 + + // 方式四,如果token放在了Storage本地存储中,拦截是每次请求都执行的 + // 所以哪怕您重新登录修改了Storage,下一次的请求将会是最新值 + const token = uni.getStorageSync('token'); + + // const token = "Bearer eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjQ0ZDljYzBlLThjZjEtNGFkOC05OGFjLThlNThjMWIxYjQ3OSJ9.v-aMkp9t7Z_QfjfsZy6d_1Ng76hPYa0A--SWScMJY9to7UlNv9IxHQnTJylLKdYKGrr8fRZ47Bu12UPm1DgMQg" + + // console.log("我是token", token) + config.header.Authorization = token; + // config.header.Tenant-Id=1 + // #ifdef H5 + config.header.Authorization = 'Bearer ' + token; + // #endif + // 可以对某个url进行特别处理,此url参数为this.$u.get(url)中的url值 + if (config.url == '/user/login') config.header.noToken = true; + // 最后需要将config进行return + return config; + + // 如果return一个false值,则会取消本次请求 + // if(config.url == '/user/rest') return false; // 取消某次请求 + } + + // 响应拦截部分 + Vue.prototype.$u.http.interceptor.response = (res) => { + // if(res.code == 10022 || res.code == 10023) { + // // res为服务端返回值,可能有code,result等字段 + // // 这里对res.result进行返回,将会在this.$u.post(url).then(res => {})的then回调中的res的到 + // // 如果配置了originalData为true,请留意这里的返回值 + // uni.redirectTo({ + // url:"/pages/login/login", + // fail:function(mes){ + // console.log(mes) + // }, + // success:function(mes){ + // console.log(mes) + // } + // }) + // // return res.result; + // } + if (res.code == 401) { + wx.login({ + success(res) { + if (res.code) { + console.log('登录!', res); + let areaId = uni.getStorageSync('areaId'); + if (areaId) { + vm.$u.post('/loginByopenid?jsCode=' + res.code + '&areaId=' + areaId).then( + res => { + uni.hideLoading(); + if (res.code == 200) { + uni.setStorageSync('token', res.token); + } else if (res.code == 501) { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } else { + uni.navigateTo({ + url: '/pages/login/login' + }) + } + }); + } + } + }, + }); + } + return res; + } + + // 手动实现超时控制 + const originalRequest = Vue.prototype.$u.http.request; + Vue.prototype.$u.http.request = (options) => { + return new Promise((resolve, reject) => { + const timeout = 20000; // 10秒超时 + const timer = setTimeout(() => { + resolve( { code: 500, msg: '请求超时' } ); + }, timeout); + + // 执行原始请求 + originalRequest.call(Vue.prototype.$u.http, options).then(response => { + clearTimeout(timer); + resolve(response); + }).catch(error => { + clearTimeout(timer); + reject(error); + }); + }); + }; } export default { - install -} \ No newline at end of file + install +} diff --git a/manifest.json b/manifest.json index 57d1132..3106710 100644 --- a/manifest.json +++ b/manifest.json @@ -54,7 +54,7 @@ "appid" : "wx3428c498d5061192", "setting" : { "urlCheck" : false, - "minified" : false + "minified" : true }, "usingComponents" : true, "optimization" : { diff --git a/page_vip/Vip_index.vue b/page_vip/Vip_index.vue new file mode 100644 index 0000000..920498c --- /dev/null +++ b/page_vip/Vip_index.vue @@ -0,0 +1,37 @@ + + + + + diff --git a/pages.json b/pages.json index 998e5a1..8ca43be 100644 --- a/pages.json +++ b/pages.json @@ -29,24 +29,8 @@ "enablePullDownRefresh": false, "navigationStyle": "custom" } - }, - { - "path": "pages/bind_sn", - "style": { - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } - }, - { - "path" : "pages/bind_mac", - "style" : - { - "navigationBarTitleText": "", - "enablePullDownRefresh": false, - "navigationStyle": "custom" - } } + ], @@ -104,6 +88,23 @@ "enablePullDownRefresh" : false } }, + { + "path": "worke/bind_sn", + "style": { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, + { + "path" : "worke/bind_mac", + "style" : + { + "navigationBarTitleText": "", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + }, { "path" : "worke/worke_income", "style" : @@ -199,6 +200,22 @@ } + // ... 分包A的其他页面 + ] + }, + { + "root": "page_vip", // 分包A的根目录 + "pages": [ + { + "path": "Vip_index", + "style": { + "navigationBarTitleText": "上传", + "enablePullDownRefresh": false, + "navigationStyle": "custom" + } + } + + // ... 分包A的其他页面 ] }, diff --git a/pages/index/index.vue b/pages/index/index.vue index 8a196b3..997eab0 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -4410,7 +4410,7 @@ } if (this.sn) { setTimeout(()=>{ - this.deviceInfo(0) + this.deviceInfo(1) this.qParam = null },500) @@ -4817,7 +4817,7 @@ }); } else if (this.deviceInfos.status == 1) { - if (this.areaId != res.data.areaId) { + if (this.areaInfo.areaId != res.data.areaId) { this.getArea() } // this.routePlanning(res.data.latitude, res.data.longitude) @@ -4825,7 +4825,7 @@ this.showdevice = true this.type = 1; this.deviceIndex = 1; - }, 500) + }, 600) } } @@ -4949,7 +4949,7 @@ // this.routePlanning(res.data // .latitude, res.data // .longitude) - if (this.areaId != res.data + if (this.areaInfo != res.data .areaId) { this.getArea() } @@ -4958,7 +4958,7 @@ this.showdevice = true this.type = 1; this.deviceIndex = 1; - }, 500) + }, 600) } } } else { diff --git a/pages_admin/admin_worke.vue b/pages_admin/admin_worke.vue index e6805b0..a355d64 100644 --- a/pages_admin/admin_worke.vue +++ b/pages_admin/admin_worke.vue @@ -174,7 +174,7 @@ }) }else if(num==5){ uni.navigateTo({ - url:'/pages/bind_sn' + url:'/pages_admin/worke/bind_sn' }) // uni.scanCode({ // onlyFromCamera: true, diff --git a/pages_admin/order/device_detail.vue b/pages_admin/order/device_detail.vue index f805d51..1897b1e 100644 --- a/pages_admin/order/device_detail.vue +++ b/pages_admin/order/device_detail.vue @@ -1167,6 +1167,7 @@ }, deviceInfo() { this.$u.get('/app/device/info?sn=' + this.sn).then((res) => { + console.log(res,'rererer'); if (res.code === 200) { this.deviceInfos = res.data if(this.getnum==0){ @@ -1337,6 +1338,12 @@ } this.$forceUpdate() + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); } }) }, diff --git a/pages_admin/order/order_detail.vue b/pages_admin/order/order_detail.vue index 87e4a00..7422a0d 100644 --- a/pages_admin/order/order_detail.vue +++ b/pages_admin/order/order_detail.vue @@ -64,15 +64,27 @@ - + + 网络状态:离线 + + + 网络状态:在线 + 运营区域: {{orderInfo.area}} -- + + + 锁状态:关锁 + + + 锁状态:开锁 + + + @@ -104,11 +116,20 @@ 骑行费用:{{orderInfo.ridingFee}} + + + + 停车点外调度费:{{orderInfo.manageFee}} + + + 骑行费用:{{orderInfo.ridingFee}} + + 实收:{{orderInfo.totalFee}} - 支付方式:微信支付 + 支付方式:押金抵扣微信支付 计费模板:{{orderInfo.rule.name}} @@ -266,7 +287,15 @@ 审核通过 - + + 押金抵扣 + + + 开锁 + + + 关锁 + 有损坏 @@ -490,7 +519,8 @@ areaNum: 1, showload:false, showfzhc:false, - showgj:false + showgj:false, + deviceInfos:{} } }, @@ -542,6 +572,116 @@ }, methods: { + status() { + // if (this.deviceInfos.onlineStatus == 0) { + // return '离线' + // } else { + + // } + if (this.deviceInfos.status == 0) { + return '仓库中' + } else if (this.deviceInfos.status == 1) { + return '待租' + } else if (this.deviceInfos.status == 2) { + return '预约中' + } else if (this.deviceInfos.status == 3) { + return '骑行中' + } else if (this.deviceInfos.status == 4) { + return '临时锁车中' + }else if (this.deviceInfos.status == 6) { + return '调度中' + } else if (this.deviceInfos.status == 8) { + return '下线' + } + + }, + deviceInfo() { + this.$u.get('/app/device/info?sn=' + this.orderInfo.sn).then((res) => { + console.log(res,'rererer'); + if (res.code === 200) { + this.deviceInfos = res.data + + + + + this.$forceUpdate() + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }, + // 开锁 + openBtn(){ + this.$u.post('/appVerify/admin/unlocking?sn=' + this.orderInfo.sn).then((res) => { + + if (res.code == 200) { + // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 + + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }).catch(error => { + console.error("Error fetching area data:", error); + }); + }, + // 关锁 + closBtn(){ + this.$u.post('/appVerify/admin/lock?sn=' + this.orderInfo.sn).then((res) => { + if (res.code == 200) { + // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 + + uni.showToast({ + title: '操作成功', + icon: 'none', + duration: 2000 + }); + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }).catch(error => { + console.error("Error fetching area data:", error); + }); + }, + // 押金抵扣 + yjdkBtn(){ + let data = { + orderNo: this.orderInfo.orderNo, + + } + this.$u.post('/appVerify/order/deduction', data).then((res) => { + if (res.code === 200) { + // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 + + + this.getOrderDetail() + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }).catch(error => { + console.error("Error fetching area data:", error); + }); + }, // 改价 changeMoney() { let data = { @@ -1011,8 +1151,9 @@ this.areaNum = this.areaNum + 1 if (this.areaNum != 0) { this.getArea() + } - + this.deviceInfo() this.loading = true this.latitude = parseFloat(this.orderInfo.latitude) diff --git a/pages_admin/worke/AccountDetails.vue b/pages_admin/worke/AccountDetails.vue index f025429..1720d0a 100644 --- a/pages_admin/worke/AccountDetails.vue +++ b/pages_admin/worke/AccountDetails.vue @@ -28,7 +28,7 @@ - + 实际到账:{{realprice}}元