佰川加油
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1197 lines
32 KiB

<template>
<view class="padding-top bg-white">
<view class="text-center padding-sm">
<view class="text-lg">
请提醒加油员使用
<text class="text-red padding-left-xs padding-right-xs">{{showtitles}}</text>
进行订单核实
</view>
</view>
<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" @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>
{{item.channelCode|channelCodeFamt}}
<!-- 少了壳牌 -->
</view>
</scroll-view>
<radio-group class="block" @change="changePrice">
<view class="cu-list menu text-left">
<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">
<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>
<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-delete">¥{{itemx.oilSitePrice}}/L</text>
<text
class="text-sm">预计每100L节省{{(100*(itemx.oilSitePrice - itemx.sitePrice))|moneyFormat}}元</text>
</label>
</view>
</view>
</radio-group>
<!-- -->
<view class="bg-gray padding-top-sm ">
<view class="bg-white padding ">
<text>油枪选择</text>
<view class="padding-top-sm">
<view class="grid col-5 ">
<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">
{{item.name}}
<view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'"
v-if="item.hot">HOT</view>
</button>
</view>
<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="" />
</view>
</view>
</view>
</view>
</view>
<view class="margin solid margin-top-0 radius">
<form>
<view class="flex bg-white">
<view class="flex-sub padding-right" @tap="showPlate='show'">
<view class="cu-form-group ">
<view class="">
<view class="site-icon-sm">
<image :src="imgURL+'site-car.png'" mode="widthFix" width="100upx"></image>
</view>
</view>
<view class="">
{{plateNumber?plateNumber:(plateNumberSel?plateNumberSel:'非必填')}}
</view>
</view>
</view>
<view class="flex-sub padding-left">
<!-- @tap="showJober='show'" -->
<!-- 请选择加油员 -->
<view class="cu-form-group ">
<view class="">
<view class="site-icon-sm">
<image :src="imgURL+'site-jober.png'" mode="widthFix" width="100upx"></image>
</view>
</view>
<picker @change="pickJober" :value="joberIndex" :range="siteUserNames">
<view class="picker">
{{siteUserNames[joberIndex]?siteUserNames[joberIndex] :'选择加油员'}}
</view>
</picker>
</view>
</view>
</view>
</form>
</view>
<!-- 非团油加油输入框 -->
<view class="margin solid radius" v-if="activeChannelCode!='TY'&&radio!==null">
<view class=" menu cu-list ">
<view class="cu-item nowrap">
<view class="text-bold ">
油机金额
</view>
<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;" />
</view>
<view class="">
<text class=" padding-right-sm">
约{{vlom?vlom :'' | moneyVolm}}L
</text>
</view>
</view>
<view class="grid col-5 padding-sm">
<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">
{{item.name}}&yen;
<view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'"
v-if="item.hot">HOT</view>
</button>
</view>
</view>
</view>
</view>
<!-- 团油金额输入框 -->
<view class="margin solid radius" v-if="activeChannelCode=='TY' && radio!==null">
<view class=" menu cu-list ">
<view class="cu-item nowrap">
<view class="text-bold ">
加油金额
</view>
<view class="text-center">
<input v-model="ty.realMoney" @input="onInputTyMoney" type="digit" class="block"
placeholder="加油金额" value="" />
</view>
<view class="">
<text class="text-bold padding-right-sm">
</text>
约{{tyRes.liter>0?tyRes.liter:'-.--'}}L
</view>
</view>
<view class="grid col-5 padding-sm">
<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">
{{item.name}}
<view class="cu-tag sm round" :class="item.checked?'bg-white text-red':'bg-red'"
v-if="item.hot">HOT</view>
</button>
</view>
</view>
</view>
</view>
<view v-if="radio!==null" class="bg-white padding">
<view class="">
<text class="text-bold">优惠</text>
</view>
<view class="padding-top-sm" v-if="activeChannelCode!='TY'">
星油优惠金额
<text class="fr">-¥{{discount>0?discount:'xxx.x'|moneyFormat}}</text>
</view>
<view class="padding-top-sm" v-else>
直降金额
<text class="fr">-¥{{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text>
</view>
<view class="padding-top-sm">
优惠券 <text class="fr">{{'----'}}</text>
</view>
</view>
<view class="placeholder-hidden">
<view class="margin cu-list pay-bar menu radius solid-top solid-bottom solid-left">
<view class="cu-item ">
<view class="">
合计:<text class="text-red">{{realMoney>0?realMoney:'xxx.x'|moneyFormat}}元</text>
</view>
<view class="" @tap="showOrderMsg">
明细<text class="cuIcon-unfold padding-left-xs"></text>
</view>
<view class="">
<button @tap="beforeMake" class="bg-main-oil self-btn cu-btn block lg">立即下单</button>
</view>
</view>
</view>
</view>
<view class="fixed-bottom">
<view class="margin cu-list pay-bar menu radius solid-top solid-bottom solid-left">
<view class="cu-item ">
<view class="">
合计:<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-tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text>
</view>
<view class="" @tap="showOrderMsg">
明细<text class="cuIcon-unfold padding-left-xs"></text>
</view>
<view class="">
<button @tap="beforeMake" class="bg-main-oil self-btn cu-btn block lg">立即下单</button>
</view>
</view>
</view>
</view>
<!-- 金额明细弹窗 -->
<view class="cu-modal bottom-modal" :class="showOrder">
<view class="cu-dialog" @tap.stop="">
<view class="cu-bar bg-white justify-end">
<view class="content">订单明细</view>
<view class="action" @tap="showOrder=''">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="bg-white dashed-top">
<view class="padding">
<view class="padding-tb-xs text-left">
油站:
<text class="fr">{{siteName?siteName:''}}</text>
</view>
<view class="padding-tb-xs text-left">
油品油枪:
<text class="fr">{{oilProductCode?oilProductCode:''}} {{oilBar?oilBar+'号枪':'未选择油枪'}}</text>
</view>
<view class="" v-if="activeChannelCode!='TY'">
<view class="padding-tb-xs margin-bottom text-left">
加油升数:
<text class="fr">{{vlom?vlom :'' |moneyFormats}}L</text>
</view>
<view class=" dashed-top margin-top padding-top text-left">
加油金额:
<text class="fr">{{vol>0?vol:'xxx.x'|moneyFormat}}</text>
</view>
<view class="padding-tb-xs text-left">
星油优惠:
<text class="text-red fr">{{discount>0?discount:'xxx.x'|moneyFormat}}</text>
</view>
</view>
<view class="" v-else>
<view class=" dashed-top margin-top padding-top text-left">
加油金额:
<text class="fr">{{ty.realMoney>0?ty.realMoney:'xxx.x'|moneyFormat}}</text>
</view>
<view class="padding-tb-xs margin-bottom text-left">
加油升数:
<text class="fr">{{tyRes.liter?tyRes.liter+'L':''}}</text>
</view>
<view class="padding-tb-xs text-left">
直降金额:
<text
class="text-red fr">{{tyRes.depreciateAmount>0?tyRes.depreciateAmount:'xxx.x'|moneyFormat}}</text>
</view>
</view>
<view class="padding-tb-xs text-left">
优惠券:
<text class="text-red fr">{{'----'}}</text>
</view>
<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-else>{{ty.realMoney>0?ty.realMoney:'xxx.x'|moneyFormat}}</text>
</view>
</view>
<view class="cu-list margin pay-bar menu radius solid-top solid-bottom solid-left">
<view class="cu-item ">
<view class="">
合计:<text class="text-red"
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 class="" @tap="showOrder=''">
明细<text class="cuIcon-fold padding-left-xs"></text>
</view>
<view class="">
<button @tap="beforeMake" class="bg-main-oil self-btn cu-btn block lg">立即下单</button>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="cu-modal bottom-modal " :class="showPlate">
<view class="cu-dialog bg-white">
<view class="cu-bar bg-white justify-end">
<view class="content">车牌号非必填</view>
<view class="action" @tap="showPlate=''">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view class="padding-bottom-lg ">
<view class="text-left margin solid radius flex padding bg-gray">
<view class="flex-sub">
输入车牌号
</view>
<input type="text" value="" placeholder="请选择或输入车牌号" v-model.trim="plateNumber" />
</view>
<picker-view :indicator-style="indicatorStyle" v-if="plateNumbers.length" :value="plateIndex"
@change="pickPlate" class="picker-view">
<picker-view-column>
<view class="item" v-for="(item,index) in plateNumbers" :key="index">{{item}}</view>
</picker-view-column>
</picker-view>
</view>
</view>
</view>
<view class=" cu-modal show" v-show="showtitle">
<view class="cu-dialog overflow-unset dialog-box box-paddings">
<view class="close-icon" @tap="hidendialog">
<image src="../../../static/img/close.png" mode="" style="width:50rpx;height: 50rpx;"></image>
</view>
<view class="">
<image src="../../../static/img/errIcon.png" mode="" style="width:100rpx;height: 100rpx;"></image>
</view>
<view class="cu-bar box-panding text-centerS">
<text class="headShow">支付提醒</text>
</view>
<view class="cu-bar box-panding">
<text class="showtext">当前油站距离您较远请与加油员确认您选择的油站是否正确</text>
</view>
<view class="checklocation_box_button">
<view class="cu-tn btn-box red_btn" @tap="backTohome">
返回油站列表
</view>
<view class="cu-tn btn-box" @tap="gotoPay">
确认下单
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import oilSiteApi from '@/api/oil-site.js'
import toilApi from '@/api/toil.js'
import oilOrderApi from '@/api/oil-order.js'
export default {
props: {
channelList: {
type: Array,
default () {}
},
channelJuli: {
type: Number,
default: ''
},
siteName: {
type: String,
default: ''
},
activeCur: {
type: Number,
default: 0
}
},
data() {
return {
timer: null,
discount: '',
activeSitePrice: '',
showtitles: "",
showtitle: false,
oilBarTy: '',
ty: {
realMoney: ""
},
tyRes: {
liter: '',
depreciateAmount: ''
},
value: '',
visible: true,
indicatorStyle: `height: 50px;`,
visiblePlateNumbers: true,
inputBar: '',
oilBar: '',
testPlateResult: false,
plateIndex: 0,
joberIndex: 0,
showJober: '',
vol: '',
oilSitePriceDetailsVo: [],
siteUserNames: [],
plateNumbers: [],
showPlate: "",
showOrder: '',
radio: null,
imgURL: this.global.imgURL,
scrollLeft: 0,
checkVol: [{
value: 100,
name: '100L',
checked: false,
hot: false,
}, {
value: 200,
name: '200L',
checked: false,
hot: false,
}, {
value: 500,
name: '500L',
checked: false,
hot: false,
}, {
value: 1000,
name: '1000L',
checked: false,
hot: false,
}, {
value: 2000,
name: '2000L',
checked: false,
hot: false,
}],
plateNumber: '',
checkMoney: [{
value: 100,
name: '100 ',
checked: false,
hot: false,
}, {
value: 200,
name: '200 ',
checked: false,
hot: false,
}, {
value: 500,
name: '500 ',
checked: false,
hot: false,
}, {
value: 1000,
name: '1000 ',
checked: false,
hot: false,
}, {
value: 2000,
name: '2000 ',
checked: false,
hot: false,
}],
checkbox: [{
value: 1,
name: '1',
checked: true,
hot: false,
}, {
value: 2,
name: '2',
checked: false,
hot: false,
}, {
value: 3,
name: '3',
checked: false,
hot: false,
}, {
value: 4,
name: '4',
checked: false,
hot: false,
}, {
value: 5,
name: '5',
checked: false,
hot: false,
}, {
value: 6,
name: '6',
checked: false,
hot: false,
}, {
value: 7,
name: '7',
checked: false,
hot: false,
}, {
value: 8,
name: '8',
checked: false,
hot: false,
}],
activeChannelCode: '',
checkBar: [],
realMoney: '',
xoilAmountGun: '',
vlom: '',
oilItem: {},
}
},
created() {
this.oilItem = uni.getStorageSync('oilItem')
// console.log('oilItemoilItemoilItemoilItem',this.oilItem)
this.showtitles = this.oilItem.listTag
},
watch: {
activeChannelCode: {
handler(newval) {
setTimeout(() => {
this.oilBar = 1
this.checkBar = this.calcBar()
}, 0)
}
},
priceId: {
handler(newval) {
// 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 = ''
}
}
},
computed: {
priceId() {
if (this.channelList.length && this.channelList[this.activeCur] && this.oilSitePriceDetailsVo[this
.radio]) {
return this.oilSitePriceDetailsVo[this.radio].priceId
}
},
channelId() {
if (this.channelList.length && this.channelList[this.activeCur]) {
let channelId = this.channelList[this.activeCur].channelId
this.getNewSitePrice(channelId)
this.activeChannelCode = this.channelList[this.activeCur].channelCode
return channelId
}
},
plateNumberSel() {
if (this.plateNumbers.length) {
return this.plateNumbers[this.plateIndex] ? this.plateNumbers[this.plateIndex] : '非必填'
}
},
jober() {
if (this.siteUserNames.length) {
return this.siteUserNames[this.joberIndex]
}
},
totalMoney() {
// // console.log('this.oilSitePriceDetailsVo[this.radio]', this.oilSitePriceDetailsVo[this.radio])
if (this.vol > 0 && this.oilSitePriceDetailsVo[this.radio]) {
return this.vol * this.oilSitePriceDetailsVo[this.radio].oilSitePrice
}
},
// discount() {
// if (this.totalMoney) {
// return this.vol * (this.oilSitePriceDetailsVo[this.radio].oilSitePrice - this.oilSitePriceDetailsVo[
// this.radio].sitePrice)
// }
// },
// realMoney() {
// if (this.totalMoney) {
// return this.vol * this.oilSitePriceDetailsVo[this.radio].sitePrice
// }
// },
oilProductCode() {
if (this.totalMoney) {
return this.oilSitePriceDetailsVo[this.radio].oilProductCode
}
}
},
methods: {
checkNumber(e) {
e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
this.$nextTick(() => {
this.vol = e.detail.value
})
},
checkMoneyVol(e) {
console.log(e)
if (e == '') {
uni.showToast({
title: '请输入金额',
icon: 'none'
})
return
}
let isNumber = this.isNumber(e)
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 => {
console.log(res)
this.realMoney = res.data.payRealAmount
this.discount = res.data.oilDiscountAmount
this.vlom = res.data.volume
})
},
ChooseCheckMoney(e) {
// console.log(e)
this.vol = e + ''
this.checkMoneyVol(this.vol)
},
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) {
return false
}
if (regPos.test(value) || regNeg.test(value)) {
return true
} else {
return false
}
},
getMoneyVol(e) {
console.log(e)
if (e.detail.value == '') {
uni.showToast({
title: '请输入金额',
icon: 'none'
})
return
}
let isNumber = this.isNumber(e.detail.value)
if (!isNumber) {
uni.showToast({
title: '请输入正确金额',
icon: 'none'
})
return
}
let number = {
payType: 'CUSTOMER_ACTIVE',
userType: '0',
xoilAmountGun: e.detail.value,
priceId: this.activeSitePrice
}
this.xoilAmountGun = e.detail.value
oilSiteApi.getOrderDiscountInfo(number).then(res => {
console.log(res)
this.realMoney = res.data.payRealAmount
this.discount = res.data.oilDiscountAmount
this.vlom = res.data.volume
})
},
checkInfo() {
// console.log(this.radio)
this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel)
if (!this.testPlateResult && !['1689182438357262336', '1689183144276463616', '1689185023261741056']
.includes(this.oilItem.siteId)) {
// this.plateNumber=''
uni.showToast({
title: '车牌号不可为空或格式错误,请重新输入',
icon: 'none',
duration: 2000
})
return false
}
if (this.radio == null || !this.oilSitePriceDetailsVo[this.radio].priceId) {
uni.showToast({
icon: 'none',
title: '请选择油品'
})
return false
}
// if (!(this.plateNumber ? this.plateNumber : this.plateNumberSel)) {
// uni.showToast({
// icon: 'none',
// title: '未选择加油车牌'
// })
// // return false
// }
if (!this.oilBar) {
uni.showToast({
icon: 'none',
title: '未选择油枪'
})
return false
}
if (!this.oilBar) {
uni.showToast({
icon: 'none',
title: '未选择加油员'
})
return false
}
if (!this.vol && !this.tyRes.liter) {
uni.showToast({
icon: 'none',
title: '加油金额不能为空'
})
return false
}
if (this.vol < 0.01 && !this.tyRes.liter) {
uni.showToast({
icon: 'none',
title: '加油金额不能为空'
})
return false
}
if (!this.oilSitePriceDetailsVo[this.radio].sitePrice) {
uni.showToast({
icon: 'none',
title: '未选择油价'
})
return false
}
this.makerOrder()
},
gotoPay() {
this.checkInfo()
},
hidendialog() {
this.showtitle = false
},
backTohome() {
uni.switchTab({
url: '../../../pages/tabbar/home/home'
})
},
calcBar() {
if (this.activeChannelCode == 'TY') {
uni.showLoading({
title: '',
mask: false
});
if (this.oilSitePriceDetailsVo[this.radio] && this.oilSitePriceDetailsVo[this.radio].oilsBar) {
console.log('计算有钱', this.oilSitePriceDetailsVo[this.radio].oilsBar)
this.oilBarTy = this.oilSitePriceDetailsVo[this.radio].oilsBar
}
if (this.channelId && this.oilBarTy) {
let gunLsit = this.oilBarTy.split(',')
let gunCheck = []
gunLsit.forEach(item => {
gunCheck.push({
value: item,
name: item,
checked: false,
hot: false
})
})
uni.hideLoading()
return gunCheck
}
} else {
return this.checkbox
}
},
onInputTyMoney(val) {
setTimeout(() => {
this.getTyRes()
}, 500)
},
// 团油查询直降金额
getTyRes() {
if (this.ty.realMoney < 5) {
uni.showToast({
title: '加油金额不得低于5元',
icon: 'none'
})
return false
}
if (!this.ty.realMoney) {
uni.showToast({
title: '请输入加油金额',
icon: 'none'
})
this.tyRes = {}
return false
}
const data9 = {
amountGun: this.ty.realMoney,
priceId: this.oilSitePriceDetailsVo[this.radio].priceId
}
toilApi.getTyPrice(data9).then(res => {
if (res.code == 20000) {
this.tyRes = res.data
}
})
},
onInputVol(val) {
let items = this.checkVol;
let values = val
// this.vol = values
for (let i = 0, lenI = items.length; i < lenI; ++i) {
if (items[i].value == values) {
items[i].checked = !items[i].checked;
} else {
items[i].checked = false
}
}
},
onInputBar() {
this.oilBar = this.inputBar
let items = this.checkbox;
let values = this.oilBar
for (let i = 0, lenI = items.length; i < lenI; ++i) {
if (items[i].value == values) {
items[i].checked = !items[i].checked;
} else {
items[i].checked = false
}
}
},
beforeMake() {
// console.log(this.radio, 'beforeMake')
this.tsetPlate(this.plateNumber ? this.plateNumber : this.plateNumberSel)
if (!this.testPlateResult && !['1689182438357262336', '1689183144276463616', '1689185023261741056']
.includes(this.oilItem.siteId)) {
// this.plateNumber=''
uni.showToast({
title: '车牌号不可为空或格式错误,请重新输入',
icon: 'none',
duration: 2000
})
return false
}
if (this.radio == null || !this.oilSitePriceDetailsVo[this.radio].priceId) {
uni.showToast({
icon: 'none',
title: '请选择油品'
})
return false
}
// if (!(this.plateNumber ? this.plateNumber : this.plateNumberSel)) {
// uni.showToast({
// icon: 'none',
// title: '未选择加油车牌'
// })
// // return false
// }
if (!this.oilBar) {
uni.showToast({
icon: 'none',
title: '未选择油枪'
})
return false
}
if (!this.oilBar) {
uni.showToast({
icon: 'none',
title: '未选择加油员'
})
return false
}
if (!this.vol && !this.tyRes.liter) {
uni.showToast({
icon: 'none',
title: '加油金额不能为空'
})
return false
}
if (this.vol < 0.01 && !this.tyRes.liter) {
uni.showToast({
icon: 'none',
title: '加油金额不能为空'
})
return false
}
if (!this.oilSitePriceDetailsVo[this.radio].sitePrice) {
uni.showToast({
icon: 'none',
title: '未选择油价'
})
return false
}
if (this.channelJuli > 1000) {
this.showtitle = true
return
}
this.makerOrder()
},
// 下单
makerOrder() {
// // 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) {
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)
}
},
tsetPlate(plateNumber) {
this.testPlateResult =
/(^[京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领A-Z]{1}[A-Z]{1}[A-Z0-9]{4,5}[A-Z0-9挂学警港澳]{1}$)/
.test(plateNumber)
},
// 获取渠道下价格等信息
getNewSitePrice(channelId) {
this.oilSitePriceDetailsVo = []
oilSiteApi.getSitePriceKAByBelong({
channelId: channelId,
clientBelong: "BAICHUAN"
}).then(res => {
if (res.code == 20000) {
this.plateNumbers = res.data.plateNumbers
this.oilSitePriceDetailsVo = res.data.oilSitePriceDetailsVo;
this.siteUserNames = res.data.siteUserNames;
if (this.oilSitePriceDetailsVo.length == 1) {
this.radio = 0
this.activeSitePrice = res.data.oilSitePriceDetailsVo[0].priceId
}
}
})
},
pickJober(e) {
this.joberIndex = e.detail.value
},
pickPlate(e) {
this.plateIndex = e.detail.value
this.plateNumber = this.plateNumberSel
console.log(this.plateIndex, this.plateNumber)
},
showOrderMsg() {
this.showOrder = 'show'
},
ChooseCheckVol(e) {
let items = this.checkVol;
let values = e.currentTarget.dataset.value;
this.vol = values
for (let i = 0, lenI = items.length; i < lenI; ++i) {
if (items[i].value == values) {
items[i].checked = !items[i].checked;
} else {
items[i].checked = false
}
}
},
ChooseBar(e) {
let items = this.checkBar;
let values = e.currentTarget.dataset.value;
this.oilBar = values
for (let i = 0, lenI = items.length; i < lenI; ++i) {
if (items[i].value == values) {
items[i].checked = !items[i].checked;
} else {
items[i].checked = false
}
}
},
changePrice(e) {
this.radio = e.detail.value
console.log(e, 'changePrice')
this.vol = ''
this.activeSitePrice = this.oilSitePriceDetailsVo[this.radio].priceId
this.realMoney = '--'
this.xoilAmountGun = '';
Object.keys(this.tyRes).forEach(key => {
this.tyRes[key] = ''
})
Object.keys(this.ty).forEach(key => {
this.ty[key] = ''
})
this.vlom = ''
// // console.log(this.radio)
console.log(this.oilSitePriceDetailsVo[this.radio])
},
tabSelect(e) {
this.activeChannelCode = e.currentTarget.dataset.channelCode;
// console.log('ty activeChannelCode', this.activeChannelCode)
this.activeCur = e.currentTarget.dataset.id;
this.scrollLeft = (e.currentTarget.dataset.id - 1) * 60
}
},
filters: {
moneyVolm(value) {
if (value != 'xxx.x') {
return Math.round(value * 100) / 100;
} else {
return value
}
},
channelCodeFamt(value) {
if (value) {
// 渠道编码 ( XOIL:星油 WJY:万金油 LV:老吕(找油网) TY:团油 YDJY:一点加油(壳牌))
switch (value) {
case 'XOIL':
return '星油'
case 'WJY':
return '万金油'
case 'LV':
return '老吕(找油网)'
case 'TY':
return '团油'
case 'YDJY':
return '一点加油(壳牌)'
}
}
},
moneyFormats(value) {
if (value != 'xxx.x') {
return Math.round(value * 100) / 100
} else {
return value
}
},
moneyFormat(value) {
if (value != 'xxx.x') {
return (parseInt(value * 100) / 100).toFixed(2)
} else {
return value
}
}
}
}
</script>
<style scoped>
.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;
}
.close-icon {
position: absolute;
right: 2%;
top: 2%;
}
.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 {
display: flex;
justify-content: center;
align-items: center;
text-align: center;
}
.red_btn {
color: #FFFFFF;
background-color: #fe0505;
}
.box-paddings {
padding: 40rpx 0;
}
.headShow {
font-size: 36rpx;
font-weight: 600;
}
.showtext {
line-height: 2;
font-size: 30rpx;
margin-bottom: 30rpx;
padding: 0 10%;
word-spacing: 10px;
letter-spacing: 3px;
text-align: left;
}
.checklocation_box_button {
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 5%;
}
.btn-box {
width: 45%;
flex: 0 0 auto;
text-align: center;
padding: 3%;
border-radius: 20rpx;
font-size: 28rpx;
box-sizing: border-box;
border: 2rpx solid #bfbfbf;
}
.box-panding {
padding: 10 0;
}
</style>