1101 lines
30 KiB
Vue
1101 lines
30 KiB
Vue
<template>
|
||
<div class="signUp-container">
|
||
|
||
<div class="steps-container">
|
||
<div class="tit">
|
||
<el-result
|
||
:icon="auditInfo.approval_status==1 ? 'success' : [3,5].includes(auditInfo.approval_status) ? 'warning' : 'error' "
|
||
:title="auditInfo?.approval_remark"
|
||
:sub-title="auditInfo.approval_status==1 ? '现在去商家端看看吧~' : [3,5].includes(auditInfo.approval_status) ? '预计3-5个工作日哦~' : '请填写以下资料重新提交审核' "
|
||
>
|
||
</el-result>
|
||
</div>
|
||
</div>
|
||
|
||
<div class="form-submit">
|
||
<el-form
|
||
:model="applyFormData"
|
||
ref="formRef"
|
||
label-width="160px"
|
||
v-loading.fullscreen.lock="loading"
|
||
element-loading-text="数据加载中..."
|
||
element-loading-background="rgba(0,0,0,.75)"
|
||
>
|
||
<el-form-item
|
||
:label="item.label"
|
||
:prop="item.key"
|
||
v-for="(item, index) in formItemData"
|
||
:key="index"
|
||
>
|
||
|
||
<el-input
|
||
v-if="item.type == 'input'"
|
||
v-model="applyFormData[item.key]"
|
||
:placeholder="item.placeholder"
|
||
/>
|
||
|
||
<el-input
|
||
:rows="5"
|
||
type="textarea"
|
||
v-if="item.type == 'textarea'"
|
||
v-model="applyFormData[item.key]"
|
||
:placeholder="item.placeholder"
|
||
/>
|
||
|
||
<el-date-picker
|
||
v-if="item.type == 'datepicker'"
|
||
v-model="applyFormData[item.key]"
|
||
type="date"
|
||
:placeholder="item.placeholder"
|
||
/>
|
||
|
||
<template v-if="item.type == 'select' && item.key=='mapAddress'">
|
||
<el-cascader
|
||
style="marginright: 5px"
|
||
v-model="applyFormData.map_address"
|
||
:options="cascaderOptions2"
|
||
@change="handleChange"
|
||
/>
|
||
<el-autocomplete
|
||
v-if="applyFormData.map_address"
|
||
style="width: 180px"
|
||
v-model="applyFormData.position"
|
||
placeholder="试试搜索,快速填写地址"
|
||
:fetch-suggestions="querySearch"
|
||
value-key="value"
|
||
:options="autocompleteOptions"
|
||
@select="handleSelect"
|
||
>
|
||
<template #default="{ item }">
|
||
<div class="auto-item" v-if="item">
|
||
<div>
|
||
<p>{{ item.name }}</p>
|
||
</div>
|
||
<div>
|
||
<span>{{ item.address }}</span>
|
||
</div>
|
||
</div>
|
||
</template>
|
||
</el-autocomplete>
|
||
</template>
|
||
|
||
<el-select-v2
|
||
v-if="(item.type == 'select' && item.key=='bank_name') || item.key=='bank_branch_name'"
|
||
clearable
|
||
filterable
|
||
remote
|
||
:remote-method="bankListRemoteMethod"
|
||
@change="bankListChange"
|
||
v-model="applyFormData[item.key]"
|
||
placeholder="搜索银行名称"
|
||
placement="top-start"
|
||
:options="bankList2"
|
||
>
|
||
<template #prefix>
|
||
<el-icon>
|
||
<Search />
|
||
</el-icon>
|
||
</template>
|
||
</el-select-v2>
|
||
|
||
<el-cascader
|
||
v-if="item.type == 'select' && item.key=='biz_category'"
|
||
v-model="applyFormData[item.key]"
|
||
:placeholder="item.placeholder"
|
||
:options="cascaderOptions"
|
||
:show-all-levels="false"
|
||
@change="handleChangeBizCategory"
|
||
clearable
|
||
/>
|
||
|
||
<el-select
|
||
v-if="item.type == 'select' && item.key=='license_type'"
|
||
v-model="applyFormData[item.key]"
|
||
placeholder="请选择类型"
|
||
clearable
|
||
>
|
||
<el-option
|
||
v-for="item in optionsPermitType"
|
||
:key="item.value"
|
||
:label="item.label"
|
||
:value="item.value"
|
||
>
|
||
</el-option>
|
||
</el-select>
|
||
|
||
<el-upload
|
||
v-if="item.type == 'upload'"
|
||
ref="uploadRef"
|
||
:limit="1"
|
||
list-type="picture-card"
|
||
:auto-upload="true"
|
||
:on-preview="handlePictureCardPreview"
|
||
v-model="applyFormData[item.key]"
|
||
:on-remove="
|
||
(file, fileList) =>
|
||
handleRemove(file, fileList, item.key)
|
||
"
|
||
:on-success="
|
||
(response, file, fileList) =>
|
||
handleUploadSuccess(
|
||
response,
|
||
file,
|
||
fileList,
|
||
item.key
|
||
)
|
||
"
|
||
:on-error="handleUploadError"
|
||
:before-upload="beforeUpload"
|
||
:action="uploadUrl"
|
||
name="upfile"
|
||
:class="{
|
||
'upload-hidden': isUploadHidden(item.key),
|
||
}"
|
||
>
|
||
<el-icon class="avatar-uploader-icon">
|
||
<Plus />
|
||
</el-icon>
|
||
</el-upload>
|
||
</el-form-item>
|
||
</el-form>
|
||
</div>
|
||
|
||
<div class="form-button">
|
||
<el-button type="primary" @click="merchToApply" class="custom-button"
|
||
>重新审核</el-button
|
||
>
|
||
</div>
|
||
|
||
<el-dialog v-model="dialogVisible" width="max-content">
|
||
<img w-full :src="dialogImageUrl" alt="Preview Image" />
|
||
</el-dialog>
|
||
</div>
|
||
</template>
|
||
|
||
<script lang="ts" setup>
|
||
import { ref, reactive, onMounted, watch } from "vue";
|
||
import { ElMessage } from "element-plus";
|
||
import { Plus,Search } from "@element-plus/icons-vue";
|
||
|
||
import cityData from "../../stores/cityData";
|
||
import type { CityDataStructure } from "../../stores/cityData";
|
||
import { useUserStore } from "@/stores/userStore";
|
||
|
||
import {
|
||
GetStoreCategories,
|
||
transformStoreCategories,
|
||
GetPostion,
|
||
GetBank,
|
||
merchApply,
|
||
re_apply,
|
||
GetAppDistrict,
|
||
GetAuditInfo
|
||
} from "@/api/login";
|
||
import { batchNoApi, imgOcrResultApi } from "@/api/upload";
|
||
import config from "./formConfig";
|
||
|
||
interface Bank {
|
||
id: number;
|
||
bank_name: string;
|
||
}
|
||
|
||
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",
|
||
};
|
||
|
||
const userStore = useUserStore();
|
||
|
||
const processData = () => {
|
||
const { provinceData, cityData: cityList, areaData } = cityData;
|
||
return provinceData.map((province, provinceIndex) => {
|
||
const provinceItem = {
|
||
...province,
|
||
children: cityList[provinceIndex].map((city, cityIndex) => {
|
||
const cityItem = {
|
||
...city,
|
||
};
|
||
if (areaData[provinceIndex] && areaData[provinceIndex][cityIndex]) {
|
||
cityItem.children = areaData[provinceIndex][cityIndex];
|
||
}
|
||
return cityItem;
|
||
}),
|
||
};
|
||
return provinceItem;
|
||
});
|
||
};
|
||
|
||
const active = ref(1);
|
||
const loading = ref(false);
|
||
const formRef = ref(null);
|
||
const dialogVisible = ref(false);
|
||
const dialogImageUrl = ref("");
|
||
const bankNameSearchText = ref("");
|
||
const selectedValue = ref([]);
|
||
const value = ref([]);
|
||
const cascaderOptions = ref([]);
|
||
const cascaderOptions2 = ref(processData());
|
||
const cityData2 = ref<CityDataStructure>();
|
||
const cascaderOptions3 = ref();
|
||
//hover触发选择
|
||
const cascaderProps = ref({
|
||
value: "value",
|
||
label: "label",
|
||
children: "children",
|
||
expandTrigger: "hover" as const,
|
||
});
|
||
const bankList2 = ref([]);
|
||
|
||
let orcTimeout = 0;
|
||
let currentFile = ref(null);
|
||
let currentBbatchNo = ref('');
|
||
|
||
const handleChangeBizCategory = (value) => {
|
||
if (value && value.length === 2) {
|
||
const [bizCategoryId, bizSecondCategoryId] = value;
|
||
applyFormData.biz_category = bizCategoryId;
|
||
applyFormData.biz_second_category = bizSecondCategoryId;
|
||
}
|
||
};
|
||
const currentBankItem = reactive(null);
|
||
const applyFormData = reactive({
|
||
bank_name: "",
|
||
bank_district: "",
|
||
bank_area: "",
|
||
openning_bank_code: "",
|
||
clearing_bank_code: "",
|
||
bank_branch_name: "",
|
||
account_number: "",
|
||
account_holder_name: "",
|
||
biz_category: null,
|
||
biz_license_company: "",
|
||
biz_license_image: "",
|
||
biz_license_number: "",
|
||
biz_second_category: null,
|
||
biz_license_content: "",
|
||
city_id: null,
|
||
contact_name: "",
|
||
county_id: null,
|
||
entity_type: 1,
|
||
environment_image: "",
|
||
front_facade_image: "",
|
||
individual_id_images: "",
|
||
individual_id_images2: "",
|
||
individual_id_number: "",
|
||
individual_id_addr: "",
|
||
individual_id_period_begin: "",
|
||
individual_id_period_end: "",
|
||
legal_person_id_images: "",
|
||
legal_person_id_images2: "",
|
||
legal_person_id_number: "",
|
||
legal_person_mobile: "",
|
||
legal_person_name: "",
|
||
legal_person_id_addr: "",
|
||
legal_person_id_period_begin: "",
|
||
legal_person_id_period_end: "",
|
||
license_image: [],
|
||
license_number: "",
|
||
license_type: "",
|
||
login_mobile: localStorage.getItem("mobilePhone"),
|
||
province_id: null,
|
||
store_address: "",
|
||
map_address: "",
|
||
position: "",
|
||
store_latitude: null,
|
||
store_longitude: null,
|
||
store_name: "",
|
||
mapAddressLabel: "",
|
||
license_imageToString: "",
|
||
store_area: "",
|
||
user_status: "",
|
||
bank_image: "",
|
||
email: "",
|
||
});
|
||
const license_type = ref('1')
|
||
const optionsPermitType = [
|
||
{
|
||
value: "1",
|
||
label: "无需特殊资质",
|
||
},
|
||
{
|
||
value: "2",
|
||
label: "需许可证资质",
|
||
},
|
||
{
|
||
value: "3",
|
||
label: "需特许证件资质",
|
||
},
|
||
];
|
||
const rules = reactive({
|
||
contact_name: [
|
||
{ required: true, message: "请输入联系人姓名", trigger: "blur" },
|
||
],
|
||
biz_category: [
|
||
{ required: true, message: "请选择经营品类", trigger: "change" },
|
||
],
|
||
store_name: [{ required: true, message: "请输入门店名称", trigger: "blur" }],
|
||
map_address: [
|
||
{ required: true, message: "请选择地图地址", trigger: "change" },
|
||
],
|
||
// position: [{ required: true, message: "请选择地图地址", trigger: "change" }],
|
||
store_address: [
|
||
{ required: true, message: "请输入详细地址", trigger: "blur" },
|
||
],
|
||
front_facade_image: [
|
||
{ required: true, message: "请上传门脸图", trigger: ["change", "blur"] },
|
||
],
|
||
environment_image: [
|
||
{ required: true, message: "请上传环境图", trigger: ["change", "blur"] },
|
||
],
|
||
entity_type: [{ required: true, message: "请主体类型", trigger: "change" }],
|
||
// license_type: [{ required: true, message: "请选择许可证类型", trigger: "change" }],
|
||
// license_number: [{ required: true, message: "请输入许可证编号", trigger: "blur" }],
|
||
biz_license_number: [
|
||
{ required: true, message: "请输入注册号", trigger: "blur" },
|
||
],
|
||
biz_license_company: [
|
||
{ required: true, message: "请输入公司名称", trigger: "blur" },
|
||
],
|
||
legal_person_name: [
|
||
{ required: true, message: "请输入法人姓名", trigger: "blur" },
|
||
],
|
||
legal_person_mobile: [
|
||
{ required: true, message: "请输入法人手机号", trigger: "blur" },
|
||
],
|
||
legal_person_id_number: [
|
||
{ required: true, message: "请输入法人身份证号", trigger: "blur" },
|
||
],
|
||
biz_license_image: [
|
||
{ required: true, message: "请上传营业执照", trigger: "change" },
|
||
],
|
||
// license_image: [{ required: true, message: '请上传许可证', trigger: 'change' }],
|
||
legal_person_id_images: [
|
||
{ required: true, message: "请上传法人身份证正面", trigger: "change" },
|
||
],
|
||
legal_person_id_images2: [
|
||
{ required: true, message: "请上传法人身份证反面", trigger: "change" },
|
||
],
|
||
individual_id_number: [
|
||
{ required: true, message: "请输入个人身份证号", trigger: "blur" },
|
||
],
|
||
individual_id_images: [
|
||
{ required: true, message: "请上传个人身份证正面", trigger: "change" },
|
||
],
|
||
individual_id_images2: [
|
||
{ required: true, message: "请上传个人身份证反面", trigger: "change" },
|
||
],
|
||
bank_branch_name: [
|
||
{ required: true, message: "请选择银行", trigger: "change" },
|
||
],
|
||
// bank_branch_name: [{ required: true, message: '请输入支行名称', trigger: 'blur' }],
|
||
account_number: [
|
||
{ required: true, message: "请输入银行卡号", trigger: "blur" },
|
||
],
|
||
account_holder_name: [
|
||
{ required: true, message: "请输入开户名称", trigger: "blur" },
|
||
],
|
||
});
|
||
const formItemData = ref([]);
|
||
let auditInfo = ref({
|
||
approval_status: 0,
|
||
created_at: "2099-02-17 09:25:53",
|
||
approval_remark: "",
|
||
approval_invalid_col: [],
|
||
});
|
||
const formConfig = reactive(JSON.parse(JSON.stringify(config.formConfig)));
|
||
|
||
const handleGetAuditInfo = async () => {
|
||
const res = (await GetAuditInfo({
|
||
mobile: localStorage.getItem("mobilePhone"),
|
||
})) as any;
|
||
|
||
let arr = JSON.parse(res.data.approval_invalid_col);
|
||
let legal_person_card = ['legal_person_id_addr','legal_person_id_period_begin','legal_person_id_period_end']
|
||
let individual_id_card = ['individual_id_addr','individual_id_period_begin','individual_id_period_end']
|
||
|
||
// arr = arr.concat(legal_person_card).concat(individual_id_card).concat(['biz_license_content'])
|
||
|
||
if(res.data.entity_type==1){
|
||
arr = arr.filter(item=>(!individual_id_card.includes(item)))
|
||
} else if(res.data.entity_type==2){
|
||
arr = arr.filter(item=>(!legal_person_card.includes(item)))
|
||
}
|
||
|
||
const arr2 = formConfig.reduce((acc, item) => {
|
||
if (arr.includes(item.key)) {
|
||
acc.push(item);
|
||
}
|
||
return acc;
|
||
}, []);
|
||
|
||
auditInfo.value = { ...res.data, approval_invalid_col: arr };
|
||
formItemData.value = arr2.sort((a,b)=>(a.sort-b.sort));
|
||
};
|
||
|
||
const handleMerchApply = async () => {
|
||
const {
|
||
bank_name,
|
||
bank_district,
|
||
bank_area,
|
||
openning_bank_code,
|
||
clearing_bank_code,
|
||
account_number,
|
||
account_holder_name,
|
||
biz_category,
|
||
biz_license_company,
|
||
biz_license_image,
|
||
biz_license_number,
|
||
biz_second_category,
|
||
city_id,
|
||
contact_name,
|
||
county_id,
|
||
entity_type,
|
||
environment_image,
|
||
front_facade_image,
|
||
individual_id_images,
|
||
individual_id_images2,
|
||
individual_id_number,
|
||
legal_person_id_images,
|
||
legal_person_id_images2,
|
||
legal_person_id_number,
|
||
legal_person_mobile,
|
||
legal_person_name,
|
||
license_image,
|
||
license_number,
|
||
license_type,
|
||
login_mobile,
|
||
province_id,
|
||
store_address,
|
||
store_latitude,
|
||
store_longitude,
|
||
store_name,
|
||
store_area,
|
||
biz_license_content,
|
||
legal_person_id_addr,
|
||
legal_person_id_period_begin,
|
||
legal_person_id_period_end,
|
||
individual_id_addr,
|
||
individual_id_period_begin,
|
||
individual_id_period_end,
|
||
} = applyFormData;
|
||
const res = await re_apply({
|
||
id: auditInfo.value.id,
|
||
bank_name,
|
||
bank_district,
|
||
bank_area,
|
||
openning_bank_code,
|
||
clearing_bank_code,
|
||
account_number,
|
||
account_holder_name,
|
||
biz_category,
|
||
biz_license_company,
|
||
biz_license_image,
|
||
biz_license_number,
|
||
biz_second_category,
|
||
city_id,
|
||
contact_name,
|
||
county_id,
|
||
entity_type,
|
||
environment_image,
|
||
front_facade_image,
|
||
individual_id_images,
|
||
individual_id_images2,
|
||
individual_id_number,
|
||
legal_person_id_images,
|
||
legal_person_id_images2,
|
||
legal_person_id_number,
|
||
legal_person_mobile,
|
||
legal_person_name,
|
||
license_image,
|
||
license_number,
|
||
license_type,
|
||
login_mobile,
|
||
province_id,
|
||
store_address: store_area.replace(/\//g, "") + store_address,
|
||
store_latitude,
|
||
store_longitude,
|
||
store_name,
|
||
store_area,
|
||
biz_license_content,
|
||
legal_person_id_addr,
|
||
legal_person_id_period_begin,
|
||
legal_person_id_period_end,
|
||
individual_id_addr,
|
||
individual_id_period_begin,
|
||
individual_id_period_end,
|
||
});
|
||
if(res.status==200&&res.code==0){
|
||
ElMessage.success("资料已提交~")
|
||
handleGetAuditInfo();
|
||
}
|
||
};
|
||
|
||
const checkForm = async () => {
|
||
const isValid = await (formRef.value as any).validate((valid) => {
|
||
return valid;
|
||
});
|
||
|
||
if(applyFormData.entity_type==2 && !applyFormData.bank_image){
|
||
ElMessage.error("请上传银行卡")
|
||
return
|
||
}
|
||
|
||
if (isValid) {
|
||
handleMerchApply()
|
||
}
|
||
};
|
||
|
||
const next = () => {
|
||
if (active.value < 3) {
|
||
active.value++;
|
||
window.scrollTo({
|
||
top: 0, //回到顶部
|
||
left: 0,
|
||
behavior: "smooth",
|
||
});
|
||
}
|
||
};
|
||
const pre = () => {
|
||
if (active.value > 1) {
|
||
active.value--;
|
||
window.scrollTo({
|
||
top: 0, //回到顶部
|
||
left: 0,
|
||
behavior: "smooth",
|
||
});
|
||
}
|
||
};
|
||
|
||
const getLabel = (field: string, limit: number) => {
|
||
const labels = {
|
||
front_facade_image: "门脸图",
|
||
environment_image: "环境图",
|
||
biz_license_image: "营业执照",
|
||
license_image: "许可证",
|
||
legal_person_id_images: "法人身份证正面",
|
||
legal_person_id_images2: "法人身份证反面",
|
||
individual_id_images: "个人身份证正面",
|
||
individual_id_images2: "个人身份证反面",
|
||
};
|
||
|
||
if (field === "license_image") {
|
||
return `${labels[field]}(${applyFormData[field].length}/${limit})`;
|
||
} else {
|
||
const count = applyFormData[field] ? 1 : 0;
|
||
return `${labels[field]}(${count}/${limit})`;
|
||
}
|
||
};
|
||
|
||
const showAll = () => {
|
||
applyFormData.license_imageToString = applyFormData.license_image
|
||
.map((url) => `${url}`)
|
||
.join(",");
|
||
};
|
||
|
||
const merchToApply = async () => {
|
||
console.log("formdata", applyFormData);
|
||
// showAll();
|
||
checkForm();
|
||
};
|
||
|
||
const bankListChange = (val) => {
|
||
const item = bankList2.value.find((item) => item.value == val);
|
||
if (item) {
|
||
applyFormData.bank_name = item.label;
|
||
applyFormData.bank_district = item.district;
|
||
applyFormData.bank_area = item.area;
|
||
applyFormData.openning_bank_code = item.branch_bank_no;
|
||
applyFormData.clearing_bank_code = item.clear_no;
|
||
}
|
||
};
|
||
|
||
const bankListRemoteMethod = (val) => {
|
||
if (!val) {
|
||
bankList2.value = [];
|
||
return;
|
||
}
|
||
|
||
GetBank({
|
||
keyword: val, // 银行名称关键字,小地方支行,查不到,调整关键字范围,尝试市级银行
|
||
pageNum: 1,
|
||
pageSize: 2000,
|
||
}).then((res) => {
|
||
if (res.status == 200) {
|
||
bankList2.value = res.data.items.map((item) => {
|
||
return {
|
||
district: item.district,
|
||
area: item.area,
|
||
branch_bank_no: item.branch_bank_no,
|
||
clear_no: item.clear_no,
|
||
label: item.branch_bank_name,
|
||
value: item.branch_bank_no,
|
||
};
|
||
});
|
||
}
|
||
});
|
||
};
|
||
|
||
const handleChange = (value) => {
|
||
// 假设 cascader 的值是一个数组,格式为 [省份ID, 城市ID, 区县ID]
|
||
console.log(11, value);
|
||
|
||
if (value && value.length === 3) {
|
||
const [provinceId, cityId, countyId] = value;
|
||
applyFormData.province_id = provinceId;
|
||
applyFormData.city_id = cityId;
|
||
applyFormData.county_id = countyId;
|
||
}
|
||
|
||
const names = value.map((id, level) => {
|
||
const findName = (options, targetId) => {
|
||
for (const item of options) {
|
||
if (item.value === targetId) {
|
||
return item.label;
|
||
}
|
||
if (item.children) {
|
||
const childName = findName(item.children, targetId);
|
||
if (childName) return childName;
|
||
}
|
||
}
|
||
return "";
|
||
};
|
||
|
||
return findName(cascaderOptions2.value, id);
|
||
});
|
||
|
||
const str = names?.join("/");
|
||
|
||
applyFormData.mapAddressLabel = str;
|
||
applyFormData.store_area = str;
|
||
formRef.value.validate();
|
||
};
|
||
|
||
const autocompleteOptions = ref([]);
|
||
const querySearch = async (queryString, cb) => {
|
||
if (!queryString) {
|
||
cb([]);
|
||
return;
|
||
}
|
||
|
||
try {
|
||
const params = {
|
||
query: queryString,
|
||
region: applyFormData.mapAddressLabel,
|
||
city_limit: true,
|
||
ret_coordtype: "gcj02ll",
|
||
};
|
||
|
||
const res = await GetPostion(params);
|
||
|
||
if (res?.result?.length) {
|
||
const results = res.result
|
||
.filter((item) => "location" in item)
|
||
.map((item) => ({
|
||
value: item.name, // 确保有 value 属性
|
||
label: item.name, // 确保有 label 属性
|
||
name: item.name,
|
||
address: item.address || "", // 确保 address 属性存在
|
||
lat: item.location?.lat || "", // 确保 lat 属性存在
|
||
lng: item.location?.lng || "", // 确保 lng 属性存在
|
||
}));
|
||
cb(results);
|
||
} else {
|
||
ElMessage.error("搜索失败");
|
||
cb([]);
|
||
}
|
||
} catch (error) {
|
||
ElMessage.error("搜索失败");
|
||
cb([]);
|
||
}
|
||
};
|
||
|
||
const handleSelect = (item) => {
|
||
applyFormData.position = "";
|
||
applyFormData.store_address = item.value;
|
||
applyFormData.store_latitude = item.lat;
|
||
applyFormData.store_longitude = item.lng;
|
||
formRef.value.validate();
|
||
};
|
||
|
||
const beforeUpload = (file) => {
|
||
const isJPG = file.type === "image/jpeg";
|
||
const isPNG = file.type === "image/png";
|
||
const isLt2M = file.size / 1024 / 1024 < 2;
|
||
|
||
loading.value = true;
|
||
|
||
if (!isJPG && !isPNG) {
|
||
loading.value = false;
|
||
ElMessage.error("上传的图片必须是JPG或PNG格式!");
|
||
return false;
|
||
}
|
||
if (!isLt2M) {
|
||
loading.value = false;
|
||
ElMessage.error("上传的图片大小不能超过2MB!");
|
||
return false;
|
||
}
|
||
return true;
|
||
};
|
||
|
||
const uploadUrl = ref("https://mall.gpxscs.cn/mobile/shop/oss/upload");
|
||
|
||
const handleRemove = (file, fileList, field) => {
|
||
if (field === "license_image") {
|
||
const removedUrl = file.url;
|
||
applyFormData[field] = applyFormData[field].filter(
|
||
(url) => url !== removedUrl
|
||
);
|
||
} else {
|
||
applyFormData[field] = "";
|
||
}
|
||
};
|
||
|
||
const isUploadHidden = (field: string) => {
|
||
const limits = {
|
||
license_image: 5,
|
||
};
|
||
const limit = limits[field] || 1;
|
||
|
||
if (field === "license_image") {
|
||
return applyFormData[field].length >= limit;
|
||
} else {
|
||
return applyFormData[field] !== "" && applyFormData[field] != null;
|
||
}
|
||
};
|
||
|
||
const handleExceed = (files, fileList) => {
|
||
ElMessage.warning(`最多只能上传1张图片`);
|
||
};
|
||
|
||
const handlePictureCardPreview = (uploadFile) => {
|
||
dialogImageUrl.value = uploadFile.url!;
|
||
dialogVisible.value = true;
|
||
};
|
||
|
||
const getBatchNo = async (file, type) => {
|
||
loading.value = true;
|
||
const rsp = await batchNoApi(file, type).then((res) => {
|
||
return res;
|
||
});
|
||
loading.value = false;
|
||
if (rsp.status == 200) {
|
||
return rsp?.data;
|
||
} else {
|
||
return null;
|
||
}
|
||
};
|
||
|
||
const getOcrText = async (batchNo, type) => {
|
||
return new Promise(async (resolve, reject) => {
|
||
let formData: null | FormData = new FormData();
|
||
|
||
formData.append("batchNo", batchNo);
|
||
formData.append("imgType", type);
|
||
|
||
clearTimeout(orcTimeout);
|
||
|
||
orcTimeout = setTimeout(async () => {
|
||
const imgOcrRes = await imgOcrResultApi(formData);
|
||
|
||
formData = null;
|
||
clearTimeout(orcTimeout);
|
||
|
||
if (imgOcrRes.status != 200) {
|
||
reject(imgOcrRes?.data);
|
||
} else {
|
||
resolve(imgOcrRes?.data);
|
||
}
|
||
loading.value = false;
|
||
}, 2000);
|
||
});
|
||
};
|
||
|
||
const handleOcrText = async (batchNo, imgType) => {
|
||
loading.value = true;
|
||
|
||
switch (imgType) {
|
||
case "biz_license_image":
|
||
var res = (await getOcrText(batchNo, orcImgTypeConf.BUSINESS_LICENCE)) as any;
|
||
|
||
console.log("biz_license_image", res);
|
||
applyFormData.biz_license_company = res.bizLicenseCompanyName;
|
||
applyFormData.legal_person_name = res.bizLicenseOwnerName;
|
||
applyFormData.biz_license_number = res.bizLicenseCreditCode;
|
||
applyFormData.account_holder_name = res.bizLicenseCompanyName;
|
||
applyFormData.biz_license_content = res.bizLicenseScope;
|
||
break;
|
||
case "legal_person_id_images":
|
||
var res = (await getOcrText(batchNo, orcImgTypeConf.ID_CARD_FRONT)) as any;
|
||
|
||
console.log("legal_person_id_images", res);
|
||
applyFormData.legal_person_id_number = res.idNumber;
|
||
applyFormData.legal_person_id_addr = res.address;
|
||
break;
|
||
case "legal_person_id_images2":
|
||
var res = (await getOcrText(
|
||
batchNo,
|
||
orcImgTypeConf.ID_CARD_BEHIND
|
||
)) as any;
|
||
var validity = res.validity.split('-')
|
||
|
||
console.log("legal_person_id_images2", res);
|
||
applyFormData.legal_person_id_period_begin = validity[0];
|
||
|
||
if(validity[1]!='长期'){
|
||
applyFormData.legal_person_id_period_end = validity[1];
|
||
} else {
|
||
applyFormData.legal_person_id_period_end = "9999-12-31"
|
||
}
|
||
break;
|
||
case "individual_id_images":
|
||
var res = (await getOcrText(
|
||
batchNo,
|
||
orcImgTypeConf.FR_ID_CARD_FRONT
|
||
)) as any;
|
||
|
||
console.log("individual_id_images", res);
|
||
applyFormData.individual_id_number = res.idNumber;
|
||
applyFormData.individual_id_addr = res.address;
|
||
break;
|
||
case "individual_id_images2":
|
||
var res = (await getOcrText(
|
||
batchNo,
|
||
orcImgTypeConf.ID_CARD_BEHIND
|
||
)) as any;
|
||
|
||
var validity = res.validity.split('-')
|
||
|
||
console.log("individual_id_images2", res);
|
||
applyFormData.individual_id_period_begin = validity[0];
|
||
|
||
if(validity[1]!='长期'){
|
||
applyFormData.individual_id_period_end = validity[1];
|
||
} else {
|
||
applyFormData.individual_id_period_end = "9999-12-31"
|
||
}
|
||
break;
|
||
case "bank_image":
|
||
var res = (await getOcrText(batchNo, orcImgTypeConf.BANK_CARD)) as any;
|
||
console.log("bank_image", res);
|
||
applyFormData.account_number = res.card_number;
|
||
break;
|
||
}
|
||
|
||
loading.value = false;
|
||
formRef.value.validate()
|
||
};
|
||
|
||
const handleUploadSuccess = async (response, file, fileList, field) => {
|
||
if (response && response.status === 200 && response.code === 0) {
|
||
if (response.data && response.data.url) {
|
||
file.url = response.data.url;
|
||
|
||
if (field === "license_image") {
|
||
applyFormData[field].push(file.url);
|
||
} else {
|
||
applyFormData[field] = file.url;
|
||
}
|
||
loading.value = false;
|
||
currentFile.value = file.raw;
|
||
|
||
switch (field) {
|
||
case "biz_license_image":
|
||
var res = await getBatchNo(file.raw, orcImgTypeConf.BUSINESS_LICENCE);
|
||
currentBbatchNo.value = res.batchNo
|
||
handleOcrText(res.batchNo, field)
|
||
break;
|
||
case "legal_person_id_images":
|
||
var res = await getBatchNo(file.raw, orcImgTypeConf.ID_CARD_FRONT);
|
||
currentBbatchNo.value = res.batchNo
|
||
handleOcrText(res.batchNo, field)
|
||
break;
|
||
case "legal_person_id_images2":
|
||
var res = await getBatchNo(file.raw, orcImgTypeConf.ID_CARD_BEHIND);
|
||
currentBbatchNo.value = res.batchNo;
|
||
handleOcrText(res.batchNo, field);
|
||
break;
|
||
case "individual_id_images":
|
||
var res = await getBatchNo(file.raw, orcImgTypeConf.FR_ID_CARD_FRONT);
|
||
currentBbatchNo.value = res.batchNo;
|
||
handleOcrText(res.batchNo, field);
|
||
break;
|
||
case "individual_id_images2":
|
||
var res = await getBatchNo(file.raw, orcImgTypeConf.ID_CARD_BEHIND);
|
||
currentBbatchNo.value = res.batchNo;
|
||
handleOcrText(res.batchNo, field);
|
||
break;
|
||
case "bank_image":
|
||
var res = await getBatchNo(file.raw, orcImgTypeConf.BANK_CARD);
|
||
currentBbatchNo.value = res.batchNo
|
||
handleOcrText(res.batchNo, field)
|
||
break;
|
||
}
|
||
} else {
|
||
ElMessage.error("文件上传成功,但未返回文件 URL");
|
||
loading.value = false;
|
||
}
|
||
} else {
|
||
ElMessage.error(response.msg || "文件上传失败");
|
||
loading.value = false;
|
||
}
|
||
|
||
formRef.value.validate()
|
||
};
|
||
|
||
const handleUploadError = (error, file) => {
|
||
loading.value = false;
|
||
ElMessage.error("文件上传失败");
|
||
};
|
||
const clearOtherFields = () => {
|
||
// if (applyFormData.entity_type === 1) {
|
||
// // 清空个人部分的字段
|
||
// applyFormData.individual_id_number = "";
|
||
// applyFormData.individual_id_images = "";
|
||
// applyFormData.individual_id_images2 = "";
|
||
// } else if (applyFormData.entity_type === 2) {
|
||
// // 清空企业部分的字段
|
||
// applyFormData.license_type = "1";
|
||
// applyFormData.license_number = "";
|
||
// applyFormData.biz_license_number = "";
|
||
// applyFormData.biz_license_company = "";
|
||
// applyFormData.legal_person_name = "";
|
||
// applyFormData.legal_person_mobile = "";
|
||
// applyFormData.legal_person_id_number = "";
|
||
// applyFormData.biz_license_image = "";
|
||
// applyFormData.license_image = [];
|
||
// applyFormData.legal_person_id_images = "";
|
||
// applyFormData.legal_person_id_images2 = "";
|
||
// }
|
||
};
|
||
|
||
onMounted(() => {
|
||
// bankListRemoteMethod();
|
||
|
||
handleGetAuditInfo();
|
||
|
||
GetStoreCategories()
|
||
.then((res) => {
|
||
if (res.code === 0 && res.status === 200) {
|
||
cascaderOptions.value = transformStoreCategories(res.data);
|
||
} else {
|
||
}
|
||
})
|
||
.catch((err) => {
|
||
ElMessage.error("获取店铺分类失败");
|
||
});
|
||
|
||
GetAppDistrict()
|
||
.then((res) => {
|
||
if (res.code === 0 && res.status === 200) {
|
||
cityData2.value = res.data;
|
||
console.log(cascaderOptions3.value);
|
||
} else {
|
||
ElMessage.error("获取银行失败");
|
||
}
|
||
})
|
||
.catch((err) => {
|
||
ElMessage.error("获取银行失败");
|
||
});
|
||
});
|
||
</script>
|
||
|
||
<style lang="scss" scoped>
|
||
:deep(.el-upload--picture-card),
|
||
:deep(.el-upload-list__item) {
|
||
width: 96px;
|
||
height: 96px;
|
||
text-align: center;
|
||
flex-direction: column;
|
||
color: #666;
|
||
line-height: 20px;
|
||
}
|
||
|
||
.signUp-container {
|
||
display: flex;
|
||
padding-top: 12px;
|
||
flex-direction: column;
|
||
align-items: center;
|
||
justify-content: center;
|
||
background: #eee;
|
||
|
||
.tit {
|
||
font-size: 16px;
|
||
margin-bottom: 15px;
|
||
:deep(.el-result){
|
||
padding: 0;
|
||
}
|
||
}
|
||
|
||
.steps-container {
|
||
width: 1000px;
|
||
padding: 15px;
|
||
border-radius: 5px;
|
||
background: #fff;
|
||
margin-bottom: 12px;
|
||
}
|
||
|
||
:deep(.upload-hidden .el-upload--picture-card) {
|
||
display: none;
|
||
}
|
||
|
||
.form-submit {
|
||
width: 1000px;
|
||
padding: 15px;
|
||
border-radius: 5px;
|
||
background: #fff;
|
||
margin-bottom: 12px;
|
||
|
||
// :deep(.el-form) {
|
||
// max-width: 100% !important;
|
||
// }
|
||
|
||
.from_box {
|
||
// width: 100%;
|
||
padding: 15px;
|
||
margin: 0 0 12px;
|
||
border-radius: 5px;
|
||
background: #fff;
|
||
}
|
||
}
|
||
|
||
.form-button {
|
||
width: 100%;
|
||
text-align: center;
|
||
padding: 20px;
|
||
background: #fff;
|
||
}
|
||
}
|
||
|
||
.auto-item {
|
||
p {
|
||
font-size: 15px;
|
||
font-weight: 900;
|
||
}
|
||
|
||
span {
|
||
font-size: 10px;
|
||
}
|
||
}
|
||
|
||
@media (max-width: 768px) {
|
||
.el-cascader-menu {
|
||
width: 120px;
|
||
min-width: 120px;
|
||
}
|
||
|
||
.signUp-container {
|
||
.steps-container {
|
||
width: 100%;
|
||
}
|
||
|
||
.form-submit {
|
||
width: 100%;
|
||
}
|
||
}
|
||
}
|
||
</style>
|