From da638ec28af8170191e9923bb409a75fda475748 Mon Sep 17 00:00:00 2001 From: cjb <646858191@qq.com> Date: Wed, 7 May 2025 08:52:14 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/mytabbar/mytabbar.vue | 20 +- src/homePages/reservation/index.vue | 333 +++++++++++++++++++-------- src/minePages/account/index.vue | 221 +++++++++++++++--- src/minePages/company/index.vue | 192 +++++++++++++++ src/minePages/order/index.vue | 4 +- src/minePages/order/item.vue | 62 +++-- src/minePages/payment/index.vue | 8 +- src/minePages/recharge/index.vue | 55 +++-- src/pages.json | 3 + src/pages/home/index.vue | 47 +++- src/pages/mine/index.vue | 40 ++-- src/utils/commen.ts | 25 +- src/utils/request.ts | 3 + src/utils/service.ts | 40 +++- 14 files changed, 869 insertions(+), 184 deletions(-) create mode 100644 src/minePages/company/index.vue diff --git a/src/components/mytabbar/mytabbar.vue b/src/components/mytabbar/mytabbar.vue index 6888fa7..fffaeaf 100644 --- a/src/components/mytabbar/mytabbar.vue +++ b/src/components/mytabbar/mytabbar.vue @@ -66,13 +66,21 @@ uni.scanCode({ onlyFromCamera:true, success(res){ - let hdzcode = '' //?? + let pars = '' + if(res.path){ + pars = res.path.split('?')[1] + } + if(/hdzcode/.test(pars)){ + uni.navigateTo({ + url:`/homePages/reservation/index?${pars}&phoneNumber=${uni.getStorageSync('userInfor').phoneNumber?uni.getStorageSync('userInfor').phoneNumber:''}` + }) + }else{ + uni.showToast({ + title:'请扫码换电站小程序码', + icon:'none' + }) + } - // console.log('条码类型:' + res.scanType); - // console.log('条码内容:' + res.result); - uni.navigateTo({ - url:`/homePages/reservation/index?hdzcode=${hdzcode}&phoneNumber=${uni.getStorageSync('userInfor').phoneNumber?uni.getStorageSync('userInfor').phoneNumber:''}` - }) }, fail() { uni.switchTab({ diff --git a/src/homePages/reservation/index.vue b/src/homePages/reservation/index.vue index 77dcc2f..4d9a4f3 100644 --- a/src/homePages/reservation/index.vue +++ b/src/homePages/reservation/index.vue @@ -7,7 +7,13 @@ titleStyle="color:#fff" :placeholder="true" /> + + {{formdata.stationName}} + 温馨提示:您的车辆如果都不支持此换电站,请返回首页重新选择 + + + - + + - + ([]) carlist(uni.getStorageSync('wxuid')).then((rps:any) => { @@ -179,6 +196,7 @@ } }) + //const phoneNumber = uni.getStorageSync('PhoneNumber') //获取手机号 @@ -209,8 +227,12 @@ //reservationTime:'', //预约时间 swapDuration:'' //预约换电时间段,示例值(8:00-10:00) }) - let hdzcode = ref('') + //是否全天 + let openAllDay:string|number = '' + let stiem:any = '' + let etime:any = '' + let mindate = ref(0) onLoad((opt:any) => { hdzcode.value = opt.hdzcode?opt.hdzcode:'' if(opt.phoneNumber){ @@ -218,24 +240,26 @@ nuindex.value = 1 } - // formdata.stationCode = hdzcode.value - // formdata.stationName = opt.hdzname?opt.hdzname:'' + formdata.stationCode = hdzcode.value + formdata.stationName = opt.hdzname?opt.hdzname:'' + + openAllDay = opt.openAllDay + stiem = opt.stiem?opt.stiem:'' + etime = opt.etime?opt.etime:'' + + if(hdzcode.value){ + settime(true) + } + if(openAllDay == 0){ + const date = new Date() + const hours = date.getHours() + if(hours >= etime.split(':')[0]*1){ + mindate.value = getDateDaysAgo(1,1) + } + } }) - const timecolumns:any = ref([ - // [ - // '8:00 - 9:00', - // '9:00 - 10:00', - // '10:00 - 11:00', - // '11:00 - 12:00', - // '12:00 - 13:00', - // '13:00 - 14:00', - // '14:00 - 15:00', - // '15:00 - 16:00', - // '16:00 - 17:00', - // '17:00 - 18:00' - // ] - ]) + const timecolumns:any = ref([]) const datelist = [ { @@ -336,56 +360,91 @@ } ] + + function settime(init?:boolean) { timecolumns.value.splice(0) const date = new Date() const hours = date.getHours() - const Minutes = date.getMinutes() + //const Minutes = date.getMinutes() let arr:any = [] - datelist.forEach(n => { - if(n.time > hours || Minutes <= 30 && (n.time == hours)){ - arr.push(n.timeslot) + + let gstime = stiem.split(':') + let getime = etime.split(':') + + let sh = gstime[0]*1 + let eh = getime[0]*1 + + let shalf = gstime[1]*1 + let ehalf = getime[1]*1 + + + if(openAllDay == 1){ + datelist.forEach(n => { + //|| Minutes <= 30 && (n.time == hours) + if(n.time >= hours){ + arr.push(n.timeslot) + } + }) + }else{ + datelist.forEach(n => { + if(n.time >= hours && n.time >= sh && eh > n.time){ + if(shalf == 30 && arr.length == 0){ + arr.push(`${stiem} - ${sh+1}:00`) + }else{ + arr.push(n.timeslot) + } + } + }) + if(ehalf == 30){ + arr[arr.length -1] = `${eh-1}:00 - ${etime}` } - }) + } + + // datelist.forEach(n => { + // if(n.time > hours || Minutes <= 30 && (n.time == hours)){ + // arr.push(n.timeslot) + // } + // }) if(init){ - timecolumns.value.push(arr) + if(arr.length > 0){ + timecolumns.value.push(arr) + } }else{ if(isToday(new Date(formdata.swapDay))){ - timecolumns.value.push(arr) + if(arr.length > 0){ + timecolumns.value.push(arr) + } }else{ - timecolumns.value.push([ - '0:00 - 1:00', - '1:00 - 2:00', - '2:00 - 3:00', - '3:00 - 4:00', - '4:00 - 5:00', - '5:00 - 6:00', - '6:00 - 7:00', - '7:00 - 8:00', - '8:00 - 9:00', - '9:00 - 10:00', - '10:00 - 11:00', - '11:00 - 12:00', - '12:00 - 13:00', - '13:00 - 14:00', - '14:00 - 15:00', - '15:00 - 16:00', - '16:00 - 17:00', - '17:00 - 18:00', - '18:00 - 19:00', - '19:00 - 20:00', - '20:00 - 21:00', - '21:00 - 22:00', - '22:00 - 23:00', - '23:00 - 24:00' - ]) + if(openAllDay == 1){ + timecolumns.value.push(datelist.map(n => { + return n.timeslot + })) + }else{ + arr.splice(0) + datelist.forEach(n => { + if(n.time >= sh && eh >= n.time){ + if(shalf == 30 && arr.length == 0){ + arr.push(`${stiem} - ${sh+1}:00`) + }else{ + arr.push(n.timeslot) + } + } + }) + if(ehalf == 30){ + arr[arr.length -1] = `${eh-1}:00 - ${etime}` + } + } + if(arr.length > 0){ + timecolumns.value.push(arr) + } } } } onShow(() => { - settime(true) + // name:n.name, // code:n.code, // label:`${n.name}${n.isSuitable?'':'(不支持)'}`, @@ -410,20 +469,20 @@ required: true, message: '请选择车牌号', trigger: ['blur', 'change'], - }, - { - // 自定义验证函数,见上说明 - validator: (rule:any, value:any) => { - const regExp = new RegExp(/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))$/) - if (regExp.test(value)) { - return true - } - return false - }, - message: '车牌号格式不对', - // 触发器可以同时用blur和change - trigger: ['change','blur'], - } + } + // { + // // 自定义验证函数,见上说明 + // validator: (rule:any, value:any) => { + // const regExp = new RegExp(/^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}(([0-9]{5}[DF])|([DF][A-HJ-NP-Z0-9][0-9]{4}))$/) + // if (regExp.test(value)) { + // return true + // } + // return false + // }, + // message: '车牌号格式不对', + // // 触发器可以同时用blur和change + // trigger: ['change','blur'], + // } ], stationName:{ type: 'string', @@ -451,30 +510,60 @@ function cpconfirm(v:any) { cpshow.value = false formdata.plateNum = v.value[0].plateNum - hdzcolumns.value.splice(0) - formdata.stationCode = '' - formdata.stationName = '' - //获取换电站 - gethdz({ - plateNum:formdata.plateNum - //code:hdzcode - }).then((rps:any) => { - ishdz.value = true - let arr:any[] = rps.data.map((n:any,i:any) => { - if(hdzcode.value == n.code){ - indexarr.value = [i] - } - return { - name:n.name, - code:n.code, - label:`${n.name}${n.isSuitable?'':'(不支持)'}`, - isSuitable:n.isSuitable + + if(hdzcode.value){ + gethdz({ + plateNum:formdata.plateNum, + code:hdzcode + }).then((rps:any) => { + ishdz.value = true + if(rps.data && rps.data.length > 0){ + if(!rps.data[0].isSuitable){ + uni.showToast({ + title: '不支持此车型', + duration: 2000, + icon:'none' + }) + formdata.plateNum = '' + } } + + //isSuitable }) - hdzcolumns.value.push(arr) + }else{ + hdzcolumns.value.splice(0) + formdata.stationCode = '' + formdata.stationName = '' - //isSuitable - }) + formdata.swapDay = '' + formdata.swapDuration = '' + //获取换电站 + gethdz({ + plateNum:formdata.plateNum + //code:hdzcode + }).then((rps:any) => { + ishdz.value = true + let arr:any[] = rps.data.map((n:any,i:any) => { + if(hdzcode.value == n.code){ + indexarr.value = [i] + } + return { + name:n.name, + code:n.code, + label:`${n.name}${n.isSuitable?'':'(不支持)'}`, + isSuitable:n.isSuitable, + openAllDay:n.openAllDay, + stiem:n.runStartTime, + etime:n.runEndTime + } + }) + hdzcolumns.value.push(arr) + + //isSuitable + }) + } + + } function cpcancel() { cpshow.value = false @@ -498,6 +587,21 @@ formdata.stationName = v.value[0].name formdata.stationCode = v.value[0].code hdzshow.value = false + + openAllDay = v.value[0].openAllDay + stiem = v.value[0].stiem?v.value[0].stiem:'' + etime = v.value[0].etime?v.value[0].etime:'' + formdata.swapDay = '' + if(openAllDay == 0){ + const date = new Date() + const hours = date.getHours() + if(hours >= etime.split(':')[0]*1){ + mindate.value = getDateDaysAgo(1,1) + } + } + //settime(true) + formdata.swapDay = '' + formdata.swapDuration = '' }else{ uni.showToast({ title: '不支持此车型', @@ -514,7 +618,46 @@ //时间段 let timeshow = ref(false) function timehand() { - timeshow.value = true + if(formdata.swapDay == ''){ + uni.showToast({ + title: '请选择日期', + duration: 2000, + icon:'none' + }) + }else{ + timeshow.value = true + } + // if(stiem === ''){ + // if(timecolumns.value.length == 0){ + // uni.showToast({ + // title: '请选择换电站', + // duration: 2000, + // icon:'none' + // }) + // }if(formdata.swapDay == ''){ + // uni.showToast({ + // title: '请选择日期', + // duration: 2000, + // icon:'none' + // }) + // }else{ + // timeshow.value = true + // } + // }else{ + // if(formdata.swapDay == ''){ + // uni.showToast({ + // title: '请选择日期', + // duration: 2000, + // icon:'none' + // }) + // }else{ + // timeshow.value = true + // } + // } + + + //formdata.swapDay + } function timeconfirm(v:any) { @@ -528,7 +671,15 @@ //选择日期 let dateshow = ref(false) function datehand() { - dateshow.value = true + if(formdata.stationCode){ + dateshow.value = true + }else{ + uni.showToast({ + title: '请选择换电站', + duration: 2000, + icon:'none' + }) + } } function dateconfirm(v:any) { formdata.swapDay = v[0] diff --git a/src/minePages/account/index.vue b/src/minePages/account/index.vue index a61fb38..e649eda 100644 --- a/src/minePages/account/index.vue +++ b/src/minePages/account/index.vue @@ -17,7 +17,7 @@ - 转出 + 转出 充值 @@ -26,11 +26,13 @@ 余额明细 - - - 充值 - 支付 - 转出 + + + 充值 + + 消费 - {{n.plateNum}} - {{n.stationName}} + + 转出 {{n.ctime}} @@ -56,50 +58,135 @@ - 可转出{{totalAmount/100}}元 + 可用余额{{totalAmount/100}} - - - + + ¥ + + + + - - 全部转出 + + {{errmsg}} + + - - 请输入金额 - - + + 确认转出 + + + + + + 交易信息 + + 交易编号 + {{jyobj.tradeNo}} + + + 交易时间 + {{jyobj.ctime}} + + + 交易类型 + 消费 + + + 交易金额 + {{jyobj.tradeTotalAmount/100}}元 + + + + + + 关联订单信息 + + + 订单号 + {{xqobj.orderNo}} + + + 车牌号 + {{xqobj.plateNum}} + + + 换电站 + {{xqobj.stationName}} + + + 订单金额 + {{xqobj.amount/100}}元 + + + + + + \ No newline at end of file diff --git a/src/minePages/order/index.vue b/src/minePages/order/index.vue index 08c46c8..7258e46 100644 --- a/src/minePages/order/index.vue +++ b/src/minePages/order/index.vue @@ -95,7 +95,7 @@ if(n == 1){ return '车辆进站' }else if(n == 2){ - return '车辆到达指定位置' + return '车辆到位' }else if(n == 3){ return '启动对中机构' }else if(n == 4){ @@ -105,7 +105,7 @@ }else if(n == 6){ return '装新电池' }else if(n == 7){ - return '放旧电池' + return '存旧电池' }else if(n == 8){ return '换电完成' } diff --git a/src/minePages/order/item.vue b/src/minePages/order/item.vue index 257ccaa..2b345b7 100644 --- a/src/minePages/order/item.vue +++ b/src/minePages/order/item.vue @@ -34,13 +34,24 @@ - - - 车辆已到达指定位置 - + + + + + 车辆到达指定位置后请点击开始换电按钮 + - 确认换电 + 开始换电 + + + + @@ -103,6 +114,7 @@ + + + + + + + + 请输入金额 + + + 确认充值 +