From 55f397433701dcdad3d457b1cac7ed453a34e6cf Mon Sep 17 00:00:00 2001 From: Sliverber <2622874537@qq.com> Date: Fri, 31 May 2024 17:54:23 +0800 Subject: [PATCH] 11 --- common/http.interceptor.js | 13 +- page_user/ckmx.vue | 363 ++++------- page_user/gzsb.vue | 17 +- page_user/jfgz.vue | 196 ++++-- page_user/yj.vue | 53 +- pages/index/index.vue | 988 +++++++++++++++++------------ pages/login/login.vue | 8 +- pages/my.vue | 6 +- pages_admin/order/order_detail.vue | 12 +- 9 files changed, 921 insertions(+), 735 deletions(-) diff --git a/common/http.interceptor.js b/common/http.interceptor.js index 117cf88..fcb718c 100644 --- a/common/http.interceptor.js +++ b/common/http.interceptor.js @@ -21,8 +21,9 @@ const install = (Vue, vm) => { // }); Vue.prototype.$u.http.setConfig({ // baseUrl: 'http://61.174.243.28:15861', - baseUrl: 'http://192.168.2.6:8080', - // baseUrl: 'https://dche.ccttiot.com/prod-api', + // baseUrl: 'http://192.168.2.6:8080', + // baseUrl: 'http://124.221.246.124:2289', + baseUrl: 'https://dche.ccttiot.com/prod-api', loadingText: '努力加载中~', loadingTime: 800, // 设置自定义头部content-type @@ -128,7 +129,13 @@ const install = (Vue, vm) => { }) - } else { + }else if(res.code == 501){ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + }else { // console.log("老用户登录",res.data) uni.redirectTo({ url:'/pages/login/login' diff --git a/page_user/ckmx.vue b/page_user/ckmx.vue index f91f699..1453346 100644 --- a/page_user/ckmx.vue +++ b/page_user/ckmx.vue @@ -1,115 +1,116 @@ @@ -120,150 +121,42 @@ bgc: { backgroundColor: "", }, - - + id: 0, + info: {}, + rideDuration: '' // 新增属性用于存储骑行时间 } }, - methods: { + onLoad(e) { + this.id = e.orderId + if(this.id){ + this.orderInfo() + } + }, + methods: { + orderInfo() { + this.$u.get("/appVerify/order/" + this.id).then((res) => { + if (res.code == 200) { + this.info = res.data + this.calculateRideDuration(); // 计算骑行时间 + } + }); + }, + calculateRideDuration() { + const createTime = new Date(this.info.createTime); + const returnTime = new Date(this.info.returnTime); + const duration = (returnTime - createTime) / 1000; // 时间差,单位秒 + + const hours = Math.floor(duration / 3600); + const minutes = Math.floor((duration % 3600) / 60); + const seconds = Math.floor(duration % 60); + + if (hours > 0) { + this.rideDuration = `${hours}小时${minutes}分${seconds}秒`; + } else { + this.rideDuration = `${minutes}分${seconds}秒`; + } + } } } - - diff --git a/page_user/gzsb.vue b/page_user/gzsb.vue index 1ba8a3e..a3bf960 100644 --- a/page_user/gzsb.vue +++ b/page_user/gzsb.vue @@ -261,8 +261,21 @@ onlyFromCamera: true, scanType: ['qrCode'], success: res => { - console.log('扫描结果:', res); - this.sn = res.sn + + let sn = null; + let queryParams = res.result.split('?')[1]; + if (queryParams) { + let params = queryParams.split('&'); + params.forEach(param => { + let [key, value] = param.split('='); + if (key === 'sn') { + sn = value; + } + }); + } + + this.sn = sn + }, fail: err => { diff --git a/page_user/jfgz.vue b/page_user/jfgz.vue index 398cd38..3af3651 100644 --- a/page_user/jfgz.vue +++ b/page_user/jfgz.vue @@ -3,39 +3,144 @@ - + 骑行服务费 - 起步价 + 预约服务费 - {{startingPrice}}元(含{{startingHowManyMinutes}}分钟) + {{areaInfo. appointmentServiceFee}}元/10分钟 + - 时长费 + 押金 - {{timeFee}}元/{{timeMinutes}}分钟 + {{areaInfo.vehicleManagementFee}}元 - - 超出起步价包含时长后收取 - - - - - - - - 骑行服务费以开始服务时刻所对应的计费规则为准,时长 费不足1个计费周时,按1个计费周期计算费用 - + + + + + 预约服务费是在使用预约服务时,预约时段内的收费标准 + + + + + + + 押金是在使用车辆前的收费标准,归还设备后可退 + + + + + 免费时长 + + + + + 免费时长 + + + {{freeInfo.freeRideTime}}分钟 + + + + + + + + + + + {{freeInfo.name}} + + + + + 起步价 + + + {{freeInfo.ridingRuleJson.startingPrice}}元(含{{freeInfo.ridingRuleJson.startingTime}}分钟小时) + + + + + 时长费 + + + {{freeInfo.ridingRuleJson.timeoutPrice}}元/{{ freeInfo.ridingRuleJson.timeoutTime}}分钟小时 + + + + + + + + + {{freeInfo.name}} + + + + + + 区间计费 + + + + + + {{items.start}}-{{items.end}}分钟 + 小时 + , + 每{{items.eachUnit}}分钟 + 小时 + /{{items.fee}}元 + + + + + + + + >{{items.start}}分钟 + 小时 + , + 每{{items.eachUnit}}分钟 + 小时 + /{{items.fee}}元 + + + + + + + + + 区间计费是在使用车辆时时,不同时段内的收费标准 + + + + + + + 违规停车管理费 @@ -46,7 +151,7 @@ 调度费(非停车点) - {{dispatchFee}}元 + {{areaInfo. dispatchFee}}元 @@ -57,7 +162,7 @@ 管理费费 - {{vehicleManagementFee}}元 + {{areaInfo.vehicleManagementFee}}元 @@ -85,35 +190,47 @@ bgc: { backgroundColor: "#fff", }, + areaInfo:{}, + freeInfo:{} } }, computed: { - appointmentServiceFee() { - return this.$store.getters.appointmentServiceFee; - }, - dispatchFee() { - return this.$store.getters.dispatchFee; - }, - vehicleManagementFee() { - return this.$store.getters.vehicleManagementFee; - }, - startingPrice() { - return this.$store.getters.startingPrice; - }, - timeFee() { - return this.$store.getters.timeFee; - }, - timeMinutes() { - return this.$store.getters.timeMinutes; - }, - startingHowManyMinutes() { - return this.$store.getters.startingHowManyMinutes; - }, + userId() { return this.$store.getters.userId; }, + }, + onLoad(options) { + + try { + if (options.item) { + this.freeInfo = JSON.parse(decodeURIComponent(options.item)); + console.log( this.freeInfo,' this.freeInfo'); + } + } catch (error) { + console.error('Error parsing item:', error); + } + }, + onShow() { + this.getarea() }, methods: { + getarea() { + let id = uni.getStorageSync('areaId'); + this.$u.get("/app/area/"+id).then((res) => { + + if (res.code == 200) { + this.areaInfo=res.data + // this.getlist() + } else { + uni.showToast({ + title:res.msg, + icon: 'none', + duration: 2000 + }); + } + }); + }, } } @@ -130,6 +247,7 @@ page{ // justify-content: center; .cont{ margin: 0 58rpx; + padding-bottom: 100rpx; .tit{ margin-left: 32rpx; font-weight: 700; diff --git a/page_user/yj.vue b/page_user/yj.vue index f6d3fd3..0f9a83a 100644 --- a/page_user/yj.vue +++ b/page_user/yj.vue @@ -11,7 +11,7 @@ {{deposit}} + style="font-size: 52rpx;">¥{{areaInfo.deposit}} @@ -131,6 +131,7 @@ userinfo: {}, orderList:[], total:0, + areaInfo:"" } @@ -141,7 +142,7 @@ // // 执行其他操作... // }); this.getinfo() - + this.getarea() }, watch: { userId(newValue, oldValue) { @@ -151,32 +152,28 @@ } }, computed: { - appointmentServiceFee() { - return this.$store.getters.appointmentServiceFee; - }, - dispatchFee() { - return this.$store.getters.dispatchFee; - }, - vehicleManagementFee() { - return this.$store.getters.vehicleManagementFee; - }, - startingPrice() { - return this.$store.getters.startingPrice; - }, - timeFee() { - return this.$store.getters.timeFee; - }, - timeMinutes() { - return this.$store.getters.timeMinutes; - }, - deposit() { - return this.$store.getters.deposit; - }, + userId() { return this.$store.getters.userId; }, }, methods: { + getlist() { + this.$u.get("/appVerify/order/list?type=2&userId="+this.userId).then((res) => { + + if (res.code == 200) { + this.orderList=res.rows + this.total=res.total + } else { + uni.showToast({ + title:res.msg, + icon: 'none', + duration: 2000 + }); + } + }); + }, + tixian(){ this.$u.post("/appVerify/order/withdraw").then((res) => { @@ -193,12 +190,12 @@ } }); }, - getlist() { - this.$u.get("/appVerify/order/list?type=2&userId="+this.userId).then((res) => { + getarea() { + let id = uni.getStorageSync('areaId'); + this.$u.get("/app/area/"+id).then((res) => { if (res.code == 200) { - this.orderList=res.rows - this.total=res.total + this.areaInfo=res.data } else { uni.showToast({ title:res.msg, @@ -228,7 +225,7 @@ userId: this.userId, // ruleId: this.freeInfo.ruleId, - money: this.deposit, + money: this.areaInfo.deposit, mark: "押金充值", type: '4' diff --git a/pages/index/index.vue b/pages/index/index.vue index d78c899..1a85cf1 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -90,7 +90,7 @@ - + @@ -159,29 +160,24 @@ {{item.name}} - - - - {{items.start}}-{{items.end}}分钟 - 小时 - , - 每{{items.eachUnit}}分钟 - 小时 - /{{items.fee}}元 - - - - - - - 查看详情 + + + + + {{items.start}}-{{items.end}}分钟 + 小时 + , + 每{{items.eachUnit}}分钟 + 小时 + /{{items.fee}}元 + ... - - .... - + + + - + + 查看详情 + @@ -208,13 +206,13 @@ 确认套餐 --> - + + + 确认预约 @@ -305,7 +303,7 @@ {{orderinfo.totalFee}} - + 查看骑行费明细 > @@ -318,9 +316,9 @@ - + + > 扫码开锁 @@ -361,8 +359,8 @@ - - 您有正在进行中的套餐 + + 您有正在进行中的订单 @@ -535,14 +533,14 @@ P点外归还设备将收取调度费 - + @@ -556,7 +554,7 @@
更多用车服务
-
+
@@ -613,8 +611,8 @@ }, showindex: 0, show: false, - latitude: '26.940805', - longitude: '120.356157', + latitude: '', + longitude: '', isMap: false, zoomSize: 16, markers: [], @@ -641,7 +639,7 @@ areaInfo: {}, // feeInfo:{}, showfeeDetail: false, - + seeDetail:false // userId:this.$store.getters.userId, } @@ -654,70 +652,106 @@ } }, onLoad(e) { + console.log(e,'eeeeeeeeeeeeeeeeeee'); + if(e.q){ + let qParam = e.q; + + // 第2步: URL解码q参数 + let decodedUrl = decodeURIComponent(qParam); + + // 第3步: 使用正则表达式解析解码后的URL并提取查询参数 + let sn = null; + let queryParams = decodedUrl.split('?')[1]; + if (queryParams) { + let params = queryParams.split('&'); + params.forEach(param => { + let [key, value] = param.split('='); + if (key === 'sn') { + sn = value; + } + }); + } + this.sn = sn + if(this.sn!=''){ + + + setTimeout(() => { + if(!this.orderinfo.status){ + this.deviceInfo() + this.showdevice = true + this.deviceIndex = 1 + this.type = 1 + } + }, 1000) + + + } + + } if (e.sn) { this.sn = e.sn - this.deviceInfo() - setTimeout(() => { - this.showdevice = true - this.deviceIndex = 1 - this.type = 1 - }, 2000) + if(this.sn!=''){ + setTimeout(() => { + if(!this.orderinfo.status){ + this.deviceInfo() + this.showdevice = true + this.deviceIndex = 1 + this.type = 1 + } + }, 1000) + + } } }, onShow() { - if (uni.getStorageSync('token')) { - this.$store.dispatch('userInfo', this.$u).then(() => { - - // 执行其他操作... - - }); - - } - if (uni.getStorageSync('role')) { - let abb = uni.getStorageSync('role') - - } - // this.eventKey = Math.floor(Math.random() * 100000); - console.log(this.userId); - - // setTimeout(() => { - // this.getisInOrder() - - // }, 2000) - // this.role() - - // this.$store.dispatch('fetchFeeRules', this.$u).then(() => { - - // // 执行其他操作... - // }); - // this.fetchFeeRules() - - let that = this - uni.getLocation({ - type: 'wgs84', - success: function(lb) { - - that.gps.latitude = lb.latitude; - that.gps.longitude = lb.longitude; - that.gps.latitude = '26.940805', - that.gps.longitude = '120.356157'; - that.getmarks() - that.getArea() - - // - }, - fail: function(error) { - uni.showToast({ - title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能', - icon: 'none', - duration: 2000 + if(this.seeDetail==false){ + if (uni.getStorageSync('token')) { + this.$store.dispatch('userInfo', this.$u).then(() => { + + // 执行其他操作... + }); - // that.getmarks() - // 在这里处理获取位置信息失败的情况 + } - - }) + if (uni.getStorageSync('role')) { + let abb = uni.getStorageSync('role') + + } + + console.log(this.userId); + + + + let that = this + uni.getLocation({ + type: 'wgs84', + success: function(lb) { + + that.gps.latitude = lb.latitude; + that.gps.longitude = lb.longitude; + // that.gps.latitude = '26.940805', + // that.gps.longitude = '120.356157'; + that.latitude= lb.latitude + that.longitude= lb.longitude + // that.getmarks() + that.getArea() + + // + }, + fail: function(error) { + uni.showToast({ + title: '未获取到定位信息,请点击设置勾选允许位置信息,即可使用全部功能', + icon: 'none', + duration: 2000 + }); + // that.getmarks() + // 在这里处理获取位置信息失败的情况 + } + + }) + } + }, @@ -751,9 +785,66 @@ }, }, methods: { + // 查看费用详情 + tofeeDetail(){ + uni.navigateTo({ + url:'/page_user/ckmx?orderId='+this.orderinfo.orderNo + }) + }, + // 扫码开锁 + qecodelock(){ + uni.scanCode({ + onlyFromCamera: true, + scanType: ['qrCode'], + success: res => { + + let sn = null; + let queryParams = res.result.split('?')[1]; + if (queryParams) { + let params = queryParams.split('&'); + params.forEach(param => { + let [key, value] = param.split('='); + if (key === 'sn') { + sn = value; + } + }); + } + + this.sn = sn + if(this.sn!=''){ + setTimeout(() => { + if(!this.orderinfo.status){ + this.deviceInfo() + this.showdevice = true + this.deviceIndex = 1 + this.type = 1 + } + }, 1000) + + } + + }, + fail: err => { + console.error('扫描失败:', err); + uni.showToast({ + title: '扫描失败', + icon: 'none' + }); + } + }); + }, feedetail(item, index) { this.freeInfo = item - this.showfeeDetail = true + this.seeDetail=true + try { + const itemStr = encodeURIComponent(JSON.stringify(item)); + uni.navigateTo({ + url: `/page_user/jfgz?item=${itemStr}` + }); + } catch (error) { + console.error('Error serializing item:', error); + } + // this.showfeeDetail = true this.freeListIndex = index }, // 无套餐取消预约 @@ -801,25 +892,34 @@ }, // 套餐直接开锁 sub6() { - let data = { - userId: this.userId, - sn: this.sn, - - // ruleId: this.freeInfo.ruleId, - // money: this.freeInfo.fee, - mark: "套餐直接开锁", - // type: '1', - ruleId: this.orderinfo.ruleId, - orderNo: this.orderinfo.orderNo - - } - this.$u.post('/appVerify/device/snSwitch', data).then((res) => { - if (res.code === 200) { - this.getisInOrder() - } else { - + if(this.orderinfo.ruleId){ + let data = { + userId: this.userId, + sn: this.sn, + + // ruleId: this.freeInfo.ruleId, + // money: this.freeInfo.fee, + mark: "套餐直接开锁", + // type: '1', + ruleId: this.orderinfo.ruleId, + orderNo: this.orderinfo.orderNo + } - }) + this.$u.post('/appVerify/device/snSwitch', data).then((res) => { + if (res.code === 200) { + this.getisInOrder() + } else { + + } + }) + }else{ + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } + }, // 预约解锁骑行 unlockdevice() { @@ -836,7 +936,7 @@ } this.$u.post('/appVerify/device/snSwitch', data).then((res) => { - if (res.code === 200) { + if (res.code == 200) { this.getisInOrder() } else { uni.showToast({ @@ -863,7 +963,11 @@ if (res.code === 200) { this.getisInOrder() } else { - + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); } }) } @@ -891,6 +995,7 @@ }) }, starTime() { + this.seeDetail=false clearInterval(this.timer) this.timer = null this.$u.get('/app/device/info?sn=' + this.orderinfo.sn).then((res) => { @@ -1047,7 +1152,7 @@ } else if (this.orderinfo.status == 1) { // 取消预约 // this.topay() - const createTimeTimestamp = new Date(this.orderinfo.appointmentstartingTime).getTime(); + const createTimeTimestamp = new Date(this.orderinfo.appointmentStartTime).getTime(); // 定义定时器 @@ -1362,206 +1467,257 @@ }); }, sub5() { - this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + '&ruleId=' + this - .orderinfo.ruleId + '&type=2' + '&orderNo=' + this.orderinfo.orderNo).then((res) => { - if (res.code === 200) { - uni.showLoading({ - title: '预约中...' - }) - setTimeout(() => { - this.getisInOrder() - uni.hideLoading() - }, 1000) - // this.freList=res.rows - - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); - } - }) + if( this.orderinfo.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) => { + if (res.code === 200) { + uni.showLoading({ + title: '预约中...' + }) + setTimeout(() => { + this.getisInOrder() + uni.hideLoading() + }, 1000) + // this.freList=res.rows + + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }else{ + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } + }, // 确认开锁 sub1() { - - let data = { - userId: this.userId, - sn: this.sn, - ruleId: this.freeInfo.ruleId, - // money: this.freeInfo.fee, - mark: "确认开锁", - type: '1' - - - } - this.$u.post('/appVerify/device/snSwitch', data).then((res) => { - if (res.code === 200) { - this.getisInOrder() - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + if(this.freeInfo.ruleId){ + let data = { + userId: this.userId, + sn: this.sn, + ruleId: this.freeInfo.ruleId, + // money: this.freeInfo.fee, + mark: "确认开锁", + type: '1' + + } - }) + this.$u.post('/appVerify/device/snSwitch', data).then((res) => { + this.seeDetail=false + if (res.code === 200) { + this.getisInOrder() + + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }else{ + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } + }, // 开锁购买套餐 sub2() { - let data = { - userId: this.userId, - sn: this.sn, - ruleId: this.freeInfo.ruleId, - // money: this.freeInfo.fee, - isAppointment: false, - mark: "套餐开锁", - type: '3' - - - } - this.$u.post('/appVerify/pre/order', data).then((res) => { - if (res.code === 200) { - // this.freList=res.rows - uni.requestPayment({ - provider: 'wxpay', - timeStamp: res.data.timeStamp, - nonceStr: res.data.nonceStr, - package: res.data.packageVal, - signType: res.data.signType, - paySign: res.data.paySign, - success(res) { - // 支付成功逻辑 - this.showdevice = false - this.deviceIndex = 0 - this.mac = '' - this.type = 0 - this.freeInfo = {} - this.freeListIndex = 0 - this.getisInOrder() - }, - fail(err) { - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }); - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + if(this.freeInfo.ruleId){ + let data = { + userId: this.userId, + sn: this.sn, + ruleId: this.freeInfo.ruleId, + // money: this.freeInfo.fee, + isAppointment: false, + mark: "套餐开锁", + type: '3' + + } - }) + this.$u.post('/appVerify/pre/order', data).then((res) => { + if (res.code === 200) { + // this.freList=res.rows + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.packageVal, + signType: res.data.signType, + paySign: res.data.paySign, + success(res) { + // 支付成功逻辑 + this.showdevice = false + this.deviceIndex = 0 + this.mac = '' + this.type = 0 + this.freeInfo = {} + this.freeListIndex = 0 + this.getisInOrder() + }, + fail(err) { + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }else{ + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } + }, // 确认预约 sub3() { - let data = { - userId: this.userId, - sn: this.sn, - ruleId: this.freeInfo.ruleId, - // isAppointment: true, - // money: this.freeInfo.fee, - mark: "预约购买套餐", - type: '2' - - - } - this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + '&ruleId=' + this - .freeInfo.ruleId).then((res) => { - if (res.code === 200) { - uni.showLoading({ - title: '预约中...' - }) - setTimeout(() => { - this.getisInOrder() - uni.hideLoading() - }, 1000) - // this.freList=res.rows - - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + if(this.freeInfo.ruleId){ + let data = { + userId: this.userId, + sn: this.sn, + ruleId: this.freeInfo.ruleId, + // isAppointment: true, + // money: this.freeInfo.fee, + mark: "预约购买套餐", + type: '2' + + } - }) + this.$u.post('/appVerify/device/appointment?userId=' + this.userId + '&sn=' + this.sn + '&ruleId=' + this + .freeInfo.ruleId).then((res) => { + this.seeDetail=false + if (res.code === 200) { + uni.showLoading({ + title: '预约中...' + }) + setTimeout(() => { + this.getisInOrder() + uni.hideLoading() + }, 1000) + // this.freList=res.rows + + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }else{ + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } + + }, // 预约购买套餐 sub4() { - let data = { - userId: this.userId, - sn: this.sn, - ruleId: this.freeInfo.ruleId, - isAppointment: true, - // money: this.freeInfo.fee, - mark: "预约购买套餐", - type: '3' - - - } - console.log('点击了'); - this.$u.post('/appVerify/pre/order', data).then((res) => { - if (res.code === 200) { - // this.freList=res.rows - uni.requestPayment({ - provider: 'wxpay', - timeStamp: res.data.timeStamp, - nonceStr: res.data.nonceStr, - package: res.data.packageVal, - signType: res.data.signType, - paySign: res.data.paySign, - success(res) { - // 支付成功逻辑 - - this.showdevice = false - this.deviceIndex = 0 - this.mac = '' - this.type = 0 - this.freeInfo = {} - this.freeListIndex = 0 - this.getisInOrder() - }, - fail(err) { - // 支付失败逻辑 - uni.showToast({ - title: '支付失败', - icon: 'none', - duration: 2000 - }); - } - }); - } else { - uni.showToast({ - title: res.msg, - icon: 'none', - duration: 2000 - }); + if(this.freeInfo.ruleId){ + let data = { + userId: this.userId, + sn: this.sn, + ruleId: this.freeInfo.ruleId, + isAppointment: true, + // money: this.freeInfo.fee, + mark: "预约购买套餐", + type: '3' + + } - }) + console.log('点击了'); + this.$u.post('/appVerify/pre/order', data).then((res) => { + if (res.code === 200) { + // this.freList=res.rows + uni.requestPayment({ + provider: 'wxpay', + timeStamp: res.data.timeStamp, + nonceStr: res.data.nonceStr, + package: res.data.packageVal, + signType: res.data.signType, + paySign: res.data.paySign, + success(res) { + // 支付成功逻辑 + + this.showdevice = false + this.deviceIndex = 0 + this.mac = '' + this.type = 0 + this.freeInfo = {} + this.freeListIndex = 0 + this.getisInOrder() + }, + fail(err) { + // 支付失败逻辑 + uni.showToast({ + title: '支付失败', + icon: 'none', + duration: 2000 + }); + } + }); + } else { + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } + }) + }else{ + uni.showToast({ + title: '请选择套餐', + icon: 'none', + duration: 2000 + }); + } + }, getisInOrder() { - this.$u.post('/app/user/isInOrder?userId=' + this.userId, ).then((res) => { - if (res.code === 200) { - // this.freList=res.rows - if (res.data != '') { - this.orderinfo = res.data[0] - - this.starTime() + if(this.userId){ + this.$u.post('/app/user/isInOrder?userId=' + this.userId, ).then((res) => { + if (res.code === 200) { + // this.freList=res.rows + if (res.data != '') { + this.orderinfo = res.data[0] + + this.starTime() + } else { + this.showdevice = false + this.deviceIndex = 0 + } } else { - this.showdevice = false - this.deviceIndex = 0 + } - } else { - - } - }) + }) + } + }, changefree(item, index) { this.freeInfo = item @@ -1697,7 +1853,11 @@ // // 这里可以根据需要处理点击地图非标记区域的逻辑 // }, getmarks() { - this.$u.get(`/app/vehicleLocalization`, this.gps).then((res) => { + + let data = { + areaId: this.areaInfo.areaId + } + this.$u.get(`/app/allVehicleByArea`, data).then((res) => { if (res.code === 200) { this.listData = res.data; // const markers = data.map(item => { @@ -1745,9 +1905,14 @@ this.polyline.push(polylines) // console.log(this.areaInfo, 'areaInfoareaInfo'); uni.setStorageSync('areaId', res.data.areaId); + this.getmarks() this.getlist() this.getParking() - this.getisInOrder() + if (uni.getStorageSync('token')) { + this.getisInOrder() + + } + // console.log(this.polyline); } else { uni.showToast({ @@ -1971,7 +2136,7 @@ .map { width: 750rpx; - height: 80vh; + height: 84vh; } .botmbox2 { @@ -2245,124 +2410,111 @@ } .center { - width: 750rpx; - display: flex; - // flex-wrap: nowrap; - padding: 0 32rpx; - height: 228rpx; - overflow-x: auto; - /* 添加水平滚动条 */ - margin-bottom: 200rpx; - - .card { - margin-right: 20rpx; - position: relative; - padding: 16rpx 24rpx; - width: 500rpx !important; - height: 228rpx; - background: #FFFFFF; - box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); - border-radius: 16rpx 16rpx 16rpx 16rpx; - border: 2rpx solid #fff; - - image { - position: absolute; - top: 0; - right: 0; - width: 82rpx; - height: 50rpx; - } - - .tit { + width: 100%; + display: flex; + flex-wrap: nowrap; + overflow-x: auto; // 添加水平滚动条 + margin-bottom: 200rpx; + white-space: nowrap; // 确保子元素不换行 + + .card { + width: 500rpx !important; // 确保宽度被应用 + height: 288rpx; + margin-right: 20rpx; + position: relative; + background: #FFFFFF; + box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); + border-radius: 16rpx; + border: 2rpx solid #fff; + + image { + position: absolute; + top: 0; + right: 0; + width: 82rpx; + height: 50rpx; + } + + .tips_btn { display: flex; - flex-wrap: nowrap; align-items: center; - width: 100%; + justify-content: center; + position: absolute; + bottom: 0; + width: 350rpx; + height: 70rpx; + background: #4C97E7; + border-radius: 0rpx 0rpx 16rpx 16rpx; font-weight: 500; - font-size: 32rpx; - color: #3D3D3D; - - } - - .tips { - display: flex; - flex-wrap: nowrap; - align-items: center; - margin-left: auto; - font-size: 30rpx; - color: #3D3D3D; - - .icon-chakanxiangqing { - font-size: 30rpx; - color: #3D3D3D; - font-weight: 600; - } - } - - .nmtxt { - width: 100%; - margin-top: 22rpx; - display: flex; - flex-wrap: nowrap; - align-items: center; - justify-content: space-between; - - .left { - font-weight: 400; - font-size: 24rpx; - color: #3D3D3D; - - .tips { - display: flex; - flex-wrap: nowrap; - align-items: center; - margin-left: auto; - font-size: 30rpx; - color: #3D3D3D; - - .icon-chakanxiangqing { - font-size: 30rpx; - color: #3D3D3D; - font-weight: 600; - } - } - } - - .right { - font-weight: 400; - font-size: 24rpx; - color: #3D3D3D; - } - - // .text-ellipsis { - // display: -webkit-box; - // -webkit-line-clamp: 3; - // -webkit-box-orient: vertical; - // overflow: hidden; - // text-overflow: ellipsis; - // word-break: break-all; - // // height: 72rpx; /* Adjust the height based on font size and line height */ - // } - .red { - font-weight: 400; - font-size: 36rpx; - color: #FF4444; - } - } - - .tip { - margin-top: 14rpx; - font-weight: 400; - font-size: 20rpx; - color: #808080; - } - } - - .act1 { - border: 2rpx solid #4C97E7; - } + font-size: 28rpx; + color: #FFFFFF; + } + + .tit { + padding: 18rpx 0 0 18rpx; + width: 350rpx; + display: flex; + align-items: center; + font-weight: 500; + font-size: 36rpx; + color: #3D3D3D; + } + + .nmtxt { + + width: 100%; + margin-top: 22rpx; + display: flex; + justify-content: space-between; + align-items: center; + + .left { + font-weight: 400; + font-size: 28rpx; + color: #3D3D3D; + } + + .right { + font-weight: 400; + font-size: 28rpx; + color: #3D3D3D; + } + + .red { + font-weight: 400; + font-size: 36rpx; + color: #FF4444; + } + } + + .tip { + margin-top: 14rpx; + font-weight: 400; + font-size: 20rpx; + color: #808080; + } + + .tips { + display: flex; + align-items: center; + margin-left: auto; + font-size: 30rpx; + color: #3D3D3D; + + .icon-chakanxiangqing { + font-size: 30rpx; + color: #3D3D3D; + font-weight: 600; + } + } + } + + .act1 { + border: 2rpx solid #4C97E7; + } } + .bot { display: flex; align-items: center; @@ -2757,7 +2909,7 @@ background: #FFFFFF; box-shadow: 0rpx 10rpx 64rpx 0rpx rgba(0, 0, 0, 0.08); border-radius: 16rpx 16rpx 16rpx 16rpx; - margin-right: 12rpx; + margin-right: 10rpx; image { margin-top: 18rpx; diff --git a/pages/login/login.vue b/pages/login/login.vue index e59f512..e590d0b 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -80,7 +80,13 @@ // uni.switchTab({ // url: '/pages/index/index' // }) - } + }else{ + uni.showToast({ + title: res.msg, + icon: 'none', + duration: 2000 + }); + } }); }) diff --git a/pages/my.vue b/pages/my.vue index 13f49ce..97ec095 100644 --- a/pages/my.vue +++ b/pages/my.vue @@ -24,7 +24,7 @@ 押金 - + 未充值 @@ -68,7 +68,7 @@ - + diff --git a/pages_admin/order/order_detail.vue b/pages_admin/order/order_detail.vue index 0a01767..ab3b9fb 100644 --- a/pages_admin/order/order_detail.vue +++ b/pages_admin/order/order_detail.vue @@ -49,7 +49,7 @@ 车辆编号:{{orderInfo.device.areaName}} --> - 运营区域:{{orderInfo.device.areaName}} + 运营区域:{{orderInfo.area}} @@ -139,7 +139,7 @@ - + @@ -183,8 +183,8 @@ bgc: { backgroundColor: "#F7FAFE", }, - latitude: 39.916527, - longitude: 116.397128, + latitude: 0, + longitude: 0, isMap: false, zoomSize: 15, markers: [], @@ -355,8 +355,8 @@ // 处理接口返回的数据,将边界数据转换为地图组件需要的折线结构 this.orderInfo=res.data this.loading=true - this.latitude= parseFloat(this.orderInfo.device.latitude) - this.longitude= parseFloat(this.orderInfo.device.longitude ) + this.latitude= parseFloat(this.orderInfo.latitude) + this.longitude= parseFloat(this.orderInfo.longitude ) this.polyline[0].points = JSON.parse(res.data.tripRouteStr).map(coord => ({ latitude: coord[1], longitude: coord[0]