zyj #14

Merged
zhangyouji merged 4 commits from zyj into master 9 months ago
  1. 181
      BagStation/pages/components/price-select-tab.vue
  2. 19
      api/user.js

@ -188,6 +188,24 @@
</view>
</view>
</view>
<view class=" menu cu-list " v-if="plateNumberOcrShow==true">
<view class="cu-item nowrap">
<view class="text-bold ">
车牌识别
</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>
<view class="bg-white padding">
<view class="">
<text class="text-bold">优惠</text>
@ -367,6 +385,39 @@
</view>
</view>
</view>
<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>
@ -377,6 +428,7 @@
import oilOssApi from '@/api/oil-oss.js'
import utils from '@/utils/encode'
import oilInterfacesApi from '@/api/oil-interfaces.js'
import user from '@/api/user.js'
export default {
props: {
channelList: {
@ -504,13 +556,18 @@
activeChannelCode: '',
checkBar: [],
realMoney: '',
xoilAmountGun: ''
xoilAmountGun: '',
plateNumberOcr:'',
plateNumberOcrShow:false,
showPlicePhoto:'',
plateNumberImages:''
}
},
created() {
let oilItem = uni.getStorageSync('oilItem'),
oilSite = uni.getStorageSync(''),
otherUser = uni.getStorageSync('otherUserInfo')
otherUser = uni.getStorageSync('otherUserInfo'),
companyId = JSON.parse(uni.getStorageSync('companyCard')).companyId
if (otherUser) {
// console.log('')
this.isOtherUser = true
@ -520,6 +577,8 @@
console.log('oilItem', oilItem)
this.showtitles = oilItem.listTag;
this.init()
console.log(companyId)
this.getCompanyConfig(companyId)
},
watch: {
activeChannelCode: {
@ -598,6 +657,86 @@
}
},
methods: {
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=>{
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()
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'
}
})
}
})
},
typeChenk() {
return this.channelList[this.activeCur]?.secondChannelCode && this.thirdPartyDynamicData.includes(this
.channelList[this.activeCur].secondChannelCode)
@ -1135,14 +1274,23 @@
'xoilAmountGun': this.vol
}
} else {
var orderData = {
if(!this.plateNumberOcr){
uni.showToast({
icon: 'none',
title: '请上传车牌照片'
})
return
}
if(this.plateNumberOcrShow == true){
var orderData = {
amountGun: this.activeChannelCode == 'TY' ? this.ty.realMoney : '',
shareCompanyQuota: 0, //
priceId: this.oilSitePriceDetailsVo[this.radio].priceId, //String
orderType: "REAL_ORDER", //String REAL_ORDER VIRTUAL_ORDER
orderSource: "WECHAT_MINIAPPS", //String WECHAT_MINIAPPS
plateNumber: this.plateNumber ? this.plateNumber : this
.plateNumberSel, //String
plateNumber: this.plateNumberOcrShow == true ? this.plateNumberOcr : this
.plateNumber, //String
plateNumberImages: this.plateNumberImages, //
siteUserName: this.jober, //String
oilsBar: this.oilBar, //Number
volume: this.activeChannelCode == 'TY' ? this.tyRes.liter : this
@ -1155,6 +1303,29 @@
'version': 1,
'xoilAmountGun': this.vol
}
}else{
var orderData = {
amountGun: this.activeChannelCode == 'TY' ? this.ty.realMoney : '',
shareCompanyQuota: 0, //
priceId: this.oilSitePriceDetailsVo[this.radio].priceId, //String
orderType: "REAL_ORDER", //String REAL_ORDER VIRTUAL_ORDER
orderSource: "WECHAT_MINIAPPS", //String WECHAT_MINIAPPS
plateNumber: this.plateNumber ? this.plateNumber : this
.plateNumberSel, //String
siteUserName: this.jober, //String
oilsBar: this.oilBar, //Number
volume: this.activeChannelCode == 'TY' ? this.tyRes.liter : this
.vol, //Number
realPrice: this.oilSitePriceDetailsVo[this.radio].sitePrice, //Number
suppleMark: 0, //Number 0 1
createSource: "XOIL_DRIVER_COMPANY_WECHAT_APPLET", //String XOIL_DRIVER_COMPANY_WECHAT_APPLET
// "deviceImei": "mock", //String
// "networkIp": "mock" //String ip
'version': 1,
'xoilAmountGun': this.vol
}
}
}
// console.log(orderData)
let location = uni.getStorageSync('location') || {

@ -0,0 +1,19 @@
import request from '@/utils/request'
const service_name = "oil-user"
const group_name = "oilCustomerInfo"
export default{
carNoIdentify(data) { //图片上传-ORC识别
return request({
url: `/${service_name}/${group_name}/carNoIdentify`,
method: 'post',
data: data
})
},
// 查询企业配置
getCompanyConfigByCompanyId(id) {
return request({
url: `/${service_name}/sysCompanyConfig/getCompanyConfigByCompanyId/${id}`,
method: 'GET'
})
},
}
Loading…
Cancel
Save