可信代码库-企业认证相关接口对接
This commit is contained in:
@@ -326,3 +326,36 @@ export function acceptHistoryDelete(params): catchRt<any> {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function addEnterprise(params) {
|
||||||
|
return request({
|
||||||
|
url: `enterprise/add`,
|
||||||
|
method: 'post',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function uploadImage(file: File) {
|
||||||
|
const formData = new FormData();
|
||||||
|
formData.append('file', file);
|
||||||
|
|
||||||
|
return request({
|
||||||
|
url: `enterprise/uploadPackage`,
|
||||||
|
method: 'post',
|
||||||
|
data: formData,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'multipart/form-data',
|
||||||
|
Authorization: 'Bearer ' + localStorage.getItem('access_token')
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// return axios.request({
|
||||||
|
// url: '/gateway/detect' + `/enterprise/uploadPackage`,
|
||||||
|
// method: 'POST',
|
||||||
|
// data: formData,
|
||||||
|
// headers: {
|
||||||
|
// 'Content-Type': 'multipart/form-data',
|
||||||
|
// Authorization: 'Bearer ' + localStorage.getItem('access_token')
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|||||||
@@ -60,3 +60,18 @@ export function getGroupmemberinviteApi(params: { groupId: number }): Promise<Un
|
|||||||
params,
|
params,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fetchEnterpriseDetail(id) {
|
||||||
|
return request({
|
||||||
|
url: `enterprise/detail/${id}`,
|
||||||
|
method: 'get',
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export function addEnterprise(params) {
|
||||||
|
return request({
|
||||||
|
url: `enterprise/add`,
|
||||||
|
method: 'post',
|
||||||
|
data: params,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|||||||
@@ -5,27 +5,40 @@
|
|||||||
<div class="text-[14px] w-full flex items-center justify-between">
|
<div class="text-[14px] w-full flex items-center justify-between">
|
||||||
<div class="font-bold mb-[16px]">基础信息</div>
|
<div class="font-bold mb-[16px]">基础信息</div>
|
||||||
<div>
|
<div>
|
||||||
<!-- <d-icon style="margin-right: 4px;color: rgb(61, 204, 166)" v-if="!isEdit" class="font-normal" name="right-o" operable @click="editIconClick">-->
|
<d-icon style="margin-right: 4px;color: rgb(245, 152, 51)" v-if="!userInfo.enterpriseId" class="font-normal" name="warning-o" operable>
|
||||||
<!-- <template #suffix>-->
|
|
||||||
<!-- <span>已认证</span>-->
|
|
||||||
<!-- </template>-->
|
|
||||||
<!-- </d-icon>-->
|
|
||||||
<d-icon style="margin-right: 4px;color: rgb(245, 152, 51)" v-if="!isEdit" class="font-normal" name="warning-o" operable @click="editIconClick">
|
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span>未认证</span>
|
<span>未认证</span>
|
||||||
</template>
|
</template>
|
||||||
</d-icon>
|
</d-icon>
|
||||||
<!-- <d-icon style="margin-right: 4px;color: rgb(249, 95, 91)" v-if="!isEdit" class="font-normal" name="error-o" operable @click="editIconClick">-->
|
<d-icon v-if="userInfo.enterpriseId&&enterpriseDetail?.auditStatus===1" style="margin-right: 4px;color: rgb(61, 204, 166)" class="font-normal" name="right-o" operable>
|
||||||
<!-- <template #suffix>-->
|
<template #suffix>
|
||||||
<!-- <span>驳回</span>-->
|
<span>已认证</span>
|
||||||
<!-- </template>-->
|
</template>
|
||||||
<!-- </d-icon>-->
|
</d-icon>
|
||||||
<!-- <d-icon style="margin-right: 4px;color: rgb(254, 204, 85)" v-if="!isEdit" class="font-normal" name="warning-o" operable @click="editIconClick">-->
|
<d-icon v-if="userInfo.enterpriseId&&enterpriseDetail?.auditStatus===2" style="margin-right: 4px;color: rgb(249, 95, 91)" class="font-normal" name="error-o" operable>
|
||||||
<!-- <template #suffix>-->
|
<template #suffix>
|
||||||
<!-- <span>审核中</span>-->
|
<span>驳回</span>
|
||||||
<!-- </template>-->
|
</template>
|
||||||
<!-- </d-icon>-->
|
</d-icon>
|
||||||
<d-icon v-if="!isEdit" class="font-normal" style="margin-right: 4px" name="classroom-post-results-large" operable @click="showModal">
|
|
||||||
|
<div v-if="userInfo.enterpriseId&&enterpriseDetail?.auditStatus===0" style="display: inline-block">
|
||||||
|
<d-popover trigger="hover" :position="['bottom']">
|
||||||
|
<template #content>
|
||||||
|
<div>
|
||||||
|
<div>企业名称: {{enterpriseDetail?.enterpriseName || '--'}}</div>
|
||||||
|
<div>企业官网: {{enterpriseDetail?.website || '--'}}</div>
|
||||||
|
<div>营业执照: <img style="display: inline-block" width="80" v-if="enterpriseDetail?.businessLicenseUrl" :src="enterpriseDetail?.businessLicenseUrl"/></div>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
<d-icon style="margin-right: 4px;color: rgb(254, 204, 85)" class="font-normal" name="warning-o" operable>
|
||||||
|
<template #suffix>
|
||||||
|
<span>审核中</span>
|
||||||
|
</template>
|
||||||
|
</d-icon>
|
||||||
|
</d-popover>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<d-icon v-if="!userInfo.enterpriseId" class="font-normal" style="margin-right: 4px" name="classroom-post-results-large" operable @click="showModal">
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<span>申请企业认证</span>
|
<span>申请企业认证</span>
|
||||||
</template>
|
</template>
|
||||||
@@ -240,7 +253,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</d-modal>
|
</d-modal>
|
||||||
|
|
||||||
<QyrzModal ref="qyrzRef"/>
|
<QyrzModal @refresh="queryUserInfo" ref="qyrzRef"/>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
@@ -253,7 +266,7 @@ import {
|
|||||||
deleteOrganizationMemberApi, getGroupjoinedListApi,
|
deleteOrganizationMemberApi, getGroupjoinedListApi,
|
||||||
getOrganizationMemberListApi,
|
getOrganizationMemberListApi,
|
||||||
inviteOrganizationMemberApi,
|
inviteOrganizationMemberApi,
|
||||||
updateOrganizationInfoApi,getGroupmemberinviteApi
|
updateOrganizationInfoApi,getGroupmemberinviteApi,fetchEnterpriseDetail
|
||||||
} from '@/api/organizationManage/organizationManageApi';
|
} from '@/api/organizationManage/organizationManageApi';
|
||||||
import {
|
import {
|
||||||
type OrganizationInfoType,
|
type OrganizationInfoType,
|
||||||
@@ -382,6 +395,9 @@ async function queryUserInfo() {
|
|||||||
} else {
|
} else {
|
||||||
hasOrganization.value = false;
|
hasOrganization.value = false;
|
||||||
}
|
}
|
||||||
|
if (res.data?.data.data.enterpriseId) {
|
||||||
|
getEnterpriseDetail(res.data?.data.data.enterpriseId);
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
Message.error('查询用户信息失败');
|
Message.error('查询用户信息失败');
|
||||||
}
|
}
|
||||||
@@ -524,6 +540,22 @@ async function getOrgList(username) {
|
|||||||
orgListSearchLoading.value = false;
|
orgListSearchLoading.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const enterpriseDetail = ref({});
|
||||||
|
const getEnterpriseDetail = async (id) => {
|
||||||
|
try {
|
||||||
|
const response = await fetchEnterpriseDetail(id);
|
||||||
|
debugger
|
||||||
|
if (response.data.code === 200) {
|
||||||
|
enterpriseDetail.value = response.data.data;
|
||||||
|
} else {
|
||||||
|
Message.error('数据获取失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Message.error('网络请求失败');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
// 搜索处理函数(带防抖)
|
// 搜索处理函数(带防抖)
|
||||||
const handleSearch = debounce(() => {
|
const handleSearch = debounce(() => {
|
||||||
pager.pageIndex = 1; // 搜索时重置到第一页
|
pager.pageIndex = 1; // 搜索时重置到第一页
|
||||||
@@ -546,7 +578,6 @@ function updateFilterTableList() {
|
|||||||
|
|
||||||
// 修改 updateFilterTableList 函数
|
// 修改 updateFilterTableList 函数
|
||||||
function updateFilterOrgTableList() {
|
function updateFilterOrgTableList() {
|
||||||
debugger
|
|
||||||
const queryStr = orgListSearchParam.value.trim().toLowerCase();
|
const queryStr = orgListSearchParam.value.trim().toLowerCase();
|
||||||
|
|
||||||
filterOrgList = queryStr
|
filterOrgList = queryStr
|
||||||
|
|||||||
@@ -87,7 +87,7 @@
|
|||||||
|
|
||||||
<d-row :gutter="32" class="mb-3">
|
<d-row :gutter="32" class="mb-3">
|
||||||
<d-col :span="12">
|
<d-col :span="12">
|
||||||
<d-form-item field="businessLicense" label="营业执照">
|
<d-form-item field="businessLicenseUrl" label="营业执照">
|
||||||
<div class="img-container" v-if="!showUpload">
|
<div class="img-container" v-if="!showUpload">
|
||||||
<img class="img-preview" :src="businessLicenseUrl" alt="营业执照预览" />
|
<img class="img-preview" :src="businessLicenseUrl" alt="营业执照预览" />
|
||||||
<div class="delete-img" @click="handleDel">
|
<div class="delete-img" @click="handleDel">
|
||||||
@@ -150,9 +150,15 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, nextTick } from 'vue';
|
import { ref, nextTick,defineEmits } from 'vue';
|
||||||
import NoData from '@/components/NoData/NoData.vue';
|
import NoData from '@/components/NoData/NoData.vue';
|
||||||
import { Message } from 'vue-devui';
|
import { Message } from 'vue-devui';
|
||||||
|
import { addEnterprise } from '@/api/organizationManage/organizationManageApi';
|
||||||
|
import { uploadImage } from '@/api/jyh';
|
||||||
|
import { useAccountStore } from '@/stores/user';
|
||||||
|
|
||||||
|
const { accountInfo } = useAccountStore();
|
||||||
|
const userName = accountInfo?.username
|
||||||
|
|
||||||
const visible = ref(false);
|
const visible = ref(false);
|
||||||
const formRef = ref(null);
|
const formRef = ref(null);
|
||||||
@@ -164,16 +170,14 @@ const rules = ref({
|
|||||||
applicant: [{ required: true, message: '请填写申请人', trigger: 'blur' }],
|
applicant: [{ required: true, message: '请填写申请人', trigger: 'blur' }],
|
||||||
enterpriseName: [{ required: true, message: '请填写企业名称', trigger: 'blur' }],
|
enterpriseName: [{ required: true, message: '请填写企业名称', trigger: 'blur' }],
|
||||||
creditCode: [
|
creditCode: [
|
||||||
{ required: true, message: '请填写统一信用代码', trigger: 'blur' },
|
{ required: true, message: '请填写统一信用代码', trigger: 'blur' }
|
||||||
{ pattern: /^[0-9A-Z]{18}$/, message: '统一信用代码格式不正确', trigger: 'blur' }
|
|
||||||
],
|
],
|
||||||
website: [
|
website: [
|
||||||
{ required: true, message: '请填写企业官网', trigger: 'blur' },
|
{ required: true, message: '请填写企业官网', trigger: 'blur' }
|
||||||
{ pattern: /^https?:\/\/.+$/, message: '网址格式不正确', trigger: 'blur' }
|
|
||||||
],
|
],
|
||||||
industry: [{ required: true, message: '请填写所属行业', trigger: 'blur' }],
|
industry: [{ required: true, message: '请填写所属行业', trigger: 'blur' }],
|
||||||
introduction: [{ required: true, message: '请填写企业简介', trigger: 'blur' }],
|
introduction: [{ required: true, message: '请填写企业简介', trigger: 'blur' }],
|
||||||
businessLicense: [{ required: true, message: '请上传营业执照', trigger: 'change' }],
|
businessLicenseUrl: [{ required: true, message: '请上传营业执照', trigger: 'change' }],
|
||||||
contactEmail: [
|
contactEmail: [
|
||||||
{ required: true, message: '请填写联系人邮箱', trigger: 'blur' },
|
{ required: true, message: '请填写联系人邮箱', trigger: 'blur' },
|
||||||
{ type: 'email', message: '邮箱格式不正确', trigger: 'blur' }
|
{ type: 'email', message: '邮箱格式不正确', trigger: 'blur' }
|
||||||
@@ -194,7 +198,7 @@ const newFormData = ref({
|
|||||||
website: '', // 企业官网
|
website: '', // 企业官网
|
||||||
industry: '', // 所属行业
|
industry: '', // 所属行业
|
||||||
introduction: '', // 企业简介
|
introduction: '', // 企业简介
|
||||||
businessLicense: '', // 营业执照(存储上传后的URL或ID)
|
businessLicenseUrl: '', // 营业执照(存储上传后的URL或ID)
|
||||||
contactEmail: '', // 联系人邮箱
|
contactEmail: '', // 联系人邮箱
|
||||||
contactName: '', // 联系人姓名
|
contactName: '', // 联系人姓名
|
||||||
contactPhone: '', // 联系电话
|
contactPhone: '', // 联系电话
|
||||||
@@ -206,22 +210,35 @@ const uploadOptions = ref({
|
|||||||
uri: 'https://run.mocky.io/v3/132b3ea3-23ea-436b-aed4-c43ef9d116f0',
|
uri: 'https://run.mocky.io/v3/132b3ea3-23ea-436b-aed4-c43ef9d116f0',
|
||||||
});
|
});
|
||||||
|
|
||||||
const beforeUpload = (file) => {
|
const beforeUpload = async (file) => {
|
||||||
const reader = new FileReader();
|
debugger
|
||||||
reader.onload = async () => {
|
showUpload.value = false; // 先隐藏上传区域,显示加载状态
|
||||||
showUpload.value = false;
|
|
||||||
businessLicenseUrl.value = reader.result; // 保存预览URL
|
try {
|
||||||
newFormData.value.businessLicense = reader.result; // 保存到表单数据
|
// 调用上传接口
|
||||||
await nextTick();
|
const response = await uploadImage(file[0].file);
|
||||||
};
|
if (response.data.code === 200) {
|
||||||
reader.readAsDataURL(file[0].file);
|
const imageUrl = response.data.data; // 获取上传后的图片地址
|
||||||
|
businessLicenseUrl.value = imageUrl;
|
||||||
|
newFormData.value.businessLicenseUrl = imageUrl; // 保存到表单数据
|
||||||
|
Message.success('图片上传成功');
|
||||||
|
} else {
|
||||||
|
showUpload.value = true; // 上传失败,恢复上传区域
|
||||||
|
Message.error(response.data.msg || '图片上传失败');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
showUpload.value = true; // 网络错误,恢复上传区域
|
||||||
|
Message.error('图片上传网络失败,请重试');
|
||||||
|
console.error('图片上传异常:', error);
|
||||||
|
}
|
||||||
|
|
||||||
return false; // 阻止默认上传行为
|
return false; // 阻止默认上传行为
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleDel = () => {
|
const handleDel = () => {
|
||||||
showUpload.value = true;
|
showUpload.value = true;
|
||||||
businessLicenseUrl.value = '';
|
businessLicenseUrl.value = '';
|
||||||
newFormData.value.businessLicense = ''; // 清空表单数据
|
newFormData.value.businessLicenseUrl = ''; // 清空表单数据
|
||||||
};
|
};
|
||||||
|
|
||||||
// 暴露给父组件的方法
|
// 暴露给父组件的方法
|
||||||
@@ -241,9 +258,9 @@ function open(initialData = {}) {
|
|||||||
Object.assign(newFormData.value, initialData);
|
Object.assign(newFormData.value, initialData);
|
||||||
|
|
||||||
// 如果有营业执照数据,显示预览
|
// 如果有营业执照数据,显示预览
|
||||||
if (initialData.businessLicense) {
|
if (initialData.businessLicenseUrl) {
|
||||||
showUpload.value = false;
|
showUpload.value = false;
|
||||||
businessLicenseUrl.value = initialData.businessLicense;
|
businessLicenseUrl.value = initialData.businessLicenseUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +283,7 @@ function resetForm() {
|
|||||||
website: '',
|
website: '',
|
||||||
industry: '',
|
industry: '',
|
||||||
introduction: '',
|
introduction: '',
|
||||||
businessLicense: '',
|
businessLicenseUrl: '',
|
||||||
contactEmail: '',
|
contactEmail: '',
|
||||||
contactName: '',
|
contactName: '',
|
||||||
contactPhone: '',
|
contactPhone: '',
|
||||||
@@ -280,18 +297,41 @@ function resetForm() {
|
|||||||
formRef.value?.resetFields();
|
formRef.value?.resetFields();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const emits = defineEmits(['refresh'])
|
||||||
// 提交表单
|
// 提交表单
|
||||||
const handleConfirm = () => {
|
const handleConfirm = async () => {
|
||||||
formRef.value.validate((isValid, invalidFields) => {
|
formRef.value.validate(async (isValid, invalidFields) => {
|
||||||
if (isValid) {
|
if (isValid) {
|
||||||
// 表单验证通过,处理提交逻辑
|
// 构造请求参数(过滤掉空值和非必填字段)
|
||||||
console.log('提交表单数据:', newFormData.value);
|
const requestData = {
|
||||||
|
applicant: newFormData.value.applicant,
|
||||||
|
userName: userName,
|
||||||
|
enterpriseName: newFormData.value.enterpriseName,
|
||||||
|
creditCode: newFormData.value.creditCode,
|
||||||
|
website: newFormData.value.website || undefined, // 非必填,空值转为undefined
|
||||||
|
industry: newFormData.value.industry,
|
||||||
|
introduction: newFormData.value.introduction || undefined, // 非必填
|
||||||
|
contactName: newFormData.value.contactName,
|
||||||
|
contactEmail: newFormData.value.contactEmail || undefined, // 非必填
|
||||||
|
contactPhone: newFormData.value.contactPhone,
|
||||||
|
businessLicenseUrl: newFormData.value.businessLicenseUrl,
|
||||||
|
};
|
||||||
|
|
||||||
// 这里应该调用实际的API
|
try {
|
||||||
// await submitEnterpriseData(newFormData.value);
|
// 调用新增接口
|
||||||
|
const response = await addEnterprise(requestData);
|
||||||
Message.success('提交成功');
|
if (response.data.code === 200) {
|
||||||
close();
|
Message.success('企业认证添加成功');
|
||||||
|
close(); // 关闭模态框
|
||||||
|
// 通知父组件刷新列表(可通过事件实现)
|
||||||
|
emits('refresh');
|
||||||
|
} else {
|
||||||
|
Message.error(response.data.msg || '添加失败,请重试');
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
Message.error('网络请求失败,请检查网络连接');
|
||||||
|
console.error('新增接口异常:', error);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// 显示第一个错误字段的提示
|
// 显示第一个错误字段的提示
|
||||||
const firstError = Object.values(invalidFields)[0]?.[0]?.message;
|
const firstError = Object.values(invalidFields)[0]?.[0]?.message;
|
||||||
|
|||||||
Reference in New Issue
Block a user