You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1681 lines
53 KiB
1681 lines
53 KiB
<template> |
|
<view class="page-content"> |
|
<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"> |
|
<!-- {{siteData.siteName}} clc 注 --> |
|
扫码详情 |
|
</block> |
|
</cu-custom> |
|
<!-- 顶部填充区域 --> |
|
<view class="fill"></view> |
|
<!-- 油站位置卡片 --> |
|
<view style="margin-top: 10rpx;" class=" serviceStation my-cell margin-left margin-right padding-top padding-bottom radius shadow "> |
|
<view style="padding-bottom: 25rpx;" class="strong padding-bottom-xs">{{siteData.siteName}}</view> |
|
<view class=" textEllipsis font-12 color-999"> |
|
<uni-icons color="#666666" type="location-filled" size="15"></uni-icons> |
|
<text class="text-cut">{{siteData.siteAddress}}</text> |
|
</view> |
|
</view> |
|
|
|
<!-- clc 注 <view class="cu-list menu-avatar"> |
|
<view class="cu-item margin-sm margin-left margin-right radius"> |
|
<view v-if="siteData.headUrl" class="cu-avatar round lg" |
|
:style="'background-image:url('+siteData.headUrl+');'"></view> |
|
<view v-else class="cu-avatar round lg">星</view> |
|
<view class="content money-container"> |
|
<view class="color-333"> |
|
<view class="text-cut" v-if="type!= 'RIRISHUN'">{{siteData.customerName}}</view> |
|
|
|
<view class="text-cut" v-else> |
|
{{'日日顺司机'}} |
|
</view> |
|
</view> |
|
<view class="text-gray text-sm flex"> |
|
<view class="text-cut" v-if="type!= 'RIRISHUN'">{{siteData.customerPhone}}</view> |
|
<view class="text-cut" v-else> |
|
{{'保密'}} |
|
</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> |
|
¥{{siteData.userBalance}} |
|
</view> |
|
</view> |
|
</view> |
|
</view> --> |
|
|
|
<!-- 司机卡片 --> |
|
<view class="newdirvercard"> |
|
<view class="newdirvercard_left"> |
|
<view style="flex-shrink: 1;"> |
|
<view style="height: 119rpx; width: 119rpx;overflow: hidden;" v-if="siteData.headUrl" class="cu-avatar round lg" :style="'background-image:url('+siteData.headUrl+');'"></view> |
|
<view style="height: 119rpx; width: 119rpx;overflow: hidden;" v-else class="cu-avatar round lg">星</view> |
|
</view> |
|
<view class="newdirvercard_name "> |
|
<view class="newdirvercard_name_text ">{{ type=='RIRISHUN'? '日日顺司机': type=='shunfeng'?'顺丰司机': siteData.customerName}}</view> |
|
<view class="newdirvercard_name_phone ">{{ type=='RIRISHUN'? '保密': type=='shunfeng'?'保密': siteData.customerPhone}}</view> |
|
</view> |
|
</view> |
|
<view class="newdirvercard_right"> |
|
¥{{siteData.userBalance || 0}} |
|
</view> |
|
</view> |
|
<!-- 不知 --> |
|
<view class="UpFileBox" v-if="isOtherUser"> |
|
<view class="UpFileBoxMain"> |
|
<view class="plateNumber_box"> |
|
<view class="text-title">司机车牌</view> |
|
<view class="text-img"> |
|
<image src="../../static/img/upload.png" style="width:260upx;height: 160upx;" |
|
v-if='isPlateNumber' @tap='upPlateNumber' mode="aspectFill"></image> |
|
<image :src="PlateNumberImages" style="width:260upx;height:160upx;" mode="aspectFill" |
|
v-else></image> |
|
<image src="../../static/img/close_red.png" v-if='!isPlateNumber' @tap='cleraPlateNumber' |
|
class="close_Img" mode="aspectFill"></image> |
|
</view> |
|
<view class="text-p">需可识别车牌号</view> |
|
</view> |
|
<view class="refuellerImages"> |
|
<view class="text-title">油机照片</view> |
|
<view class="text-img"> |
|
<image src="../../static/img/upload.png" style="width:260upx;height:160upx;" |
|
v-if='isUefueller' @tap='upUefueller' mode="aspectFill"></image> |
|
<image :src="refuellerImages" style="width:260upx;height:160upx;" v-else mode="aspectFill"> |
|
</image> |
|
<image src="../../static/img/close_red.png" v-if='!isUefueller' @tap='cleraUefueller' |
|
class="close_Img" mode="aspectFill"></image> |
|
</view> |
|
<view class="text-p">需包含加油升数和价格</view> |
|
</view> |
|
</view> |
|
|
|
<!-- <uni-file-picker :value='plateNumberValue' @success='successplateNumber' auto-upload='true' @fail='failplateNumber' limit='1' file-mediatype='image' mode='grid' /> --> |
|
|
|
</view> |
|
<!-- 车牌号卡片 --> |
|
<view class="cu-form-group margin margin-top-0 radius" v-if="type!= 'RIRISHUN'"> |
|
<view class="title text-black">车牌号</view> |
|
|
|
<!-- clc 注 <input :maxlength="7" @tap="showModel='show'" v-model="carNumber" disabled placeholder="请输入车牌号" |
|
name="input" /> --> |
|
|
|
<view style="flex-grow: 1; display: flex;" @tap="showModel='show'"> |
|
<view v-if="hz( String(carNumber).charAt(0))" class="sign"> |
|
<text v-if="carNumber">{{String(carNumber).charAt(0)||''}}</text> |
|
<uni-icons color="#ffffff" type="forward" size="15"></uni-icons> |
|
</view> |
|
<view class="flexcenter">{{String(carNumber).substr(1,6)||'请输入车牌号'}}</view> |
|
</view> |
|
|
|
<!-- <text class="cuIcon-roundclosefill text-gray"></text> --> |
|
|
|
<text class="cuIcon-write text-orange"></text> |
|
</view> |
|
<!-- 油品卡片 --> |
|
<view class="padding-top-xs margin margin-top-xs margin-bottom-0 padding-bottom radius"> |
|
|
|
<view style="border-radius: 6px; overflow: hidden; " > |
|
<!-- 油品类型 油品价格区域 --> |
|
<view class="bg-white padding padding-bottom-sm"> |
|
<!-- 油品类型 v-for siteData.oilSitePriceDetailsVos --> |
|
<view style="width: 100%;display: flex;flex-wrap: wrap; margin-bottom: 28rpx;"> |
|
<view |
|
style="margin-right: 15rpx;" |
|
v-for="(item,index) in siteData.oilSitePriceDetailsVos" |
|
:key="item.priceId" |
|
@tap="oilNameSel(item)" |
|
:class="insertResult.oilProductCode===item.oilProductCode?'selecardoil':'cardoil'" |
|
class="strong padding-right-xs font-16 cardoil"> |
|
{{item.oilProductCode}} |
|
</view> |
|
</view> |
|
|
|
<!-- clc 注 <view class="padding-bottom-sm text-lg">油号选择:</view> --> |
|
|
|
<!-- **** 油品价格 sitePrice价格 oilProductCode 选中油品的类型动态控制单位 --> |
|
<view class="padding-top-xs" v-if='type == ""'> |
|
<!-- clc 注 <text class="strong padding-right-xs font-16">{{insertResult.oilProductCode}}</text> --> |
|
|
|
<text class="padding-right-xs"> |
|
星油价格: |
|
<text class="text-blod oil-main-color" |
|
v-if="(insertResult.sitePrice -1+1)>0">¥{{(insertResult.sitePrice -1+1)|numberFilter}}/{{siteData.siteType|company}}</text> |
|
<text class="text-blod oil-main-color" v-else>无价格</text> |
|
</text> |
|
<text class="s-rich">市场价¥{{insertResult.oilSitePrice|numberFilter}}/{{siteData.siteType|company}}</text> |
|
</view> |
|
|
|
<view class="padding-top-xs" v-else> |
|
|
|
<!-- clc 注 <view class="grid col-5 padding-top justify-start" v-if='type == ""'> |
|
<view class="padding-xs" v-for="(item,index) in siteData.oilSitePriceDetailsVos" |
|
:key="item.priceId"> |
|
<button class="cu-btn" @tap="oilNameSel(item)" |
|
:class="[insertResult.oilProductCode===item.oilProductCode?'bg-main-oil':'line-gray']">{{item.oilProductCode}}</button> |
|
</view> |
|
</view> --> |
|
|
|
<!-- clc 注 <view class="strong padding-right-xs font-16 cardoil">{{insertResult.oilProductCode}}</view> --> |
|
|
|
<text style="font-size: 26rpx; color: #222222;font-weight: bold;" class="padding-right-xs"> |
|
星油价格: |
|
<text style="font-weight: bold;" class="text-blod oil-main-color" |
|
v-if="(insertResult.sitePrice -1+1)>0">¥{{ insertResult.sitePrice|numberFilter}}/{{siteData.siteType|company}}</text> |
|
<text class="text-blod oil-main-color" v-else>无价格</text> |
|
</text> |
|
<text style="margin-left: 75rpx; color: #222222;font-weight: bold;" >油站价格:¥ |
|
<text v-if="insertResult.oilSitePrice">{{insertResult.oilSitePrice}}/{{siteData.siteType|company }}</text> |
|
<text class="text-blod oil-main-color" v-else>无价格</text> |
|
</text> |
|
</view> |
|
|
|
|
|
|
|
<!-- clc 注 <view class="grid col-5 padding-top justify-start" v-else> |
|
<view class="padding-xs" v-for="(item,index) in siteData.oilSitePriceDetailsVos" |
|
:key="item.priceId"> |
|
<button class="cu-btn" @tap="changeBar(item,index)" |
|
:class="[curIndex===index?'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" v-if='type == ""'> |
|
<view class="title">加油升数</view> |
|
<input placeholder="请输入加油升数" type="digit" @input="calcMoney" @blur="backType" |
|
@focus="changeType" v-model="insertResult.vol" name="input" /> |
|
<text>约¥{{insertResult.vMoney|numberFilter}}</text> |
|
</view> |
|
<view class="cu-form-group" v-else> |
|
<view class="title newtitle"> {{siteData.siteType=='2'?'加气升数':'加油金额'}}</view> |
|
<input class="newtitle" :placeholder="`请输入${siteData.siteType=='2'?'加气升数':'加油金额'}`" @input="checkNumber" type="digit" @blur="getMoney" |
|
v-model="insertResult.vol" name="input" /> |
|
<view style="width: 170rpx;text-align: end;" class="textEllipsis"> |
|
<text class=""> |
|
<!-- 约 {{ vlom? vlom:'xxx.x' }} L clc 注销 --> |
|
<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> |
|
<!-- {{vlom?'约' + ( (Math.round(vlom*100)/100).toFixed(2) ) + 'L':''}} --> |
|
</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> |
|
<button :disabled="shake!==null" class="margin round bg-main-oil" @tap="charge"> {{shake==null?'立即下单':'下单中'}}</button> |
|
</view> |
|
</view> |
|
<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> |
|
</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> |
|
<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 oliSiteApi from '@/api/oli-site.js' |
|
import oilFinanceApi from '@/api/oil-finance.js' |
|
import g7Api from '@/api/g7.js' |
|
import utils from '@/utils/encode' |
|
import PlateNumberPicker from '@/components/plate-number-picker/plate-number-picker.vue' |
|
export default { |
|
components: { |
|
PlateNumberPicker |
|
}, |
|
data() { |
|
return { |
|
shake:null, |
|
vlom: '', |
|
companyId: '', |
|
activeSitePrice: '', |
|
PlateNumberImages: '', |
|
isOtherUser: false, |
|
isPlateNumber: true, |
|
isUefueller: true, |
|
refuellerImages: '', |
|
changTypes: 0, |
|
siteData: {}, |
|
zyInfo: { |
|
qrCode: uni.getStorageSync('qrCode'), //类型:String 必有字段 备注:二维码字符串 |
|
oilsStationId: uni.getStorageSync('oilSite').oilSiteCode //类型:String 必有字段 备注:加油站id |
|
}, |
|
isG7: false, |
|
beforePay: true, |
|
testResult: false, |
|
showPlateList: true, |
|
showInputList: false, |
|
carNumber: '', |
|
plateNo: '', |
|
plateText: '', |
|
imgList: [], |
|
plateName: '', |
|
orderId: '', |
|
showModel: '', |
|
// 车牌号,上 |
|
radio: 'B', |
|
active: 0, |
|
plateNumber: '', |
|
ColorList: [1, 2, 3, 4, 5], |
|
qrCode: uni.getStorageSync('qrCode'), |
|
driverMsg: { |
|
balance: '', |
|
plateNumber: '' |
|
}, |
|
statOil: {}, |
|
oilGunList: {}, |
|
oilTypeList: [], |
|
stationMsg: {}, |
|
payErrorMessage: '', |
|
timer: null, |
|
selected: {}, |
|
insertResult: { |
|
bar: 1, |
|
oilName: '', |
|
discountMoney: '0.00', |
|
oilCode: "", |
|
realPrice: "", |
|
standardPrice: '', |
|
vDoMoney: "0.00", |
|
vMoney: "0.00", |
|
vol: "" |
|
}, |
|
orderKey: '', |
|
payState: '0', |
|
type: '', |
|
curIndex: null, |
|
InputNumber: 0, |
|
} |
|
}, |
|
onLoad(option) { |
|
console.log(option) //接收option.type |
|
if (option.user == 'kl') { |
|
let code = uni.getStorageSync('qrCode'), |
|
orderId = code.slice(0, -3) |
|
this.qrCode = orderId |
|
this.isOtherUser = true |
|
console.log('这里是onload', 'CODE', code, '++++', orderId, '------', 'END') |
|
console.log(this.qrCode) |
|
} |
|
// if(option.type =='RIRISHUN'){ |
|
// console.log('这里是日日顺') |
|
this.type = option.type //根据option.type 进行本地赋值 |
|
// }if(option.type =='zeyi'){ |
|
// console.log('这里是日日顺') |
|
// this.type = 'zeyi' //根据option.type 进行本地赋值 |
|
// } |
|
// if(option.type =='shunfeng'){ |
|
// console.log('这里是顺丰') |
|
// this.type = 'shunfeng' //根据option.type 进行本地赋值 |
|
// } |
|
// if(option.type =='fykc'){ |
|
// console.log('这里是福佑') |
|
// this.type = 'fykc' //根据option.type 进行本地赋值 |
|
// } |
|
if (this.qrCode) { |
|
if (this.qrCode.substr(0, 2) == 'HT' || this.qrCode.substr(0, 2) == 'G7'|| this.type === 'G7') { |
|
this.isG7 = true |
|
console.log('G7加油站') |
|
} |
|
} |
|
this.verifyQrCode() |
|
}, |
|
onUnload() { |
|
if (this.timer) { |
|
clearInterval(this.timer); |
|
this.timer = null; |
|
} |
|
}, |
|
watch: { |
|
oilTypeList: { |
|
handler(newVal, oldVal) { |
|
console.log('深度监听', newVal, oldVal) |
|
this.oilTypeList = newVal |
|
if (!this.insertResult.oilCode) { |
|
this.initForm() |
|
} |
|
}, |
|
deep: true |
|
}, |
|
selected: { |
|
deep: true, |
|
immediate: true, |
|
handler(newVal, oldVal) { |
|
console.log(newVal) |
|
console.log(oldVal) |
|
this.selected = newVal |
|
if (newVal) { |
|
console.log('selected发生变化') |
|
// oilSitePrice 市场价格 sitePrice 实际加油价格 |
|
if (this.selected.oilSitePrice) { |
|
this.insertResult.oilSitePrice = this.selected.oilSitePrice |
|
} else if (this.selected.lvPrice) { |
|
this.insertResult.realPrice = this.selected.xkPrice |
|
} |
|
this.insertResult.priceId = this.selected.priceId |
|
this.insertResult.sitePrice = this.selected.sitePrice |
|
this.insertResult.oilProductCode = this.selected.oilProductCode |
|
if (this.type != undefined) { |
|
console.log(this.type) |
|
console.log('changeMoney') |
|
this.changeMoney() |
|
} |
|
|
|
} |
|
} |
|
}, |
|
plateNo: { |
|
immediate: true, |
|
handler(newVal, oldVal) { |
|
this.plateNo = newVal |
|
if (newVal) { |
|
this.text() |
|
} |
|
} |
|
} |
|
|
|
}, |
|
methods: { |
|
hz(e){ |
|
// carNumber.length>0 |
|
// console.log(new RegExp("[\u4E00-\u9FA5]+").test(e),'*-*-*-*-*-*') |
|
return new RegExp("[\u4E00-\u9FA5]+").test(e) |
|
}, |
|
checkNumber(e) { |
|
e.detail.value = e.detail.value.match(/^\d*(\.?\d{0,2})/g)[0] || null; |
|
this.$nextTick(() => { |
|
this.insertResult.vol = e.detail.value |
|
}) |
|
}, |
|
changeBar(item, i) { |
|
console.log(item) |
|
this.activeSitePrice = item.priceId |
|
this.curIndex = i |
|
this.selected = { |
|
...item |
|
} |
|
// this.insertResult.sitePrice = this.statOil.sitePrice |
|
// console.log(this.statOil) |
|
if (this.insertResult.vol) { |
|
this.getMoney(this.InputNumber) |
|
} |
|
// 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.siteType=='2'?'XOIL':'' |
|
} |
|
} |
|
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) |
|
}) |
|
}, |
|
cleraPlateNumber() { |
|
this.PlateNumberImages = '' |
|
this.isPlateNumber = true |
|
this.plateNumber = '' |
|
}, |
|
cleraUefueller() { |
|
this.refuellerImages = '' |
|
this.isUefueller = true |
|
}, |
|
upPlateNumber() { |
|
this.upImages('car') |
|
}, |
|
upUefueller() { |
|
this.upImages('Uefueller') |
|
}, |
|
upImages(type) { |
|
let _that = this |
|
uni.chooseImage({ |
|
count: 1, //默认9 |
|
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有 |
|
// sourceType: ['album'], //从相册选择 |
|
success: function(res) { |
|
console.log(res) |
|
console.log('进入1') |
|
const JSESSIONID = utils.uuid() |
|
uni.uploadFile({ |
|
url: 'https://www.xingoil.com/adminapi/oil-oss/obejct/uploadFile', |
|
filePath: res.tempFilePaths[0], |
|
formData: { |
|
ossKey: 'xingyou', |
|
pathKey: 'publicxingyou ', |
|
encrypt: 'PUBLIC', |
|
}, |
|
name: 'file', |
|
header: { |
|
"Content-Type": "multipart/form-data", |
|
"Authorization": uni.getStorageSync('Authorization'), |
|
'dataSources': 'MP', |
|
"imei": uni.getStorageSync('unionid'), |
|
"openId": uni.getStorageSync('openid'), |
|
'JSESSIONID': JSESSIONID, |
|
'token': utils.md5Salt(JSESSIONID) |
|
}, |
|
success(e) { |
|
console.log('进入2') |
|
console.log(e) |
|
let obj = JSON.parse(e.data), |
|
url = obj.data.publicUrl |
|
if (type == 'car') { |
|
|
|
let data = { |
|
plateNumberImage: obj.data.publicUrl |
|
} |
|
_that.PlateNumberImages = url |
|
console.log('这里是司机车牌', url) |
|
_that.isPlateNumber = false |
|
oliSiteApi.plateNumberRecognition(data).then((res) => { |
|
let obj = JSON.parse(res.data) |
|
console.log(obj.NUMBER) |
|
_that.carNumber = obj.NUMBER |
|
}) |
|
} else { |
|
_that.refuellerImages = url |
|
_that.isUefueller = false |
|
console.log('这里是油站图片', _that.refuellerImages, url) |
|
} |
|
|
|
} |
|
}) |
|
} |
|
}) |
|
}, |
|
changeType() { |
|
this.changTypes = 1 |
|
}, |
|
backType() { |
|
this.changTypes = 0 |
|
}, |
|
charge() { |
|
//防抖 |
|
clearTimeout(this.shake) |
|
this.shake = setTimeout(()=>{ |
|
this.tsetPlate() |
|
console.log(this.plateText) |
|
console.log(this.plateNo) |
|
console.log(this.carNumber) |
|
console.log(this.testResult) |
|
if ((this.insertResult.sitePrice - 1 + 1) > 0) { |
|
if (this.type == 'RIRISHUN') { //根据type值判断是否为日日顺 |
|
this.RrsOrder() |
|
return |
|
} |
|
if (this.type == 'shunfeng') { |
|
this.SfOrder() |
|
return |
|
} |
|
if (this.type === 'G7') { |
|
this.G7Order() |
|
return |
|
} |
|
if (this.type == 'fykc') { |
|
this.FyOrder() |
|
return |
|
} |
|
if (this.testResult) { |
|
if (this.qrCode.substring(0, 4) == 'XING') { |
|
this.saveZeyiOrder() |
|
} else { |
|
this.saveXoilOrder() |
|
} |
|
} else { |
|
uni.showToast({ |
|
title: '车牌号校验不通过', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
} |
|
} else { |
|
uni.showToast({ |
|
title: '您选择的油品没有油价,不能加油', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
} |
|
},500) |
|
|
|
}, |
|
//福佑 |
|
FyOrder() { |
|
const data6 = { |
|
qrCode: uni.getStorageSync('qrCode'), //类型:String 必有字段 二维码 qrcode |
|
siteId: this.siteData.siteId, //类型:String 必有字段 油站id siteId |
|
priceId: this.insertResult.priceId, //类型:String 必有字段 油价id priceId |
|
companyId: this.siteData.companyId, //类型:String 必有字段 企业id companyId |
|
customerId: this.siteData.customerId, //类型:String 必有字段 司机id customerId |
|
volume: parseFloat(this.insertResult.vol), //类型:number 必有字段 升数 volume, |
|
vehicleLicenseNum: this.carNumber, |
|
version: 1, //类型:Number 必有字段 备注:版本号 |
|
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
} |
|
console.log(data6) |
|
if (!data6.qrCode) { |
|
uni.showToast({ |
|
title: 'qrCode为空', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.siteId) { |
|
uni.showToast({ |
|
title: '请选择油站id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.companyId) { |
|
uni.showToast({ |
|
title: '请选择企业id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.customerId) { |
|
uni.showToast({ |
|
title: '请选择司机id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.volume) { |
|
uni.showToast({ |
|
title: '请输入加油体积', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
oliSiteApi.FYPay(data6).then(res => { |
|
if (res.code === 20000) { |
|
uni.showToast({ |
|
title: '下单成功!' |
|
}); |
|
// uni.setStorageSync('orderInfo',data6) |
|
// console.log(res.data.orderId) |
|
// let orderId = res.data.orderId |
|
// this.checkSf(res.data.orderId) |
|
// this.gotoOrderStatus(res.data) |
|
// uni.setStorageSync('formQr', true) |
|
uni.setStorageSync('orderSource', 'mpxoil') |
|
if (!this.isG7) { |
|
setTimeout(() => { |
|
this.toDetails(res.data.orderId) |
|
}, 400) |
|
} else { |
|
this.beforePay = false |
|
setTimeout(() => { |
|
this.orderId = res.data.orderId |
|
this.queryTimer() |
|
this.getPayStatus(this.orderId) |
|
}, 400) |
|
} |
|
// setTimeout(()=>{ |
|
// this.shake=null |
|
// },1000) |
|
} |
|
}) |
|
}, |
|
//顺丰 |
|
SfOrder() { |
|
const data6 = { |
|
qrCode: uni.getStorageSync('qrCode'), //类型:String 必有字段 二维码 qrcode |
|
siteId: this.siteData.siteId, //类型:String 必有字段 油站id siteId |
|
priceId: this.insertResult.priceId, //类型:String 必有字段 油价id priceId |
|
companyId: this.siteData.companyId, //类型:String 必有字段 企业id companyId |
|
customerId: this.siteData.customerId, //类型:String 必有字段 司机id customerId |
|
volume: parseFloat(this.insertResult.vol), //类型:number 必有字段 升数 volume, |
|
vehicleLicenseNum: this.carNumber, |
|
version: 1, //类型:Number 必有字段 备注:版本号 |
|
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
} |
|
console.log(data6) |
|
if (!data6.qrCode) { |
|
uni.showToast({ |
|
title: 'qrCode为空', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.siteId) { |
|
uni.showToast({ |
|
title: '请选择油站id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.companyId) { |
|
uni.showToast({ |
|
title: '请选择企业id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.customerId) { |
|
uni.showToast({ |
|
title: '请选择司机id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.volume) { |
|
uni.showToast({ |
|
title: '请输入加油体积', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
oliSiteApi.sfPay(data6).then(res => { |
|
if (res.code === 20000) { |
|
uni.showToast({ |
|
title: '下单成功!' |
|
}); |
|
uni.setStorageSync('orderInfo', data6) |
|
console.log(res.data.orderId) |
|
let orderId = res.data.orderId |
|
// this.checkSf(res.data.orderId) |
|
this.gotoOrderStatus(res.data) |
|
// uni.setStorageSync('formQr', true) |
|
// uni.setStorageSync('orderSource', 'mpxoil') |
|
// if (!this.isG7) { |
|
// setTimeout(() => { |
|
// this.toDetails(res.data.orderId) |
|
// }, 400) |
|
// } else { |
|
// this.beforePay = false |
|
// setTimeout(() => { |
|
// this.orderId = res.data.orderId |
|
// this.queryTimer() |
|
// this.getPayStatus(this.orderId) |
|
// }, 400) |
|
// } |
|
// setTimeout(()=>{ |
|
// this.shake=null |
|
// },1000) |
|
} |
|
}) |
|
}, |
|
gotoOrderStatus(items) { |
|
let item = JSON.stringify(items) |
|
uni.redirectTo({ |
|
url: '/pages/stationDetail/OrderStatus?item=' + item |
|
}) |
|
}, |
|
// g7 |
|
G7Order() { |
|
const g7OrderInfo = { |
|
qr_code: uni.getStorageSync('qrCode'), //类型:String 必有字段 二维码 qrcode |
|
station_id: this.siteData.siteId, //类型:String 必有字段 油站id siteId |
|
oilPriceId: this.insertResult.priceId, //类型:String 必有字段 油价id priceId |
|
driver_phone: this.siteData.customerPhone, //类型:String 必有字段 油价id priceId |
|
companyId: this.siteData.companyId, //类型:String 必有字段 企业id companyId |
|
customerId: this.siteData.customerId, //类型:String 必有字段 司机id customerId |
|
truck_no: this.carNumber, |
|
gun_money: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
gun_number: this.insertResult.bar, //类型:String 必有字段 备注:加油升数 |
|
deduction_mode: 1, |
|
} |
|
console.log("加油信息===================",this.insertResult) |
|
console.log(g7OrderInfo) |
|
if (!g7OrderInfo.qr_code) { |
|
uni.showToast({ |
|
title: 'qr_code为空', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!g7OrderInfo.station_id) { |
|
uni.showToast({ |
|
title: '请选择油站id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!g7OrderInfo.companyId) { |
|
uni.showToast({ |
|
title: '请选择企业id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!g7OrderInfo.customerId) { |
|
uni.showToast({ |
|
title: '请选择司机id', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!g7OrderInfo.gun_money) { |
|
uni.showToast({ |
|
title: '请输入加油金额', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
oliSiteApi.G7Pay(g7OrderInfo).then(res => { |
|
if (res.code === 20000) { |
|
uni.showToast({ |
|
title: '下单成功!' |
|
}); |
|
uni.setStorageSync('orderSource', 'mpxoil') |
|
console.log("是否是g7================",this.isG7) |
|
if (!this.isG7) { |
|
setTimeout(() => { |
|
this.toDetails(res.data.orderId) |
|
}, 400) |
|
} else { |
|
this.beforePay = false |
|
setTimeout(() => { |
|
this.orderId = res.data.orderId |
|
console.log("queryTimer",this.orderId) |
|
this.queryTimer() |
|
console.log("getPayStatus",this.orderId) |
|
this.getPayStatus(this.orderId) |
|
}, 400) |
|
} |
|
this.shake=null |
|
} |
|
}) |
|
}, |
|
//日日顺 |
|
RrsOrder() { |
|
const data6 = { |
|
siteId: this.siteData.siteId, |
|
priceId: this.insertResult.priceId, |
|
customerOrderId: this.siteData.customerOrderId, |
|
volume: this.insertResult.vol, |
|
createSource: "WECHAT_MINIAPPS", //类型:String 必有字段 备注:创建来源 |
|
orderSource: "WECHAT_MINIAPPS", |
|
vehicleLicenseNum: this.carNumber, |
|
customerId: this.siteData.customerId, //类型:String 必有字段 备注:司机id |
|
companyId: this.siteData.companyId, //类型:String 必有字段 备注:企业id |
|
oilsBar: this.insertResult.bar, |
|
oilsCode: this.insertResult.oilProductCode, |
|
orderMethod: "SITE_SCAN", //类型:String 必有字段 备注:订单产生方式 |
|
suppleMark: 0, |
|
orderType: "REAL_ORDER", //类型:String 必有字段 备注:订单类型 ( REAL_ORDER:真实订单 VIRTUAL_ORDER:虚拟订单) |
|
payChannel: "BALANCE_PAYMENT", //类型:String 必有字段 备注:支付渠道 |
|
oilCardType: this.siteData.oilCardNature, //类型:String 必有字段 备注:油卡性质 1:个人 2:企业 3:外请 |
|
accountCardCode: this.siteData.accountCardCode, //类型:String 必有字段 备注:油卡卡号 |
|
siteUserName: "1", //类型:String 必有字段 备注:加油员名称 |
|
version: 1, //类型:Number 必有字段 备注:版本号 |
|
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
} |
|
if (!data6.oilsCode) { |
|
uni.showToast({ |
|
title: '请选择油品', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.volume) { |
|
uni.showToast({ |
|
title: '请输入加油体积', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
oliSiteApi.RrsPay(data6).then(res => { |
|
if (res.code === 20000) { |
|
uni.showToast({ |
|
title: '下单成功!' |
|
}); |
|
uni.setStorageSync('formQr', true) |
|
// const data8 = { |
|
// orderStatus: res.data.orderStatus, //待支付,1:已支付,-1:支付失败,2:已取消, 3:已退款 |
|
// oilSiteName: res.data.siteName, |
|
// address: res.data.siteAddress, |
|
// userName: res.data.userName, |
|
// carNo: res.data.vehicleLicenseNum, |
|
// vol: res.data.volume, |
|
// orderID: res.data.orderSerialNumber, |
|
// oilName: res.data.oilsCode, |
|
// bar: res.data.oilsBar, |
|
// coupon: res.data.couponDiscountAmount, |
|
// xoilDiscountAmount: res.data.xoilDiscountAmount, |
|
// createDatetime: res.data.orderTime, |
|
// realamount: res.data.payRealAmount, |
|
// istate: res.data.orderStatus |
|
|
|
// } |
|
// uni.setStorageSync('tempOrderInfo', data8) |
|
uni.setStorageSync('orderSource', 'mpxoil') |
|
if (!this.isG7) { |
|
setTimeout(() => { |
|
this.toDetails(res.data.orderId) |
|
}, 400) |
|
} else { |
|
this.beforePay = false |
|
setTimeout(() => { |
|
this.orderId = res.data.orderId |
|
this.queryTimer() |
|
this.getPayStatus(this.orderId) |
|
}, 400) |
|
} |
|
// setTimeout(()=>{ |
|
// this.shake=null |
|
// },1000) |
|
} |
|
}) |
|
}, |
|
// 收费星油 |
|
saveXoilOrder() { |
|
if (this.isOtherUser) { |
|
let PlateNumberImages = this.PlateNumberImages, |
|
refuellerImages = this.refuellerImages |
|
if (PlateNumberImages == '') { |
|
this.shake=null |
|
uni.showToast({ |
|
icon: 'none', |
|
title: '请上传车辆照片' |
|
}) |
|
return |
|
} |
|
if (refuellerImages == '') { |
|
uni.showToast({ |
|
icon: 'none', |
|
title: '请上传油机照片' |
|
}) |
|
this.shake=null |
|
return |
|
} |
|
var data6 = { |
|
kaliState: '1', //判断是否为卡力 |
|
siteId: this.siteData.siteId, |
|
priceId: this.insertResult.priceId, |
|
customerOrderId: this.siteData.customerOrderId, |
|
volume: this.insertResult.vol, |
|
plateNumberImage: this.PlateNumberImages, |
|
engineImage: this.refuellerImages, |
|
createSource: "WECHAT_MINIAPPS", //类型:String 必有字段 备注:创建来源 |
|
orderSource: "WECHAT_MINIAPPS", |
|
vehicleLicenseNum: this.carNumber, |
|
customerId: this.siteData.customerId, //类型:String 必有字段 备注:司机id |
|
companyId: this.siteData.companyId, //类型:String 必有字段 备注:企业id |
|
oilsBar: this.insertResult.bar, |
|
oilsCode: this.insertResult.oilProductCode, |
|
orderMethod: "SITE_SCAN", //类型:String 必有字段 备注:订单产生方式 |
|
suppleMark: 0, |
|
orderType: "REAL_ORDER", //类型:String 必有字段 备注:订单类型 ( REAL_ORDER:真实订单 VIRTUAL_ORDER:虚拟订单) |
|
payChannel: "BALANCE_PAYMENT", //类型:String 必有字段 备注:支付渠道 |
|
oilCardType: this.siteData.oilCardNature, //类型:String 必有字段 备注:油卡性质 1:个人 2:企业 3:外请 |
|
accountCardCode: this.siteData.accountCardCode, //类型:String 必有字段 备注:油卡卡号 |
|
siteUserName: "1", //类型:String 必有字段 备注:加油员名称 |
|
version: this.siteData.siteType=='2'?null:'1', //类型:Number 必有字段 备注:版本号 |
|
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
} |
|
} else { |
|
var data6 = { |
|
siteId: this.siteData.siteId, |
|
priceId: this.insertResult.priceId, |
|
customerOrderId: this.siteData.customerOrderId, |
|
volume: this.insertResult.vol, |
|
plateNumberImage: this.PlateNumberImages, |
|
engineImage: this.refuellerImages, |
|
createSource: "WECHAT_MINIAPPS", //类型:String 必有字段 备注:创建来源 |
|
orderSource: "WECHAT_MINIAPPS", |
|
vehicleLicenseNum: this.carNumber, |
|
customerId: this.siteData.customerId, //类型:String 必有字段 备注:司机id |
|
companyId: this.siteData.companyId, //类型:String 必有字段 备注:企业id |
|
oilsBar: this.insertResult.bar, |
|
oilsCode: this.insertResult.oilProductCode, |
|
orderMethod: "SITE_SCAN", //类型:String 必有字段 备注:订单产生方式 |
|
suppleMark: 0, |
|
orderType: "REAL_ORDER", //类型:String 必有字段 备注:订单类型 ( REAL_ORDER:真实订单 VIRTUAL_ORDER:虚拟订单) |
|
payChannel: "BALANCE_PAYMENT", //类型:String 必有字段 备注:支付渠道 |
|
oilCardType: this.siteData.oilCardNature, //类型:String 必有字段 备注:油卡性质 1:个人 2:企业 3:外请 |
|
accountCardCode: this.siteData.accountCardCode, //类型:String 必有字段 备注:油卡卡号 |
|
siteUserName: "1", //类型:String 必有字段 备注:加油员名称 |
|
version: this.siteData.siteType=='2'?null:"1", //类型:Number 必有字段 备注:版本号 |
|
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
} |
|
} |
|
|
|
if (!data6.oilsCode) { |
|
uni.showToast({ |
|
title: '请选择油品', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!Number(data6.volume)) { |
|
if(this.siteData.siteType=='2'){ |
|
uni.showToast({ |
|
title: '请输入加油升数', |
|
icon: 'none' |
|
}); |
|
}else{ |
|
uni.showToast({ |
|
title: '请输入加油金额', |
|
icon: 'none' |
|
}); |
|
} |
|
this.shake=null |
|
return false |
|
} |
|
let location = uni.getStorageSync('location')||{longitude:'',latitude:''}; |
|
// if(!location){ |
|
// let locationChenk = true |
|
// let that = this |
|
// uni.getLocation({ |
|
// type: 'gcj02', |
|
// success: function(res) { |
|
// uni.setStorage({ |
|
// key:'location', |
|
// data:res |
|
// }) |
|
// }, |
|
// fail(e) { |
|
// locationChenk = false |
|
// }, |
|
// }); |
|
// if(!locationChenk){ |
|
// uni.showToast({ |
|
// title:'请授权位置', |
|
// icon:'error' |
|
// }) |
|
// } |
|
// console.log(location,'**************************************************') |
|
// return |
|
// } |
|
// uni.getLocation({ |
|
// type: 'gcj02', |
|
// success: function(res) { |
|
// uni.setStorage({ |
|
// key:'location', |
|
// data:res |
|
// }) |
|
// }, |
|
// fail(e) { |
|
// uni.showModal({ |
|
// title:'获取定位', |
|
// content:'是否重新获取定位?', |
|
// success:function(e){ |
|
// wx.openSetting({ |
|
// success:function(e){ |
|
// if (res.authSetting['scope.userLocation']){ |
|
// console.log('******') |
|
// } |
|
// }, |
|
// fail:function(e){ |
|
// console.log(e,'//////') |
|
// } |
|
// }) |
|
// } |
|
// }) |
|
// }, |
|
// }); |
|
// return |
|
// |
|
console.log(data6, 'data6+++++') |
|
oliSiteApi.xoilPay(Object.assign(data6,{longitude:location.longitude,latitude:location.latitude})).then(res => { |
|
console.log(res) |
|
if (res.code === 20000) { |
|
uni.showToast({ |
|
title: '下单成功!' |
|
}); |
|
uni.setStorageSync('formQr', true) |
|
// const data8 = { |
|
// orderStatus: res.data.orderStatus, //待支付,1:已支付,-1:支付失败,2:已取消, 3:已退款 |
|
// oilSiteName: res.data.siteName, |
|
// address: res.data.siteAddress, |
|
// userName: res.data.userName, |
|
// carNo: res.data.vehicleLicenseNum, |
|
// vol: res.data.volume, |
|
// orderID: res.data.orderSerialNumber, |
|
// oilName: res.data.oilsCode, |
|
// bar: res.data.oilsBar, |
|
// coupon: res.data.couponDiscountAmount, |
|
// xoilDiscountAmount: res.data.xoilDiscountAmount, |
|
// createDatetime: res.data.orderTime, |
|
// realamount: res.data.payRealAmount, |
|
// istate: res.data.orderStatus |
|
// } |
|
// uni.setStorageSync('tempOrderInfo', data8) |
|
uni.setStorageSync('orderSource', 'mpxoil') |
|
if (!this.isG7) { |
|
setTimeout(() => { |
|
this.toDetails(res.data.orderId) |
|
}, 400) |
|
} else { |
|
this.beforePay = false |
|
setTimeout(() => { |
|
this.orderId = res.data.orderId |
|
this.queryTimer() |
|
this.getPayStatus(this.orderId) |
|
}, 400) |
|
} |
|
} |
|
setTimeout(()=>{ |
|
this.shake=null |
|
},1000) |
|
}) |
|
}, |
|
// 收费则yi |
|
saveZeyiOrder() { |
|
const data6 = { |
|
siteId: this.siteData.siteId, |
|
priceId: this.insertResult.priceId, |
|
customerOrderId: this.siteData.customerOrderId, |
|
volume: this.insertResult.vol, |
|
createSource: "WECHAT_MINIAPPS", //类型:String 必有字段 备注:创建来源 |
|
orderSource: "WECHAT_MINIAPPS", |
|
vehicleLicenseNum: this.carNumber, |
|
customerId: this.siteData.customerId, //类型:String 必有字段 备注:司机id |
|
companyId: this.siteData.companyId, //类型:String 必有字段 备注:企业id |
|
oilsBar: this.insertResult.bar, |
|
oilsCode: this.insertResult.oilProductCode, |
|
payChannel: "ZEYI", //类型:String 必有字段 备注:支付渠道 |
|
orderMethod: "SITE_SCAN", //类型:String 必有字段 备注:订单产生方式 |
|
version: 1, //类型:Number 必有字段 备注:版本号 |
|
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数 |
|
} |
|
if (!data6.oilsCode) { |
|
uni.showToast({ |
|
title: '请选择油品', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
if (!data6.volume) { |
|
uni.showToast({ |
|
title: '请输入加油体积', |
|
icon: 'none' |
|
}); |
|
this.shake=null |
|
return false |
|
} |
|
oliSiteApi.zeyiPay(data6).then(res => { |
|
if (res.code === 20000) { |
|
uni.showToast({ |
|
title: '下单成功!' |
|
}); |
|
uni.setStorageSync('formQr', true) |
|
const data8 = { |
|
orderStatus: res.data.orderStatus, //待支付,1:已支付,-1:支付失败,2:已取消, 3:已退款 |
|
oilSiteName: res.data.siteName, |
|
address: res.data.siteAddress, |
|
userName: res.data.userName, |
|
carNo: res.data.vehicleLicenseNum, |
|
vol: res.data.volume, |
|
// orderID: res.data.orderSerialNumber, |
|
orderId: res.data.orderId, |
|
oilName: res.data.oilsCode, |
|
bar: res.data.oilsBar, |
|
coupon: res.data.couponDiscountAmount, |
|
xoilDiscountAmount: res.data.xoilDiscountAmount, |
|
createDatetime: res.data.orderTime, |
|
realamount: res.data.payRealAmount, |
|
istate: res.data.orderStatus |
|
|
|
} |
|
uni.setStorageSync('tempOrderInfo', data8) |
|
uni.setStorageSync('orderSource', 'zy') |
|
if (!this.isG7) { |
|
setTimeout(() => { |
|
this.toDetails(res.data.orderSerialNumber) |
|
}, 400) |
|
} else { |
|
this.beforePay = false |
|
setTimeout(() => { |
|
this.orderId = res.data.orderId |
|
this.queryTimer() |
|
this.getPayStatus(this.orderId) |
|
}, 400) |
|
} |
|
setTimeout(()=>{ |
|
this.shake=null |
|
},1000) |
|
} |
|
}) |
|
}, |
|
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(id) |
|
} |
|
} |
|
}) |
|
}, |
|
|
|
toDetails(id) { |
|
uni.setStorageSync('orderId', id) |
|
console.log('id', id) |
|
uni.redirectTo({ |
|
url: '/packageOrders/pages/orderList/OrderDetail/OrderDetail' |
|
}) |
|
|
|
}, |
|
gunIdSel(index) { |
|
this.insertResult.bar = index + 1 |
|
}, |
|
oilNameSel(item) { |
|
console.log(item, 'item') |
|
this.selected = { |
|
...item |
|
} |
|
this.activeSitePrice = item.priceId |
|
console.log('选择你/n', this.selected, '/n') |
|
}, |
|
initForm() { |
|
if (!this.insertResult.realPrice) { |
|
this.selected = this.siteData.oilSitePriceDetailsVos[0] |
|
} |
|
this.insertResult.bar = 1 |
|
console.log(this.selected) |
|
}, |
|
verifyQrCode() { |
|
console.log(this.zyInfo) |
|
// if(this.zyInfo.oilsStationId !=undefined){ |
|
// let obj={ |
|
// qrCode: this.zyInfo.qrCode, //类型:String 必有字段 备注:二维码字符串 |
|
// oilsStationId: uni.getStorageSync('oilSite').oilSiteCode //类型:String 必有字段 备注:加油站id |
|
// } |
|
// }else{ |
|
let obj = { |
|
qrCode: this.qrCode, //类型:String 必有字段 备注:二维码字符串 |
|
oilsStationId: uni.getStorageSync('oilSiteId') //类型:String 必有字段 备注:加油站id |
|
} |
|
// } |
|
console.log(obj,'**************'); |
|
oliSiteApi.verifyQrCode(obj).then(res => { |
|
if (res.code === 20000) { |
|
this.siteData = res.data |
|
this.activeSitePrice = res.data.oilSitePriceDetailsVos[0].priceId |
|
this.curIndex = 0 |
|
this.selected = { |
|
...res.data.oilSitePriceDetailsVos[0] |
|
} |
|
uni.setStorageSync('SiteInfo', res.data) |
|
// this.carNumber = res.data.vehicleLicenseNum[0] |
|
if (res.data.stateKL === '1') { |
|
this.isOtherUser = true |
|
} |
|
if (res.data.vehicleLicenseNum) { |
|
this.carNumber = res.data.vehicleLicenseNum[0] |
|
} else if (res.data.plateNumbers) { |
|
this.carNumber = res.data.plateNumbers[0] |
|
} |
|
|
|
} else { |
|
uni.showToast({ |
|
title: res.msg ? res.msg : '请确认是否油站二维码', |
|
icon: 'none' |
|
}) |
|
setTimeout(() => { |
|
uni.navigateBack() |
|
}, 800) |
|
} |
|
}) |
|
}, |
|
tRadio() { |
|
this.radio === 'A' ? this.radio = '' : this.radio = 'A' |
|
}, |
|
changeMoney() { |
|
// this.insertResult.vMoney = this.insertResult.vol * this.selected.oilSitePrice |
|
// this.insertResult.discountMoney = this.insertResult.vol * (this.selected.oilSitePrice - this.insertResult |
|
// .sitePrice) |
|
// this.insertResult.vDoMoney = this.insertResult.vol * this.selected.sitePrice |
|
console.log('%c look me ↓','font-size:50px;color:green') |
|
console.log(this.insertResult.vMoney,this.insertResult,this.selected) |
|
if(this.insertResult.vol!==''){ |
|
this.getMoney({ |
|
detail:{ |
|
value:this.insertResult.vol |
|
} |
|
}) |
|
} |
|
}, |
|
calcMoney(e) { |
|
// console.log(e) |
|
if (this.changTypes = 1) { |
|
let rrs = e.target.value.match(/^\d*(\.?\d{0,2})/g)[0]; // 处理输入油升数 只保留小数点后两位 |
|
this.$nextTick(() => { //重新赋值给input |
|
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.vDoMoney = this.insertResult.vol * this.selected.sitePrice |
|
}, |
|
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 = "" |
|
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' |
|
} |
|
}, |
|
filters: { |
|
company(e){ |
|
if(e){ |
|
return e=='2' ?'KG':'L'; |
|
} else { |
|
return '' |
|
} |
|
}, |
|
moneyVolm(value) { |
|
console.log(value, '++awdad+++++++-') |
|
if (value != 'xxx.x') { |
|
return Math.round(value * 100) / 100; |
|
} else { |
|
return value |
|
} |
|
}, |
|
toT(value) { |
|
if (value) { |
|
return value / 1000 |
|
} |
|
}, |
|
dateFormat(value) { |
|
if (value) { |
|
return value.substring(5, 16) |
|
} |
|
}, |
|
newNumberFilter(value) { |
|
let values = Math.round(value * 100) / 100; |
|
return values |
|
}, |
|
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 '' |
|
} |
|
} |
|
} |
|
} |
|
</script> |
|
|
|
<style scoped> |
|
@import url("./ZYSite.css"); |
|
|
|
.UpFileBox { |
|
width: 100%; |
|
padding: 18px; |
|
padding-top: 0; |
|
} |
|
|
|
.UpFileBoxMain { |
|
width: 100%; |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
} |
|
|
|
.close-icon { |
|
position: absolute; |
|
right: 2%; |
|
top: 2%; |
|
} |
|
|
|
.page-content { |
|
background-color: #f1f2f7; |
|
min-height: 100%; |
|
position: relative; |
|
} |
|
|
|
.navigation { |
|
position: absolute; |
|
right: 16px; |
|
top: 10px; |
|
} |
|
|
|
.icon-self { |
|
width: 1rem; |
|
height: 1rem; |
|
} |
|
|
|
.oil-price { |
|
position: relative; |
|
} |
|
|
|
.oil-price radio { |
|
position: absolute; |
|
left: 0rem; |
|
top: 10px; |
|
} |
|
|
|
.qr-icon { |
|
font-size: 2rem; |
|
} |
|
|
|
.pay-desc { |
|
line-height: 2rem; |
|
} |
|
|
|
.bottom-pay { |
|
min-height: 100rpx; |
|
width: 750upx; |
|
} |
|
|
|
.pay-bar { |
|
width: 750upx; |
|
position: absolute; |
|
bottom: 0; |
|
} |
|
|
|
.money-container { |
|
position: relative; |
|
} |
|
|
|
.money-position { |
|
position: absolute; |
|
top: 0; |
|
right: 0; |
|
display: block; |
|
border-radius: 0 0 0 100upx; |
|
} |
|
|
|
.UpFileBox { |
|
width: 100%; |
|
padding: 34rpx 32rpx; |
|
padding-top: 12rpx; |
|
} |
|
|
|
.UpFileBoxMain { |
|
width: 100%; |
|
display: flex; |
|
justify-content: space-between; |
|
align-items: center; |
|
background-color: #ffff; |
|
padding: 10px; |
|
box-sizing: border-box; |
|
border-radius: 6px; |
|
} |
|
|
|
.text-p { |
|
text-align: center; |
|
margin: 10rpx 0; |
|
font-size: 28rpx; |
|
} |
|
|
|
.text-title { |
|
text-align: left; |
|
margin: 10rpx 0; |
|
font-size: 28rpx; |
|
font-weight: 700; |
|
} |
|
|
|
.text-p { |
|
text-align: center; |
|
margin: 4rpx 0; |
|
font-size: 22rpx; |
|
color: #6f6f6fe8; |
|
} |
|
|
|
.refuellerImages { |
|
position: relative; |
|
} |
|
|
|
.plateNumber_box { |
|
position: relative; |
|
} |
|
|
|
.close_Img { |
|
position: absolute; |
|
right: -10px; |
|
top: -10px; |
|
width: 40rpx; |
|
height: 40rpx; |
|
} |
|
|
|
.text-img { |
|
position: relative; |
|
} |
|
</style>
|
|
|