diff --git a/src/api/mine.js b/src/api/mine.js index 6bba5823..0b8d63e0 100644 --- a/src/api/mine.js +++ b/src/api/mine.js @@ -18,6 +18,14 @@ export function saveVehicle(data){ data }) } +//车辆属性预判(行驶证OCR识别出车辆所有人后调用,命中服务商信息则锁定为自有车辆) +export function preJudgeVirtualVehicle(data){ + return request({ + url:'/supplierAppV2/dispatchApp/user/preJudgeVirtualVehicle', + method:'POST', + data + }) +} //提交审批车辆信息 export function saveSupplierApproval(data){ return request({ diff --git a/src/views/index/vehicleAdd.vue b/src/views/index/vehicleAdd.vue index ac16061f..f18129fd 100644 --- a/src/views/index/vehicleAdd.vue +++ b/src/views/index/vehicleAdd.vue @@ -131,23 +131,29 @@ 车辆属性 - - + - - - + + + + + + +
+ 匹配角色:{{ virtualVehicleMatchRole || '—' }}
@@ -463,7 +469,7 @@ import {formatDate1} from "@/utils/common" import {myMixins} from "@/utils/myMixins" import {vehicleTypeList,saveVehicle,getInfoById,supplierServiceTree, uploadImage, ocrHandler, - userOperationPermissions,saveSupplierApproval} from "@/api/mine" + userOperationPermissions,saveSupplierApproval,preJudgeVirtualVehicle as preJudgeVirtualVehicleApi} from "@/api/mine" import TwoCommonBtn from "@/components/twoBtnCommon.vue" import CellGroup from "@/components/cellGroup.vue"; export default { @@ -515,6 +521,9 @@ export default { vehicleLicenseInfo: {}, vehicleLicenseBackOcrFlag: false, // 行驶证副页 修改时默认不需要 ocr识别 isMultiple: false, // 是否支持多选 + virtualVehicleLocked: false, // 车辆属性锁定(OCR所有人命中服务商信息时锁定为自有车辆) + virtualVehicleMatchRole: '', // 车辆属性自动判定命中的匹配角色 + matchRoleExpand: false, // 匹配角色面板展开状态 vehicleLicense:'',//牌照 vehicleFrontLicensePlate:'',//车头照车牌号码 insuranceCorp: '', @@ -1221,6 +1230,8 @@ export default { this.vehicleLicenseInfo.licensePlateNumber = frontInfo?.plateNo; this.vehicleLicenseInfo.vehicleType = frontInfo?.vehicleType; this.vehicleLicenseInfo.owner = frontInfo?.owner; + // 行驶证所有人识别成功后,预判车辆属性(命中服务商信息则锁定为自有车辆) + this.preJudgeVirtualVehicle(); this.vehicleLicenseInfo.address = frontInfo?.address; this.vehicleLicenseInfo.useNature = frontInfo?.useCharacter; this.vehicleLicenseInfo.model = frontInfo?.model; @@ -1245,6 +1256,28 @@ export default { } return true }, + // 车辆属性预判:行驶证所有人与车辆归属服务商的名称/法人/关联人员比对,命中自有则锁定选择器 + async preJudgeVirtualVehicle() { + this.virtualVehicleLocked = false; + this.virtualVehicleMatchRole = ''; + const owner = (this.vehicleLicenseInfo.owner || '').trim(); + if (!owner) { + return; + } + try { + const res = await preJudgeVirtualVehicleApi({ + owner, + supplierId: this.supplierId || undefined // 车辆归属服务商ID,自录场景为空由后端取当前用户服务商 + }); + if (res?.data?.locked) { + this.virtualVehicleLocked = true; + this.virtualVehicleMatchRole = res.data.matchRole || ''; + this.virtualVehicle = 1; + } + } catch (e) { + // 预判失败不影响保存,选择器保持可编辑 + } + }, async vehicleBackOcrHandler() { // 行驶证副页 ocr 识别 this.vehicleLicenseInfo.recordNumber = ''; this.vehicleLicenseInfo.passengerCapacity = ''; @@ -1323,6 +1356,9 @@ export default { }); this.auditStatus = result.auditStatus; this.virtualVehicle = result.virtualVehicle; + // 车辆属性溯源:编辑场景初始化匹配角色,已是自有车辆且命中角色时锁定选择器 + this.virtualVehicleMatchRole = result.virtualVehicleMatchRole || ''; + this.virtualVehicleLocked = !!(result.virtualVehicleMatchRole && result.virtualVehicle === 1); this.$refs.tree.setCheckedKeys(result.serviceIds) this.vehicleStatus = result.vehicleStatus this.vehicleLicenseFront = result.vehicleLicenseFront; @@ -1894,6 +1930,34 @@ export default { pointer-events: none; opacity: 0.6; } +/* 车辆属性-匹配角色溯源 */ +.virtualVehicleField { + display: flex; + align-items: center; + justify-content: flex-end; + .matchRoleArrow { + margin-left: 6px; + cursor: pointer; + color: #909399; + user-select: none; + display: inline-block; + transition: transform .2s; + &.expanded { + transform: rotate(180deg); + color: #354D93; + } + } +} +.matchRolePanel { + margin: 0 25px 6px 0; + padding: 4px 10px; + font-size: 12px; + color: #606266; + background: #f4f4f5; + border-radius: 4px; + line-height: 1.6; + text-align: right; +} .pop_wrap { width: 340px; box-sizing: border-box;