中秋更新

This commit is contained in:
caolc
2022-09-09 14:53:48 +08:00
parent a59bf23fd7
commit 26b9d6fe85
18 changed files with 388 additions and 275 deletions

View File

@@ -27,7 +27,7 @@
</text>
<text class="text-bold text-black text-lg">{{itemx.oilProductCode}}</text>
<!-- !=0?itemx.sitePrice:'-.--' -->
<text class="text-bold text-red text-lg">{{itemx.sitePrice |moneyIntercept}}/L</text>
<text class="text-bold text-red text-lg">{{moneyIntercept(itemx.sitePrice)}}/L</text>
<text class="text-delete">{{itemx.oilSitePrice}}/L</text>
<text class="text-sm">预计每100L节省{{(100*(itemx.oilSitePrice - itemx.sitePrice))|moneyForMath}}</text>
</label>
@@ -41,13 +41,13 @@
<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">
<button class="cu-btn red block" :class="item.checked?'bg-red':'line-red'" @tap="ChooseBar(item)" :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 class="padding-xs" style="width:40% ;" v-if="activeChannelCode!='TY'&&!typeChenk()">
<input type="number" @input="onInputBar" v-model="inputBar" class="cu-btn red block" placeholder="其他油枪" value="" />
</view>
</view>
</view>
@@ -90,6 +90,7 @@
<view class="">
{{plateNumber?plateNumber:(plateNumberSel?plateNumberSel:'必填项')}}
</view>
<uni-icons type="forward" size="20" color="#8799a3"></uni-icons>
</view>
</view>
<view class="flex-sub padding-left">
@@ -232,7 +233,7 @@
</view>
<view class="padding-tb-xs text-left">
油品油枪
<text class="fr">{{oilProductCode?oilProductCode:''}} {{oilBar?oilBar+'号枪':'未选择油枪'}}</text>
<text class="fr">{{oilProductCode?oilProductCode:''}} {{oilBar?(checkBar.filter(item=>oilBar==item.value)[0].name||oilBar)+'号枪':'未选择油枪'}}</text>
</view>
<view class="" v-if="activeChannelCode!='TY'">
<view class="padding-tb-xs margin-bottom text-left">
@@ -321,11 +322,12 @@
</view>
<view class="padding-bottom-lg ">
<view class="text-left margin solid radius flex padding bg-gray">
<view class="flex-sub">
输入车牌号
<view style="align-items: center;" class="text-left margin solid radius flex padding bg-gray">
<view class="">
输入车牌号
</view>
<input type="text" value="" placeholder="请选择或输入车牌号" v-model="plateNumber" />
<input style="flex: 1;" type="text" value="" placeholder="请选择或输入车牌号" v-model="plateNumber" />
<uni-icons v-if="plateNumber" @tap=" plateNumber=''; " type="clear" size="20"></uni-icons>
</view>
<picker-view :indicator-style="indicatorStyle" v-if="plateNumbers.length" :value="plateIndex" @change="pickPlate"
class="picker-view">
@@ -367,10 +369,16 @@
isOther:{
type:Boolean,
default:false
},
siteId:{
type:String,
default:''
}
},
data() {
return {
thirdPartyDynamicData:['LAIYOU'],
vlom:'',
discount:'',
activeSitePrice:'',
@@ -407,7 +415,7 @@
plateNumbers: [],
showPlate: "",
showOrder: '',
radio: '',
radio: 0,
imgURL: this.global.imgURL,
scrollLeft: 0,
checkMoney:[{
@@ -466,8 +474,6 @@
checkbox: [],
activeChannelCode: '',
checkBar: [],
activeChannelCode: '',
checkBar: [],
realMoney:'',
xoilAmountGun:''
}
@@ -482,36 +488,31 @@
}else{
console.log('这里是非卡力')
}
this.showtitles = oilItem.listTag
//生成油枪数据 原来在data里写死的1-8号油枪数据新加 clc 2022-3-18
for(let i=0;i<30;i++){
this.checkbox.push({
value: i+1,
name: i+1,
checked: false,
hot: false,
})
}
this.showtitles = oilItem.listTag;
this.init()
},
watch: {
activeChannelCode: {
handler(newval) {
console.log('activeChannelCode')
this.oilBar = ''
setTimeout(() => {
this.checkBar = this.calcBar()
setTimeout(async() => {
this.checkBar = (this.typeChenk())? await this.dynamic() : this.calcBar()
}, 2)
}
},
priceId: {
priceId: {
handler(newval) {
console.log('priceId')
this.oilBar = ''
setTimeout(() => {
this.checkBar = this.calcBar()
setTimeout(async() => {
this.checkBar = (this.typeChenk())? await this.dynamic() : this.calcBar()
}, 2)
}
},
},
computed: {
priceId() {
if (this.channelList.length && this.channelList[this.activeCur] && this.oilSitePriceDetailsVo[this.radio]) {
return this.oilSitePriceDetailsVo[this.radio].priceId
@@ -566,6 +567,21 @@
}
},
methods: {
typeChenk(){
return this.channelList[this.activeCur]?.secondChannelCode&&this.thirdPartyDynamicData.includes(this.channelList[this.activeCur].secondChannelCode)
},
init(){
//生成油枪数据 原来在data里写死的1-8号油枪数据新加 clc 2022-3-18
for(let i=0;i<30;i++){
this.checkbox.push({
value: i+1,
name: i+1,
checked: false,
hot: false,
})
};
},
ifFn(e){
// if(this.oilSitePriceDetailsVo[this.radio].oilsBar==null){
// return true
@@ -628,7 +644,6 @@
}
},
getMoneyVol(e){
console.log(e)
if(e.detail.value == ''){
uni.showToast({
title:'请输入金额',
@@ -749,39 +764,51 @@
this.checkInfo()
},
//动态油枪方法 this.checkbox数据格式在我改之前就是这样, clc 2022-3-18
calcBar() {
//复制一份源数组
let arry = JSON.parse(JSON.stringify(this.checkbox))
//字段等于null或没有字段 默认显示1-8号油枪
if(!this.oilSitePriceDetailsVo[this.radio].oilsBar){
arry.length = 8
return arry
}else{
//声明空数组 保存满足条件的数据
let newArry = []
// 如果有字段并且字段有值 去重 分割数组
new Set(this.oilSitePriceDetailsVo[this.radio].oilsBar.split(',')).forEach((item,i)=>{
//数值不能等于零 数值最大30 不能有小数点 必须是数字 才能添加到数组
if(Number(item)>0&&Number(item)&&Number(item)<=30&&item.indexOf('.')==-1){
newArry.push({
value: Number(item),
name: Number(item),
checked: false,
hot: false,
})
}else{
//不满足条件 跳过
return
dynamic(){
return new Promise((re,rj)=>{
oilSiteApi.gunList({siteId:this.siteId}).then(res=>{
if(res.data.length!==0){
let array = res.data.map((item,index)=>{return {value:item.otherGunId,name:item.gunNum,checked: false,hot: false,oilsType:item.oilsType,oilsId:item.oilsId}})||[]
let filterArray = array.filter(item=>item.oilsId==this.oilSitePriceDetailsVo[this.radio]?.priceId);
re(filterArray)
}
})
// 如果字段 有值且没有一个满足 条件 默认返回 1-8号油枪
if(newArry.length==0){
})
},
calcBar() {
//复制一份源数组
let arry = JSON.parse(JSON.stringify(this.checkbox));
//字段等于null或没有字段 默认显示1-8号油枪
if(!this.oilSitePriceDetailsVo[this.radio]?.oilsBar){
arry.length = 8
return arry
return arry
}else{
//声明空数组 保存满足条件的数据
let newArry = []
// 如果有字段并且字段有值 去重 分割数组
new Set(this.oilSitePriceDetailsVo[this.radio].oilsBar.split(',')).forEach((item,i)=>{
//数值不能等于零 数值最大30 不能有小数点 必须是数字 才能添加到数组
if(Number(item)>0&&Number(item)&&Number(item)<=30&&item.indexOf('.')==-1){
newArry.push({
value: Number(item),
name: Number(item),
checked: false,
hot: false,
})
}else{
//不满足条件 跳过
return
}
})
// 如果字段 有值且没有一个满足 条件 默认返回 1-8号油枪
if(newArry.length==0){
arry.length = 8
return arry
}
//返回排序数组
return newArry.sort((a,b)=>{a-b});
}
//返回排序数组
return newArry.sort((a,b)=>{a-b})
}
// clc 2022-3-18 注
// if (this.activeChannelCode == 'TY') {
// uni.showLoading({
@@ -1084,17 +1111,18 @@
let location = uni.getStorageSync('location')||{longitude:'',latitude:''};
oilOrderApi.createOrder(Object.assign(orderData,{longitude:location.longitude,latitude:location.latitude})).then(res => {
if (res.code == 20000) {
let data = (this.typeChenk()&&(Object.assign(res.data,{gunName:this.checkBar.filter(item=>this.oilBar==item.value)[0].name})))||res.data
if(otherUser){
console.log('这里是卡力订单创建')
console.log(res.data)
uni.setStorageSync('orderMade', res.data)
console.log(data)
uni.setStorageSync('orderMade', data)
uni.redirectTo({
url: '/BagStation/pages/SeparateProcess/orderPaying?payMethod='+res.data.payMethod +'&&type=oil'
})
return
}
console.log(res,'这里是非卡力')
uni.setStorageSync('orderMade', res.data)
console.log(data,'这里是非卡力')
uni.setStorageSync('orderMade', data)
uni.redirectTo({
url: '/BagStation/pages/makeOrder/orderPaying?payMethod='+res.data.payMethod+'&&type=oil'
})
@@ -1144,9 +1172,9 @@
}
},
ChooseBar(e) {
console.log( e.currentTarget.dataset.value)
console.log( e)
let items = this.checkBar;
let values = e.currentTarget.dataset.value;
let values = e.value;
this.oilBar = values
for (let i = 0, lenI = items.length; i < lenI; ++i) {
if (items[i].value == values) {