版本1.2.3

This commit is contained in:
xk_guohonglei
2020-10-14 11:40:08 +08:00
parent 80d2a48dec
commit 9320a99366
26 changed files with 2136 additions and 852 deletions

View File

@@ -19,11 +19,17 @@
<view class="action">
<view class="text-white money-position padding-left-lg padding-xs bg-main-oil text-lg">
<text class="text-xs">余额</text>
{{driverMsg.balance|numberFilter}}
{{driverMsg.balance}}
</view>
</view>
</view>
</view>
<view class="cu-form-group margin margin-top-0 radius">
<view class="title mini-label text-black">车牌号</view>
<input :maxlength="7" v-model="carNumber" disabled @tap="showModel='show'" placeholder="请输入车牌号" name="input" />
<!-- <text class="cuIcon-roundclosefill text-gray"></text> -->
<text class="cuIcon-write text-orange"></text>
</view>
<view class="my-cell margin-left margin-right padding-top padding-bottom radius">
<view class="strong padding-bottom-xs">{{stationMsg.oilSiteName}}</view>
<view class="font-12 color-999">
@@ -32,7 +38,7 @@
<!-- <view class="navigation" @tap="openMap">
<image class="icon-self" src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=907966196,3433585328&fm=11&gp=0.jpg"
mode=""></image>
导航
导航v
</view>-->
</view>
<!-- -->
@@ -80,20 +86,38 @@
</view>
<button class="margin round bg-main-oil" @tap="charge">确定</button>
</view>
<PlateNumberPicker @newPlate="showPlateModal(false,true)" @onDeleteInput="onDeleteInput" :showInputList="showInputList"
:showPlateList="showPlateList" @selectNo="selectNo" @clearAll="clearPlateNumber" @selectName="selectText" @hideModal="showModel=''"
:modalName="showModel" />
</view>
</template>
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import PlateNumberPicker from '@/components/plate-number-picker/plate-number-picker.vue'
export default {
components: {
PlateNumberPicker
},
data() {
return {
testResult: false,
showPlateList: true,
showInputList: false,
carNumber: '',
plateNo: '',
plateText: '',
imgList: [],
plateName: '',
showModel: '',
// 车牌号,上
radio: 'B',
active: 0,
ColorList: [1, 2, 3, 4, 5],
qrCode: uni.getStorageSync('qrCode'),
driverMsg: {
balance: ''
balance: '',
plateNumber: ''
},
oilGunList: {},
oilTypeList: [],
@@ -147,55 +171,141 @@
}
},
plateNo: {
immediate: true,
handler(newVal, oldVal) {
this.plateNo = newVal
if (newVal) {
this.text()
}
}
}
},
created() {
this.verifyQrCode()
},
methods: {
clearPlateNumber() {
this.plateText = ''
this.plateNo = ""
this.carNumber = ''
this.showPlateList = true
this.showInputList = false
},
text() {
this.carNumber = this.plateText + this.plateNo
this.tsetPlate()
},
tsetPlate() {
this.testResult =
/^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/
.test(this.carNumber)
},
onDeleteInput() {
this.carNumber = this.carNumber.slice(0, -1)
if (this.carNumber.length > 1) {
this.plateNo = this.plateNo.slice(0, -1)
}
if (this.carNumber.length == 1) {
this.plateText = ''
}
if (this.plateNo.length == 1) {
this.plateNo = ''
}
if(!this.carNumber){
this.plateText = ''
this.plateNo = ''
this.showPlateList = false
this.showInputList = true
this.text()
}
},
selectText(item) {
this.plateText = item
this.showPlateList = false
this.showInputList = true
this.text()
},
selectNo(item) {
if (this.plateNo.length >= 5) {
this.showModel = ''
}
this.plateNo = this.plateNo + item
this.text()
},
showPlateModal(val1, val2) {
this.showPlateList = val1
this.showInputList = val2
this.showModel = 'show'
},
//关于车牌号,结束
// 收费
charge() {
const data6 = {
...this.driverMsg,
siteCode: this.stationMsg.oilSiteCode,
oilPrice: this.insertResult.realPrice,
volume: this.insertResult.vol,
standardAmount: this.insertResult.vMoney,
oilAmount: this.insertResult.vDoMoney,
oilCode: this.insertResult.oilCode,
oilName: this.insertResult.oilName,
oilGun: this.insertResult.bar,
standardPrice: this.insertResult.standardPrice,
orderKey: this.orderKey
}
if (!data6.oilCode) {
uni.showToast({
title: '请选择油品',
icon:'none'
});
return false
}
if (!data6.volume) {
uni.showToast({
title: '请输入加油体积',
icon:'none'
});
return false
}
cloudSiteApi.saveOrder(data6).then(res => {
if (res.code === 20000) {
uni.showToast({
title: '扣款成功'
});
setTimeout(() => {
uni.navigateBack()
}, 800)
this.tsetPlate()
console.log(this.plateText)
console.log(this.plateNo)
console.log(this.carNumber)
console.log(this.testResult)
if (this.testResult) {
const data6 = {
...this.driverMsg,
siteCode: this.stationMsg.oilSiteCode,
oilPrice: this.insertResult.realPrice,
volume: this.insertResult.vol,
standardAmount: this.insertResult.vMoney,
oilAmount: this.insertResult.vDoMoney,
oilCode: this.insertResult.oilCode,
oilName: this.insertResult.oilName,
oilGun: this.insertResult.bar,
standardPrice: this.insertResult.standardPrice,
orderKey: this.orderKey,
plateNumber: this.carNumber
}
if (!data6.oilCode) {
uni.showToast({
title: '请选择油品',
icon: 'none'
});
return false
}
if (!data6.volume) {
uni.showToast({
title: '请输入加油体积',
icon: 'none'
});
return false
}
cloudSiteApi.saveOrder(data6).then(res => {
if (res.code === 20000) {
uni.showToast({
title: '下单成功!请确认是否支付成功!'
});
uni.setStorageSync('formQr', true)
setTimeout(() => {
this.toDetails(res.data.orderId)
}, 800)
}
})
} else {
uni.showToast({
title: '车牌号校验不通过',
icon: 'none'
});
}
},
toDetails(id) {
uni.setStorageSync('orderId', id)
console.log('id', id)
uni.navigateTo({
url: '/pages/orderList/OrderDetail/OrderDetail'
})
},
gunIdSel(index) {
this.insertResult.bar = index+1
this.insertResult.bar = index + 1
},
initForm() {
if (!this.insertResult.realPrice) {
@@ -210,6 +320,7 @@
}).then(res => {
if (res.code === 20000) {
this.driverMsg = res.data.driverMsg
this.carNumber = this.driverMsg.plateNumber
this.oilGunList = res.data.oilGunList
this.oilTypeList = res.data.oilTypeList
this.orderKey = res.data.orderKey