OCR
This commit is contained in:
@@ -94,4 +94,11 @@ export default{
|
||||
method: 'GET'
|
||||
})
|
||||
},
|
||||
// 查询企业配置
|
||||
getCompanyConfigByCompanyId(id) {
|
||||
return request({
|
||||
url: `/${service_name}/sysCompanyConfig/getCompanyConfigByCompanyId/${id}`,
|
||||
method: 'GET'
|
||||
})
|
||||
},
|
||||
}
|
||||
@@ -116,6 +116,19 @@
|
||||
|
||||
<text class="cuIcon-write text-orange"></text>
|
||||
</view>
|
||||
|
||||
<view class="cu-form-group margin margin-top-0 radius">
|
||||
<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">
|
||||
|
||||
@@ -309,6 +322,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
|
||||
@@ -375,6 +389,8 @@
|
||||
type: '',
|
||||
curIndex: null,
|
||||
InputNumber: 0,
|
||||
plateNumberOcr:'',
|
||||
plateNumberOcrShow:false
|
||||
}
|
||||
},
|
||||
onLoad(option) {
|
||||
@@ -416,6 +432,7 @@
|
||||
this.timer = null;
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
oilTypeList: {
|
||||
handler(newVal, oldVal) {
|
||||
@@ -466,6 +483,60 @@
|
||||
|
||||
},
|
||||
methods: {
|
||||
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(){
|
||||
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)
|
||||
console.log(obj,obj.data,obj.data.carNo)
|
||||
_that.plateNumberOcr = obj.data.carNo
|
||||
},fail(res){
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
}
|
||||
})
|
||||
},
|
||||
hz(e){
|
||||
// carNumber.length>0
|
||||
// console.log(new RegExp("[\u4E00-\u9FA5]+").test(e),'*-*-*-*-*-*')
|
||||
@@ -1066,7 +1137,33 @@
|
||||
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数
|
||||
}
|
||||
} else {
|
||||
var data6 = {
|
||||
if(this.plateNumberOcrShow == true){
|
||||
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,
|
||||
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,
|
||||
@@ -1090,6 +1187,8 @@
|
||||
version: this.siteData.siteType=='2'?null:"1", //类型:Number 必有字段 备注:版本号
|
||||
xoilAmountGun: this.insertResult.vol, //类型:String 必有字段 备注:加油升数
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (!data6.oilsCode) {
|
||||
@@ -1372,7 +1471,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 : '请确认是否油站二维码',
|
||||
|
||||
Reference in New Issue
Block a user