This commit is contained in:
xiaozhiyong
2023-11-27 14:47:28 +08:00
parent 548ba526f3
commit a4bf992e9b
6 changed files with 366 additions and 348 deletions

131
App.vue
View File

@@ -64,7 +64,7 @@
value: item.id 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[0].detailList = this.menuList[0].detailList.concat(channelCodes)
this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes) this.menuList[1].detailList = this.menuList[1].detailList.concat(productCodes)
this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands) this.menuList[2].detailList = this.menuList[2].detailList.concat(siteBrands)
@@ -93,8 +93,8 @@
} }
} }
// console.log(view.route) // console.log(view.route)
clearTimeout(loginTimer) // clearTimeout(loginTimer)
clearTimeout(onlineTimer) // clearTimeout(onlineTimer)
if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) { if (view.route != 'pages/index/startPage/startPage' && view.route.indexOf('BagAuth') == -1) {
const token = uni.getStorageSync('Authorization') const token = uni.getStorageSync('Authorization')
@@ -102,137 +102,70 @@
let jumpUrl = '/BagAuth/pages/login/login?loginType=true' let jumpUrl = '/BagAuth/pages/login/login?loginType=true'
let urlTarget = this.obtainUrlPathParameterTarget(view.$page.fullPath) let urlTarget = this.obtainUrlPathParameterTarget(view.$page.fullPath)
console.log('urlTarget',urlTarget) // console.log('urlTarget', urlTarget)
let target = {} let target = {}
if(urlTarget.q) { if (urlTarget.q) {
try {
let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q)) let originLink = decodeURIComponent(decodeURIComponent(urlTarget.q))
target = this.obtainUrlPathParameterTarget(originLink) target = this.obtainUrlPathParameterTarget(originLink)
target.siteId && (jumpUrl += `?scanningParams=${decodeURIComponent(urlTarget.q)}`) target.siteId && (jumpUrl += `&scanningParams=${decodeURIComponent(urlTarget.q)}`)
} catch (e) {}
} }
if (token && openid) { if (token && openid) {
this.getAmount() this.getAmount(jumpUrl)
// 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)
} else { } else {
target.siteId && uni.redirectTo({ target.siteId && uni.redirectTo({
url: jumpUrl url: jumpUrl
}) })
// loginTimer = setTimeout(() => {
// uni.showModal({
// title: '请您登录',
// content: '您还没有登录,暂时查不到油站哦',
// duration: '3000',
// success: function(res) {
// if (res.confirm) {
// uni.redirectTo({
// url: '/BagAuth/pages/login/login'
// })
// }
// }
// })
// }, 1000)
} }
} }
// }
}) })
}, },
obtainUrlPathParameterTarget(url) { obtainUrlPathParameterTarget(url) {
let target = {} let target = {}
if(url.includes('?')) { if (url.includes('?')) {
let paramsText = url.split("?")[1] let paramsText = url.split("?")[1]
let paramsArr = paramsText.split("&") let paramsArr = paramsText.split("&")
paramsArr.forEach(item => { paramsArr.forEach(item => {
target[item.split('=')[0]] = item.split('=')[1] target[item.split('=')[0]] = item.split('=')[1]
}) })
} }
console.log('11target',target) // console.log('11target', target)
return target return target
}, },
// 是否token过期或ip更改 // 是否token过期或ip更改
getAmount() { getAmount(jumpUrl) {
clearTimeout(loginTimer)
accountApi.getTotalOilCardInfo().then(res => { accountApi.getTotalOilCardInfo().then(res => {
if (res.code == 20000) { if (res.code == 42011) {
this.loginStatus = 'online' uni.clearStorageSync()
} else if (res.code == 42011) { uni.showModal({
this.loginStatus = 'offline' title: '需要您重新登录',
this.msg = res.msg content: res.msg,
duration: '3000',
success: (res) => {
if (res.confirm) {
uni.redirectTo({
url: jumpUrl
})
}
}
})
} }
}) })
}, },
}, },
onReady() { // onShow: function() {
// const token = uni.getStorageSync('Authorization')
// const openid = uni.getStorageSync('openid')
}, // if (token && openid) {
// this.getAmount()
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 == '在线') {
}
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')
}
} }
</script> </script>

View File

@@ -223,17 +223,17 @@
let user = resData.authTokenDTO.loginUser let user = resData.authTokenDTO.loginUser
uni.setStorageSync('user', user) uni.setStorageSync('user', user)
setTimeout(() => { // setTimeout(() => {
uni.showToast({ // uni.showToast({
title: res.msg, // title: res.msg,
icon: 'none', // icon: 'none',
complete: (err) => { // complete: (err) => {
} // }
}) // })
}, 1000); // }, 1000);
if(this.scanningParams) { if(this.scanningParams) {
uni.redirectTo({ uni.redirectTo({
url: `/BagStation/pages/stationDetail/stationDetail?q=${this.scanningParams}` url: `/BagStation/pages/makeOrder/makeOrder?q=${this.scanningParams}`
}) })
return return
} }

View File

@@ -171,11 +171,11 @@
loginRes: {}, loginRes: {},
checked: false, checked: false,
next: false, next: false,
scanningParams:null scanningParams: null
} }
}, },
onLoad(options) { onLoad(options) {
if(options.scanningParams) { if (options.scanningParams) {
// 用于扫码进入油站详情页面 // 用于扫码进入油站详情页面
this.scanningParams = options.scanningParams this.scanningParams = options.scanningParams
} }
@@ -408,9 +408,9 @@
icon: 'none' icon: 'none'
}) })
}, 1000); }, 1000);
if(this.scanningParams) { if (this.scanningParams && this.scanningParams !== 'null') {
uni.redirectTo({ uni.redirectTo({
url: `/BagStation/pages/stationDetail/stationDetail?q=${this.scanningParams}` url: `/BagStation/pages/makeOrder/makeOrder?q=${this.scanningParams}`
}) })
return return
} }

View File

@@ -8,8 +8,9 @@
</view> </view>
</view> </view>
<scroll-view scroll-x class=" nav text-center"> <scroll-view scroll-x class=" nav text-center">
<view class="cu-item" v-for="(item,index) in channelList" v-if="index==activeCur" :class="index==activeCur?'text-red cur':''" :key="item.channelId" <view class="cu-item" v-for="(item,index) in channelList" v-if="index==activeCur"
@tap="tabSelect" :data-id="index" :data-channel-code="item.channelCode"> :class="index==activeCur?'text-red cur':''" :key="item.channelId" @tap="tabSelect" :data-id="index"
:data-channel-code="item.channelCode">
<image class="site-icon margin-right-sm" :src="imgURL+'site-'+item.channelCode+'.png'" mode="widthFix"> <image class="site-icon margin-right-sm" :src="imgURL+'site-'+item.channelCode+'.png'" mode="widthFix">
</image> </image>
{{item.channelCode|channelCodeFamt}} {{item.channelCode|channelCodeFamt}}
@@ -18,16 +19,19 @@
</scroll-view> </scroll-view>
<radio-group class="block" @change="changePrice"> <radio-group class="block" @change="changePrice">
<view class="cu-list menu text-left"> <view class="cu-list menu text-left">
<view class="cu-item" v-for="(itemx,index) in oilSitePriceDetailsVo" :key="index" v-if="itemx.sitePrice>0"> <view class="cu-item" v-for="(itemx,index) in oilSitePriceDetailsVo" :key="index"
v-if="itemx.sitePrice>0">
<label class="flex justify-between align-center flex-sub"> <label class="flex justify-between align-center flex-sub">
<radio class="round red" :class="radio=='radio' + index?'checked':''" :checked= " radio ==index?true : false" :value="index"></radio> <radio class="round red" :class="radio=='radio' + index?'checked':''"
:checked=" radio ==index?true : false" :value="index"></radio>
<text class="cu-tag my-tag line-red text-lg"> <text class="cu-tag my-tag line-red text-lg">
</text> </text>
<text class="text-bold text-black text-lg">{{itemx.oilProductCode}}</text> <text class="text-bold text-black text-lg">{{itemx.oilProductCode}}</text>
<text class="text-bold text-red text-lg">{{itemx.sitePrice!=0?itemx.sitePrice:'-.--'}}/L</text> <text class="text-bold text-red text-lg">{{itemx.sitePrice!=0?itemx.sitePrice:'-.--'}}/L</text>
<text class="text-delete">{{itemx.oilSitePrice}}/L</text> <text class="text-delete">{{itemx.oilSitePrice}}/L</text>
<text class="text-sm">预计每100L节省{{(100*(itemx.oilSitePrice - itemx.sitePrice))|moneyFormat}}</text> <text
class="text-sm">预计每100L节省{{(100*(itemx.oilSitePrice - itemx.sitePrice))|moneyFormat}}</text>
</label> </label>
</view> </view>
</view> </view>
@@ -39,14 +43,17 @@
<view class="padding-top-sm"> <view class="padding-top-sm">
<view class="grid col-5 "> <view class="grid col-5 ">
<view v-for="(item,index) in checkBar" class="padding-xs" :key="index"> <view v-for="(item,index) in checkBar" class="padding-xs" :key="index">
<button class="cu-btn red block" :class="item.checked?'bg-red':'line-red'" @tap="ChooseBar" :data-value="item.value"> <button class="cu-btn red block" :class="item.checked?'bg-red':'line-red'" @tap="ChooseBar"
:data-value="item.value">
{{item.name}} {{item.name}}
<view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'" v-if="item.hot">HOT</view> <view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'"
v-if="item.hot">HOT</view>
</button> </button>
</view> </view>
<view class="padding-xs" style="width:40% ;" v-if="activeChannelCode!='TY'"> <view class="padding-xs" style="width:40% ;" v-if="activeChannelCode!='TY'">
<input type="number" @input="onInputBar" v-model="inputBar" class="cu-btn red block" placeholder="其他油枪" value="" /> <input type="number" @input="onInputBar" v-model="inputBar" class="cu-btn red block"
placeholder="其他油枪" value="" />
</view> </view>
</view> </view>
</view> </view>
@@ -96,7 +103,8 @@
油机金额 油机金额
</view> </view>
<view class="text-center" style="width: 60%;margin: 0 2%;"> <view class="text-center" style="width: 60%;margin: 0 2%;">
<input v-model="vol" @input='checkNumber' @blur="getMoneyVol" type="digit" class="block" placeholder="请输入油机金额" value=""style="border-bottom: 1px solid #efefef;" /> <input v-model="vol" @input='checkNumber' @blur="getMoneyVol" type="digit" class="block"
placeholder="请输入油机金额" value="" style="border-bottom: 1px solid #efefef;" />
</view> </view>
<view class=""> <view class="">
<text class=" padding-right-sm"> <text class=" padding-right-sm">
@@ -107,9 +115,12 @@
</view> </view>
<view class="grid col-5 padding-sm"> <view class="grid col-5 padding-sm">
<view v-for="(item,index) in checkMoney" class="padding-xs" :key="index"> <view v-for="(item,index) in checkMoney" class="padding-xs" :key="index">
<button class="cu-btn red block" style=" padding: 0;" :class="item.checked?'bg-red':'line-red'" @tap="ChooseCheckMoney(item.value)" :data-value="item.value"> <button class="cu-btn red block" style=" padding: 0;"
:class="item.checked?'bg-red':'line-red'" @tap="ChooseCheckMoney(item.value)"
:data-value="item.value">
{{item.name}}&yen; {{item.name}}&yen;
<view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'" v-if="item.hot">HOT</view> <view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'"
v-if="item.hot">HOT</view>
</button> </button>
</view> </view>
</view> </view>
@@ -124,7 +135,8 @@
加油金额 加油金额
</view> </view>
<view class="text-center"> <view class="text-center">
<input v-model="ty.realMoney" @input="onInputTyMoney" type="digit" class="block" placeholder="加油金额" value="" /> <input v-model="ty.realMoney" @input="onInputTyMoney" type="digit" class="block"
placeholder="加油金额" value="" />
</view> </view>
<view class=""> <view class="">
<text class="text-bold padding-right-sm"> <text class="text-bold padding-right-sm">
@@ -135,9 +147,11 @@
</view> </view>
<view class="grid col-5 padding-sm"> <view class="grid col-5 padding-sm">
<view v-for="(item,index) in checkVol" class="padding-xs" :key="index"> <view v-for="(item,index) in checkVol" class="padding-xs" :key="index">
<button class="cu-btn red block" :class="item.checked?'bg-red':'line-red'" @tap="ChooseCheckVol" :data-value="item.value"> <button class="cu-btn red block" :class="item.checked?'bg-red':'line-red'"
@tap="ChooseCheckVol" :data-value="item.value">
{{item.name}} {{item.name}}
<view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'" v-if="item.hot">HOT</view> <view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'"
v-if="item.hot">HOT</view>
</button> </button>
</view> </view>
@@ -181,8 +195,10 @@
<view class="margin cu-list pay-bar menu radius solid-top solid-bottom solid-left"> <view class="margin cu-list pay-bar menu radius solid-top solid-bottom solid-left">
<view class="cu-item "> <view class="cu-item ">
<view class=""> <view class="">
合计<text class="text-red fr" v-if="activeChannelCode!='TY'">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}</text> 合计<text class="text-red fr"
<text class="text-red fr" v-else>{{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text> v-if="activeChannelCode!='TY'">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}</text>
<text class="text-red fr"
v-else>{{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text>
</view> </view>
<view class="" @tap="showOrderMsg"> <view class="" @tap="showOrderMsg">
明细<text class="cuIcon-unfold padding-left-xs"></text> 明细<text class="cuIcon-unfold padding-left-xs"></text>
@@ -238,7 +254,8 @@
</view> </view>
<view class="padding-tb-xs text-left"> <view class="padding-tb-xs text-left">
直降金额 直降金额
<text class="text-red fr">{{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text> <text
class="text-red fr">{{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text>
</view> </view>
</view> </view>
<view class="padding-tb-xs text-left"> <view class="padding-tb-xs text-left">
@@ -247,7 +264,8 @@
</view> </view>
<view class="padding-tb-xs text-left"> <view class="padding-tb-xs text-left">
合计 合计
<text class="text-red fr" v-if="activeChannelCode!='TY'">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}</text> <text class="text-red fr"
v-if="activeChannelCode!='TY'">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}</text>
<text class="text-red fr" v-else>{{ty.realMoney>0?ty.realMoney:'xxx.x'|moneyFormat}}</text> <text class="text-red fr" v-else>{{ty.realMoney>0?ty.realMoney:'xxx.x'|moneyFormat}}</text>
</view> </view>
</view> </view>
@@ -255,8 +273,10 @@
<view class="cu-list margin pay-bar menu radius solid-top solid-bottom solid-left"> <view class="cu-list margin pay-bar menu radius solid-top solid-bottom solid-left">
<view class="cu-item "> <view class="cu-item ">
<view class=""> <view class="">
合计<text class="text-red" v-if="activeChannelCode!='TY'">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}</text> 合计<text class="text-red"
<text class="text-red" v-else>{{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text> v-if="activeChannelCode!='TY'">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}</text>
<text class="text-red"
v-else>{{ty.realMoney>0?ty.realMoney-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text>
</view> </view>
<view class="" @tap="showOrder=''"> <view class="" @tap="showOrder=''">
明细<text class="cuIcon-fold padding-left-xs"></text> 明细<text class="cuIcon-fold padding-left-xs"></text>
@@ -285,8 +305,8 @@
</view> </view>
<input type="text" value="" placeholder="请选择或输入车牌号" v-model="plateNumber" /> <input type="text" value="" placeholder="请选择或输入车牌号" v-model="plateNumber" />
</view> </view>
<picker-view :indicator-style="indicatorStyle" v-if="plateNumbers.length" :value="plateIndex" @change="pickPlate" <picker-view :indicator-style="indicatorStyle" v-if="plateNumbers.length" :value="plateIndex"
class="picker-view"> @change="pickPlate" class="picker-view">
<picker-view-column> <picker-view-column>
<view class="item" v-for="(item,index) in plateNumbers" :key="index">{{item}}</view> <view class="item" v-for="(item,index) in plateNumbers" :key="index">{{item}}</view>
</picker-view-column> </picker-view-column>
@@ -303,10 +323,10 @@
<view class=""> <view class="">
<image src="../../../static/img/errIcon.png" mode="" style="width:100rpx;height: 100rpx;"></image> <image src="../../../static/img/errIcon.png" mode="" style="width:100rpx;height: 100rpx;"></image>
</view> </view>
<view class="cu-bar box-panding text-centerS" > <view class="cu-bar box-panding text-centerS">
<text class="headShow">支付提醒</text> <text class="headShow">支付提醒</text>
</view> </view>
<view class="cu-bar box-panding" > <view class="cu-bar box-panding">
<text class="showtext">当前油站距离您较远请与加油员确认您选择的油站是否正确</text> <text class="showtext">当前油站距离您较远请与加油员确认您选择的油站是否正确</text>
</view> </view>
<view class="checklocation_box_button"> <view class="checklocation_box_button">
@@ -332,7 +352,7 @@
type: Array, type: Array,
default () {} default () {}
}, },
channelJuli:{ channelJuli: {
type: Number, type: Number,
default: '' default: ''
}, },
@@ -347,11 +367,11 @@
}, },
data() { data() {
return { return {
timer:null, timer: null,
discount:'', discount: '',
activeSitePrice:'', activeSitePrice: '',
showtitles:"", showtitles: "",
showtitle:false, showtitle: false,
oilBarTy: '', oilBarTy: '',
ty: { ty: {
realMoney: "" realMoney: ""
@@ -406,7 +426,7 @@
hot: false, hot: false,
}], }],
plateNumber: '', plateNumber: '',
checkMoney:[{ checkMoney: [{
value: 100, value: 100,
name: '100 ', name: '100 ',
checked: false, checked: false,
@@ -435,7 +455,7 @@
checkbox: [{ checkbox: [{
value: 1, value: 1,
name: '1', name: '1',
checked: false, checked: true,
hot: false, hot: false,
}, { }, {
value: 2, value: 2,
@@ -475,9 +495,9 @@
}], }],
activeChannelCode: '', activeChannelCode: '',
checkBar: [], checkBar: [],
realMoney:'', realMoney: '',
xoilAmountGun:'', xoilAmountGun: '',
vlom:'' vlom: ''
} }
}, },
created() { created() {
@@ -487,33 +507,34 @@
watch: { watch: {
activeChannelCode: { activeChannelCode: {
handler(newval) { handler(newval) {
this.oilBar = ''
setTimeout(() => { setTimeout(() => {
this.oilBar = 1
this.checkBar = this.calcBar() this.checkBar = this.calcBar()
}, 2) }, 0)
} }
}, },
priceId: { priceId: {
handler(newval) { handler(newval) {
this.oilBar = '' // this.oilBar = ''
setTimeout(() => { // setTimeout(() => {
this.checkBar = this.calcBar() // this.checkBar = this.calcBar()
}, 2) // }, 2)
} }
}, },
radio:{ radio: {
handler(n,o) { handler(n, o) {
console.log(n,o,'handler'); // console.log(n,o,'handler');
this.checkBar.forEach(item=>{ // this.checkBar.forEach(item=>{
item.checked = false // item.checked = false
}); // });
this.oilBar = '' // this.oilBar = ''
} }
} }
}, },
computed: { computed: {
priceId() { 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 return this.oilSitePriceDetailsVo[this.radio].priceId
} }
}, },
@@ -527,7 +548,7 @@
}, },
plateNumberSel() { plateNumberSel() {
if (this.plateNumbers.length) { if (this.plateNumbers.length) {
return this.plateNumbers[this.plateIndex]?this.plateNumbers[this.plateIndex]:'非必填' return this.plateNumbers[this.plateIndex] ? this.plateNumbers[this.plateIndex] : '非必填'
} }
}, },
jober() { jober() {
@@ -560,92 +581,92 @@
}, },
methods: { methods: {
checkNumber(e){ checkNumber(e) {
e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null; e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
this.$nextTick(()=>{ this.$nextTick(() => {
this.vol = e.detail.value this.vol = e.detail.value
}) })
}, },
checkMoneyVol(e){ checkMoneyVol(e) {
console.log(e) console.log(e)
if(e == ''){ if (e == '') {
uni.showToast({ uni.showToast({
title:'请输入金额', title: '请输入金额',
icon:'none' icon: 'none'
}) })
return return
} }
let isNumber = this.isNumber(e) let isNumber = this.isNumber(e)
if(!isNumber){ if (!isNumber) {
uni.showToast({ uni.showToast({
title:'请输入正确金额', title: '请输入正确金额',
icon:'none' icon: 'none'
}) })
return return
} }
let number = { let number = {
payType : 'CUSTOMER_ACTIVE', payType: 'CUSTOMER_ACTIVE',
userType:'0', userType: '0',
xoilAmountGun:e , xoilAmountGun: e,
priceId:this.activeSitePrice priceId: this.activeSitePrice
} }
this.xoilAmountGun = e this.xoilAmountGun = e
oilSiteApi.getOrderDiscountInfo(number).then( res=>{ oilSiteApi.getOrderDiscountInfo(number).then(res => {
console.log(res) console.log(res)
this.realMoney = res.data.payRealAmount this.realMoney = res.data.payRealAmount
this.discount = res.data.oilDiscountAmount this.discount = res.data.oilDiscountAmount
this.vlom = res.data.volume this.vlom = res.data.volume
}) })
}, },
ChooseCheckMoney(e){ ChooseCheckMoney(e) {
console.log(e) console.log(e)
this.vol = e+'' this.vol = e + ''
this.checkMoneyVol(this.vol ) this.checkMoneyVol(this.vol)
}, },
isNumber(value){ // 判断是否为正常数字 isNumber(value) { // 判断是否为正常数字
const regPos = /^\d+(\.\d+)?$/; //非负浮点数 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]*)))$/; //负浮点数 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 return false
} }
if( regPos.test(value) || regNeg.test(value)){ if (regPos.test(value) || regNeg.test(value)) {
return true return true
}else{ } else {
return false return false
} }
}, },
getMoneyVol(e){ getMoneyVol(e) {
console.log(e) console.log(e)
if(e.detail.value == ''){ if (e.detail.value == '') {
uni.showToast({ uni.showToast({
title:'请输入金额', title: '请输入金额',
icon:'none' icon: 'none'
}) })
return return
} }
let isNumber = this.isNumber(e.detail.value) let isNumber = this.isNumber(e.detail.value)
if(!isNumber){ if (!isNumber) {
uni.showToast({ uni.showToast({
title:'请输入正确金额', title: '请输入正确金额',
icon:'none' icon: 'none'
}) })
return return
} }
let number = { let number = {
payType : 'CUSTOMER_ACTIVE', payType: 'CUSTOMER_ACTIVE',
userType:'0', userType: '0',
xoilAmountGun:e.detail.value, xoilAmountGun: e.detail.value,
priceId:this.activeSitePrice priceId: this.activeSitePrice
} }
this.xoilAmountGun = e.detail.value this.xoilAmountGun = e.detail.value
oilSiteApi.getOrderDiscountInfo(number).then( res=>{ oilSiteApi.getOrderDiscountInfo(number).then(res => {
console.log(res) console.log(res)
this.realMoney = res.data.payRealAmount this.realMoney = res.data.payRealAmount
this.discount = res.data.oilDiscountAmount this.discount = res.data.oilDiscountAmount
this.vlom = res.data.volume this.vlom = res.data.volume
}) })
}, },
checkInfo(){ checkInfo() {
console.log(this.radio) console.log(this.radio)
this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel) this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel)
// if (!this.testPlateResult) { // if (!this.testPlateResult) {
@@ -656,7 +677,7 @@
// }) // })
// // return false // // return false
// } // }
if (this.radio==null||!this.oilSitePriceDetailsVo[this.radio].priceId) { if (this.radio == null || !this.oilSitePriceDetailsVo[this.radio].priceId) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '请选择油品' title: '请选择油品'
@@ -691,7 +712,7 @@
}) })
return false return false
} }
if (this.vol < 0.01&& !this.tyRes.liter) { if (this.vol < 0.01 && !this.tyRes.liter) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '加油金额不能为空' title: '加油金额不能为空'
@@ -708,15 +729,15 @@
this.makerOrder() this.makerOrder()
}, },
gotoPay(){ gotoPay() {
this.checkInfo() this.checkInfo()
}, },
hidendialog(){ hidendialog() {
this.showtitle =false this.showtitle = false
}, },
backTohome(){ backTohome() {
uni.switchTab({ uni.switchTab({
url:'../../../pages/tabbar/home/home' url: '../../../pages/tabbar/home/home'
}) })
}, },
calcBar() { calcBar() {
@@ -805,7 +826,7 @@
} }
}, },
beforeMake() { beforeMake() {
console.log(this.radio,'beforeMake') console.log(this.radio, 'beforeMake')
this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel) this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel)
// if (!this.testPlateResult) { // if (!this.testPlateResult) {
// this.plateNumber='' // this.plateNumber=''
@@ -815,7 +836,7 @@
// }) // })
// // return false // // return false
// } // }
if (this.radio==null||!this.oilSitePriceDetailsVo[this.radio].priceId) { if (this.radio == null || !this.oilSitePriceDetailsVo[this.radio].priceId) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '请选择油品' title: '请选择油品'
@@ -850,7 +871,7 @@
}) })
return false return false
} }
if (this.vol < 0.01&& !this.tyRes.liter) { if (this.vol < 0.01 && !this.tyRes.liter) {
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '加油金额不能为空' title: '加油金额不能为空'
@@ -864,7 +885,7 @@
}) })
return false return false
} }
if(this.channelJuli>1000){ if (this.channelJuli > 1000) {
this.showtitle = true this.showtitle = true
return return
} }
@@ -875,39 +896,44 @@
// // console.log('下单数据', // // console.log('下单数据',
// this.plateNumber, this.jober, // this.plateNumber, this.jober,
// ) // )
if(!this.timer){ if (!this.timer) {
this.timer = setTimeout(()=>{ this.timer = setTimeout(() => {
let orderData = { let orderData = {
'clientBelong':'BAICHUAN', 'clientBelong': 'BAICHUAN',
"amountGun": this.activeChannelCode == 'TY' ? this.ty.realMoney : '', "amountGun": this.activeChannelCode == 'TY' ? this.ty.realMoney : '',
"shareCompanyQuota": 0, // 共享标识 "shareCompanyQuota": 0, // 共享标识
"priceId": this.oilSitePriceDetailsVo[this.radio].priceId, //类型String 必有字段 备注:油价主键 "priceId": this.oilSitePriceDetailsVo[this.radio]
.priceId, //类型String 必有字段 备注:油价主键
"orderType": "REAL_ORDER", //类型String 必有字段 备注订单类型REAL_ORDER真实订单 VIRTUAL_ORDER虚拟订单 "orderType": "REAL_ORDER", //类型String 必有字段 备注订单类型REAL_ORDER真实订单 VIRTUAL_ORDER虚拟订单
"orderSource": "WECHAT_MINIAPPS", //类型String 必有字段 备注订单来源WECHAT_MINIAPPS "orderSource": "WECHAT_MINIAPPS", //类型String 必有字段 备注订单来源WECHAT_MINIAPPS
"plateNumber": this.plateNumber ? this.plateNumber : this.plateNumberSel, //类型String 必有字段 备注:车牌号 "plateNumber": this.plateNumber ? this.plateNumber : this
.plateNumberSel, //类型String 必有字段 备注:车牌号
"siteUserName": this.jober, //类型String 必有字段 备注:加油员 "siteUserName": this.jober, //类型String 必有字段 备注:加油员
"oilsBar": this.oilBar, //类型Number 必有字段 备注:油枪 "oilsBar": this.oilBar, //类型Number 必有字段 备注:油枪
"volume": this.activeChannelCode == 'TY' ? this.tyRes.liter : this.vol, //类型Number 必有字段 备注:加油升数 "volume": this.activeChannelCode == 'TY' ? this.tyRes.liter : this
"realPrice": this.oilSitePriceDetailsVo[this.radio].sitePrice, //类型Number 必有字段 备注:实际加油价格 .vol, //类型Number 必有字段 备注:加油升数
"realPrice": this.oilSitePriceDetailsVo[this.radio]
.sitePrice, //类型Number 必有字段 备注:实际加油价格
"suppleMark": 0, //类型Number 必有字段 备注补录标识0实时订单 1补录订单 "suppleMark": 0, //类型Number 必有字段 备注补录标识0实时订单 1补录订单
"createSource": "XOIL_DRIVER_WECHAT_APPLET", //类型String 必有字段 备注:创建来源( XOIL_DRIVER_WECHAT_APPLET "createSource": "XOIL_DRIVER_WECHAT_APPLET", //类型String 必有字段 备注:创建来源( XOIL_DRIVER_WECHAT_APPLET
// "deviceImei": "mock", //类型String 可有字段 备注:设备唯一码 // "deviceImei": "mock", //类型String 可有字段 备注:设备唯一码
// "networkIp": "mock" //类型String 可有字段 备注ip地址, // "networkIp": "mock" //类型String 可有字段 备注ip地址,
'version':1, 'version': 1,
'xoilAmountGun':this.vol 'xoilAmountGun': this.vol
} }
oilOrderApi.createOrder(orderData).then(res => { oilOrderApi.createOrder(orderData).then(res => {
if (res.code == 20000) { if (res.code == 20000) {
clearTimeout(this.timer) clearTimeout(this.timer)
uni.setStorageSync('orderMade', res.data) uni.setStorageSync('orderMade', res.data)
uni.redirectTo({ uni.redirectTo({
url: '/BagStation/pages/makeOrder/orderPaying?payMethod='+res.data.payMethod url: '/BagStation/pages/makeOrder/orderPaying?payMethod=' + res
.data.payMethod
}) })
} }
}).finally(msg=>{ }).finally(msg => {
clearTimeout(this.timer) clearTimeout(this.timer)
}) })
},500) }, 500)
} }
}, },
@@ -924,7 +950,7 @@
this.plateNumbers = res.data.plateNumbers this.plateNumbers = res.data.plateNumbers
this.oilSitePriceDetailsVo = res.data.oilSitePriceDetailsVo; this.oilSitePriceDetailsVo = res.data.oilSitePriceDetailsVo;
this.siteUserNames = res.data.siteUserNames; this.siteUserNames = res.data.siteUserNames;
if(this.oilSitePriceDetailsVo.length==1){ if (this.oilSitePriceDetailsVo.length == 1) {
this.radio = 0 this.radio = 0
this.activeSitePrice = res.data.oilSitePriceDetailsVo[0].priceId this.activeSitePrice = res.data.oilSitePriceDetailsVo[0].priceId
} }
@@ -969,16 +995,16 @@
}, },
changePrice(e) { changePrice(e) {
this.radio = e.detail.value this.radio = e.detail.value
console.log(e,'changePrice') console.log(e, 'changePrice')
this.vol ='' this.vol = ''
this.activeSitePrice = this.oilSitePriceDetailsVo[this.radio].priceId this.activeSitePrice = this.oilSitePriceDetailsVo[this.radio].priceId
this.realMoney ='--' this.realMoney = '--'
this.xoilAmountGun = ''; this.xoilAmountGun = '';
Object.keys(this.tyRes).forEach(key=>{ Object.keys(this.tyRes).forEach(key => {
this.tyRes[key]='' this.tyRes[key] = ''
}) })
Object.keys(this.ty).forEach(key=>{ Object.keys(this.ty).forEach(key => {
this.ty[key]='' this.ty[key] = ''
}) })
this.vlom = '' this.vlom = ''
// // console.log(this.radio) // // console.log(this.radio)
@@ -1018,7 +1044,7 @@
} }
} }
}, },
moneyFormats(value){ moneyFormats(value) {
if (value != 'xxx.x') { if (value != 'xxx.x') {
return Math.round(value * 100) / 100 return Math.round(value * 100) / 100
} else { } else {
@@ -1031,7 +1057,8 @@
} else { } else {
return value return value
} }
} } }
}
} }
</script> </script>
@@ -1065,14 +1092,17 @@
.picker-view { .picker-view {
min-height: 300upx; min-height: 300upx;
} }
.close-icon{
.close-icon {
position: absolute; position: absolute;
right: 2%; right: 2%;
top: 2%; top: 2%;
} }
.dialog-box{
.dialog-box {
position: relative; position: relative;
} }
.site-icon { .site-icon {
width: 2rem; width: 2rem;
vertical-align: middle; vertical-align: middle;
@@ -1102,24 +1132,29 @@
.picker-view { .picker-view {
min-height: 300upx; min-height: 300upx;
} }
.text-centerS{
.text-centerS {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
text-align: center; text-align: center;
} }
.red_btn{
.red_btn {
color: #FFFFFF; color: #FFFFFF;
background-color: #fe0505; background-color: #fe0505;
} }
.box-paddings{
padding:40rpx 0; .box-paddings {
padding: 40rpx 0;
} }
.headShow{
.headShow {
font-size: 36rpx; font-size: 36rpx;
font-weight: 600; font-weight: 600;
} }
.showtext{
.showtext {
line-height: 2; line-height: 2;
font-size: 30rpx; font-size: 30rpx;
margin-bottom: 30rpx; margin-bottom: 30rpx;
@@ -1128,13 +1163,15 @@
letter-spacing: 3px; letter-spacing: 3px;
text-align: left; text-align: left;
} }
.checklocation_box_button{
.checklocation_box_button {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
padding: 0 5%; padding: 0 5%;
} }
.btn-box{
.btn-box {
width: 45%; width: 45%;
flex: 0 0 auto; flex: 0 0 auto;
text-align: center; text-align: center;
@@ -1144,7 +1181,8 @@
box-sizing: border-box; box-sizing: border-box;
border: 2rpx solid #bfbfbf; border: 2rpx solid #bfbfbf;
} }
.box-panding{
padding:10 0; .box-panding {
padding: 10 0;
} }
</style> </style>

View File

@@ -4,8 +4,10 @@
<block slot="content">中石化紫云路</block> <block slot="content">中石化紫云路</block>
<block slot="backText">返回</block> <block slot="backText">返回</block>
</cu-custom> --> </cu-custom> -->
<view class="bg-img fixed-top flex align-end margin-bottom-lg " :style="'background-image: url('+imgURL+'site-bg.png '+');width: 750upx;height: 326rpx;background-size:cover'"> <view class="bg-img fixed-top flex align-end margin-bottom-lg "
<image @tap="goBack" :src="imgURL+'site-back.png'" width="20upx" mode="widthFix" class="position-ab site-back"> :style="'background-image: url('+imgURL+'site-bg.png '+');width: 750upx;height: 326rpx;background-size:cover'">
<image @tap="goBack" :src="imgURL+'site-back.png'" width="20upx" mode="widthFix"
class="position-ab site-back">
</image> </image>
<view class="flex-sub"> <view class="flex-sub">
<view class="cu-list menu margin padding-sm radius my-shadow bg-white yu-card-xuan"> <view class="cu-list menu margin padding-sm radius my-shadow bg-white yu-card-xuan">
@@ -28,8 +30,10 @@
</view> </view>
</view> </view>
</view> </view>
<view class="bg-img placeholder-hidden flex align-end margin-bottom-lg " :style="'background-image: url('+imgURL+'site-bg.png '+');width: 750upx;height: 326rpx;background-size:cover'"> <view class="bg-img placeholder-hidden flex align-end margin-bottom-lg "
<image @tap="goBack" :src="imgURL+'site-back.png'" width="20upx" mode="widthFix" class="position-ab site-back"> :style="'background-image: url('+imgURL+'site-bg.png '+');width: 750upx;height: 326rpx;background-size:cover'">
<image @tap="goBack" :src="imgURL+'site-back.png'" width="20upx" mode="widthFix"
class="position-ab site-back">
</image> </image>
<view class="flex-sub"> <view class="flex-sub">
<view class="cu-list menu margin padding-sm radius my-shadow bg-white yu-card-xuan"> <view class="cu-list menu margin padding-sm radius my-shadow bg-white yu-card-xuan">
@@ -57,8 +61,9 @@
</view> </view>
<!-- 价格 --> <!-- 价格 -->
<price-select-tab @onChangePayQr="onChangePayQr" @onChangePay="onChangePay" :active-cur="activeCur" :site-name="siteInfo.siteName" <price-select-tab @onChangePayQr="onChangePayQr" @onChangePay="onChangePay" :active-cur="activeCur"
:channel-list="siteInfo.oilSiteChannelDetailsVos" :channelJuli="siteInfo.juli"></price-select-tab> :site-name="siteInfo.siteName" :channel-list="siteInfo.oilSiteChannelDetailsVos"
:channelJuli="siteInfo.juli"></price-select-tab>
</view> </view>
@@ -73,6 +78,7 @@
}, },
data() { data() {
return { return {
isBackPrev: true,
radio: 'B', radio: 'B',
mainURL: this.global.mainURL, mainURL: this.global.mainURL,
imgURL: this.global.imgURL, imgURL: this.global.imgURL,
@@ -81,7 +87,7 @@
siteInfo: { siteInfo: {
}, },
activeCur:0, activeCur: 0,
activePay: null, activePay: null,
qrcodePay: null, qrcodePay: null,
@@ -94,6 +100,19 @@
} }
}, },
onLoad(option) { 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) // console.log(option.siteId)
if (this.tempScanSite) { if (this.tempScanSite) {
this.siteInfo = this.tempScanSite this.siteInfo = this.tempScanSite
@@ -103,14 +122,26 @@
} }
}, },
methods: { 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() { siteQrPay() {
uni.navigateTo({ uni.navigateTo({
url: '/BagStation/pages/stationDetail/stieQr' url: '/BagStation/pages/stationDetail/stieQr'
}) })
}, },
getSiteInfo(id) { getSiteInfo(id) {
let location = uni.getStorageSync('location') || {}
let data2 = { let data2 = {
...uni.getStorageSync('location'), ...location,
siteId: id siteId: id
} }
oilSiteApi.getSiteDetails(data2).then(res => { oilSiteApi.getSiteDetails(data2).then(res => {
@@ -140,9 +171,10 @@
}, },
goBack() { goBack() {
uni.navigateBack({ this.isBackPrev ? uni.navigateBack() : uni.navigateBack({
url: '../../../pages/tabbar/home/home'
}) })
}, },
selectRadio() { selectRadio() {
this.radio === 'A' ? this.radio = '' : this.radio = 'A' this.radio === 'A' ? this.radio = '' : this.radio = 'A'
@@ -178,15 +210,14 @@
return value > 1000 ? ((value / 1000).toFixed(2) + 'km') : (value + 'm') return value > 1000 ? ((value / 1000).toFixed(2) + 'km') : (value + 'm')
} }
} }
} },
,
onHide() { onHide() {
console.log('这里是hiden') // console.log('这里是hiden')
this.innerAudioContext.stop() // this.innerAudioContext.stop()
}, },
onUnload() { onUnload() {
console.log('这里是卸载页面') // console.log('这里是卸载页面')
this.innerAudioContext.stop() // this.innerAudioContext.stop()
}, },
} }
</script> </script>

View File

@@ -178,19 +178,35 @@
this.innerAudioContext && this.innerAudioContext.stop() this.innerAudioContext && this.innerAudioContext.stop()
}, },
onUnload() { onUnload() {
this.innerAudioContext && this.innerAudioContext.stop() if (this.innerAudioContext) {
this.innerAudioContext.stop()
this.innerAudioContext.destroy()
}
}, },
onLoad(option) { onLoad(option) {
if (option.q) {
if(option.q) { try {
let originLink = decodeURIComponent(option.q) let originLink = decodeURIComponent(option.q)
let target = this.obtainUrlPathParameterTarget(originLink) let target = this.obtainUrlPathParameterTarget(originLink)
if(target.siteId) { let authorization = uni.getStorageSync('Authorization')
if (authorization && target.siteId) {
uni.showModal({
content: '该二维码非最新版,请提示油站工作人员更新',
success: res => {
if(res.confirm) {
this.siteId = target.siteId this.siteId = target.siteId
this.getSiteInfo(target.siteId) this.gotoPay()
} }
if(res.cancel) {
this.backTohome()
}
}
})
}
} catch (e) {}
return return
} }
if (!option.item) { if (!option.item) {
let siteInfos = uni.getStorageSync('siteInfo') let siteInfos = uni.getStorageSync('siteInfo')
var oilItem = JSON.parse(decodeURIComponent(siteInfos)) var oilItem = JSON.parse(decodeURIComponent(siteInfos))
@@ -236,7 +252,7 @@
}); });
}, },
backTohome() { backTohome() {
this.innerAudioContext && this.innerAudioContext.stop() // this.innerAudioContext && this.innerAudioContext.stop()
uni.switchTab({ uni.switchTab({
url: '../../../pages/tabbar/home/home' url: '../../../pages/tabbar/home/home'
}) })
@@ -245,7 +261,7 @@
this.showtitle = false this.showtitle = false
}, },
gotoPay() { gotoPay() {
this.innerAudioContext && this.innerAudioContext.stop() // this.innerAudioContext && this.innerAudioContext.stop()
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}` url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}`
}) })
@@ -255,7 +271,7 @@
this.secondChannelCode = sec this.secondChannelCode = sec
}, },
siteQrPay() { siteQrPay() {
this.innerAudioContext && this.innerAudioContext.stop() // this.innerAudioContext && this.innerAudioContext.stop()
// let siteId = // let siteId =
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/stationDetail/stieQr?siteId=${this.siteId}&activeChannelCode=${this.activeChannelCode}&secondChannelCode=${this.secondChannelCode}` url: `/BagStation/pages/stationDetail/stieQr?siteId=${this.siteId}&activeChannelCode=${this.activeChannelCode}&secondChannelCode=${this.secondChannelCode}`
@@ -306,7 +322,7 @@
if (this.siteInfo.juli > 1000) { if (this.siteInfo.juli > 1000) {
this.showtitle = true this.showtitle = true
} else { } else {
this.innerAudioContext && this.innerAudioContext.stop() // this.innerAudioContext && this.innerAudioContext.stop()
uni.navigateTo({ uni.navigateTo({
url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}` url: `/BagStation/pages/makeOrder/makeOrder?siteId=${this.siteId}&activeCur=${this.activeCur}`
}) })
@@ -317,7 +333,7 @@
this.qrcodePay = val this.qrcodePay = val
}, },
onChangePay(val, active) { onChangePay(val, active) {
console.log(val) // console.log(val)
this.activePay = val this.activePay = val
this.activeCur = active this.activeCur = active
}, },