pull/1/head
xiaozhiyong 2 years ago
parent 6967207669
commit 87caa6203b
  1. 100
      src/components/homeNavBar.vue
  2. 91
      src/components/listItem.vue
  3. 6
      src/permission.js
  4. 29
      src/store/piniaIndex.js
  5. 80
      src/utils/auth.js
  6. 52
      src/utils/request.js
  7. 25
      src/views/HomeView.vue
  8. 51
      src/views/orderDetails/components/oilEvaluate.vue
  9. 736
      src/views/orderDetails/components/oilGun.vue
  10. 232
      src/views/orderDetails/components/oilLable.vue
  11. 84
      src/views/orderDetails/components/oilNextFooter.vue
  12. 4
      src/views/orderDetails/components/optionalOilLable.vue
  13. 87
      src/views/orderDetails/nextOrderDetails.vue
  14. 4
      src/views/personalOrderList/index.vue
  15. 3
      vue.config.js

@ -2,7 +2,7 @@
<div class="homeNavBar_body">
<div class="homeNavBar_body_title">
<div class="vc homeNavBar_body_title_compantName">
<div class="textov">{{$pinia.state.value.user.user?.networkName||'--'}}</div>
<div class="textov">{{ $pinia.state.value.user.user?.networkName || '- -' }}</div>
</div>
<div class="vc homeNavBar_body_title_right">
<van-icon @click="golist" size="20" name="orders-o" />
@ -12,21 +12,17 @@
<div class="homeNavBar_body_seach">
<div @click="isShow.filter = !isShow.filter" class="homeNavBar_body_seach_left">
<span>油品</span>
<van-icon :style="{transform:`rotate(${isShow.filter?180:0}deg)`}" style="margin-left: 10px;transition: all .3s;" name="arrow-down" />
<van-icon :style="{ transform: `rotate(${isShow.filter ? 180 : 0}deg)` }" style="margin-left: 10px; transition: all 0.3s" name="arrow-down" />
</div>
<div class="homeNavBar_body_seach_right">
<input @keydown.enter="input" v-model="value" placeholder="请输入油站查询" class="homeNavBar_body_seach_input" type="text">
<input @keydown.enter="input" v-model="value" placeholder="请输入油站查询" class="homeNavBar_body_seach_input" type="text" />
</div>
</div>
<div :style="{height:isShow.filter?'':'0px'}" class="homeNavBar_body_filter">
<van-tree-select
style="margin-top:5px"
:items="productCodeList"
:active-id.sync="activeId"
:main-active-index.sync="activeIndex" />
<div style="padding:10px 0;background-color: #ffffff;" class="flex sa">
<van-button @click="seleFn" size="small" type="danger">确定</van-button>
<van-button @click="clearFn" size="small" type="default">重置</van-button>
<div :style="{ height: isShow.filter ? '' : '0px' }" class="homeNavBar_body_filter">
<van-tree-select style="margin-top: 5px" :items="productCodeList" :active-id.sync="activeId" :main-active-index.sync="activeIndex" />
<div style="padding: 10px 0; background-color: #ffffff" class="flex sa">
<van-button @click="seleFn" size="small" type="danger">确定</van-button>
<van-button @click="clearFn" size="small" type="default">重置</van-button>
</div>
</div>
</div>
@ -34,66 +30,65 @@
<script>
import filterList from '../components/oilType'
import useStore from '@/store/piniaIndex';
let store = useStore();
import useStore from '@/store/piniaIndex'
let store = useStore()
export default {
name: 'homeNavBar',
props:{
productCodeList:{
type:Array,
default:()=>[]
props: {
productCodeList: {
type: Array,
default: () => []
}
},
data() {
return {
timer:null,
isShow:{
filter:false
timer: null,
isShow: {
filter: false
},
value:'',
value: '',
show: false,
activeId:'',
activeId: '',
activeIndex: '',
items: filterList
}
},
created(){},
watch:{
activeId(n){
console.log(n,'activeId')
},
activeIndex(n){
console.log(n,'activeIndex')
},
networkName:function(){}
created() {
// console.log('$pinia', this.$pinia)
},
mounted(){
watch: {
// activeId(n) {
// console.log(n, 'activeId')
// },
// activeIndex(n) {
// console.log(n, 'activeIndex')
// },
// networkName: function () {}
},
methods:{
clearFn(){
this.activeIndex='';
this.activeId='';
this.$emit("input", this.activeId);
mounted() {},
methods: {
clearFn() {
this.activeIndex = ''
this.activeId = ''
this.$emit('input', this.activeId)
},
input(){
this.$emit('seach',this.value)
input() {
this.$emit('seach', this.value)
},
golist(){
golist() {
this.$router.push('/personalOrderList')
},
seleFn(){
this.$emit("input", this.activeId);
this.isShow.filter = !this.isShow.filter;
seleFn() {
this.$emit('input', this.activeId)
this.isShow.filter = !this.isShow.filter
this.$emit('getlist')
}
},
}
}
</script>
<style>
</style>
<style></style>
<style scoped lang="scss">
.homeNavBar_body_filter {
position: absolute;
width: 100%;
@ -102,11 +97,11 @@ export default {
height: calc(100vh - 250px);
color: black;
overflow: hidden;
transition: all .3s;
padding: 0px ;
transition: all 0.3s;
padding: 0px;
box-sizing: border-box;
z-index: 99;
// background-color: #ffffff;
}
@ -120,7 +115,7 @@ export default {
margin-left: 20px;
flex: 1;
}
.homeNavBar_body_seach_input input{
.homeNavBar_body_seach_input input {
box-sizing: border-box;
width: 100%;
padding: 0 10px;
@ -143,7 +138,6 @@ export default {
// background-color: aqua;
display: flex;
align-items: center;
}
.van_icon {

@ -6,17 +6,20 @@
<div class="list_item_body_informationContainer">
<div class="list_item_body_title tv">{{ listItem.siteName || '暂无' }}</div>
<div class="list_item_body_lable">
<div :style="{ background: item.color }" v-for="(item, index) in lableArray " :key="index"
class="list_item_body_lable_item">{{ item.lable }}</div>
<div :style="{ background: item.color }" v-for="(item, index) in lableArray" :key="index" class="list_item_body_lable_item">
{{ item.lable }}
</div>
</div>
<div class="list_item_body_tip tv">
{{ listItem.address || '暂无' }}
</div>
<div class="flex ac list_item_body_footer">
<span class="list_item_body_oilTypeText">{{ listItem.oilProductCode }}</span>
<span class="list_item_body_oilPriceText">{{ moneyIntercept(listItem.sitePrice) }}</span>
<span class="list_item_body_oilDiscountText">{{ Number(( moneyIntercept(listItem.oilSitePrice) - moneyIntercept(listItem.sitePrice) )).toFixed(2) }}</span>
<span class="list_item_body_oilOriginaltText">{{ moneyIntercept(listItem.oilSitePrice) }}/L</span>
<span class="list_item_body_oilPriceText">{{ moneyIntercept(listItem.sitePrice) }}</span>
<span class="list_item_body_oilDiscountText"
>{{ Number(moneyIntercept(listItem.oilSitePrice) - moneyIntercept(listItem.sitePrice)).toFixed(2) }}</span
>
<span class="list_item_body_oilOriginaltText">{{ moneyIntercept(listItem.oilSitePrice) }}/L</span>
</div>
</div>
<div class="list_item_body_left tv">{{ listItem.juli | distance }}</div>
@ -25,11 +28,11 @@
<script>
export default {
name: "listItem",
name: 'listItem',
props: {
index:{
type:Number,
default:0
index: {
type: Number,
default: 0
},
listItem: {
type: Object,
@ -40,25 +43,24 @@ export default {
return {
lableArray: [],
defaultImg: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/logo_default.png'
};
}
},
created() {
this.lableGenerate()
},
watch:{
listItem:{
handler(){
this.lableGenerate()
watch: {
listItem: {
handler() {
this.lableGenerate()
},
deep:true
deep: true
}
},
filters: {
distance(e) {
let defaulObj = e || null;
return !isNaN(Number(defaulObj)) ? String(defaulObj).length >= 4 ? `${(Number(defaulObj) / 1000).toFixed(2)}KM` : `${defaulObj}M` : '---'
},
let defaulObj = e || null
return !isNaN(Number(defaulObj)) ? (String(defaulObj).length >= 4 ? `${(Number(defaulObj) / 1000).toFixed(2)}KM` : `${defaulObj}M`) : '---'
}
},
methods: {
lableGenerate() {
@ -66,49 +68,47 @@ export default {
Object.keys(this.listItem).forEach((keys, index) => {
switch (keys) {
case 'siteType':
console.log(this.listItem.siteType,'siteType')
this.lableArray.push({
lable: this.listItem.siteType==1?'加油站':'加气站',
color: this.listItem.siteType==1?'#FF6700':'#00c15e'
})
break;
this.lableArray.push({
lable: this.listItem.siteType == 1 ? '加油站' : '加气站',
color: this.listItem.siteType == 1 ? '#FF6700' : '#00c15e'
})
break
case 'siteLevel':
this.lableArray.push({
lable: this.listItem['siteLevel'] + '级',
color: '#FF6700'
})
break;
break
case 'listTag':
this.lableArray.push({
lable: this.listItem['listTag'] ? this.listItem['listTag'] : '未知',
color: this.listItem.channelCode == 'XOIL' ? 'red' : '#FF9000'
})
break;
case 'highSpeedMark' :
if (this.listItem.highSpeedMark ) {
break
case 'highSpeedMark':
if (this.listItem.highSpeedMark) {
this.lableArray.push({
lable: this.speedMark(this.listItem.highSpeedMark, this.listItem.roadTpye) + (this.listItem.roadName ? this.listItem.roadName : ''),
color: this.speedMarkColor(this.listItem.highSpeedMark, this.listItem.roadTpye)
})
}
break;
case 'roadTpye':
if (this.listItem.roadTpye) {
break
case 'roadTpye':
if (this.listItem.roadTpye) {
this.lableArray.push({
lable: this.speedMark(this.listItem.highSpeedMark, this.listItem.roadTpye) + (this.listItem.roadName ? this.listItem.roadName : ''),
color: this.speedMarkColor(this.listItem.highSpeedMark, this.listItem.roadTpye)
})
}
break
break
}
})
if (this.index == 0) {
this.lableArray.push({
lable: '距离最近',
color: '#FF6700'
})
}
if (this.index == 0) {
this.lableArray.push({
lable: '距离最近',
color: '#FF6700'
})
}
},
speedMarkColor(val, data) {
if (val == 0) {
@ -139,19 +139,18 @@ export default {
}
} else if (val == 1) {
return '高速'
}else{
} else {
return '未知-'
}
},
filterImg(e) {
return e ? e.indexOf('.png') == -1 ? `${e}.png` : e : this.defaultImg
return e ? (e.indexOf('.png') == -1 ? `${e}.png` : e) : this.defaultImg
}
},
};
}
}
</script>
<style>
</style>
<style></style>
<style scoped lang="scss">
.list_item_body_lable {
color: #ffffff;

@ -15,8 +15,10 @@ router.beforeEach(async (to, from, next) => {
store.getPosition()
if (!token) {
let target = obtainUrlPathParameterTarget(location.href)
store.login(target).then(() => {
let paramsTarget = obtainUrlPathParameterTarget(location.href)
console.log('paramsTarget', paramsTarget)
sessionStorage.setItem('paramsTarget', JSON.stringify(paramsTarget))
store.login(paramsTarget).then(() => {
next()
})
return

@ -26,14 +26,6 @@ const instance = defineStore('user', {
},
actions: {
setPosition(position) {
;({ latitude: this.position.latitude, longitude: this.position.longitude } = position)
},
update_username(username) {
this.$patch(state => {
state.username = username
})
},
getPosition() {
// initAMap().then(() => {
// console.log(3)
@ -48,16 +40,11 @@ const instance = defineStore('user', {
// })
// return
// let that = this
if (navigator?.geolocation?.getCurrentPosition) {
// console.log('navigator?.geolocation?.getCurrentPosition')
console.log(1111)
navigator.geolocation.getCurrentPosition(
position => {
console.log(' position.coords position.coords', `${position.coords.longitude},${position.coords.latitude}`)
let { latitude, longitude } = position.coords
this.position = { latitude, longitude }
// console.log('positionpositionposition', position)
},
// function (position) {
// console.log('position', position)
@ -106,8 +93,6 @@ const instance = defineStore('user', {
}
},
getUser() {
// encode.decrypt(getToken(), 'Clco2uJjhZRgDHzl')
// console.log('获取user信息')
oilSite
.getCompanyInfo({
accessToken: getToken()
@ -118,7 +103,6 @@ const instance = defineStore('user', {
},
login(info) {
console.log(info)
let { username, networkId } = info
if (username && networkId) {
return serve
@ -134,19 +118,6 @@ const instance = defineStore('user', {
})
}
return Promise.reject()
// this.token = data.accessToken
// setToken(data.accessToken)
// this.getUser()
// if (data?.latitude && data?.longitude) {
// console.log('标记!!!')
// // ;({ latitude: this.position.latitude, longitude: this.longitude } = data)
// // localStorage.setItem('position', JSON.stringify(this.position))
// } else {
// console.log(data, '地理位置参数错误,手动获取位置')
// this.getPosition()
// }
// return true
},
clearToken() {
removeToken()

@ -1,10 +1,10 @@
import Cookies from 'js-cookie'
const TokenKey = 'Authorization'
const NetWorkId = 'networkId'
const UserName = 'username'
const PassWord = 'password'
const Checked = 'checked'
// const NetWorkId = 'networkId'
// const UserName = 'username'
// const PassWord = 'password'
// const Checked = 'checked'
export function getToken() {
return Cookies.get(TokenKey)
@ -18,47 +18,47 @@ export function removeToken() {
return Cookies.remove(TokenKey)
}
export function setNet(networkId) {
return Cookies.set(NetWorkId, networkId, { expires: 7 })
}
// export function setNet(networkId) {
// return Cookies.set(NetWorkId, networkId, { expires: 7 })
// }
export function setUsername(username) {
return Cookies.set(UserName, username, { expires: 7 })
}
// export function setUsername(username) {
// return Cookies.set(UserName, username, { expires: 7 })
// }
export function setPassword(password) {
return Cookies.set(PassWord, password, { expires: 7 })
}
// export function setPassword(password) {
// return Cookies.set(PassWord, password, { expires: 7 })
// }
export function getNet(networkId) {
return Cookies.get(NetWorkId)
}
// export function getNet(networkId) {
// return Cookies.get(NetWorkId)
// }
export function getUsername(username) {
return Cookies.get(UserName)
}
// export function getUsername(username) {
// return Cookies.get(UserName)
// }
export function getPassword(password) {
return Cookies.get(PassWord)
}
// export function getPassword(password) {
// return Cookies.get(PassWord)
// }
export function setChecked(checked) {
return Cookies.set(Checked, checked, { expires: 7 })
}
// export function setChecked(checked) {
// return Cookies.set(Checked, checked, { expires: 7 })
// }
export function getChecked() {
return Cookies.get(Checked)
}
// export function getChecked() {
// return Cookies.get(Checked)
// }
export function removeNet() {
return Cookies.remove(NetWorkId)
}
export function removeChecked() {
return Cookies.remove(Checked)
}
export function removeUsername() {
return Cookies.remove(UserName)
}
export function removePassword() {
return Cookies.remove(PassWord)
}
// export function removeNet() {
// return Cookies.remove(NetWorkId)
// }
// export function removeChecked() {
// return Cookies.remove(Checked)
// }
// export function removeUsername() {
// return Cookies.remove(UserName)
// }
// export function removePassword() {
// return Cookies.remove(PassWord)
// }

@ -1,12 +1,9 @@
import axios from 'axios'
import encode from '@/utils/encode'
import { Notify, Toast } from 'vant'
import { getToken } from '@/utils/auth'
import { obtainUrlPathParameterTarget } from '@/utils/index.js'
import { getToken, removeToken } from '@/utils/auth'
import useStore from 'store/piniaIndex.js'
const CancelToken = axios.CancelToken
const service = axios.create({
baseURL: process.env.VUE_APP_BASE_API,
timeout: 20000
@ -17,22 +14,13 @@ const env = process.env.VUE_APP_ENV
// request 拦截器
service.interceptors.request.use(
config => {
// console.log('config', config)
Toast.loading({
message: '加载中...',
forbidClick: true,
duration: 0
})
// let source = CancelToken.source()
// config.cancelToken = source.token
// if (a.includes(config.url)) {
// source.cancel(`tooRapid`)
// return config
// }
// a.push(config.url)
// const notEncrypt = config.notEncrypt
let token = getToken()
if (token) {
config.headers['Authorization'] = token
@ -71,11 +59,12 @@ service.interceptors.response.use(
if (res && res.code) {
if (res.code === 42011) {
console.log(42011420114201142011)
let instance = useStore()
// 无感处理
let target = obtainUrlPathParameterTarget(location.href)
instance.login(target)
// let instance = useStore()
// let paramsTargetJson = sessionStorage.getItem('paramsTarget')
// let paramsTarget = JSON.parse(paramsTargetJson)
// instance.login(paramsTarget).then(location.reload())
removeToken()
location.reload()
return
}
if (![20000].includes(res.code)) {
@ -90,25 +79,12 @@ service.interceptors.response.use(
return res
},
error => {
// if (error.message == 'tooRapid') {
// console.log(error, 'res防抖拦截')
// Notify({
// message: '请求过于频繁!',
// type: 'warning',
// duration: 5 * 1000
// })
// } else {
// let urlIndex = a.indexOf(error.config.url)
// if (urlIndex !== -1) {
// a.splice(urlIndex, 1)
// }
// Notify({
// message: '操作失败!',
// type: 'danger',
// duration: 5 * 1000
// })
// }
// return Promise.reject(error)
Notify({
message: '操作失败!',
type: 'danger',
duration: 5000
})
return Promise.reject(error)
}
)

@ -30,7 +30,7 @@ export default {
return {
productCodeList: [],
refreshing: false,
homeNavBarStyle: null,
// homeNavBarStyle: null,
show: false,
loading: false,
finished: false,
@ -67,7 +67,7 @@ export default {
// },
methods: {
getmenu() {
return
// return
oilSiteApi.getCheckInfo().then(res => {
this.productCodeList = []
Object.keys(res.data.productCodeList).forEach(key => {
@ -105,7 +105,6 @@ export default {
let container = document.getElementById('vanList')
container.onscroll = function (e) {
console.log(e.currentTarget.scrollTop, '滚动到底部')
if (Math.ceil(e.currentTarget.scrollTop + e.currentTarget.clientHeight) >= e.currentTarget.scrollHeight) {
//20px
console.log(e.currentTarget.scrollTop, '滚动到底部')
@ -115,7 +114,7 @@ export default {
init() {
this.getmenu()
this.getlist()
this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight
// this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight
// this.onscroll()
},
@ -124,12 +123,12 @@ export default {
},
getlist() {
let position = this.$pinia.state.value.user.position
console.log('position', position)
console.log(Object.assign(this.page.params, position), position, '地理位置数据')
// console.log('position', position)
// console.log(Object.assign(this.page.params, position), position, '')
if (this.positionChenk(position)) {
position = JSON.parse(localStorage.getItem('position'))
if (this.positionChenk(position)) {
console.log(position, this.$pinia.state.value.user.position, '地理位置错误')
// console.log(position, this.$pinia.state.value.user.position, '')
this.finished = true
return
}
@ -151,20 +150,12 @@ export default {
this.loading = false
this.refreshing = false
}
console.log(res)
// console.log(res)
})
.catch(error => {
this.finished = true
})
},
getPosition() {
let that = this
navigator.geolocation.getCurrentPosition(function (position) {
that.position = position
}, this.showError)
},
onClickLeft() {},
onClickRight() {}
}
}
}
</script>

@ -7,7 +7,6 @@
<div class="oilEvaluate-lable-item">服务周到</div>
<div class="oilEvaluate-lable-item">交通便利</div>
<div class="oilEvaluate-lable-item">便捷高效</div>
</div>
</div>
<div v-if="oilDetails.oilSiteOrderInfoVos" class="oilEvaluate-order-body flex">
@ -19,23 +18,26 @@
<span> {{ item.plateNumber | plateNumberF }}</span>
</div>
<div>
<span> {{ item.oilsCode }} {{ Number(item.volume).toFixed(2) }}L 节省 <span class="red">{{
Number(item.discountAmount).toFixed(2)
}}</span> </span>
<span
> {{ item.oilsCode }} {{ Number(item.volume).toFixed(2) }}L 节省
<span class="red">{{ Number(item.discountAmount).toFixed(2) }}</span>
</span>
</div>
</div>
</div>
</div>
</div>
<div class="oilEvaluate-footer">
<van-button :disabled="!open" @click="gopaly('/nextOrderDetails')" class="oilEvaluate-footer-butten" block
color="#FF6700" type="primary">一键支付</van-button>
<van-button :disabled="!open" @click="gopaly('/nextOrderDetails')" class="oilEvaluate-footer-butten" block color="#FF6700" type="primary"
>一键支付</van-button
>
<!-- <van-button class="oilEvaluate-footer-butten" block color="#FF6700" type="primary">二维码支付</van-button> -->
</div>
<van-dialog @cancel="show=false" @confirm="gopaly('/nextOrderDetails',true)" v-model="show" title="距离提示" show-cancel-button>
<div style="margin:20px">
距离油站距离大于500M<br/> 是否确认下单
</div>
<van-dialog @cancel="show = false" @confirm="gopaly('/nextOrderDetails', true)" v-model="show" title="距离提示" show-cancel-button>
<div style="margin: 20px">
距离油站距离大于500M<br />
是否确认下单
</div>
</van-dialog>
</div>
</template>
@ -43,26 +45,24 @@
<script>
export default {
props: {
oilDetails: {
type: Object,
default: () => null
},
}
},
data() {
return {
show:false,
show: false,
open: 1
}
},
methods: {
juliFn() {
return this.oilDetails.juli > 500?true:false
return this.oilDetails.juli > 500 ? true : false
},
gopaly(path,open=false) {
if(this.juliFn()&&!open){
this.show = true;
gopaly(path, open = false) {
if (this.juliFn() && !open) {
this.show = true
return
}
this.$router.push({
@ -75,15 +75,15 @@ export default {
},
created() {
this.open = (() => {
let xoil = this.oilDetails.oilSiteChannelDetailsVos.filter((item) => item.channelCode == 'XOIL')[0]
return xoil.activePay;
let xoil = this.oilDetails.oilSiteChannelDetailsVos.filter(item => item.channelCode == 'XOIL')[0]
return xoil?.activePay
})()
console.log(this.open)
},
filters: {
distanceFilter(value) {
if (value) {
return value > 1000 ? ((value / 1000).toFixed(2) + 'km') : (value + 'm')
return value > 1000 ? (value / 1000).toFixed(2) + 'km' : value + 'm'
}
},
usernameF(value) {
@ -116,7 +116,8 @@ export default {
height: 90px;
}
.oilEvaluate-footer {}
.oilEvaluate-footer {
}
.red {
color: red;
@ -152,10 +153,10 @@ export default {
}
.oilEvaluate-lable-item {
background: #F6F6F6;
background: #f6f6f6;
border-radius: 5px 5px 5px 5px;
opacity: 1;
border: 2px solid #F6F6F6;
border: 2px solid #f6f6f6;
font-size: 24px;
color: #999999;
margin-top: 21px;
@ -180,4 +181,4 @@ export default {
flex-direction: column;
overflow: auto;
}
</style>
</style>

@ -1,457 +1,481 @@
<template>
<div class="oilGun">
<div class="seleOilGun">
<div class="seleOilGun-title">油枪选择:</div>
<div class="seleOilGun-container">
<div @click="seleGun(index, item)"
:style="{ background: seleIndex == item ? '#FF6700' : '', color: seleIndex == item ? '#FFFFFF' : '', border: seleIndex == item ? '0px' : '' }"
v-for="(item, index) in 9" :key="index" class="seleOilGun-item ac jc">
{{ item }}
</div>
<div :style="{background:seleIndex==0 ? '#FF6700' : '',color:seleIndex==0 ? '#FFFFFF' : '',border: seleIndex==0 ?'0px' : ''}" @click="isShow.keyboard=true;seleIndex=0" class="other-seleOilGun-item ac jc">
{{seleIndex?'other':otherOilsBar}}
</div>
</div>
<div class="oilGun">
<div class="seleOilGun">
<div class="seleOilGun-title">油枪选择:</div>
<div class="seleOilGun-container">
<div
@click="seleGun(index, item)"
:style="{
background: seleIndex == item ? '#FF6700' : '',
color: seleIndex == item ? '#FFFFFF' : '',
border: seleIndex == item ? '0px' : ''
}"
v-for="(item, index) in 9"
:key="index"
class="seleOilGun-item ac jc"
>
{{ item }}
</div>
<div class="oilGun-information">
<div @click="isShowFn" class="oilGun-information-item ac">
<img src="@/assets/kc.png" alt="" />
<span :class="page.plateNumber ? 'cp' : ''" class="oilGun-information-item-text ">
{{ page.plateNumber ? page.plateNumber : '请输入车牌号' }}
</span>
<van-icon name="arrow" />
</div>
<div class="oilGun-information-item ac">
<img class="rigth-img" src="@/assets/sj.png" alt="" />
<span class="oilGun-information-item-text">一号加油员</span>
<van-icon name="arrow" />
</div>
<div
:style="{ background: seleIndex == 0 ? '#FF6700' : '', color: seleIndex == 0 ? '#FFFFFF' : '', border: seleIndex == 0 ? '0px' : '' }"
@click="
isShow.keyboard = true
seleIndex = 0
"
class="other-seleOilGun-item ac jc"
>
{{ seleIndex ? 'other' : otherOilsBar }}
</div>
<div class="refuelingAmount">
<div class="flex bw">
<div class="refuelingAmount-import">
<span class="refuelingAmount-import-lable">加油金额</span>
<input @blur="blur" @input="change" v-model="price" class="refuelingAmount-import-input"
type="number" />
<span class="refuelingAmount-import-lable"></span>
</div>
<div class="samall-text">升数约 {{ Number(page.volume).toFixed(2) }} L</div>
</div>
<div class="priceSelection-container flex top">
<div @click="selePrice(index)"
:style="{ background: price == item * 100 ? '#FF6700' : '', color: price == item * 100 ? '#FFFFFF' : '', border: price == item * 100 ? '0px' : '' }"
v-for="(item, index) in 5" :key="index" class="priceSelection-container-item flex ac jc">
{{ item }}00&nbsp;¥
</div>
</div>
</div>
</div>
<div class="oilGun-information">
<div @click="isShowFn" class="oilGun-information-item ac">
<img src="@/assets/kc.png" alt="" />
<span :class="page.plateNumber ? 'cp' : ''" class="oilGun-information-item-text">
{{ page.plateNumber ? page.plateNumber : '请输入车牌号' }}
</span>
<van-icon name="arrow" />
</div>
<div class="oilGun-information-item ac">
<img class="rigth-img" src="@/assets/sj.png" alt="" />
<span class="oilGun-information-item-text">一号加油员</span>
<van-icon name="arrow" />
</div>
</div>
<div class="refuelingAmount">
<div class="flex bw">
<div class="refuelingAmount-import">
<span class="refuelingAmount-import-lable">加油金额</span>
<input @blur="blur" @input="change" v-model="price" class="refuelingAmount-import-input" type="number" />
<span class="refuelingAmount-import-lable"></span>
</div>
<div class="discount">
<div class="flex discount-title">优惠:</div>
<div class="flex bw top">
<span>星油优惠金额</span>
<span>{{ page.oilDiscountAmount ? `-¥${Number(page.oilDiscountAmount).toFixed(2)}` : '---' }}</span>
</div>
<div class="flex bw top">
<span>优惠券</span>
<span>---</span>
</div>
<div class="samall-text">升数约 {{ Number(page.volume).toFixed(2) }} L</div>
</div>
<div class="priceSelection-container flex top">
<div
@click="selePrice(index)"
:style="{
background: price == item * 100 ? '#FF6700' : '',
color: price == item * 100 ? '#FFFFFF' : '',
border: price == item * 100 ? '0px' : ''
}"
v-for="(item, index) in 5"
:key="index"
class="priceSelection-container-item flex ac jc"
>
{{ item }}00&nbsp;¥
</div>
<van-popup round closeable :style="{ height: '35%' }" position="bottom" v-model="isShow.licensePlate">
<div class="license-plate-popup">
<div class="license-plate-popup-title">请输入车牌号</div>
<div class="license-plate-popup-input flex ac">
<div class="license-plate-popup-input-lable">
<span>车牌号</span>
<input v-model="plateNumber" class="license-plate-popup-input-input" type="text">
</div>
</div>
</div>
</van-popup>
<van-number-keyboard @hide="keyboardHide" v-model="otherOilsBar" :show="isShow.keyboard" :maxlength="2" @blur="isShow.keyboard = false" />
</div>
</div>
<div class="discount">
<div class="flex discount-title">优惠:</div>
<div class="flex bw top">
<span>星油优惠金额</span>
<span>{{ page.oilDiscountAmount ? `-¥${Number(page.oilDiscountAmount).toFixed(2)}` : '---' }}</span>
</div>
<div class="flex bw top">
<span>优惠券</span>
<span>---</span>
</div>
</div>
<van-popup round closeable :style="{ height: '35%' }" position="bottom" v-model="isShow.licensePlate">
<div class="license-plate-popup">
<div class="license-plate-popup-title">请输入车牌号</div>
<div class="license-plate-popup-input flex ac">
<div class="license-plate-popup-input-lable">
<span>车牌号</span>
<input v-model="plateNumber" class="license-plate-popup-input-input" type="text" />
</div>
</div>
</div>
</van-popup>
<van-number-keyboard @hide="keyboardHide" v-model="otherOilsBar" :show="isShow.keyboard" :maxlength="2" @blur="isShow.keyboard = false" />
</div>
</template>
<script>
import oilSiteApi from '@/api/oil-site.js'
export default {
props: {
seleOil: {
type: Object,
default: () => null
props: {
seleOil: {
type: Object,
default: () => null
}
},
data() {
return {
otherOilsBar: '',
timer: null,
plateNumber: '',
page: {
oilDiscountAmount: '',
volume: '',
payRealAmount: '',
plateNumber: '',
oilsBar: 1
},
aboutLiters: 0,
price: '',
seleIndex: 1,
isShow: {
licensePlate: false,
keyboard: false
},
show: true,
selePriceIndex: null
}
},
watch: {
seleIndex: function (n) {
if (n !== 0) {
this.otherOilsBar = ''
}
},
'seleOil.oilProductCode': {
handler(n, o) {
if (n !== o) {
this.blur()
}
},
deep: true
},
data() {
return {
otherOilsBar:'',
timer: null,
plateNumber:'',
page: {
oilDiscountAmount: '',
volume: '',
payRealAmount: '',
plateNumber: '',
oilsBar: 1
},
aboutLiters: 0,
price: '',
seleIndex: 1,
isShow: {
licensePlate: false,
keyboard:false
},
show: true,
selePriceIndex: null
};
'isShow.licensePlate': {
handler(n) {
if (!n) {
if (this.checkFn('plateNumber', this.plateNumber)) {
this.page.plateNumber = this.plateNumber
} else {
this.$notify('请输入正确车牌号')
this.$nextTick(function () {
this.plateNumber = ''
this.page.plateNumber = ''
})
}
}
},
deep: true
},
watch: {
seleIndex:function(n){
if(n!==0){
this.otherOilsBar = ''
}
},
'seleOil.oilProductCode': {
handler(n, o) {
if (n !== o) {
this.blur()
}
},
deep: true,
},
'isShow.licensePlate': {
handler(n) {
if (!n) {
if (this.checkFn('plateNumber', this.plateNumber)) {
this.page.plateNumber = this.plateNumber
} else {
this.$notify('请输入正确车牌号')
this.$nextTick(function () {
this.plateNumber = ''
this.page.plateNumber = ''
})
}
}
},
deep: true
},
page: {
handler() {
this.$nextTick(function () {
console.log(this.page.oilsBar,'this.page.oilsBar')
this.$emit('input', Object.assign(JSON.parse(JSON.stringify(this.seleOil)), {...this.page,oilsBar:this.page.oilsBar?this.page.oilsBar:this.otherOilsBar}));
})
},
deep: true
page: {
handler() {
this.$nextTick(function () {
this.$emit(
'input',
Object.assign(JSON.parse(JSON.stringify(this.seleOil)), {
...this.page,
oilsBar: this.page.oilsBar ? this.page.oilsBar : this.otherOilsBar
})
)
})
},
deep: true
}
},
created() {},
mounted() {
this.plateNumber = this.$pinia.state.value.user.user.plateNumber
this.page.plateNumber = this.$pinia.state.value.user.user.plateNumber
this.$nextTick(function () {
this.$emit('input', Object.assign(this.seleOil, this.page))
})
},
methods: {
keyboardHide() {
setTimeout(() => {
if (this.otherOilsBar) {
this.page = Object.assign({}, { ...this.page, oilsBar: this.otherOilsBar })
} else {
this.seleIndex = 1
}
}, 0)
},
created() { },
mounted() {
this.plateNumber = this.$pinia.state.value.user.user.plateNumber
this.page.plateNumber = this.$pinia.state.value.user.user.plateNumber
chenkFn() {
let chenk = /^\d+(.\d{1,2})?$/
if (!chenk.test(Number(this.price))) {
this.$nextTick(function () {
this.$emit('input', Object.assign(this.seleOil, this.page))
this.price = this.price.slice(0, this.price.length - 1)
})
} else {
if (this.price.indexOf('.') !== -1 && this.price.split('.')[1].length > 2) {
this.$nextTick(function () {
this.price = Number(this.price).toFixed(2)
})
}
}
},
methods: {
keyboardHide(){
setTimeout(()=>{
if(this.otherOilsBar){
this.page = Object.assign({}, { ...this.page, oilsBar: this.otherOilsBar })
}else{
this.seleIndex= 1
}
},0)
},
chenkFn() {
let chenk = /^\d+(.\d{1,2})?$/
if (!chenk.test(Number(this.price))) {
this.$nextTick(function () {
this.price = this.price.slice(0, this.price.length - 1);
})
} else {
if (this.price.indexOf('.') !== -1 && this.price.split('.')[1].length > 2) {
this.$nextTick(function () {
this.price = Number(this.price).toFixed(2);
})
}
}
},
checkFn(e, n) {
switch (e) {
case 'name':
/(^[\u4e00-\u9fa5]{1}[\u4e00-\u9fa5\.·。]{0,18}[\u4e00-\u9fa5]{1}$)|(^[a-zA-Z]{1}[a-zA-Z\s]{0,18}[a-zA-Z]{1}$)/
.test(n);
break
case 'plateNumber':
return /(^[\u4E00-\u9FA5]{1}[A-Z0-9]{6}$)|(^[A-Z]{2}[A-Z0-9]{2}[A-Z0-9\u4E00-\u9FA5]{1}[A-Z0-9]{4}$)|(^[\u4E00-\u9FA5]{1}[A-Z0-9]{5}[挂学警军港澳]{1}$)|(^[A-Z]{2}[0-9]{5}$)|(^(08|38){1}[A-Z0-9]{4}[A-Z0-9挂学警军港澳]{1}$)/
.test(n)
break
case 'phone':
return /^1[3456789]\d{9}$/.test(n);
break;
case 'replacePhone':
/^1[3456789]\d{9}$/.test(n);
break;
}
},
resetFn() {
this.page = Object.assign(
{},
{
oilDiscountAmount: '',
vlom: '',
payRealAmount: '',
plateNumber: '',
oilsBar: 1
})
},
blur() {
let page = {
payType: 'CUSTOMER_ACTIVE',
userType: '1',
xoilAmountGun: Number(this.price),
priceId: this.seleOil.priceId
}
oilSiteApi.getOrderDiscountInfo(page).then(res => {
let { payRealAmount, oilDiscountAmount, volume } = res.data;
this.page = Object.assign(JSON.parse(JSON.stringify(this.page)), { payRealAmount, oilDiscountAmount, volume });
})
},
seleGun(index, item) {
this.seleIndex = item;
this.page = Object.assign({}, { ...this.page, oilsBar: item })
},
selePrice(index) {
this.price = (index + 1) * 100;
this.blur()
},
change() {
this.chenkFn()
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
this.blur()
}, 600);
},
isShowFn() {
this.isShow.licensePlate = !this.isShow.licensePlate;
},
checkFn(e, n) {
switch (e) {
case 'name':
;/(^[\u4e00-\u9fa5]{1}[\u4e00-\u9fa5\.·。]{0,18}[\u4e00-\u9fa5]{1}$)|(^[a-zA-Z]{1}[a-zA-Z\s]{0,18}[a-zA-Z]{1}$)/.test(n)
break
case 'plateNumber':
return /(^[\u4E00-\u9FA5]{1}[A-Z0-9]{6}$)|(^[A-Z]{2}[A-Z0-9]{2}[A-Z0-9\u4E00-\u9FA5]{1}[A-Z0-9]{4}$)|(^[\u4E00-\u9FA5]{1}[A-Z0-9]{5}[挂学警军港澳]{1}$)|(^[A-Z]{2}[0-9]{5}$)|(^(08|38){1}[A-Z0-9]{4}[A-Z0-9挂学警军港澳]{1}$)/.test(
n
)
break
case 'phone':
return /^1[3456789]\d{9}$/.test(n)
break
case 'replacePhone':
;/^1[3456789]\d{9}$/.test(n)
break
}
},
resetFn() {
this.page = Object.assign(
{},
{
oilDiscountAmount: '',
vlom: '',
payRealAmount: '',
plateNumber: '',
oilsBar: 1
}
)
},
blur() {
let page = {
payType: 'CUSTOMER_ACTIVE',
userType: '1',
xoilAmountGun: Number(this.price),
priceId: this.seleOil.priceId
}
oilSiteApi.getOrderDiscountInfo(page).then(res => {
let { payRealAmount, oilDiscountAmount, volume } = res.data
this.page = Object.assign(JSON.parse(JSON.stringify(this.page)), { payRealAmount, oilDiscountAmount, volume })
})
},
seleGun(index, item) {
this.seleIndex = item
this.page = Object.assign({}, { ...this.page, oilsBar: item })
},
};
selePrice(index) {
this.price = (index + 1) * 100
this.blur()
},
change() {
this.chenkFn()
if (this.timer) {
clearTimeout(this.timer)
}
this.timer = setTimeout(() => {
this.blur()
}, 600)
},
isShowFn() {
this.isShow.licensePlate = !this.isShow.licensePlate
}
}
}
</script>
<style scoped>
.cp::first-letter {
color: red;
font-weight: 600;
margin-right: 10px;
color: red;
font-weight: 600;
margin-right: 10px;
}
.top {
margin-top: 20px;
margin-top: 20px;
}
.license-plate-popup-input-input {
border: none !important;
background-color: #fcfcfc;
margin-left: 10px;
border: none !important;
background-color: #fcfcfc;
margin-left: 10px;
}
.license-plate-popup-input-lable {
font-size: 30px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #000000;
font-size: 30px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #000000;
}
.license-plate-popup-input {
width: 647px;
height: 75px;
background: #fcfcfc;
border-radius: 0px 0px 0px 0px;
opacity: 1;
border: 1px solid #e7e7e7;
margin-top: 30px;
padding: 0 25px;
box-sizing: border-box;
width: 647px;
height: 75px;
background: #fcfcfc;
border-radius: 0px 0px 0px 0px;
opacity: 1;
border: 1px solid #e7e7e7;
margin-top: 30px;
padding: 0 25px;
box-sizing: border-box;
}
.license-plate-popup-title {
font-size: 28px;
font-family: PingFang;
font-weight: normal;
color: #000000;
text-align: left;
font-size: 28px;
font-family: PingFang;
font-weight: normal;
color: #000000;
text-align: left;
}
.license-plate-popup {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 20px var(--pd);
width: 100%;
height: 100%;
box-sizing: border-box;
padding: 20px var(--pd);
}
.discount-title {
font-size: 30px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
font-size: 30px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
}
.discount {
margin-top: 20px;
margin-top: 20px;
}
.priceSelection-container {
gap: 20px;
gap: 20px;
}
.priceSelection-container-item {
width: 110px;
height: 50px;
border-radius: 6px 6px 6px 6px;
opacity: 1;
border: 1px solid #cecece;
margin-top: 10px;
box-sizing: border-box;
width: 110px;
height: 50px;
border-radius: 6px 6px 6px 6px;
opacity: 1;
border: 1px solid #cecece;
margin-top: 10px;
box-sizing: border-box;
}
.samall-text {
font-size: 24px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
flex: 1;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
padding: 0 10px;
margin-left: 15px;
text-align: right;
font-size: 24px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
flex: 1;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
padding: 0 10px;
margin-left: 15px;
text-align: right;
}
.refuelingAmount-import-input {
border: none !important;
max-width: 200px;
margin: 0 20px;
border: none !important;
max-width: 200px;
margin: 0 20px;
font-size: 28px;
font-size: 28px;
}
.refuelingAmount-import-lable {
font-size: 28px;
font-family: PingFang SC-粗体, PingFang SC;
font-weight: normal;
color: #000000;
font-size: 28px;
font-family: PingFang SC-粗体, PingFang SC;
font-weight: normal;
color: #000000;
}
.refuelingAmount-import {
text-align: left;
text-align: left;
}
.refuelingAmount {
height: 152px;
background: #ffffff;
box-shadow: 0px 0px 10px 1px rgba(23, 23, 23, 0.102);
border-radius: 0px 0px 0px 0px;
opacity: 1;
margin-top: 10px;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
height: 152px;
background: #ffffff;
box-shadow: 0px 0px 10px 1px rgba(23, 23, 23, 0.102);
border-radius: 0px 0px 0px 0px;
opacity: 1;
margin-top: 10px;
display: flex;
flex-direction: column;
padding: 20px;
box-sizing: border-box;
}
.rigth-img {
width: 35px;
height: 45.15px;
width: 35px;
height: 45.15px;
}
.oilGun-information-item-text {
font-size: 24px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
margin-left: 21px;
margin-right: 8px;
font-size: 24px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
margin-left: 21px;
margin-right: 8px;
}
.oilGun-information-item img {
width: 47px;
height: 38px;
width: 47px;
height: 38px;
}
.oilGun-information-item {
display: flex;
display: flex;
}
.oilGun-information {
height: 85px;
background: #ffffff;
box-shadow: 0px 0px 10px 1px rgba(23, 23, 23, 0.102);
border-radius: 0px 0px 0px 0px;
opacity: 1;
margin-top: 20px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
padding: 0 30px;
height: 85px;
background: #ffffff;
box-shadow: 0px 0px 10px 1px rgba(23, 23, 23, 0.102);
border-radius: 0px 0px 0px 0px;
opacity: 1;
margin-top: 20px;
box-sizing: border-box;
display: flex;
justify-content: space-between;
padding: 0 30px;
}
.other-seleOilGun-item {
width: 110px;
height: 50px;
border-radius: 6px 6px 6px 6px;
opacity: 1;
border: 1px solid #cecece;
display: flex;
font-size: 28px;
color: #333333;
box-sizing: border-box;
width: 110px;
height: 50px;
border-radius: 6px 6px 6px 6px;
opacity: 1;
border: 1px solid #cecece;
display: flex;
font-size: 28px;
color: #333333;
box-sizing: border-box;
}
.seleOilGun-item {
width: 110px;
height: 50px;
border-radius: 6px 6px 6px 6px;
opacity: 1;
border: 1px solid #cecece;
display: flex;
font-size: 28px;
color: #333333;
box-sizing: border-box;
width: 110px;
height: 50px;
border-radius: 6px 6px 6px 6px;
opacity: 1;
border: 1px solid #cecece;
display: flex;
font-size: 28px;
color: #333333;
box-sizing: border-box;
}
.seleOilGun-container {
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-top: 15px;
width: 100%;
display: flex;
flex-wrap: wrap;
gap: 20px;
margin-top: 15px;
}
.seleOilGun-title {
font-size: 30px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
margin: 0;
text-align: left;
font-size: 30px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #333333;
margin: 0;
text-align: left;
}
.oilGun {
flex: 1;
width: 100%;
background-color: #ffffff;
margin-top: 10px;
display: flex;
padding: 27px var(--pd);
box-sizing: border-box;
flex-direction: column;
padding-bottom: 159px;
flex: 1;
width: 100%;
background-color: #ffffff;
margin-top: 10px;
display: flex;
padding: 27px var(--pd);
box-sizing: border-box;
flex-direction: column;
padding-bottom: 159px;
}
</style>
</style>

@ -1,163 +1,167 @@
<template>
<div class="oilLable">
<div class="oilLable-sele flex ac jc">
<div class="oilLable-sele-item flex ac">
<img :src=" `${imgURL}${oilType.channelCode}.png` " alt="">
<span>{{oilType.channelCode|channelCodeFamt}}</span>
</div>
</div>
<div class="oilLableDetails">
<div v-for="(itemx, index) in oilType.oilSitePriceDetailsVos" :key="index" class="oilLableDetails-item flex ac">
<span class="oilLableDetails-item-tip"></span>
<span class="oilLableDetails-item-oilNumber">{{ itemx.oilProductCode }}</span>
<span class="oilLableDetails-item-oilPrice">{{ moneyIntercept(itemx.sitePrice)}}/L</span>
<span class="oilLableDetails-item-originalPrice">{{ itemx.oilSitePrice | moneyIntercept }}/L</span>
<span class="oilLableDetails-item-text">预计每100L节省{{ (100 * (itemx.oilSitePrice - itemx.sitePrice)) | moneyFormat}}</span>
</div>
</div>
<div class="oilLable">
<div class="oilLable-sele flex ac jc">
<div class="oilLable-sele-item flex ac">
<img :src="`${imgURL}${oilType.channelCode}.png`" alt="" />
<span>{{ oilType.channelCode | channelCodeFamt }}</span>
</div>
</div>
<div class="oilLableDetails">
<div v-for="(itemx, index) in oilType.oilSitePriceDetailsVos" :key="index" class="oilLableDetails-item flex ac">
<span class="oilLableDetails-item-tip"></span>
<span class="oilLableDetails-item-oilNumber">{{ itemx.oilProductCode }}</span>
<span class="oilLableDetails-item-oilPrice">{{ moneyIntercept(itemx.sitePrice) }}/L</span>
<span class="oilLableDetails-item-originalPrice">{{ itemx.oilSitePrice | moneyIntercept }}/L</span>
<span class="oilLableDetails-item-text">预计每100L节省{{ (100 * (itemx.oilSitePrice - itemx.sitePrice)) | moneyFormat }}</span>
</div>
</div>
</div>
</template>
<script>
export default {
props: {
oilType: {
type: Object,
default: null
}
},
data() {
return {
imgURL:'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/site-'
}
props: {
oilType: {
type: Object,
default: null
}
},
data() {
return {
imgURL: 'https://publicxingyou.oss-cn-hangzhou.aliyuncs.com/mp-oil/site-'
}
},
created() {
// console.log(this.oilType, '---------------')
},
mounted() {},
filters: {
moneyIntercept(value) {
if (value != 'xxx.x') {
// console.log(value, '************************')
return String(value).split('.')[1] && String(value).split('.')[1].length > 2
? Number(
`${String(value).split('.')[0]}.${String(value).split('.')[1].substring(0, 1)}${
Number(String(value).split('.')[1].substring(1, 2)) + 1
}`
)
: Number(value).toFixed(2)
} else {
return Number(value).toFixed(2)
}
},
created() {
console.log(this.oilType, '---------------')
moneyFormat(value) {
if (value != 'xxx.x') {
// console.log('old:', value)
let realAmount = Math.floor(value * 100) / 100
// console.log('new:', realAmount)
// return realAmount
return Number(value).toFixed(2)
} else {
return Number(value).toFixed(2)
}
},
mounted() { },
filters: {
moneyIntercept(value) {
if (value != 'xxx.x') {
console.log(value, '************************')
return String(value).split('.')[1] && String(value).split('.')[1].length > 2 ? Number(`${String(value).split('.')[0]}.${String(value).split('.')[1].substring(0, 1)}${Number(String(value).split('.')[1].substring(1, 2)) + 1}`) : Number(value).toFixed(2);
} else {
return Number(value).toFixed(2)
}
},
moneyFormat(value) {
if (value != 'xxx.x') {
console.log('old:', value)
let realAmount = Math.floor(value * 100) / 100
console.log('new:', realAmount)
// return realAmount
return Number(value).toFixed(2)
} else {
return Number(value).toFixed(2)
}
},
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 '一点加油(壳牌)'
}
}
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 '一点加油(壳牌)'
}
}
}
}
}
</script>
<style scoped>
.oilLableDetails-item:last-child {
margin-bottom: 0px !important;
margin-bottom: 0px !important;
}
.oilLableDetails-item-text {
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
margin-left: 30px;
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
margin-left: 30px;
}
.oilLableDetails-item-originalPrice {
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
text-decoration: line-through;
margin-left: 13px;
font-size: 22px;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #999999;
text-decoration: line-through;
margin-left: 13px;
}
.oilLableDetails-item-oilPrice {
font-size: 32px;
font-family: PingFang SC-特粗, PingFang SC;
font-weight: normal;
color: #FF6700;
margin-left: 34px;
font-size: 32px;
font-family: PingFang SC-特粗, PingFang SC;
font-weight: normal;
color: #ff6700;
margin-left: 34px;
}
.oilLableDetails-item-oilNumber {
color: #000000;
font-size: 34px;
margin-left: 17px;
color: #000000;
font-size: 34px;
margin-left: 17px;
}
.oilLableDetails-item-tip {
width: 35px;
height: 35px;
box-sizing: border-box;
border: solid 1px #FF6700;
font-size: 25px;
color: #FF6700;
width: 35px;
height: 35px;
box-sizing: border-box;
border: solid 1px #ff6700;
font-size: 25px;
color: #ff6700;
}
.oilLableDetails-item {
margin-bottom: 43px;
margin-bottom: 43px;
}
.oilLableDetails {
margin-top: 37px;
margin-top: 37px;
}
.oilLable-sele-item {
width: fit-content;
border-bottom: 4px solid #FF6700;
padding-bottom: 5px;
box-sizing: border-box;
width: fit-content;
border-bottom: 4px solid #ff6700;
padding-bottom: 5px;
box-sizing: border-box;
}
.oilLable-sele img {
width: 45px;
height: 45px;
margin-right: 10px;
width: 45px;
height: 45px;
margin-right: 10px;
}
.oilLable-sele {
width: 100%;
border-bottom: 3px solid #F2F2F2;
width: 100%;
border-bottom: 3px solid #f2f2f2;
}
.oilLable {
--pd: calc((100vw - 684px)/2);
width: 100%;
background-color: #ffffff;
margin-top: -62px;
box-sizing: border-box;
padding-top: 102px;
padding-left: var(--pd);
padding-right: var(--pd);
padding-bottom: 36px;
--pd: calc((100vw - 684px) / 2);
width: 100%;
background-color: #ffffff;
margin-top: -62px;
box-sizing: border-box;
padding-top: 102px;
padding-left: var(--pd);
padding-right: var(--pd);
padding-bottom: 36px;
}
</style>
</style>

@ -12,7 +12,6 @@
<div @click="gopaly" class="oilNextFooter-butten flex jc ac">
{{ text }}
</div>
</div>
<van-popup round :style="{ height: '60%' }" position="bottom" v-model="isShow.details">
<div class="details-popup">
@ -21,11 +20,10 @@
</div>
</van-popup>
</div>
</template>
<script>
import detailsCard from "../../cashier/components/detailsCard.vue";
import detailsCard from '../../cashier/components/detailsCard.vue'
import oilOrderApi from '@/api/oil-order.js'
export default {
props: {
@ -58,7 +56,7 @@ export default {
{
lable: '加油升数:',
value: '---'
},
}
],
[
@ -86,9 +84,8 @@ export default {
valueStyle: {
color: '#FF0000'
}
},
],
}
]
],
isShow: {
details: false
@ -103,21 +100,19 @@ export default {
deep: true
}
},
created() {
},
created() {},
mounted() {
this.updateFn()
},
methods: {
updateFn() {
this.$nextTick(function () {
this.detailsList[0][0].value = this.oilDetails.siteName;
this.detailsList[0][1].value = this.seleOil.oilProductCode + ' ' + this.seleOil.oilsBar + '号枪';
this.detailsList[0][2].value = Number(this.seleOil.volume).toFixed(2) + 'L';
this.detailsList[1][0].value = '¥' + Number(this.seleOil.payRealAmount + this.seleOil.oilDiscountAmount).toFixed(2);
this.detailsList[1][1].value = '-¥' + Number(this.seleOil.oilDiscountAmount).toFixed(2);
this.detailsList[1][3].value = '-¥' + Number(this.seleOil.payRealAmount).toFixed(2);
this.detailsList[0][0].value = this.oilDetails.siteName
this.detailsList[0][1].value = this.seleOil.oilProductCode + ' ' + this.seleOil.oilsBar + '号枪'
this.detailsList[0][2].value = Number(this.seleOil.volume).toFixed(2) + 'L'
this.detailsList[1][0].value = '¥' + Number(this.seleOil.payRealAmount + this.seleOil.oilDiscountAmount).toFixed(2)
this.detailsList[1][1].value = '-¥' + Number(this.seleOil.oilDiscountAmount).toFixed(2)
this.detailsList[1][3].value = '-¥' + Number(this.seleOil.payRealAmount).toFixed(2)
})
},
update(e) {
@ -127,31 +122,31 @@ export default {
return !position?.latitude && !position?.longitude ? true : false
},
gopaly() {
let position = this.$pinia.state.value.user.position;
let position = this.$pinia.state.value.user.position
if (this.positionChenk(position)) {
position = JSON.parse(localStorage.getItem("position"))
position = JSON.parse(localStorage.getItem('position'))
if (this.positionChenk(position)) {
console.log(position, this.$pinia.state.value.user.position, '地理位置错误');
console.log(position, this.$pinia.state.value.user.position, '地理位置错误')
return
}
}
let page = {
shareCompanyQuota: 0, //
priceId: this.seleOil.priceId, //String
orderType: "REAL_ORDER", //String REAL_ORDER VIRTUAL_ORDER
orderSource: "WECHAT_MINIAPPS", //String WECHAT_MINIAPPS
plateNumber: this.seleOil.plateNumber, //String
siteUserName: '一号加油员', //String
oilsBar: this.seleOil.oilsBar, //Number
volume: this.seleOil.volume, //Number
realPrice: this.seleOil.payRealAmount, //Number
suppleMark: 0, //Number 0 1
createSource: "H5_COMPANY_AUTH", //String XOIL_DRIVER_COMPANY_WECHAT_APPLET
// "deviceImei": "mock", //String
// "networkIp": "mock" //String ip
priceId: this.seleOil.priceId, //
orderType: 'REAL_ORDER', //REAL_ORDER VIRTUAL_ORDER
orderSource: 'WECHAT_MINIAPPS', //WECHAT_MINIAPPS
plateNumber: this.seleOil.plateNumber, //
siteUserName: '一号加油员', //
oilsBar: this.seleOil.oilsBar, //
volume: this.seleOil.volume, //
realPrice: this.seleOil.payRealAmount, //
suppleMark: 0, //0 1
createSource: 'H5_COMPANY_AUTH', // XOIL_DRIVER_COMPANY_WECHAT_APPLET
// "deviceImei": "mock", //
// "networkIp": "mock" //ip
kaliState: 1,
'version': 1,
'xoilAmountGun': Number(Number(this.seleOil.payRealAmount + this.seleOil.oilDiscountAmount).toFixed(2)),
version: 1,
xoilAmountGun: Number(Number(this.seleOil.payRealAmount + this.seleOil.oilDiscountAmount).toFixed(2)),
latitude: position.latitude,
longitude: position.longitude
}
@ -162,7 +157,7 @@ export default {
oilOrderApi.createOrder(page).then(res => {
if (res.code == 20000) {
this.$router.push({
'path': '/cashier',
path: '/cashier',
query: {
order: JSON.stringify(res.data)
}
@ -173,7 +168,7 @@ export default {
console.log(page, '+++')
}
}
};
}
</script>
<style scoped>
@ -186,9 +181,8 @@ export default {
.details-popup-one:last-child {
margin-top: 0px;
border-top: dashed 0px #B9B9B9;
border-bottom: dashed 0px #B9B9B9;
border-top: dashed 0px #b9b9b9;
border-bottom: dashed 0px #b9b9b9;
}
.details-popup-title {
@ -200,9 +194,9 @@ export default {
.details-popup-one {
height: 220px;
border-top: dashed 1px #B9B9B9;
border-top: dashed 1px #b9b9b9;
margin-top: 45px;
border-bottom: dashed 1px #B9B9B9;
border-bottom: dashed 1px #b9b9b9;
overflow: auto;
flex-wrap: wrap;
}
@ -220,8 +214,7 @@ export default {
.oilNextFooter-price {
font-size: 28px;
color: #FE0505;
color: #fe0505;
}
.oilNextFooter-hj {
@ -232,14 +225,13 @@ export default {
.oilNextFooter-butten {
width: 314px;
height: 90px;
background: #FF6700;
background: #ff6700;
border-radius: 15px 15px 15px 15px;
opacity: 1;
font-family: PingFang SC-中等, PingFang SC;
font-weight: normal;
color: #FFFFFF;
color: #ffffff;
font-size: 32px;
}
.oilNextFooter {
@ -260,4 +252,4 @@ export default {
justify-content: space-between;
z-index: 9;
}
</style>
</style>

@ -60,9 +60,9 @@ export default {
},
moneyFormat(value) {
if (value != 'xxx.x') {
console.log('old:', value)
// console.log('old:', value)
let realAmount = Math.floor(value * 100) / 100
console.log('new:', realAmount)
// console.log('new:', realAmount)
// return realAmount
return Number(value).toFixed(2)
} else {

@ -1,10 +1,10 @@
<template>
<div class="nextOrderDetails flex">
<orderDetailsLable :oilDetails="oilDetails" />
<optionalOilLable v-model="seleOil" v-if="oilType" :oilType="oilType" />
<oilGun @update="update" v-model="seleOil" :seleOil="seleOil" />
<oilNextFooter :oilDetails="oilDetails" ref="oilNextFooter" :seleOil="seleOil" />
</div>
<div class="nextOrderDetails flex">
<orderDetailsLable :oilDetails="oilDetails" />
<optionalOilLable v-model="seleOil" v-if="oilType" :oilType="oilType" />
<oilGun @update="update" v-model="seleOil" :seleOil="seleOil" />
<oilNextFooter :oilDetails="oilDetails" ref="oilNextFooter" :seleOil="seleOil" />
</div>
</template>
<script>
@ -13,51 +13,52 @@ import optionalOilLable from './components/optionalOilLable.vue'
import oilGun from './components/oilGun.vue'
import oilNextFooter from './components/oilNextFooter.vue'
export default {
components: {
orderDetailsLable,
optionalOilLable,
oilGun,
oilNextFooter
},
created() {
this.oilDetails = JSON.parse(this.$route.query.oilDetails);
this.oilTypeFn()
},
data() {
return {
oilDetails: null,
oilType: null,
seleOil: {
oilDiscountAmount: '',
volume: '',
payRealAmount: 0,
plateNumber: '',
oilsBar: 1
}
}
components: {
orderDetailsLable,
optionalOilLable,
oilGun,
oilNextFooter
},
created() {
this.oilDetails = JSON.parse(this.$route.query.oilDetails)
// console.log('this.oilDetails', this.oilDetails)
this.oilTypeFn()
console.log('seleOil', this.seleOil)
},
data() {
return {
oilDetails: null,
oilType: null,
seleOil: {
oilDiscountAmount: '',
volume: '',
payRealAmount: 0,
plateNumber: '',
oilsBar: 1
}
}
},
methods: {
update(e) {
this.$refs.oilNextFooter.update(e)
},
methods: {
update(e) {
this.$refs.oilNextFooter.update(e)
},
showPopup() { },
oilTypeFn() {
let a = this.oilDetails.oilSiteChannelDetailsVos.filter((item) => item.channelCode == 'XOIL');
this.oilType = a.length ? a[0] : null;
},
oilTypeFn() {
let target = this.oilDetails.oilSiteChannelDetailsVos.filter(item => item.channelCode == 'XOIL')
this.oilType = target.length ? target[0] : null
// console.log('this.oilType', this.oilType)
}
}
}
</script>
<style>
:root {
--pd: calc((100vw - 684px)/2);
--pd: calc((100vw - 684px) / 2);
}
</style>
<style scoped>
.nextOrderDetails {
background: #F1F2F7;
flex-direction: column;
overflow: auto;
background: #f1f2f7;
flex-direction: column;
overflow: auto;
}
</style>
</style>

@ -39,7 +39,7 @@ export default {
}
},
refreshing: false,
homeNavBarStyle: null,
// homeNavBarStyle: null,
show: false,
loading: false,
finished: false,
@ -50,7 +50,7 @@ export default {
this.init()
},
mounted() {
this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight
// this.homeNavBarStyle = this.$refs.homeNavBar.$el.clientHeight
},
methods: {
goPlay(e, type) {

@ -16,8 +16,9 @@ module.exports = defineConfig({
// https: true,
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: `http://192.168.110.10:38080`,
// target: `http://192.168.110.230:38080`,
// target: `https://www.xingoil.com/adminapi`,
target: `http://uat.xingoil.com/adminapi`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''

Loading…
Cancel
Save