From a4bf992e9bc8b73105e7e832457e37a2e61b627d Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Mon, 27 Nov 2023 14:47:28 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 151 ++----- BagAuth/pages/login/login.vue | 18 +- BagAuth/pages/login/oldLogin.vue | 10 +- .../pages/components/price-select-tab.vue | 426 ++++++++++-------- BagStation/pages/makeOrder/makeOrder.vue | 63 ++- .../pages/stationDetail/stationDetail.vue | 46 +- 6 files changed, 366 insertions(+), 348 deletions(-) diff --git a/App.vue b/App.vue index 9a674d2..485b3c5 100644 --- a/App.vue +++ b/App.vue @@ -64,7 +64,7 @@ value: item.id }) }) - console.log(channelCodes, productCodes, siteBrands) + // console.log(channelCodes, productCodes, siteBrands) this.menuList[0].detailList = this.menuList[0].detailList.concat(channelCodes) this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes) this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands) @@ -93,146 +93,79 @@ } } // console.log(view.route) - clearTimeout(loginTimer) - clearTimeout(onlineTimer) - + // clearTimeout(loginTimer) + // clearTimeout(onlineTimer) + if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { const token = uni.getStorageSync('Authorization') const openid = uni.getStorageSync('openid') - + let jumpUrl = '/BagAuth/pages/login/login?loginType=true' let urlTarget = this.obtainUrlPathParameterTarget(view.$page.fullPath) - console.log('urlTarget',urlTarget) + // console.log('urlTarget', urlTarget) let target = {} - if(urlTarget.q) { - let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q)) - target = this.obtainUrlPathParameterTarget(originLink) - target.siteId && (jumpUrl += `?scanningParams=${decodeURIComponent(urlTarget.q)}`) + if (urlTarget.q) { + try { + let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q)) + target = this.obtainUrlPathParameterTarget(originLink) + target.siteId && (jumpUrl += `&scanningParams=${decodeURIComponent(urlTarget.q)}`) + } catch (e) {} } - - if (token && openid) { - this.getAmount() - // if(!white.includes(view.route)){ - // this.getAmount() - // } - onlineTimer = setTimeout(() => { - if (this.loginStatus == 'offline') { - uni.clearStorageSync() - uni.showModal({ - title: '需要您重新登录', - content: this.msg, - duration: '3000', - success: function(res) { - if (res.confirm) { - uni.redirectTo({ - url: jumpUrl - }) - } - }, - complete: () => { - clearTimeout(onlineTimer) - } - }) - } - }, 1000) + if (token && openid) { + this.getAmount(jumpUrl) } else { target.siteId && uni.redirectTo({ - url: jumpUrl - }) - // loginTimer = setTimeout(() => { - // uni.showModal({ - // title: '请您登录', - // content: '您还没有登录,暂时查不到油站哦', - // duration: '3000', - // success: function(res) { - // if (res.confirm) { - // uni.redirectTo({ - // url: '/BagAuth/pages/login/login' - // }) - // } - // } - // }) - // }, 1000) + url: jumpUrl + }) } - - } - // } }) }, - + obtainUrlPathParameterTarget(url) { let target = {} - if(url.includes('?')) { + if (url.includes('?')) { let paramsText = url.split("?")[1] let paramsArr = paramsText.split("&") paramsArr.forEach(item => { target[item.split('=')[0]] = item.split('=')[1] }) } - console.log('11target',target) + // console.log('11target', target) return target }, - + // 是否token过期或ip更改 - getAmount() { - clearTimeout(loginTimer) + getAmount(jumpUrl) { accountApi.getTotalOilCardInfo().then(res => { - if (res.code == 20000) { - this.loginStatus = 'online' - } else if (res.code == 42011) { - this.loginStatus = 'offline' - this.msg = res.msg + if (res.code == 42011) { + uni.clearStorageSync() + uni.showModal({ + title: '需要您重新登录', + content: res.msg, + duration: '3000', + success: (res) => { + if (res.confirm) { + uni.redirectTo({ + url: jumpUrl + }) + } + } + }) } }) }, }, - onReady() { - - }, - - onShow: function() { - // uni.getLocation({ - // type: 'wgs84', - // success: function(res) { - // uni.setStorageSync('location', { - // longitude: res.longitude + '', - // latitude: res.latitude + '' - // }) - // } - // }); - // console.log('onReady') - const token = uni.getStorageSync('Authorization') - const openid = uni.getStorageSync('openid') - let key = '' - if (token && openid) { - this.getAmount() - key = '真在线' - } else { - key = '离线' - } - if (key == '在线') { + // onShow: function() { + // const token = uni.getStorageSync('Authorization') + // const openid = uni.getStorageSync('openid') - } - setTimeout(() => { - // console.log(key) - if (key == '在线') { - - } else { - // uni.redirectTo({ - // url: '/BagAuth/pages/login/login' - // }) - } - }, 2000) - // uni.showShareMenu() - // console.log('App Show') - - }, - onHide: function() { - // console.log('App Hide') - } + // if (token && openid) { + // this.getAmount() + // } + // }, } diff --git a/BagAuth/pages/login/login.vue b/BagAuth/pages/login/login.vue index 9df523a..9c2f7c8 100644 --- a/BagAuth/pages/login/login.vue +++ b/BagAuth/pages/login/login.vue @@ -223,17 +223,17 @@ let user = resData.authTokenDTO.loginUser uni.setStorageSync('user', user) - setTimeout(() => { - uni.showToast({ - title: res.msg, - icon: 'none', - complete: (err) => { - } - }) - }, 1000); + // setTimeout(() => { + // uni.showToast({ + // title: res.msg, + // icon: 'none', + // complete: (err) => { + // } + // }) + // }, 1000); if(this.scanningParams) { uni.redirectTo({ - url: `/BagStation/pages/stationDetail/stationDetail?q=${this.scanningParams}` + url: `/BagStation/pages/makeOrder/makeOrder?q=${this.scanningParams}` }) return } diff --git a/BagAuth/pages/login/oldLogin.vue b/BagAuth/pages/login/oldLogin.vue index cf5bc00..fab67b0 100644 --- a/BagAuth/pages/login/oldLogin.vue +++ b/BagAuth/pages/login/oldLogin.vue @@ -171,11 +171,11 @@ loginRes: {}, checked: false, next: false, - scanningParams:null + scanningParams: null } }, onLoad(options) { - if(options.scanningParams) { + if (options.scanningParams) { // 用于扫码进入油站详情页面 this.scanningParams = options.scanningParams } @@ -408,11 +408,11 @@ icon: 'none' }) }, 1000); - if(this.scanningParams) { + if (this.scanningParams && this.scanningParams !== 'null') { uni.redirectTo({ - url: `/BagStation/pages/stationDetail/stationDetail?q=${this.scanningParams}` + url: `/BagStation/pages/makeOrder/makeOrder?q=${this.scanningParams}` }) - return + return } // 这里有问题 uni.switchTab({ diff --git a/BagStation/pages/components/price-select-tab.vue b/BagStation/pages/components/price-select-tab.vue index 0042965..7edcd28 100644 --- a/BagStation/pages/components/price-select-tab.vue +++ b/BagStation/pages/components/price-select-tab.vue @@ -8,26 +8,30 @@ - + {{item.channelCode|channelCodeFamt}} - + - + @@ -39,14 +43,17 @@ - - + @@ -73,7 +80,7 @@ - + @@ -89,28 +96,32 @@ - + 油机金额 - + - 约{{vlom?vlom :'' | moneyVolm}}L + 约{{vlom?vlom :'' | moneyVolm}}L - + - + @@ -124,7 +135,8 @@ 加油金额 - + @@ -135,9 +147,11 @@ - @@ -155,12 +169,12 @@ 直降金额 -¥{{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}} - + 优惠券 {{'----'}} - + @@ -181,8 +195,10 @@ - 合计:{{realMoney>0?realMoney:'xxx.x'|moneyFormat}} - {{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}} + 合计:{{realMoney>0?realMoney:'xxx.x'|moneyFormat}} + {{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}} 明细 @@ -238,7 +254,8 @@ 直降金额: - {{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}} + {{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}} @@ -247,7 +264,8 @@ 合计: - {{realMoney>0?realMoney:'xxx.x'|moneyFormat}} + {{realMoney>0?realMoney:'xxx.x'|moneyFormat}} {{ty.realMoney>0?ty.realMoney:'xxx.x'|moneyFormat}} @@ -255,8 +273,10 @@ - 合计:{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}元 - {{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}元 + 合计:{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}元 + {{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}元 明细 @@ -285,8 +305,8 @@ - + {{item}} @@ -303,10 +323,10 @@ - - 支付提醒 + + 支付提醒 - + 当前油站距离您较远,请与加油员确认您选择的油站是否正确。 @@ -332,7 +352,7 @@ type: Array, default () {} }, - channelJuli:{ + channelJuli: { type: Number, default: '' }, @@ -347,11 +367,11 @@ }, data() { return { - timer:null, - discount:'', - activeSitePrice:'', - showtitles:"", - showtitle:false, + timer: null, + discount: '', + activeSitePrice: '', + showtitles: "", + showtitle: false, oilBarTy: '', ty: { realMoney: "" @@ -406,7 +426,7 @@ hot: false, }], plateNumber: '', - checkMoney:[{ + checkMoney: [{ value: 100, name: '100 ', checked: false, @@ -435,7 +455,7 @@ checkbox: [{ value: 1, name: '1', - checked: false, + checked: true, hot: false, }, { value: 2, @@ -475,45 +495,46 @@ }], activeChannelCode: '', checkBar: [], - realMoney:'', - xoilAmountGun:'', - vlom:'' + realMoney: '', + xoilAmountGun: '', + vlom: '' } }, created() { let oilItem = uni.getStorageSync('oilItem') - this.showtitles = oilItem.listTag + this.showtitles = oilItem.listTag }, watch: { activeChannelCode: { handler(newval) { - this.oilBar = '' setTimeout(() => { + this.oilBar = 1 this.checkBar = this.calcBar() - }, 2) + }, 0) } }, priceId: { handler(newval) { - this.oilBar = '' - setTimeout(() => { - this.checkBar = this.calcBar() - }, 2) + // this.oilBar = '' + // setTimeout(() => { + // this.checkBar = this.calcBar() + // }, 2) } }, - radio:{ - handler(n,o) { - console.log(n,o,'handler'); - this.checkBar.forEach(item=>{ - item.checked = false - }); - this.oilBar = '' + radio: { + handler(n, o) { + // console.log(n,o,'handler'); + // this.checkBar.forEach(item=>{ + // item.checked = false + // }); + // this.oilBar = '' } } }, computed: { priceId() { - if (this.channelList.length && this.channelList[this.activeCur] && this.oilSitePriceDetailsVo[this.radio]) { + if (this.channelList.length && this.channelList[this.activeCur] && this.oilSitePriceDetailsVo[this + .radio]) { return this.oilSitePriceDetailsVo[this.radio].priceId } }, @@ -527,7 +548,7 @@ }, plateNumberSel() { if (this.plateNumbers.length) { - return this.plateNumbers[this.plateIndex]?this.plateNumbers[this.plateIndex]:'非必填' + return this.plateNumbers[this.plateIndex] ? this.plateNumbers[this.plateIndex] : '非必填' } }, jober() { @@ -558,94 +579,94 @@ } } }, - + methods: { - checkNumber(e){ + checkNumber(e) { e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null; - this.$nextTick(()=>{ + this.$nextTick(() => { this.vol = e.detail.value }) }, - checkMoneyVol(e){ + checkMoneyVol(e) { console.log(e) - if(e == ''){ + if (e == '') { uni.showToast({ - title:'请输入金额', - icon:'none' + title: '请输入金额', + icon: 'none' }) return } let isNumber = this.isNumber(e) - if(!isNumber){ - uni.showToast({ - title:'请输入正确金额', - icon:'none' - }) - return + if (!isNumber) { + uni.showToast({ + title: '请输入正确金额', + icon: 'none' + }) + return } let number = { - payType : 'CUSTOMER_ACTIVE', - userType:'0', - xoilAmountGun:e , - priceId:this.activeSitePrice - } - this.xoilAmountGun = e - oilSiteApi.getOrderDiscountInfo(number).then( res=>{ + payType: 'CUSTOMER_ACTIVE', + userType: '0', + xoilAmountGun: e, + priceId: this.activeSitePrice + } + this.xoilAmountGun = e + oilSiteApi.getOrderDiscountInfo(number).then(res => { console.log(res) this.realMoney = res.data.payRealAmount - this.discount = res.data.oilDiscountAmount - this.vlom = res.data.volume + this.discount = res.data.oilDiscountAmount + this.vlom = res.data.volume }) }, - ChooseCheckMoney(e){ + ChooseCheckMoney(e) { console.log(e) - this.vol = e+'' - this.checkMoneyVol(this.vol ) + this.vol = e + '' + this.checkMoneyVol(this.vol) }, - isNumber(value){ // 判断是否为正常数字 + isNumber(value) { // 判断是否为正常数字 const regPos = /^\d+(\.\d+)?$/; //非负浮点数 const regNeg = /^(-(([0-9]+\.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*\.[0-9]+)|([0-9]*[1-9][0-9]*)))$/; //负浮点数 - if(value.indexOf('-') != -1){ + if (value.indexOf('-') != -1) { return false } - if( regPos.test(value) || regNeg.test(value)){ + if (regPos.test(value) || regNeg.test(value)) { return true - }else{ + } else { return false } }, - getMoneyVol(e){ - console.log(e) - if(e.detail.value == ''){ + getMoneyVol(e) { + console.log(e) + if (e.detail.value == '') { uni.showToast({ - title:'请输入金额', - icon:'none' + title: '请输入金额', + icon: 'none' }) return } let isNumber = this.isNumber(e.detail.value) - if(!isNumber){ - uni.showToast({ - title:'请输入正确金额', - icon:'none' - }) - return + if (!isNumber) { + uni.showToast({ + title: '请输入正确金额', + icon: 'none' + }) + return } let number = { - payType : 'CUSTOMER_ACTIVE', - userType:'0', - xoilAmountGun:e.detail.value, - priceId:this.activeSitePrice - } + payType: 'CUSTOMER_ACTIVE', + userType: '0', + xoilAmountGun: e.detail.value, + priceId: this.activeSitePrice + } this.xoilAmountGun = e.detail.value - oilSiteApi.getOrderDiscountInfo(number).then( res=>{ + oilSiteApi.getOrderDiscountInfo(number).then(res => { console.log(res) this.realMoney = res.data.payRealAmount - this.discount = res.data.oilDiscountAmount - this.vlom = res.data.volume + this.discount = res.data.oilDiscountAmount + this.vlom = res.data.volume }) }, - checkInfo(){ + checkInfo() { console.log(this.radio) this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel) // if (!this.testPlateResult) { @@ -656,7 +677,7 @@ // }) // // return false // } - if (this.radio==null||!this.oilSitePriceDetailsVo[this.radio].priceId) { + if (this.radio == null || !this.oilSitePriceDetailsVo[this.radio].priceId) { uni.showToast({ icon: 'none', title: '请选择油品' @@ -691,7 +712,7 @@ }) return false } - if (this.vol < 0.01&& !this.tyRes.liter) { + if (this.vol < 0.01 && !this.tyRes.liter) { uni.showToast({ icon: 'none', title: '加油金额不能为空' @@ -705,18 +726,18 @@ }) return false } - + this.makerOrder() }, - gotoPay(){ + gotoPay() { this.checkInfo() }, - hidendialog(){ - this.showtitle =false + hidendialog() { + this.showtitle = false }, - backTohome(){ + backTohome() { uni.switchTab({ - url:'../../../pages/tabbar/home/home' + url: '../../../pages/tabbar/home/home' }) }, calcBar() { @@ -805,7 +826,7 @@ } }, beforeMake() { - console.log(this.radio,'beforeMake') + console.log(this.radio, 'beforeMake') this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel) // if (!this.testPlateResult) { // this.plateNumber='' @@ -815,7 +836,7 @@ // }) // // return false // } - if (this.radio==null||!this.oilSitePriceDetailsVo[this.radio].priceId) { + if (this.radio == null || !this.oilSitePriceDetailsVo[this.radio].priceId) { uni.showToast({ icon: 'none', title: '请选择油品' @@ -850,7 +871,7 @@ }) return false } - if (this.vol < 0.01&& !this.tyRes.liter) { + if (this.vol < 0.01 && !this.tyRes.liter) { uni.showToast({ icon: 'none', title: '加油金额不能为空' @@ -864,10 +885,10 @@ }) return false } - if(this.channelJuli>1000){ + if (this.channelJuli > 1000) { this.showtitle = true return - } + } this.makerOrder() }, // 下单 @@ -875,41 +896,46 @@ // // console.log('下单数据', // this.plateNumber, this.jober, // ) - if(!this.timer){ - this.timer = setTimeout(()=>{ - let orderData = { - 'clientBelong':'BAICHUAN', - "amountGun": this.activeChannelCode == 'TY' ? this.ty.realMoney : '', - "shareCompanyQuota": 0, // 共享标识 - "priceId": this.oilSitePriceDetailsVo[this.radio].priceId, //类型:String 必有字段 备注:油价主键 - "orderType": "REAL_ORDER", //类型:String 必有字段 备注:订单类型(REAL_ORDER:真实订单 VIRTUAL_ORDER:虚拟订单) - "orderSource": "WECHAT_MINIAPPS", //类型:String 必有字段 备注:订单来源(WECHAT_MINIAPPS) - "plateNumber": this.plateNumber ? this.plateNumber : this.plateNumberSel, //类型:String 必有字段 备注:车牌号 - "siteUserName": this.jober, //类型:String 必有字段 备注:加油员 - "oilsBar": this.oilBar, //类型:Number 必有字段 备注:油枪 - "volume": this.activeChannelCode == 'TY' ? this.tyRes.liter : this.vol, //类型:Number 必有字段 备注:加油升数 - "realPrice": this.oilSitePriceDetailsVo[this.radio].sitePrice, //类型:Number 必有字段 备注:实际加油价格 - "suppleMark": 0, //类型:Number 必有字段 备注:补录标识(0:实时订单 1:补录订单) - "createSource": "XOIL_DRIVER_WECHAT_APPLET", //类型:String 必有字段 备注:创建来源( XOIL_DRIVER_WECHAT_APPLET) - // "deviceImei": "mock", //类型:String 可有字段 备注:设备唯一码 - // "networkIp": "mock" //类型:String 可有字段 备注:ip地址, - 'version':1, - 'xoilAmountGun':this.vol - } - oilOrderApi.createOrder(orderData).then(res => { - if (res.code == 20000) { + if (!this.timer) { + this.timer = setTimeout(() => { + let orderData = { + 'clientBelong': 'BAICHUAN', + "amountGun": this.activeChannelCode == 'TY' ? this.ty.realMoney : '', + "shareCompanyQuota": 0, // 共享标识 + "priceId": this.oilSitePriceDetailsVo[this.radio] + .priceId, //类型:String 必有字段 备注:油价主键 + "orderType": "REAL_ORDER", //类型:String 必有字段 备注:订单类型(REAL_ORDER:真实订单 VIRTUAL_ORDER:虚拟订单) + "orderSource": "WECHAT_MINIAPPS", //类型:String 必有字段 备注:订单来源(WECHAT_MINIAPPS) + "plateNumber": this.plateNumber ? this.plateNumber : this + .plateNumberSel, //类型:String 必有字段 备注:车牌号 + "siteUserName": this.jober, //类型:String 必有字段 备注:加油员 + "oilsBar": this.oilBar, //类型:Number 必有字段 备注:油枪 + "volume": this.activeChannelCode == 'TY' ? this.tyRes.liter : this + .vol, //类型:Number 必有字段 备注:加油升数 + "realPrice": this.oilSitePriceDetailsVo[this.radio] + .sitePrice, //类型:Number 必有字段 备注:实际加油价格 + "suppleMark": 0, //类型:Number 必有字段 备注:补录标识(0:实时订单 1:补录订单) + "createSource": "XOIL_DRIVER_WECHAT_APPLET", //类型:String 必有字段 备注:创建来源( XOIL_DRIVER_WECHAT_APPLET) + // "deviceImei": "mock", //类型:String 可有字段 备注:设备唯一码 + // "networkIp": "mock" //类型:String 可有字段 备注:ip地址, + 'version': 1, + 'xoilAmountGun': this.vol + } + oilOrderApi.createOrder(orderData).then(res => { + if (res.code == 20000) { + clearTimeout(this.timer) + uni.setStorageSync('orderMade', res.data) + uni.redirectTo({ + url: '/BagStation/pages/makeOrder/orderPaying?payMethod=' + res + .data.payMethod + }) + } + }).finally(msg => { clearTimeout(this.timer) - uni.setStorageSync('orderMade', res.data) - uni.redirectTo({ - url: '/BagStation/pages/makeOrder/orderPaying?payMethod='+res.data.payMethod - }) - } - }).finally(msg=>{ - clearTimeout(this.timer) - }) - },500) - } - + }) + }, 500) + } + }, tsetPlate(plateNumber) { this.testPlateResult = @@ -924,11 +950,11 @@ this.plateNumbers = res.data.plateNumbers this.oilSitePriceDetailsVo = res.data.oilSitePriceDetailsVo; this.siteUserNames = res.data.siteUserNames; - if(this.oilSitePriceDetailsVo.length==1){ + if (this.oilSitePriceDetailsVo.length == 1) { this.radio = 0 this.activeSitePrice = res.data.oilSitePriceDetailsVo[0].priceId } - + } }) }, @@ -969,16 +995,16 @@ }, changePrice(e) { this.radio = e.detail.value - console.log(e,'changePrice') - this.vol ='' + console.log(e, 'changePrice') + this.vol = '' this.activeSitePrice = this.oilSitePriceDetailsVo[this.radio].priceId - this.realMoney ='--' + this.realMoney = '--' this.xoilAmountGun = ''; - Object.keys(this.tyRes).forEach(key=>{ - this.tyRes[key]='' + Object.keys(this.tyRes).forEach(key => { + this.tyRes[key] = '' }) - Object.keys(this.ty).forEach(key=>{ - this.ty[key]='' + Object.keys(this.ty).forEach(key => { + this.ty[key] = '' }) this.vlom = '' // // console.log(this.radio) @@ -993,13 +1019,13 @@ }, filters: { moneyVolm(value) { - if (value != 'xxx.x') { - return Math.round(value * 100) / 100; - } else { - return value - } - - + if (value != 'xxx.x') { + return Math.round(value * 100) / 100; + } else { + return value + } + + }, channelCodeFamt(value) { if (value) { @@ -1018,9 +1044,9 @@ } } }, - moneyFormats(value){ + moneyFormats(value) { if (value != 'xxx.x') { - return Math.round(value * 100) / 100 + return Math.round(value * 100) / 100 } else { return value } @@ -1031,7 +1057,8 @@ } else { return value } - } } + } + } } @@ -1065,61 +1092,69 @@ .picker-view { min-height: 300upx; } - .close-icon{ + + .close-icon { position: absolute; right: 2%; top: 2%; } - .dialog-box{ + + .dialog-box { position: relative; } + .site-icon { width: 2rem; vertical-align: middle; } - + .my-tag { padding: 0 12rpx; } - + .pay-bar>>>.self-btn { padding: 0 64rpx; height: 94rpx !important; } - + .pay-bar>.cu-item { padding-right: 0; } - + .site-icon-sm { width: 50upx; } - + .nowrap { white-space: nowrap; } - + .picker-view { min-height: 300upx; } - .text-centerS{ + + .text-centerS { display: flex; justify-content: center; align-items: center; text-align: center; } - .red_btn{ + + .red_btn { color: #FFFFFF; background-color: #fe0505; } - .box-paddings{ - padding:40rpx 0; + + .box-paddings { + padding: 40rpx 0; } - .headShow{ + + .headShow { font-size: 36rpx; font-weight: 600; } - .showtext{ + + .showtext { line-height: 2; font-size: 30rpx; margin-bottom: 30rpx; @@ -1128,13 +1163,15 @@ letter-spacing: 3px; text-align: left; } - .checklocation_box_button{ + + .checklocation_box_button { display: flex; justify-content: space-between; align-items: center; padding: 0 5%; } - .btn-box{ + + .btn-box { width: 45%; flex: 0 0 auto; text-align: center; @@ -1144,7 +1181,8 @@ box-sizing: border-box; border: 2rpx solid #bfbfbf; } - .box-panding{ - padding:10 0; + + .box-panding { + padding: 10 0; } diff --git a/BagStation/pages/makeOrder/makeOrder.vue b/BagStation/pages/makeOrder/makeOrder.vue index 64901db..a173881 100644 --- a/BagStation/pages/makeOrder/makeOrder.vue +++ b/BagStation/pages/makeOrder/makeOrder.vue @@ -4,8 +4,10 @@ 中石化紫云路 返回 --> - - + + @@ -28,8 +30,10 @@ - - + + @@ -57,8 +61,9 @@ - + @@ -73,6 +78,7 @@ }, data() { return { + isBackPrev: true, radio: 'B', mainURL: this.global.mainURL, imgURL: this.global.imgURL, @@ -81,7 +87,7 @@ siteInfo: { }, - activeCur:0, + activeCur: 0, activePay: null, qrcodePay: null, @@ -94,6 +100,19 @@ } }, onLoad(option) { + if (option.q) { + try { + let originLink = decodeURIComponent(option.q) + let target = this.obtainUrlPathParameterTarget(originLink) + let authorization = uni.getStorageSync('Authorization') + if (authorization && target.siteId) { + // 扫码进入 返回按钮点击回到首页 + this.isBackPrev = false + this.getSiteInfo(target.siteId) + } + } catch (e) {} + return + } // console.log(option.siteId) if (this.tempScanSite) { this.siteInfo = this.tempScanSite @@ -103,14 +122,26 @@ } }, methods: { + obtainUrlPathParameterTarget(url) { + let target = {} + if (url.includes('?')) { + let paramsText = url.split("?")[1] + let paramsArr = paramsText.split("&") + paramsArr.forEach(item => { + target[item.split('=')[0]] = item.split('=')[1] + }) + } + return target + }, siteQrPay() { uni.navigateTo({ url: '/BagStation/pages/stationDetail/stieQr' }) }, getSiteInfo(id) { + let location = uni.getStorageSync('location') || {} let data2 = { - ...uni.getStorageSync('location'), + ...location, siteId: id } oilSiteApi.getSiteDetails(data2).then(res => { @@ -140,9 +171,10 @@ }, goBack() { - uni.navigateBack({ - + this.isBackPrev ? uni.navigateBack() : uni.navigateBack({ + url: '../../../pages/tabbar/home/home' }) + }, selectRadio() { this.radio === 'A' ? this.radio = '' : this.radio = 'A' @@ -178,15 +210,14 @@ return value > 1000 ? ((value / 1000).toFixed(2) + 'km') : (value + 'm') } } - } - , + }, onHide() { - console.log('这里是hiden') - this.innerAudioContext.stop() + // console.log('这里是hiden') + // this.innerAudioContext.stop() }, onUnload() { - console.log('这里是卸载页面') - this.innerAudioContext.stop() + // console.log('这里是卸载页面') + // this.innerAudioContext.stop() }, } diff --git a/BagStation/pages/stationDetail/stationDetail.vue b/BagStation/pages/stationDetail/stationDetail.vue index 36afe05..fdc477f 100644 --- a/BagStation/pages/stationDetail/stationDetail.vue +++ b/BagStation/pages/stationDetail/stationDetail.vue @@ -178,19 +178,35 @@ this.innerAudioContext && this.innerAudioContext.stop() }, onUnload() { - this.innerAudioContext && this.innerAudioContext.stop() + if (this.innerAudioContext) { + this.innerAudioContext.stop() + this.innerAudioContext.destroy() + } }, onLoad(option) { - - if(option.q) { - let originLink = decodeURIComponent(option.q) - let target = this.obtainUrlPathParameterTarget(originLink) - if(target.siteId) { - this.siteId = target.siteId - this.getSiteInfo(target.siteId) - } - return + if (option.q) { + try { + let originLink = decodeURIComponent(option.q) + let target = this.obtainUrlPathParameterTarget(originLink) + let authorization = uni.getStorageSync('Authorization') + if (authorization && target.siteId) { + uni.showModal({ + content: '该二维码非最新版,请提示油站工作人员更新', + success: res => { + if(res.confirm) { + this.siteId = target.siteId + this.gotoPay() + } + if(res.cancel) { + this.backTohome() + } + } + }) + } + } catch (e) {} + return } + if (!option.item) { let siteInfos = uni.getStorageSync('siteInfo') var oilItem = JSON.parse(decodeURIComponent(siteInfos)) @@ -236,7 +252,7 @@ }); }, backTohome() { - this.innerAudioContext && this.innerAudioContext.stop() + // this.innerAudioContext && this.innerAudioContext.stop() uni.switchTab({ url: '../../../pages/tabbar/home/home' }) @@ -245,7 +261,7 @@ this.showtitle = false }, gotoPay() { - this.innerAudioContext && this.innerAudioContext.stop() + // this.innerAudioContext && this.innerAudioContext.stop() uni.navigateTo({ url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}` }) @@ -255,7 +271,7 @@ this.secondChannelCode = sec }, siteQrPay() { - this.innerAudioContext && this.innerAudioContext.stop() + // this.innerAudioContext && this.innerAudioContext.stop() // let siteId = uni.navigateTo({ url: `/BagStation/pages/stationDetail/stieQr?siteId=${this.siteId}&activeChannelCode=${this.activeChannelCode}&secondChannelCode=${this.secondChannelCode}` @@ -306,7 +322,7 @@ if (this.siteInfo.juli > 1000) { this.showtitle = true } else { - this.innerAudioContext && this.innerAudioContext.stop() + // this.innerAudioContext && this.innerAudioContext.stop() uni.navigateTo({ url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}` }) @@ -317,7 +333,7 @@ this.qrcodePay = val }, onChangePay(val, active) { - console.log(val) + // console.log(val) this.activePay = val this.activeCur = active },