十一月十一凌晨更新

This commit is contained in:
xk_guohonglei
2020-11-11 14:02:28 +08:00
parent 1d9a1ae3be
commit f1210f1a44
28 changed files with 1243 additions and 347 deletions

View File

@@ -1,90 +1,152 @@
<template>
<view class="page-content">
<cu-custom class="main-topbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">{{stationMsg.oilSiteName}}</block>
</cu-custom>
<view class="cu-list menu-avatar">
<view class="cu-item margin-sm margin-left margin-right radius">
<view class="cu-avatar round lg" :style="'background-image:url('+driverMsg.headUrl+');'"></view>
<view class="content money-container">
<view class="color-333">
<view class="text-cut">{{driverMsg.driverName}}</view>
<view class v-show="beforePay">
<cu-custom class="main-topbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">{{stationMsg.oilSiteName}}</block>
</cu-custom>
<view class="cu-list menu-avatar">
<view class="cu-item margin-sm margin-left margin-right radius">
<view class="cu-avatar round lg" :style="'background-image:url('+driverMsg.headUrl+');'"></view>
<view class="content money-container">
<view class="color-333">
<view class="text-cut">{{driverMsg.driverName}}</view>
</view>
<view class="text-gray text-sm flex">
<view class="text-cut">{{driverMsg.phone}}</view>
</view>
</view>
<view class="text-gray text-sm flex">
<view class="text-cut">{{driverMsg.phone}}</view>
</view>
</view>
<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}}
<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}}
</view>
</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">
<text class="text-cut">{{stationMsg.address}}</text>
<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="navigation" @tap="openMap">
<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">
<text class="text-cut">{{stationMsg.address}}</text>
</view>
<!-- <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>-->
</view>
<!-- -->
<view class="padding-top-xs margin margin-top-xs margin-bottom-0 padding-bottom radius">
<view class="bg-white padding padding-bottom-sm">
<view class="padding-bottom-sm text-lg">油号选择</view>
<view class="padding-top-xs">
<text class="strong padding-right-xs font-16">{{insertResult.oilName}}</text>
<text class="padding-right-xs">
星油价格:
<text class="text-blod oil-main-color">{{insertResult.realPrice|numberFilter}}</text>
</text>
<text class="s-rich">市场价{{insertResult.standardPrice|numberFilter}}/L</text>
</view>
<view class="grid col-5 padding-top justify-start">
<view class="padding-xs" v-for="(item,index) in oilTypeList" :key="index">
<button class="cu-btn" @tap="oilNameSel(item)" :class="[insertResult.oilName===item.oilName?'bg-main-oil':'line-gray']">{{item.oilName}}</button>
</view>
</view>
</view>
<view class="padding solid-top padding-bottom-0 padding-top-xs bg-white">
<view class="padding-bottom-sm text-lg">油枪选择</view>
<view class="grid col-5 justify-start">
<view class="padding-xs" v-for="(item,index) in ColorList" :key="index">
<button @tap="gunIdSel(index)" class="cu-btn" :class="[insertResult.bar===index+1?'bg-main-oil':'line-gray']">{{index+1}}</button>
</view>
</view>
</view>
<view class="solid-top padding solid-top bg-white">
<view class="shadow-warp bg-white">
<view class="cu-form-group">
<view class="title">加油升数</view>
<input placeholder="请输入加油升数" type="digit" @input="calcMoney" v-model="insertResult.vol" name="input" />
<text>{{insertResult.vMoney|numberFilter}}</text>
</view>
<view class="my-cell">
<text class="font-12">星卡优惠金额</text>
<text class="fr">-{{insertResult.discountMoney|numberFilter}}</text>
</view>
<view class="my-cell">
<text class="font-12">实际扣款金额</text>
<text class="oil-main-color fr">{{insertResult.vDoMoney|numberFilter}}</text>
</view>
</view>
</view>
<button class="margin round bg-main-oil" @tap="charge">确定</button>
</view>
</view>
<!-- -->
<view class="padding-top-xs margin margin-top-xs margin-bottom-0 padding-bottom radius">
<view class="bg-white padding padding-bottom-sm">
<view class="padding-bottom-sm text-lg">油号选择</view>
<view class="padding-top-xs">
<text class="strong padding-right-xs font-16">{{insertResult.oilName}}</text>
<text class="padding-right-xs">
星油价格:
<text class="text-blod oil-main-color">{{insertResult.realPrice|numberFilter}}</text>
<view class v-show="!beforePay&&isG7">
<cu-custom class="main-topbar bg-main-oil" :isBack="true" bgColor="bg-main-oil">
<block slot="backText">返回</block>
<block slot="content">{{payState|payStateFormat}}</block>
</cu-custom>
<view class="margin-sm bg-white padding-lg">
<view class="padding-top margin-bottom"></view>
<view class="text-xsl text-center">
<text class="cuIcon-rechargefill oil-main-color"></text>
</view>
<view class="text-center text-bold">
{{payState|payStateFormat}}
</view>
<view class="padding margin-sm">
<text v-if="payErrorMessage">{{ payErrorMessage }} </text>
<text v-else>{{ payState==0?'请勿离开当前页面等待扣款状态查询确认后页面会自动跳转......':'' }} </text>
</view>
<view class="text-center">
<button style="width: 500upx;" class="round large cu-btn bg-main-oil" @tap="getPayStatus(orderId)">手动刷新</button>
</view>
</view>
<view class="margin-sm bg-white padding">
<view class="margin-bottom-sm" @tap="copyId(driverMsg.driverName,'加油司机')">
加油司机
<text class="fr">
{{driverMsg.driverName}}
<text class="flex-sub padding-left-sm text-right cuIcon-copy text-lg text-red"></text>
</text>
<text class="s-rich">市场价{{insertResult.standardPrice|numberFilter}}/L</text>
</view>
<view class="grid col-5 padding-top justify-start">
<view class="padding-xs" v-for="(item,index) in oilTypeList" :key="index">
<button class="cu-btn" @tap="oilNameSel(item)" :class="[insertResult.oilName===item.oilName?'bg-main-oil':'line-gray']">{{item.oilName}}</button>
</view>
<view class="margin-bottom-sm" @tap="copyId(carNumber,'司机车牌')">
司机车牌
<text class="fr">
{{carNumber}}
<text class="flex-sub padding-left-sm text-right cuIcon-copy text-lg text-red"></text>
</text>
</view>
<view class="margin-bottom-sm">
油枪油号
<text class="fr">{{insertResult.bar}}号枪{{insertResult.oilName}}</text>
</view>
<view class="margin-bottom-sm">
加油总金额
<text class="fr">¥ {{insertResult.vMoney|numberFilter}}</text>
</view>
<view class="margin-bottom-sm">
加油升数
<text class="fr">{{insertResult.vol|numberFilter}} </text>
</view>
<view class="margin-bottom-sm">
星卡优惠
<text class="fr">¥ {{insertResult.vMoney-insertResult.vDoMoney|numberFilter}}</text>
</view>
<view class="margin-bottom-sm">
实扣款
<text class="fr oil-main-color">¥ {{insertResult.vDoMoney|numberFilter}}</text>
</view>
</view>
<view class="padding solid-top padding-bottom-0 padding-top-xs bg-white">
<view class="padding-bottom-sm text-lg">油枪选择</view>
<view class="grid col-5 justify-start">
<view class="padding-xs" v-for="(item,index) in ColorList" :key="index">
<button @tap="gunIdSel(index)" class="cu-btn" :class="[insertResult.bar===index+1?'bg-main-oil':'line-gray']">{{index+1}}</button>
</view>
</view>
</view>
<view class="solid-top padding solid-top bg-white">
<view class="shadow-warp bg-white">
<view class="cu-form-group">
<view class="title">加油升数</view>
<input placeholder="请输入加油升数" type="digit" @input="calcMoney" v-model="insertResult.vol" name="input" />
<text>{{insertResult.vMoney|numberFilter}}</text>
</view>
<view class="my-cell">
<text class="font-12">星卡优惠金额</text>
<text class="fr">-{{insertResult.discountMoney|numberFilter}}</text>
</view>
<view class="my-cell">
<text class="font-12">实际扣款金额</text>
<text class="oil-main-color fr">{{insertResult.vDoMoney|numberFilter}}</text>
</view>
</view>
</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=''"
@@ -94,6 +156,7 @@
<script>
import cloudSiteApi from '@/api/cloud-site.js'
import g7Api from '@/api/g7.js'
import PlateNumberPicker from '@/components/plate-number-picker/plate-number-picker.vue'
export default {
components: {
@@ -101,6 +164,8 @@
},
data() {
return {
isG7: false,
beforePay: true,
testResult: false,
showPlateList: true,
showInputList: false,
@@ -109,6 +174,7 @@
plateText: '',
imgList: [],
plateName: '',
orderId: '',
showModel: '',
// 车牌号,上
radio: 'B',
@@ -124,6 +190,8 @@
stationMsg: {
},
payErrorMessage: '',
timer: null,
selected: {},
insertResult: {
bar: 1,
@@ -136,10 +204,25 @@
vMoney: "0.00",
vol: ""
},
orderKey: ''
orderKey: '',
payState: '0'
}
},
onLoad() {
if (this.qrCode) {
if (this.qrCode.substr(0, 2) == 'HT' || this.qrCode.substr(0, 2) == 'G7') {
this.isG7 = true
console.log('G7加油站')
}
}
this.verifyQrCode()
},
onUnload() {
if (this.timer) {
clearInterval(this.timer);
this.timer = null;
}
},
watch: {
oilTypeList: {
handler(newVal, oldVal) {
@@ -182,11 +265,29 @@
}
},
created() {
this.verifyQrCode()
},
methods: {
queryTimer() {
var count = 5
this.timer = setInterval(() => {
console.log('查询次', count)
count--
this.getPayStatus(this.orderId)
}, 5000);
if (!count) {
clearInterval(this.timer)
}
},
copyId(id, name) {
uni.setClipboardData({
data: id,
success: () => {
uni.showToast({
title: name + '已复制',
icon: 'none'
})
}
})
},
clearPlateNumber() {
this.plateText = ''
this.plateNo = ""
@@ -214,7 +315,7 @@
if (this.plateNo.length == 1) {
this.plateNo = ''
}
if(!this.carNumber){
if (!this.carNumber) {
this.plateText = ''
this.plateNo = ''
this.showPlateList = false
@@ -280,26 +381,57 @@
cloudSiteApi.saveOrder(data6).then(res => {
if (res.code === 20000) {
uni.showToast({
title: '下单成功!请确认是否支付成功!'
title: '下单成功!'
});
uni.setStorageSync('formQr', true)
setTimeout(() => {
this.toDetails(res.data.orderId)
}, 800)
uni.setStorageSync('tempOrderInfo', res.data)
if (!this.isG7) {
setTimeout(() => {
this.toDetails(res.data.payOrderId)
}, 400)
} else {
this.beforePay = false
setTimeout(() => {
this.orderId = res.data.orderId
this.queryTimer()
this.getPayStatus(this.orderId)
}, 400)
}
}
})
} else {
uni.showToast({
title: '车牌号校验不通过',
icon: 'none'
});
}
},
getPayStatus(id) {
// 获取订单支付状态
console.log('获取支付状态', id)
g7Api.getPayStatus(id).then(res => {
if (res.code == 20000) {
this.payState = res.data.payState
if (res.data.payState == -1) {
this.payErrorMessage = res.data.payErrorMessage
clearInterval(this.timer)
uni.showToast({
icon: 'none',
title: res.data.payErrorMessage
})
}
if (res.data.payState == 1) {
clearInterval(this.timer)
this.toDetails(res.data.payOrderId)
}
}
})
},
toDetails(id) {
uni.setStorageSync('orderId', id)
console.log('id', id)
uni.navigateTo({
uni.redirectTo({
url: '/pages/orderList/OrderDetail/OrderDetail'
})
@@ -365,9 +497,22 @@
return value.substring(5, 16)
}
},
numberFilter(value) {
value = value - 1 + 1
return value.toFixed(2)
},
payStateFormat(value) {
switch (parseInt(value)) {
case 1:
return '支付成功'
case -1:
return '支付失败'
case 0:
return '等待支付'
default:
return ''
}
}
}
}