更新
This commit is contained in:
@@ -32,7 +32,7 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="cu-form-group margin margin-top-0 radius" v-if="type!= 'rrs'">
|
||||
<view class="cu-form-group margin margin-top-0 radius" v-if="type!= 'rrs'">
|
||||
<view class="title mini-label text-black">车牌号</view>
|
||||
<input :maxlength="7" @tap="showModel='show'" v-model="carNumber" disabled placeholder="请输入车牌号"
|
||||
name="input" />
|
||||
@@ -58,49 +58,53 @@
|
||||
<text class="s-rich">市场价¥{{insertResult.oilSitePrice|numberFilter}}/L</text>
|
||||
</view>
|
||||
<view class="grid col-5 padding-top justify-start">
|
||||
<view class="padding-xs" v-for="(item,index) in siteData.oilSitePriceDetailsVos" @tap="oilNameSel(item)"
|
||||
:key="item.priceId">
|
||||
<view class="padding-xs" v-for="(item,index) in siteData.oilSitePriceDetailsVos"
|
||||
@tap="oilNameSel(item)" :key="item.priceId">
|
||||
<button class="cu-btn"
|
||||
:class="[insertResult.oilProductCode===item.oilProductCode?'bg-main-oil':'line-gray']">{{item.oilProductCode}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- **** 抢号选择 -->
|
||||
<view class="padding padding-bottom-0 padding-top-xs bg-white">
|
||||
<view style="color: #333333;font-size: 30rpx;" class="padding-bottom-sm text-lg">枪号选择:</view>
|
||||
<view class="grid col-5 justify-start">
|
||||
<view style="width: calc(100% / 4);" class="padding-xs" v-for="(item,index) in ColorList" :key="index">
|
||||
<button @tap="gunIdSel(index)" :style="{width: '100%',color:insertResult.bar===index+1?'':'#333333'}" class="cu-btn"
|
||||
:class="[insertResult.bar===index+1?'bg-main-oil':'line-gray']">{{index+1}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- ***油品金额区域 insertResult.oilProductCode 动态控制显示加注的类型和单位 KG/L -->
|
||||
<view class=" padding bg-white">
|
||||
<view class="shadow-warp bg-white">
|
||||
<view class="cu-form-group">
|
||||
<view class="title newtitle"> {{siteData.siteType=='2'?'加气升数':'加油金额'}}</view>
|
||||
<input class="newtitle" :placeholder="`请输入${siteData.siteType=='2'?'加气升数':'加油金额'}`" @input="checkNumber" type="digit"
|
||||
v-model="insertResult.vol" name="input" />
|
||||
<view style="width: 170rpx;text-align: end;" class="textEllipsis">
|
||||
<text class="">
|
||||
<text v-if="siteData.siteType!='2'">{{vlom?'约' + ( (Math.round(vlom*100)/100).toFixed(2) ) + (siteData.siteType=='2'?'元':'L'):''}}</text>
|
||||
<text v-if="siteData.siteType=='2'">{{vlom?'约' + ( insertResult.vDoMoney ? insertResult.vDoMoney+insertResult.discountMoney:'') + (siteData.siteType=='2'?'元':'L'):''}}</text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="my-cell">
|
||||
<text class="font-12">星卡优惠金额</text>
|
||||
<text
|
||||
class="fr">-¥{{insertResult.discountMoney ?insertResult.discountMoney :'' |numberFilter}}</text>
|
||||
</view>
|
||||
<view class="my-cell">
|
||||
<text class="font-12">实际支付金额</text>
|
||||
<text
|
||||
class="oil-main-color fr">¥{{insertResult.vDoMoney ?insertResult.vDoMoney :''|numberFilter}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- **** 抢号选择 -->
|
||||
<view class="padding padding-bottom-0 padding-top-xs bg-white">
|
||||
<view style="color: #333333;font-size: 30rpx;" class="padding-bottom-sm text-lg">枪号选择:</view>
|
||||
<view class="grid col-5 justify-start">
|
||||
<view style="width: calc(100% / 4);" class="padding-xs" v-for="(item,index) in ColorList"
|
||||
:key="index">
|
||||
<button @tap="gunIdSel(index)"
|
||||
:style="{width: '100%',color:insertResult.bar===index+1?'':'#333333'}" class="cu-btn"
|
||||
:class="[insertResult.bar===index+1?'bg-main-oil':'line-gray']">{{index+1}}</button>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- ***油品金额区域 insertResult.oilProductCode 动态控制显示加注的类型和单位 KG/L -->
|
||||
<view class=" padding bg-white">
|
||||
<view class="shadow-warp bg-white">
|
||||
<view class="cu-form-group">
|
||||
<view class="title newtitle"> {{siteData.siteType=='2'?'加气升数':'加油金额'}}</view>
|
||||
<input class="newtitle" :placeholder="`请输入${siteData.siteType=='2'?'加气升数':'加油金额'}`"
|
||||
@input="checkNumber" type="digit" v-model="insertResult.vol" name="input" />
|
||||
<view style="width: 170rpx;text-align: end;" class="textEllipsis">
|
||||
<text class="">
|
||||
<text
|
||||
v-if="siteData.siteType!='2'">{{vlom?'约' + ( numberHandle(vlom) ) + (siteData.siteType=='2'?'元':'L'):''}}</text>
|
||||
<text
|
||||
v-if="siteData.siteType=='2'">{{vlom?'约' + ( insertResult.vDoMoney ? insertResult.vDoMoney+insertResult.discountMoney:'') + (siteData.siteType=='2'?'元':'L'):''}}</text>
|
||||
</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="my-cell">
|
||||
<text class="font-12">星卡优惠金额</text>
|
||||
<text
|
||||
class="fr">-¥{{insertResult.discountMoney ?insertResult.discountMoney :'' |numberFilter}}</text>
|
||||
</view>
|
||||
<view class="my-cell">
|
||||
<text class="font-12">实际支付金额</text>
|
||||
<text
|
||||
class="oil-main-color fr">¥{{insertResult.vDoMoney ?insertResult.vDoMoney :''|numberFilter}}</text>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<button class="margin round bg-main-oil" @tap="charge">确定</button>
|
||||
</view>
|
||||
</view>
|
||||
@@ -183,8 +187,8 @@
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
changTypes:0,
|
||||
vlom: '',
|
||||
changTypes: 0,
|
||||
vlom: '',
|
||||
siteData: {
|
||||
|
||||
},
|
||||
@@ -235,14 +239,14 @@
|
||||
},
|
||||
orderKey: '',
|
||||
payState: '0',
|
||||
type : ''
|
||||
type: ''
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
onLoad(option) {
|
||||
console.log("option============",option) //接收option.type
|
||||
if(option.type =='rrs'){
|
||||
console.log("option============", option) //接收option.type
|
||||
if (option.type == 'rrs') {
|
||||
console.log('这里是日日顺')
|
||||
this.type = 'rrs' //根据option.type 进行本地赋值
|
||||
}
|
||||
@@ -271,10 +275,11 @@
|
||||
},
|
||||
deep: true
|
||||
},
|
||||
selected: function(newVal, oldVal){
|
||||
selected: function(newVal, oldVal) {
|
||||
if (newVal) {
|
||||
this.selected = newVal
|
||||
console.log('selected发生变化',this.insertResult.oilSitePrice,this.selected.oilSitePrice,this.insertResult.realPrice,this.selected.xkPrice)
|
||||
console.log('selected发生变化', this.insertResult.oilSitePrice, this.selected.oilSitePrice, this
|
||||
.insertResult.realPrice, this.selected.xkPrice)
|
||||
// oilSitePrice 市场价格 sitePrice 实际加油价格
|
||||
if (this.selected.oilSitePrice) {
|
||||
this.insertResult.oilSitePrice = this.selected.oilSitePrice
|
||||
@@ -299,98 +304,104 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
changeType(){
|
||||
numberHandle(num) {
|
||||
num *= 10000
|
||||
num /= 100
|
||||
num = Math.ceil(num) / 100
|
||||
return num.toFixed(2)
|
||||
},
|
||||
changeType() {
|
||||
this.changTypes = 1
|
||||
},
|
||||
backType(){
|
||||
backType() {
|
||||
this.changTypes = 0
|
||||
},
|
||||
checkNumber(e) {
|
||||
e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
|
||||
this.$nextTick(() => {
|
||||
this.insertResult.vol = e.detail.value
|
||||
this.getMoney(e)
|
||||
})
|
||||
},
|
||||
oilNameSel(item) {
|
||||
console.log(item, 'item')
|
||||
this.selected = {
|
||||
...item
|
||||
}
|
||||
this.activeSitePrice = item.priceId
|
||||
console.log(this.insertResult.vol)
|
||||
let e = {
|
||||
detail:{
|
||||
checkNumber(e) {
|
||||
e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null;
|
||||
this.$nextTick(() => {
|
||||
this.insertResult.vol = e.detail.value
|
||||
this.getMoney(e)
|
||||
})
|
||||
},
|
||||
oilNameSel(item) {
|
||||
console.log(item, 'item')
|
||||
this.selected = {
|
||||
...item
|
||||
}
|
||||
this.activeSitePrice = item.priceId
|
||||
console.log(this.insertResult.vol)
|
||||
let e = {
|
||||
detail: {
|
||||
|
||||
}
|
||||
}
|
||||
e.detail.value = this.insertResult.vol
|
||||
this.getMoney(e)
|
||||
console.log('选择你/n', this.selected, '/n')
|
||||
},
|
||||
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
|
||||
}
|
||||
},
|
||||
getMoney(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
|
||||
}
|
||||
this.InputNumber = e
|
||||
if (this.siteData.oilCardNature == 1) {
|
||||
var uerTyps = '0' // 0是个人 1是企业
|
||||
} else {
|
||||
console.log('当前为企业')
|
||||
var uerTyps = '1' // 0是个人 1是企业
|
||||
}
|
||||
if (this.type == 'ZEYI' || this.type == 'RIRISHUN') {
|
||||
var number = {
|
||||
payType: 'SITE_SCAN',
|
||||
userType: uerTyps,
|
||||
xoilAmountGun: e.detail.value,
|
||||
priceId: this.activeSitePrice,
|
||||
companyId: this.siteData.companyId,
|
||||
createSource: this.type
|
||||
}
|
||||
} else {
|
||||
var number = {
|
||||
payType: 'SITE_SCAN',
|
||||
userType: uerTyps,
|
||||
xoilAmountGun: e.detail.value,
|
||||
priceId: this.activeSitePrice,
|
||||
companyId: this.siteData.companyId,
|
||||
createSource:this.siteData.createSource
|
||||
}
|
||||
}
|
||||
this.xoilAmountGun = e.detail.value
|
||||
let _that = this
|
||||
oliSiteApi.getOrderDiscountInfo(number).then(res => {
|
||||
this.insertResult.vDoMoney = res.data.payRealAmount
|
||||
this.insertResult.discountMoney = res.data.oilDiscountAmount
|
||||
_that.vlom = res.data.volume.toFixed(2)
|
||||
})
|
||||
},
|
||||
}
|
||||
}
|
||||
e.detail.value = this.insertResult.vol
|
||||
this.getMoney(e)
|
||||
console.log('选择你/n', this.selected, '/n')
|
||||
},
|
||||
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
|
||||
}
|
||||
},
|
||||
getMoney(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
|
||||
}
|
||||
this.InputNumber = e
|
||||
if (this.siteData.oilCardNature == 1) {
|
||||
var uerTyps = '0' // 0是个人 1是企业
|
||||
} else {
|
||||
console.log('当前为企业')
|
||||
var uerTyps = '1' // 0是个人 1是企业
|
||||
}
|
||||
if (this.type == 'ZEYI' || this.type == 'RIRISHUN') {
|
||||
var number = {
|
||||
payType: 'SITE_SCAN',
|
||||
userType: uerTyps,
|
||||
xoilAmountGun: e.detail.value,
|
||||
priceId: this.activeSitePrice,
|
||||
companyId: this.siteData.companyId,
|
||||
createSource: this.type
|
||||
}
|
||||
} else {
|
||||
var number = {
|
||||
payType: 'SITE_SCAN',
|
||||
userType: uerTyps,
|
||||
xoilAmountGun: e.detail.value,
|
||||
priceId: this.activeSitePrice,
|
||||
companyId: this.siteData.companyId,
|
||||
createSource: this.siteData.createSource
|
||||
}
|
||||
}
|
||||
this.xoilAmountGun = e.detail.value
|
||||
let _that = this
|
||||
oliSiteApi.getOrderDiscountInfo(number).then(res => {
|
||||
this.insertResult.vDoMoney = res.data.payRealAmount
|
||||
this.insertResult.discountMoney = res.data.oilDiscountAmount
|
||||
_that.vlom = res.data.volume
|
||||
})
|
||||
},
|
||||
charge() {
|
||||
this.tsetPlate()
|
||||
console.log(this.plateText)
|
||||
@@ -409,19 +420,20 @@
|
||||
|
||||
// 支付订单
|
||||
saveOrder() {
|
||||
console.log("加油升数:",this.vlom)
|
||||
console.log("加油金额:",this.insertResult.vol)
|
||||
console.log("加油升数:", this.vlom)
|
||||
console.log("加油金额:", this.insertResult.vol)
|
||||
const orderParams = {
|
||||
siteId: this.siteData.siteId,
|
||||
oilsId: this.insertResult.priceId,
|
||||
volume: this.siteData.siteType=='2'?this.insertResult.vol:this.vlom,
|
||||
orderNum:this.siteData.otherSerialNumber,
|
||||
volume: this.siteData.siteType == '2' ? this.insertResult.vol : this.vlom,
|
||||
orderNum: this.siteData.otherSerialNumber,
|
||||
customerOrderId: this.siteData.customerOrderId,
|
||||
money: this.siteData.siteType=='2'?this.insertResult.vDoMoney+this.insertResult.discountMoney:this.insertResult.vol,
|
||||
money: this.siteData.siteType == '2' ? this.insertResult.vDoMoney + this.insertResult
|
||||
.discountMoney : this.insertResult.vol,
|
||||
createSource: "WECHAT_MINIAPPS", //类型:String 必有字段 备注:创建来源
|
||||
orderSource: "WECHAT_MINIAPPS",
|
||||
driverName:this.siteData.customerName,
|
||||
driverPhone:this.siteData.customerPhone,
|
||||
driverName: this.siteData.customerName,
|
||||
driverPhone: this.siteData.customerPhone,
|
||||
plateNumber: this.carNumber,
|
||||
customerId: this.siteData.customerId, //类型:String 必有字段 备注:司机id
|
||||
companyId: this.siteData.companyId, //类型:String 必有字段 备注:企业id
|
||||
@@ -519,13 +531,14 @@
|
||||
oliSiteApi.verifyQrCode(this.zyInfo).then(res => {
|
||||
if (res.code === 20000) {
|
||||
this.siteData = res.data
|
||||
if(res.data.oilSitePriceDetailsVos){
|
||||
this.insertResult = Object.assign(this.insertResult,res.data.oilSitePriceDetailsVos[0])
|
||||
if (res.data.oilSitePriceDetailsVos) {
|
||||
this.insertResult = Object.assign(this.insertResult, res.data.oilSitePriceDetailsVos[
|
||||
0])
|
||||
console.log(this.insertResult)
|
||||
}
|
||||
this.carNumber = res.data.plateNumber;
|
||||
this.selected = res.data.oilSitePriceDetailsVos[0]
|
||||
this.activeSitePrice = this.selected.priceId
|
||||
this.activeSitePrice = this.selected.priceId
|
||||
} else {
|
||||
console.log('此处为verifyQrCode false')
|
||||
uni.showToast({
|
||||
@@ -541,22 +554,24 @@
|
||||
tRadio() {
|
||||
this.radio === 'A' ? this.radio = '' : this.radio = 'A'
|
||||
},
|
||||
changeMoney(){
|
||||
changeMoney() {
|
||||
this.insertResult.vMoney = this.insertResult.vol * this.selected.oilSitePrice
|
||||
this.insertResult.discountMoney = this.insertResult.vol * (this.selected.oilSitePrice - this.insertResult.sitePrice)
|
||||
this.insertResult.discountMoney = this.insertResult.vol * (this.selected.oilSitePrice - this.insertResult
|
||||
.sitePrice)
|
||||
this.insertResult.vDoMoney = this.insertResult.vol * this.selected.sitePrice
|
||||
},
|
||||
calcMoney(e) {
|
||||
// console.log(e)
|
||||
if(this.changTypes = 1){
|
||||
if (this.changTypes = 1) {
|
||||
let rrs = e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]; // 处理输入油升数 只保留小数点后两位
|
||||
this.$nextTick(() => { //重新赋值给input
|
||||
this.insertResult.vol= rrs
|
||||
this.insertResult.vol = rrs
|
||||
})
|
||||
}
|
||||
// oilSitePrice 市场价格 sitePrice 实际加油价格
|
||||
this.insertResult.vMoney = this.insertResult.vol * this.selected.oilSitePrice
|
||||
this.insertResult.discountMoney = this.insertResult.vol * (this.selected.oilSitePrice - this.insertResult.sitePrice)
|
||||
this.insertResult.discountMoney = this.insertResult.vol * (this.selected.oilSitePrice - this.insertResult
|
||||
.sitePrice)
|
||||
this.insertResult.vDoMoney = this.insertResult.vol * this.selected.sitePrice
|
||||
},
|
||||
queryTimer() {
|
||||
|
||||
Reference in New Issue
Block a user