This commit is contained in:
xiaozhiyong
2024-03-12 11:58:21 +08:00
19 changed files with 2962 additions and 72 deletions

View File

@@ -21,7 +21,7 @@
</view>
</view>
<!-- clc <view class="cu-list menu-avatar">
<!-- 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>
@@ -29,7 +29,7 @@
<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>
@@ -121,6 +121,19 @@
<text class="cuIcon-write text-orange"></text>
</view>
<view class="cu-form-group margin margin-top-0 radius" v-if="plateNumberOcrShow==true">
<view class="title text-black ">
车牌识别
</view>
<view @tap="srcPhoto" class="text-center" style="width: 60%;margin: 0 2%;">
<input v-model="plateNumberOcr" type="digit" class="block"
placeholder="请点击拍照识别车牌" value="" style="border-bottom: 1px solid #efefef;" />
</view>
<view @tap="srcPhoto">
<uni-icons type="camera-filled" size="30"></uni-icons>
</view>
</view>
<!-- 油品卡片 -->
<view class="padding-top-xs margin margin-top-xs margin-bottom-0 padding-bottom radius">
@@ -186,7 +199,7 @@
<button class="cu-btn" @tap="changeBar(item,index)"
:class="[curIndex===index?'bg-main-oil':'line-gray']">{{item.oilProductCode}}</button>
</view>
</view> -->
</view>
@@ -310,6 +323,39 @@
<PlateNumberPicker @newPlate="showPlateModal(false,true)" @onDeleteInput="onDeleteInput"
:showInputList="showInputList" :showPlateList="showPlateList" @selectNo="selectNo"
@clearAll="clearPlateNumber" @selectName="selectText" @hideModal="showModel=''" :modalName="showModel" />
<view class="cu-modal bottom-modal " :class="showPlicePhoto">
<view class="cu-dialog bg-white">
<view class="cu-bar bg-white justify-end">
<view class="content"></view>
<view class="action" @tap="showPlicePhoto=''">
<text class="cuIcon-close text-red"></text>
</view>
</view>
<view style="height: 1000rpx;">
<view style="margin: 100rpx 0;">
<uni-icons type="clear" size="80" color="#f56c6c"></uni-icons>
<view>
<text style="color: #d9001b;font-size: 30rpx;font-weight: bold;">识别失败!</text>
</view>
</view>
<view style="margin: 60rpx 0;">
<button @tap="srcPhoto" style="width: 60%;background-color: #409EFF;color: #ffffff;">重新拍照</button>
</view>
<view style="margin: 60rpx 0;">
<button style="width: 60%;background-color: #F59A23;color: #ffffff;" @click="manualInput">手动输入车牌号</button>
</view>
</view>
</view>
</view>
<uni-popup ref="inputDialog" type="dialog">
<uni-popup-dialog mode="input" title="请输入车牌号" value="" :before-close="true"
placeholder="请输入" @close="inputClose" @confirm="inputConfirm"></uni-popup-dialog>
</uni-popup>
</view>
</template>
@@ -320,6 +366,7 @@
import g7Api from '@/api/g7.js'
import utils from '@/utils/encode'
import PlateNumberPicker from '@/components/plate-number-picker/plate-number-picker.vue'
import user from '@/api/oli-user.js'
export default {
components: {
PlateNumberPicker
@@ -386,10 +433,14 @@
type: '',
curIndex: null,
InputNumber: 0,
plateNumberOcr:'',
plateNumberOcrShow:false,
showPlicePhoto:'',
plateNumberImages:''
}
},
onLoad(option) {
console.log(option) //接收option.type
console.log(option) //接收option.type
if (option.user == 'kl') {
let code = uni.getStorageSync('qrCode'),
orderId = code.slice(0, -3)
@@ -399,18 +450,18 @@
console.log(this.qrCode)
}
// if(option.type =='RIRISHUN'){
// console.log('这里是日日顺')
// console.log('这里是日日顺')
this.type = option.type //根据option.type 进行本地赋值
// }if(option.type =='zeyi'){
// console.log('这里是日日顺')
// console.log('这里是日日顺')
// this.type = 'zeyi' //根据option.type 进行本地赋值
// }
// if(option.type =='shunfeng'){
// console.log('这里是顺丰')
// console.log('这里是顺丰')
// this.type = 'shunfeng' //根据option.type 进行本地赋值
// }
// if(option.type =='fykc'){
// console.log('这里是福佑')
// console.log('这里是福佑')
// this.type = 'fykc' //根据option.type 进行本地赋值
// }
if (this.qrCode) {
@@ -427,6 +478,7 @@
this.timer = null;
}
},
watch: {
oilTypeList: {
handler(newVal, oldVal) {
@@ -477,7 +529,87 @@
},
methods: {
hz(e) {
manualInput(){
this.showPlicePhoto=''
this.$refs.inputDialog.open()
},
inputClose(){
this.$refs.inputDialog.close()
},
inputConfirm(val){
if(val){
this.plateNumberOcr = val
this.$refs.inputDialog.close()
}else{
uni.showToast({
title: '请输入车牌号',
icon: 'none'
})
}
},
getCompanyConfig(companyId){
if(companyId){
user.getCompanyConfigByCompanyId(companyId).then(res=>{
console.log(res,'res')
if(res.data.plateNumberOcr==1){
this.plateNumberOcrShow = true
}else{
this.plateNumberOcrShow = false
}
})
}
},
srcPhoto(){
this.showPlicePhoto=''
let _that = this
uni.chooseImage({
count: 1, //默认9
sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
sourceType: ['camera'], // 只能拍照
success: function(res) {
uni.showLoading({
title: '识别中',
mask: true
});
const JSESSIONID = utils.uuid()
uni.uploadFile({
url: 'http://uat.xingoil.com/adminapi/oil-oss/obejct/carNoIdentify',
filePath: res.tempFilePaths[0],
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) {
uni.hideLoading()
console.log(e)
let obj = JSON.parse(e.data)
if(obj.data&&obj.data.carNo){
_that.plateNumberOcr = obj.data.carNo
_that.plateNumberImages = obj.data.imgUrl
}else{
_that.plateNumberOcr = ''
_that.showPlicePhoto = 'show'
}
},fail(res){
uni.hideLoading()
_that.showPlicePhoto = 'show'
}
})
}
})
},
hz(e){
// carNumber.length>0
// console.log(new RegExp("[\u4E00-\u9FA5]+").test(e),'*-*-*-*-*-*')
return new RegExp("[\u4E00-\u9FA5]+").test(e)
@@ -1077,7 +1209,41 @@
xoilAmountGun: this.insertResult.vol, //类型String 必有字段 备注:加油升数
}
} else {
var data6 = {
if(this.plateNumberOcrShow == true){
if(!this.plateNumberOcr){
uni.showToast({
icon: 'none',
title: '请上传车牌照片'
})
return
}
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.plateNumberOcr,
plateNumberImages: this.plateNumberImages, // 车牌照片地址
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,
@@ -1101,6 +1267,8 @@
version: this.siteData.siteType == '2' ? null : "1", //类型Number 必有字段 备注:版本号
xoilAmountGun: this.insertResult.vol, //类型String 必有字段 备注:加油升数
}
}
}
if (!data6.oilsCode) {
@@ -1150,7 +1318,7 @@
// title:'请授权位置',
// icon:'error'
// })
// }
// }
// console.log(location,'**************************************************')
// return
// }
@@ -1182,7 +1350,7 @@
// },
// });
// return
//
//
console.log(data6, 'data6+++++')
oliSiteApi.xoilPay(Object.assign(data6, {
longitude: location.longitude,
@@ -1389,7 +1557,7 @@
} else if (res.data.plateNumbers) {
this.carNumber = res.data.plateNumbers[0]
}
this.getCompanyConfig(res.data.companyId)
} else {
uni.showToast({
title: res.msg ? res.msg : '请确认是否油站二维码',