From 48e5c51ffb3814f36f3e5d965dbb1471e5078475 Mon Sep 17 00:00:00 2001 From: qijq <624811160@qq.com> Date: Mon, 8 Sep 2025 08:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A4=E6=8E=A5=E5=89=A9=E4=BD=99=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/baidu/baidu.js | 24 + src/api/upload.js | 33 + src/config/net.config.js | 8 + src/utils/file.js | 87 ++ .../store/shopAudit/shopAuditDetails.vue | 890 +++++++++++++++--- 5 files changed, 936 insertions(+), 106 deletions(-) create mode 100644 src/api/baidu/baidu.js create mode 100644 src/api/upload.js create mode 100644 src/utils/file.js diff --git a/src/api/baidu/baidu.js b/src/api/baidu/baidu.js new file mode 100644 index 0000000..d43ca10 --- /dev/null +++ b/src/api/baidu/baidu.js @@ -0,0 +1,24 @@ +import request from '@/utils/request' +import { URL } from '@/config' + +/** + * 获取百度地图输入点提示词 + * @author Seven + * @data 2025-3-5 + * @param { + * query: value, //关键词 + * region: this.citys[0], //城市名 + * city_limit: true, //指定的区域的返回结果 + * ret_coordtype: "gcj02ll", //坐标类型 1(WGS84ll即GPS经纬度)2(GCJ02ll即国测局经纬度坐标) 3(BD09ll即百度经纬度坐标) 4(BD09mc即百度米制坐标) + *} + * @returns { query,region } + * @see https://mall.gpxscs.cn/mobile/shop/merch/baidu/place/v2/suggestion + */ + +export function getBaiduSuggestion(params) { + return request({ + url: URL.baidu.getBaiduSuggestion, + method: 'get', + params, + }) +} diff --git a/src/api/upload.js b/src/api/upload.js new file mode 100644 index 0000000..42e95fe --- /dev/null +++ b/src/api/upload.js @@ -0,0 +1,33 @@ +import request from '@/utils/request' +import { URL } from '@/config' + +export function batchNoApi(file, type) { + const formData = new FormData() + formData.append('upfile', file) + formData.append('imgType', type) + return new Promise((resolve, reject) => { + request({ + url: URL.ocr.batchNoApi, + method: 'post', + data: formData, + headers: { + 'Content-Type': 'multipart/form-data', + }, + }) + .then((res) => { + resolve(res) + }) + .catch((e) => reject(console.warn(e))) + }) +} + +export function imgOcrResultApi(data) { + return request({ + url: URL.ocr.imgOcrResultApi, + method: 'POST', + data, + headers: { + 'Content-Type': 'multipart/form-data', + }, + }) +} diff --git a/src/config/net.config.js b/src/config/net.config.js index d1a6053..348f6a9 100644 --- a/src/config/net.config.js +++ b/src/config/net.config.js @@ -29,6 +29,14 @@ let url = { disableUpdateShopApp: api_url + '/admin/admin/app-market-update/enable-or-disable', }, + baidu: { + getBaiduSuggestion: + api_url + '/mobile/shop/merch/baidu/place/v2/suggestion', + }, + ocr: { + batchNoApi: api_url + '/mobile/shop/lakala/tk/uploadOcrImg', + imgOcrResultApi: api_url + '/mobile/shop/lakala/tk/imgOcrResult', + }, orderPush: { orderPushTest: api_url + '/mobile/account/login/push/testcase', }, diff --git a/src/utils/file.js b/src/utils/file.js new file mode 100644 index 0000000..27f9516 --- /dev/null +++ b/src/utils/file.js @@ -0,0 +1,87 @@ +export async function compressImage(file, options = {}) { + // 提取选项参数,设置默认值 + const { + quality = 0.75, + maxWidth = 800, + maxHeight = 600 + } = options; + + // 验证输入是否为有效的File对象 + if (!(file instanceof File)) { + throw new Error('输入参数必须是一个File对象'); + } + + // 检查文件类型是否为图片 + if (!file.type.startsWith('image/')) { + throw new Error('输入文件必须是图片类型'); + } + + // 创建一个Promise来处理异步操作 + return new Promise((resolve, reject) => { + // 创建Image对象用于加载图片 + const img = new Image(); + + // 监听图片加载完成事件 + img.onload = () => { + // 创建Canvas元素 + const canvas = document.createElement('canvas'); + const ctx = canvas.getContext('2d'); + + // 获取原始图片尺寸 + let width = img.width; + let height = img.height; + + // 计算调整后的尺寸(保持原始比例) + if (width > maxWidth) { + height = height * (maxWidth / width); + width = maxWidth; + } + + if (height > maxHeight) { + width = width * (maxHeight / height); + height = maxHeight; + } + + // 设置Canvas尺寸 + canvas.width = width; + canvas.height = height; + + // 在Canvas上绘制图片 + ctx.drawImage(img, 0, 0, width, height); + + // 将Canvas内容转换为Blob对象 + canvas.toBlob( + (blob) => { + if (!blob) { + reject(new Error('图片转换失败')); + return; + } + + // 创建新的File对象 + const compressedFile = new File( + [blob], + file.name, + { type: blob.type, lastModified: Date.now() } + ); + + resolve(compressedFile); + }, + file.type, // 使用原始图片类型 + quality // 压缩质量 + ); + }; + + // 监听图片加载错误事件 + img.onerror = () => reject(new Error('图片加载失败')); + + // 读取图片数据 + const reader = new FileReader(); + reader.onload = () => { + img.src = reader.result; + }; + reader.onerror = () => reject(new Error('文件读取失败')); + + // 开始读取文件 + reader.readAsDataURL(file); + }); + } \ No newline at end of file diff --git a/src/views/store/shopAudit/shopAuditDetails.vue b/src/views/store/shopAudit/shopAuditDetails.vue index 87e9070..4540ecb 100644 --- a/src/views/store/shopAudit/shopAuditDetails.vue +++ b/src/views/store/shopAudit/shopAuditDetails.vue @@ -18,7 +18,7 @@ class="item-input" v-model="form.store_id" clearable - :readonly="isReadonly" + :disabled="isReadonly" />
@@ -28,7 +28,7 @@ style="width: 300px;margin-right: 0;" v-model="form.store_name" clearable - :readonly="isReadonly" + :disabled="isReadonly" /> 检查名字
@@ -39,7 +39,7 @@ class="item-input" v-model="form.biz_category" clearable - :readonly="isReadonly" + :disabled="isReadonly" /> @@ -50,7 +50,7 @@ class="item-input" v-model="form.contact_name" clearable - :readonly="isReadonly" + :disabled="isReadonly" />
@@ -59,7 +59,8 @@ class="item-input" v-model="form.login_mobile" clearable - :readonly="true" + :disabled="true" + disabled />
@@ -68,9 +69,35 @@
店铺所在的省
+ v-model="areaCode" filterable placeholder="请选择" :disabled="isReadonly" + @change="handerChangeArea" + > + + + +
+
+
店铺所在的市
+ + @@ -78,28 +105,29 @@
-
-
店铺所在的市
- -
店铺所在的县区
- + v-model="provinceCode" + filterable + placeholder="请选择" + :disabled="isReadonly" + @change="handerChangeProvince" + > + + + +
@@ -109,7 +137,8 @@ class="item-input" v-model="form.store_longitude" clearable - :readonly="isReadonly" + :disabled="isReadonly" + disabled />
@@ -118,25 +147,48 @@ class="item-input" v-model="form.store_latitude" clearable - :readonly="isReadonly" + :disabled="isReadonly" + disabled />
店铺的详细地址
- + + + +
店铺门面正面图片
+
+
+ + 点击上传 +
只能上传jpg/png文件
+
+
+
店铺门面环境图片
+
+
+ + 点击上传 +
只能上传jpg/png文件
+
+
+
到账/结算  信息
@@ -166,14 +247,17 @@ class="item-input" v-model="form.split_ratio" clearable - :readonly="isReadonly" + :disabled="isReadonly" >
-
结算类型:{{ form.settlement_method > 0 ? "次日结算" : "秒到" }}
- +
+ + 秒到 + 次日结算 +
@@ -185,7 +269,8 @@ class="item-input" v-model="entityType[form.entity_type - 1]" clearable - :readonly="isReadonly" + :disabled="isReadonly" + disabled > @@ -198,7 +283,7 @@ class="item-input" v-model="form.legal_person_name" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -209,7 +294,7 @@ class="item-input" v-model="form.biz_license_company" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -221,7 +306,7 @@ v-model="form.biz_license_number" style="width: 600px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -233,7 +318,7 @@ v-model="form.biz_license_period_begin" style="width: 600px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -245,13 +330,14 @@ v-model="form.biz_license_period_end" style="width: 600px" clearable - :readonly="isReadonly" + :disabled="isReadonly" >
-
+
营业执照图片
+
+
+ + 点击上传 +
只能上传jpg/png文件
+
+
+
经营范围
-
+
许可证图片
- + + + + + + +
+
+ + + + + +
+
+
+ +
@@ -317,7 +477,7 @@ v-model="form.legal_person_name" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" >
@@ -329,7 +489,7 @@ v-model="form.legal_person_mobile" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -341,7 +501,7 @@ v-model="form.legal_person_id_number" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -353,7 +513,7 @@ v-model="form.legal_person_id_addr" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -365,7 +525,7 @@ v-model="form.legal_person_id_period_begin" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -377,34 +537,68 @@ v-model="form.legal_person_id_period_end" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" >
法人身份证正面图片
- +
+ +
+ + 点击上传 +
只能上传jpg/png文件
+
+
+
法人身份证反面图片
- +
+ +
+ + 点击上传 +
只能上传jpg/png文件
+
+
+
@@ -417,7 +611,7 @@ v-model="form.individual_id_name" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -429,7 +623,7 @@ v-model="form.individual_id_number" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -441,7 +635,7 @@ v-model="form.individual_id_addr" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -453,7 +647,7 @@ v-model="form.individual_id_period_begin" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -465,7 +659,7 @@ v-model="form.individual_id_period_end" style="width: 300px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -505,7 +699,7 @@ v-model="form.bank_name" style="width: 400px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -527,7 +721,7 @@ v-model="form.account_holder_name" style="width: 400px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -539,7 +733,7 @@ v-model="form.account_number" style="width: 400px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -552,7 +746,7 @@ v-model="form.lkl_ec_no" style="width: 400px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > @@ -564,7 +758,7 @@ v-model="form.contract_download_url" style="width: 400px" clearable - :readonly="isReadonly" + :disabled="isReadonly" > {{ downloading ? '下载中...' : '下载合同' }} @@ -795,6 +989,7 @@ 取消 + @@ -808,12 +1003,33 @@ import { createSubAccount, checkShopName, } from '@/api/shopAudit/shopAudit' + +import { batchNoApi, imgOcrResultApi } from "@/api/upload"; + +import { + getBaiduSuggestion +} from "@/api/baidu/baidu.js" + import { GetCategoryList } from '@/api/base/store/category' import city from './cityData.js' import config from './formConfig' import { color } from 'echarts' import { copy } from 'clipboard' import { getAreaJSON } from '@/utils/static' +import { URL } from '@/config' +import { mapGetters } from 'vuex' +import { getToken } from '@/utils/token' +import { compressImage } from "@/utils/file"; + + +const orcImgTypeConf = { + FR_ID_CARD_FRONT: "FR_ID_CARD_FRONT", + FR_ID_CARD_BEHIND: "FR_ID_CARD_BEHIND", + ID_CARD_FRONT: "ID_CARD_FRONT", + ID_CARD_BEHIND: "ID_CARD_BEHIND", + BUSINESS_LICENCE: "BUSINESS_LICENCE", + BANK_CARD: "BANK_CARD", +}; export default { props: { @@ -853,7 +1069,7 @@ export default { biz_license_content:'', license_type: 1, license_number: '', - license_image: '', + license_image: [], legal_person_name: '', legal_person_mobile: '', legal_person_id_number: '', @@ -880,7 +1096,9 @@ export default { has_apply_mer:'' ,// 是否进件成功,1-是;2-否; has_apply_split:'',// 是否申请分账业务,1-是;2-否; has_apply_receiver:'',// 是否申请创建分账接收方,1-是;2-否;, - has_bind_receiver:''// 是否是否绑定分账接收方,1-是;2-否; + has_bind_receiver:'',// 是否是否绑定分账接收方,1-是;2-否; + other_license_list:[], + other_license_list_2:[] }, entityType: ['企业', '个人'], approvalStatus:[ @@ -915,7 +1133,20 @@ export default { color:'red' }, ], - licenseType: ['许可证', '特许证件', '其他证件'], + licenseType: [ + { + id: 1, + name: "许可证", + }, + { + id: 2, + name: "特许证件", + }, + { + id: 3, + name: "其他证件", + }, + ], storeStatus : ['已创建','未创建'], signedStatus: [ { @@ -966,12 +1197,32 @@ export default { sourceFormData:{}, isShopNamePass:true, areaData:[], + areaCode:"", cityData:[], + cityCode:"", provinceData:[], - + provinceCode:"", + time:null, + searchAddressList:[], + loadingBaiduSuggestion:false, + front_facade_image:[], + environment_image:[], + uploadUrl: URL.action, + uploadParams: { + authorization: "", + gallery_id: 0, + }, + loadingPage:false, + orcTimeout:null, + orcLoading:{}, + dialogImageUrl: '', + dialogVisible: false, + dialogImageUrlList:[], + } }, computed: { + isReadonly(){ return this.form.approval_status == 1 && this.form.has_apply_mer == 1 }, @@ -1051,14 +1302,21 @@ export default { }, }, }, + created() { + this.uploadParams.authorization = getToken() + + console.log(this.uploadParams) + }, methods: { async getMerchDetail() { this.showLoading = true let res = await getMerchDetail({ id: this.id }) if (res && res.status == 200) { - this.form = res.data - + this.form = {...this.form,...res.data} + if(!this.form.other_license_list){ + this.form.other_license_list = [] + } if (res.data) { let item = this.signedStatus.find( (item) => item.index == res.data.signed_status @@ -1087,20 +1345,66 @@ export default { this.form.biz_license_period_end = '长期' } + //深拷贝原始数据 + + this.showLoading = false + await this.getCategoryList(); + const areaData = await getAreaJSON() + + if(this.form.store_district){ + let storeDistrict = this.form.store_district.split("/") + if(storeDistrict[0]){ + this.areaCode = Number(storeDistrict[0]) + } + if(storeDistrict[1]){ + this.cityCode = Number(storeDistrict[1]); + } + + if(storeDistrict[2]){ + this.provinceCode = Number(storeDistrict[2]) + } + } + + if (areaData) { + this.areaData = this.formatAreaData(areaData[0]['provinces']) + console.log(this.areaData) + } if(this.form.store_area){ let areaArr = this.form.store_area.split('/'); + if(areaArr[0]){ this.form.province_nmae = areaArr[0] } - + if(areaArr[1]){ this.form.city_name = areaArr[1] + + const cityData = this.areaData.find((item)=>{ + if(item.id == this.areaCode){ + return item + } + }) + + if(cityData && cityData.citys){ + this.cityData = cityData.citys + console.log(this.cityData) + } } if(areaArr[2]){ this.form.county_name = areaArr[2] + + const provinceData = this.cityData.find(item=>{ + if(item.id == this.cityCode){ + return item + } + }) + + if(provinceData && provinceData.districts){ + this.provinceData = provinceData.districts + } } } @@ -1132,25 +1436,24 @@ export default { this.srcList2.push(res.data.environment_image) this.srcList3.push(res.data.biz_license_image) - if (res.data.license_image) { - this.srcList4 = res.data.license_image.split(',') - this.form.license_image = this.srcList4 + if (res.data.other_license_list) { + + this.form.other_license_list_2 = res.data.other_license_list.map((item)=>{ + return { + name:item.img, + url:item.img, + } + }) + } this.srcList5.push(res.data.legal_person_id_images) this.srcList6.push(res.data.legal_person_id_images2) this.srcList7.push(res.data.individual_id_images) this.srcList8.push(res.data.individual_id_images2) + + this.sourceFormData = JSON.parse(JSON.stringify(this.form)); } - //深拷贝原始数据 - this.sourceFormData = JSON.parse(JSON.stringify(this.form)); - this.showLoading = false - await this.getCategoryList(); - const areaData = await getAreaJSON() - if (areaData) { - this.areaData = this.formatAreaData(areaData[0]['provinces']) - console.log(this.areaData) - } }, formatAreaData(data){ let provinces = [] @@ -1166,6 +1469,7 @@ export default { pid: item.id, id: iCity.id, name: iCity.name, + districts:iCity.districts } citys.push(city) }) @@ -1189,7 +1493,7 @@ export default { message: '下载完成,请注意浏览器右上角下载', type: 'success', }) - + }, // 从URL中提取文件名 getFileNameFromUrl(url) { @@ -1216,7 +1520,7 @@ export default { // 如果有子分类,递归查找 if (category.children && category.children.length > 0) { - const foundInChildren = findCategoryName(category.children, targetId); + const foundInChildren = this.findCategoryName(category.children, targetId); if (foundInChildren) { return foundInChildren; } @@ -1475,6 +1779,332 @@ export default { this.isShopNamePass = false } } + }, + handerChangeArea(e){ + this.areaCode = e; + this.cityCode = ''; + this.provinceCode = '' + this.cityData = []; + this.provinceData = []; + this.form.store_address = ""; + this.form.store_longitude = ""; + this.form.store_latitude = ""; + + const areaData = this.areaData.find((item)=>{ + if(item.id == this.areaCode){ + return item + } + }) + if(areaData && areaData.citys){ + this.cityData = areaData.citys + this.form.province_nmae = areaData.name + + console.log(this.form.province_nmae) + } + }, + handerChangeCity(e){ + this.provinceData = []; + this.provinceCode = "" + this.form.store_address = ""; + this.form.store_longitude = ""; + this.form.store_latitude = ""; + this.cityCode = e + const cityData = this.cityData.find(item=>{ + if(item.id == this.cityCode){ + return item + } + }) + + if(cityData && cityData.districts){ + this.provinceData = cityData.districts + this.form.city_name = cityData.name + + console.log( this.form.city_name) + } + }, + handerChangeProvince(e){ + this.provinceCode = e; + this.form.store_address = ""; + this.form.store_longitude = ""; + this.form.store_latitude = ""; + const districtsItem = this.provinceData.find(item=>{ + if(item.id == this.provinceCode){ + return item + } + }) + if(districtsItem){ + this.county_name = districtsItem.name + } + }, + handerGetBaiduSuggestion(e){ + if(e == ""){ + return + } + + this.loadingBaiduSuggestion = true + let params = { + query:e, + region:this.form.city_name, + city_limit:true, + ret_coordtype: "gcj02ll", + } + clearTimeout(this.time); + this.time = setTimeout(async () => { + let res = await getBaiduSuggestion(params); + if (res && res.status == 0) { + this.searchAddressList = res.result + .filter((item) => "location" in item) + .map((item) => { + let obj = { + ...item, + name: item.name, + detailedInformation: item.address + ? item.address.replace(/-/g, "") + : item.name, + }; + return obj; + }); + + } + this.loadingBaiduSuggestion = false; + }, 600); + + + }, + handerChangeStoreAddress(e,index){ + this.form.store_address = this.form.province_nmae + this.form.city_name + this.form.county_name + e.name ; + this.form.store_longitude = e.location.lng; + this.form.store_latitude = e.location.lat; + }, + beforeUpload(file){ + const isJPG = file.type === 'image/jpeg'; + const isPNG = file.type === 'image/png'; + const isLt2M = file.size / 1024 / 1024 < 2; + if (!isJPG && !isPNG) { + ElMessage.error('上传的图片必须是JPG或PNG格式!'); + // this.orcLoading.close() + return false; + } + if (!isLt2M) { + ElMessage.error('上传的图片大小不能超过2MB!'); + return false; + } + return true; + }, + progressUpload(){ + this.orcLoading = this.$loading({ + lock: true, + text: 'Loading', + spinner: 'el-icon-loading', + background: 'rgba(0, 0, 0, 0.7)' + }); + }, + async handleAvatarSuccess(response, file, fileList, type){ + + if (response && response.status === 200 && response.code === 0) { + if (response.data && response.data.media_url) { + if(type != 'license_image'){ + this.form[type] = response.data.media_url + }else{ + this.form[type].push(response.data.media_url) + } + switch (type) { + case 'front_facade_image': + this.srcList1 = [response.data.media_url]; + break; + case 'environment_image': + this.srcList2 = [response.data.media_url]; + break; + case 'biz_license_image': + this.srcList3 = [response.data.media_url]; + var res = await this.getBatchNo(file.raw, orcImgTypeConf.BUSINESS_LICENCE); + if(res){ + this.handleOcrText(res.batchNo, type); + } + break; + case 'license_image': + this.form.other_license_list_2.push({ + name:response.data.media_url, + url:response.data.media_url + }) + + this.form.other_license_list.push({ + type:1, + number:"", + img:response.data.media_url + }) + + console.log(this.form.other_license_list) + + // debugger; + // const imrArr = [] + // imrArr.push(response.data.media_url) + // imrArr = [...this.form.license_image,...imrArr] + // this.form.license_image = imrArr.map((item)=>{ + // return { + // name:item, + // url:item + // } + // }) + // this.dialogImageUrlList = imrArr; + // console.log(this.form.license_image) + + break; + case 'legal_person_id_images': + this.srcList5 = [response.data.media_url]; + var res = await this.getBatchNo(file.raw, orcImgTypeConf.FR_ID_CARD_FRONT); + this.handleOcrText(res.batchNo, type); + break; + case 'legal_person_id_images2': + this.srcList6 = [response.data.media_url]; + var res = await this.getBatchNo( + file.raw, + orcImgTypeConf.FR_ID_CARD_BEHIND + ); + + this.handleOcrText(res.batchNo, type); + break; + case 'front_facade_image': + this.srcList7 = [response.data.media_url]; + break; + case 'front_facade_image': + this.srcList8 = [response.data.media_url]; + break; + } + } + } + + }, + async getBatchNo(file, type){ + + file = await compressImage(file); + const rsp = await batchNoApi(file, type).then((res) => { + return res; + }); + + if (rsp && rsp.status == 200) { + return rsp?.data; + } else { + return null; + } + }, + async handleOcrText (batchNo, imgType) { + switch (imgType) { + case "biz_license_image": + var res = await this.getOcrText( + batchNo, + orcImgTypeConf.BUSINESS_LICENCE + ); + console.log("biz_license_image", res); + this.form.biz_license_company = res.bizLicenseCompanyName; + this.form.legal_person_name = res.bizLicenseOwnerName; + this.form.biz_license_number = res.bizLicenseCreditCode; + this.form.account_holder_name = res.bizLicenseCompanyName; + this.form.biz_license_content = res.bizLicenseScope; + break; + case "legal_person_id_images": + var res = await this.getOcrText( + batchNo, + orcImgTypeConf.FR_ID_CARD_FRONT + ); + + console.log("legal_person_id_images", res); + this.form.legal_person_id_number = res.idNumber; + this.form.legal_person_id_addr = res.address; + break; + case "legal_person_id_images2": + var res = await this.getOcrText( + batchNo, + orcImgTypeConf.FR_ID_CARD_BEHIND + ); + var validity = res.validity.split("-"); + + console.log("legal_person_id_images2", res); + this.form.legal_person_id_period_begin = validity[0]; + + if (validity[1] != "长期") { + this.form.legal_person_id_period_end = validity[1]; + } else { + this.form.legal_person_id_period_end = "9999-12-31"; + } + break; + case "individual_id_images": + var res = await this.getOcrText( + batchNo, + orcImgTypeConf.ID_CARD_FRONT + ); + + console.log("individual_id_images", res); + this.form.individual_id_name = res.name; + this.form.account_holder_name = res.name; + this.form.individual_id_number = res.idNumber; + this.form.individual_id_addr = res.address; + break; + case "individual_id_images2": + var res = await this.getOcrText( + batchNo, + orcImgTypeConf.ID_CARD_BEHIND + ); + + var validity = res.validity.split("-"); + + console.log("individual_id_images2", res); + this.form.individual_id_period_begin = validity[0]; + + if (validity[1] != "长期") { + this.form.individual_id_period_end = validity[1]; + } else { + this.form.individual_id_period_end = "9999-12-31"; + } + break; + case "bank_image": + var res = await this.getOcrText(batchNo, orcImgTypeConf.BANK_CARD); + console.log("bank_image", res); + this.form.account_number = res.card_number; + break; + } + this.orcLoading.close() + }, + async getOcrText(batchNo, type){ + return new Promise(async (resolve, reject) => { + let formData = new FormData(); + + formData.append("batchNo", batchNo); + formData.append("imgType", type); + clearTimeout(this.orcTimeout); + + this.orcTimeout = setTimeout(async () => { + const imgOcrRes = await imgOcrResultApi(formData); + formData = null; + clearTimeout(this.orcTimeout); + + if (imgOcrRes.status != 200) { + reject(imgOcrRes?.data); + } else { + resolve(imgOcrRes?.data); + } + }, 2000); + }); + }, + handleUploadChange(file, fileList){ + // this.form.license_image = fileList; + + // console.log(this.form.license_image) + }, + handerRemoveUpload(file, fileList){ + this.form.other_license_list_2 = fileList; + this.form.other_license_list = this.form.other_license_list.filter(item => item.img != file.url); + }, + handleExceed(){ + this.$message.error('许可证图片数量最多为5张'); + }, + handlePictureCardPreview(file){ + this.dialogImageUrl = file.url || file.raw?.url || file.response?.data?.media_url; + if (!this.dialogImageUrl) { + console.error('无法获取图片URL'); + return; + } + this.dialogVisible = true; } }, } @@ -1571,5 +2201,53 @@ export default { .audit-steps{ margin: 100px auto; } + + .upload-btn{ + margin: 10px 20px; + // margin-right: 20px; + text-align: right; + } + + .avatar-uploader .el-upload { + border: 1px dashed #d9d9d9; + border-radius: 6px; + cursor: pointer; + position: relative; + overflow: hidden; + width: 178px; + height: 178px; + } + .avatar-uploader .el-upload:hover { + border-color: #409EFF; + } + + .el-upload-list__item{ + width: 178px; + height: 178px; + } + + .avatar-uploader-icon { + font-size: 28px; + color: #8c939d; + width: 178px; + height: 178px; + line-height: 178px; + text-align: center; + } + .avatar { + width: 178px; + height: 178px; + display: block; + } + + .other_license_list{ + display: flex; + } + + .other_license_list_item{ + display: flex; + flex-flow: column; + width: 187px; + } } \ No newline at end of file