单位认证和单位用户接口变更

This commit is contained in:
马梓彭 2026-03-30 14:55:51 +08:00
parent 2f5581ca19
commit 6a34c1e8ff
4 changed files with 213 additions and 139 deletions

View File

@ -1,69 +1,20 @@
import { BaseApi } from '../baseApi';
import { http } from '../../utils/request';
// ==================== 商户管理 ====================
/**
* 发送验证码
* @param {Object} params - 查询参数
* @param {string} params.phone - 手机号码
*/
export const merchantSendverificationcodePost = (params) => {
return http.post('/merchant/sendverificationcode', null, { params });
};
/**
* 提交单位认证
* @param {Object} data - 认证信息
* @param {string} data.merchantName - 商户名称
* @param {string} data.creditCode - 统一信用代码
* @param {string} data.businessLicenseUrl - 营业执照URL
* @param {string} data.address - 地址
* @param {string} data.contactPhone - 联系电话
* @param {string} data.verificationCode - 验证码
*/
export const merchantSubmitcertificationPost = (data) => {
return http.post('/merchant/submitcertification', data);
};
/**
* 获取我的认证信息
* @returns {Promise<{
* id: number,
* merchantName: string,
* creditCode: string,
* bankName: string,
* accountNumber: string,
* businessLicenseUrl: string,
* contactPhone: string,
* address: string,
* auditStatus: string,
* auditRemark: string,
* status: string,
* deleteMark: boolean,
* createdUserId: number,
* createdTime: string,
* updatedUserId: number,
* updatedTime: string
* }>}
*/
export const merchantMycertificationGet = () => {
return http.get('/merchant/mycertification');
};
/**
* 商户分页查询
* @param {Object} params - 查询参数
* @param {string} [params.MerchantName] - 商户名称
* @param {string} [params.ContactPhone] - 联系电话
* @param {string} [params.AuditStatus] - 审核状态 (PendingSubmission=待提交, PendingAudit=待审核, Approved=审核通过, Rejected=驳回)
* @param {string} [params.StartTime] - 开始时间
* @param {string} [params.EndTime] - 结束时间
* @param {number} [params.PageNo] - 页码
* @param {number} [params.PageSize] - 每页条数
* @param {string} [params.merchantName] - 商户名称
* @param {string} [params.contactPhone] - 联系电话
* @param {string} [params.auditStatus] - 审核状态
* @param {string} [params.startTime] - 开始时间
* @param {string} [params.endTime] - 结束时间
* @param {number} [params.pageNo] - 页码
* @param {number} [params.pageSize] - 每页条数
*/
export const merchantPageGet = (params) => {
return http.get('/merchant/page', {params});
return http.get('/merchant/page', { params });
};
/**
@ -103,33 +54,13 @@ export const merchantDeletePost = (data) => {
return http.post('/merchant/delete', data);
};
/**
* 删除商户
* @param {Object} data - 删除参数
* @param {number} data.id - 商户ID
*/
export const merchantDeleteDelete = (data) => {
return http.delete('/merchant/delete', { data });
};
/**
* 获取商户详情
* @param {Object} params - 查询参数
* @param {number} params.id - 商户ID
*/
export const merchantDetailGet = (params) => {
return http.get('/merchant/detail', params);
};
/**
* 审核商户
* @param {Object} data - 审核参数
* @param {Array<number>} data.ids - 商户ID数组
* @param {string} data.status - 审核状态 (PendingSubmission=待提交, PendingAudit=待审核, Approved=审核通过, Rejected=驳回)
* @param {string} [data.remark] - 审核备注
*/
export const merchantAuditPost = (data) => {
return http.post('/merchant/audit', data);
return http.get('/merchant/detail', { params });
};
/**
@ -139,16 +70,6 @@ export const merchantAuditPost = (data) => {
* @param {number} data.couponId - 优惠券ID
* @param {number} data.count - 发放数量
*/
export const merchantIssuecouponPost = (data) => {
return http.post('/merchant/issuecoupon', data);
export const merchantIssueCouponPost = (data) => {
return http.post('/merchant/issueCoupon', data);
};
/**
* 修改状态
* @param {Object} data - 状态参数
* @param {number} data.id - 商户ID
* @param {string} data.status - 状态 (Enable=启用, Disable=禁用)
*/
export const merchantSetstatusPatch = (data) => {
return http.patch('/merchant/setstatus', data);
};

View File

@ -0,0 +1,81 @@
import { http } from '../../utils/request';
// ==================== 单位认证管理 ====================
/**
* 发送验证码
* @param {Object} params - 查询参数
* @param {string} params.phone - 手机号码
*/
export const merchantcertificationSendVerificationCodePost = (params) => {
return http.post('/merchantcertification/sendVerificationCode', null, { params });
};
/**
* 提交单位认证
* @param {Object} data - 认证信息
* @param {string} data.merchantName - 单位名称
* @param {string} data.creditCode - 统一社会信用代码
* @param {string} data.businessLicenseUrl - 营业执照URL
* @param {string} data.address - 地址
* @param {string} data.contactPhone - 联系电话
* @param {string} data.verificationCode - 验证码
*/
export const merchantcertificationSubmitCertificationPost = (data) => {
return http.post('/merchantcertification/submitCertification', data);
};
/**
* 获取我的认证信息
* @returns {Promise<{
* id: number,
* userId: number,
* merchantName: string,
* creditCode: string,
* businessLicenseUrl: string,
* contactPhone: string,
* address: string,
* auditStatus: string,
* auditRemark: string,
* createdTime: string,
* updatedTime: string
* }>}
*/
export const merchantcertificationMyCertificationGet = () => {
return http.get('/merchantcertification/myCertification');
};
/**
* 单位认证分页查询
* @param {Object} params - 查询参数
* @param {string} [params.merchantName] - 单位名称
* @param {string} [params.contactPhone] - 联系电话
* @param {string} [params.auditStatus] - 审核状态 (PendingAudit=待审核, Pass=通过, Reject=驳回)
* @param {string} [params.startTime] - 开始时间
* @param {string} [params.endTime] - 结束时间
* @param {number} [params.pageNo] - 页码
* @param {number} [params.pageSize] - 每页条数
*/
export const merchantcertificationPageGet = (params) => {
return http.get('/merchantcertification/page', { params });
};
/**
* 获取单位认证详情
* @param {Object} params - 查询参数
* @param {number} params.id - 认证ID
*/
export const merchantcertificationDetailGet = (params) => {
return http.get('/merchantcertification/detail', params);
};
/**
* 审核单位认证
* @param {Object} data - 审核参数
* @param {Array<number>} data.ids - 认证ID数组
* @param {string} data.status - 审核状态 (Pass=通过, Reject=驳回)
* @param {string} [data.remark] - 审核备注
*/
export const merchantcertificationAuditPost = (data) => {
return http.post('/merchantcertification/audit', data);
};

View File

@ -52,7 +52,7 @@
<script setup>
import { ref, reactive, onMounted, computed } from 'vue';
import { ElMessage } from 'element-plus';
import { merchantMycertificationGet, merchantSubmitcertificationPost, merchantSendverificationcodePost } from '/@/api/match/merchant';
import { merchantcertificationMyCertificationGet, merchantcertificationSubmitCertificationPost, merchantcertificationSendVerificationCodePost } from '/@/api/match/merchantcertification';
const formRef = ref(null);
@ -85,19 +85,20 @@ const isPhoneValid = computed(() => { const reg = /^1[3-9]\d{9}$/; return reg.te
const auditText = computed(() => {
const s = formData.auditStatus;
if (s == '0') return '未提交';
if (s == '1') return '审核中';
if (s == '2') return '审核通过';
if (s == '3') return '已驳回';
if (s === 0) return '待提交';
if (s === 1) return '待审核';
if (s === 2) return '审核通过';
if (s === 3) return '审核拒绝';
if (s === 4) return '已取消';
return s;
});
const auditTagType = computed(() => {
const s = formData.auditStatus;
if (s == '2') return 'success';
if (s == '3') return 'danger';
if (s == '1') return 'warning';
return '';
if (s === 2) return 'success';
if (s === 3) return 'danger';
if (s === 1) return 'warning';
return 'info';
});
const beforeUpload = () => {
@ -111,7 +112,7 @@ const handleUploadChange = (response) => {
const loadData = async () => {
try {
const res = await merchantMycertificationGet();
const res = await merchantcertificationMyCertificationGet();
if (!res) return;
// API likely returns data properties; handle both wrapped and direct
const data = res.data || res;
@ -136,7 +137,7 @@ const onSendCode = async () => {
sending.value = true;
sendTimer.value = 60;
try {
const res = await merchantSendverificationcodePost({ phone: formData.contactPhone });
const res = await merchantcertificationSendVerificationCodePost({ phone: formData.contactPhone });
if (!res.succeeded) return
ElMessage.success('验证码已发送');
sendInterval.value = setInterval(() => {
@ -165,7 +166,7 @@ const onSubmit = () => {
verificationCode: formData.verificationCode
};
try {
const res = await merchantSubmitcertificationPost(payload);
const res = await merchantcertificationSubmitCertificationPost(payload);
// assume API returns { succeeded, errors }
if (res && (res.succeeded || (res.code === 0))) {
ElMessage.success('提交成功');

View File

@ -1,23 +1,19 @@
<template>
<div class="system-menu-container layout-padding">
<ProTable ref="tableRef" :request-api="merchantPageGet" @selection-change="handleSelectionChange" :columns="columns" :pagination="true"
:tool-button="false" :initParams="initParam" row-key="userId">
<ProTable ref="tableRef" :request-api="merchantcertificationPageGet" @selection-change="handleSelectionChange" :columns="columns" :pagination="true"
:tool-button="false" :initParams="initParam" row-key="id">
<template #tools>
<el-popconfirm title="确认批量审核吗?" @confirm="onBatchAudit">
<template #reference>
<el-button v-auth="'user:general:audit'" size="small" type="primary"> 批量审核
</el-button>
</template>
</el-popconfirm>
</template>
<el-button v-auth="'user:general:audit'" size="small" type="primary" @click="showAuditDialog"> 批量审核
</el-button>
</template>
<template #index="scope">
{{ scope.$index + 1 }}
</template>
<template #auditStatus="scope">
<el-tag :type="statusList[scope.row.auditStatus]">
{{ scope.row.auditRemark }}
</el-tag>
</template>
<el-tag :type="getAuditStatusType(scope.row.auditStatus)">
{{ getAuditStatusText(scope.row.auditStatus) }}
</el-tag>
</template>
<template #businessLicenseUrl="scope">
<el-image style="width: 100px;" :src="scope.row.businessLicenseUrl" fit="cover"></el-image>
</template>
@ -62,6 +58,27 @@
</span>
</template>
</el-dialog>
<!-- 审核弹窗 -->
<el-dialog title="批量审核" v-model="isShowAuditDialog" width="500px">
<el-form :model="auditForm" label-width="100px">
<el-form-item label="审核状态">
<el-radio-group v-model="auditForm.status">
<el-radio :value="2">审核通过</el-radio>
<el-radio :value="3">审核拒绝</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item label="审核备注">
<el-input v-model="auditForm.remark" type="textarea" :rows="3" placeholder="请输入审核备注"></el-input>
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button @click="isShowAuditDialog = false">取消</el-button>
<el-button type="primary" @click="onSubmitAudit">确定</el-button>
</span>
</template>
</el-dialog>
</div>
</template>
@ -70,9 +87,8 @@ import { defineAsyncComponent, ref, reactive } from 'vue';
import { ElMessage, ElForm } from 'element-plus';
import { auths } from '/@/utils/authFunction';
import ProTable from '/@/components/ProTable/index.vue';
import { appuserAuditPost} from '/@/api/match/appuser';
import { eventrecordPageGet , eventrecordCertificatesGet} from '/@/api/match/eventRecord';
import { merchantPageGet} from '/@/api/match/merchant';
import { merchantcertificationPageGet, merchantcertificationAuditPost} from '/@/api/match/merchantcertification';
const initParam = ref({
refresh: true,
@ -83,6 +99,40 @@ const initParamUser = ref({
});
const statusList = ['info', 'warning', 'success', 'danger'];
const getAuditStatusText = (status) => {
switch (status) {
case 0:
return '待提交';
case 1:
return '待审核';
case 2:
return '审核通过';
case 3:
return '审核拒绝';
case 4:
return '已取消';
default:
return status;
}
};
const getAuditStatusType = (status) => {
switch (status) {
case 0:
return 'info';
case 1:
return 'warning';
case 2:
return 'success';
case 3:
return 'danger';
case 4:
return 'info';
default:
return 'info';
}
};
const columns = ref([
{ prop: 'ss', type: 'selection' },
{ prop: 'index', label: '序号', align: 'center' },
@ -90,7 +140,7 @@ const columns = ref([
{ prop: 'creditCode', label: '统一社会信用代码', search: { el: 'input' } },
{ prop: 'address', label: '地址' },
{ prop: 'phone', label: '联系电话' },
{ prop: 'contactPhone', label: '联系电话', search: { el: 'input' } },
{prop: 'businessLicenseUrl', label: '营业执照', width: '130px',},
{
prop: 'auditStatus',
@ -99,12 +149,13 @@ const columns = ref([
el: 'select',
},
enum: [
{ label: '全部', value: '' },
{ label: '未通过', value: 3 },
{ label: '已通过', value: 2 },
{ label: '未审核', value: 1 },
{ label: '未提交', value: 0 },
],
{ label: '全部', value: '' },
{ label: '审核拒绝', value: 3 },
{ label: '审核通过', value: 2 },
{ label: '待审核', value: 1 },
{ label: '待提交', value: 0 },
{ label: '已取消', value: 4 },
],
},
{
prop: 'createdTime',
@ -120,7 +171,7 @@ const columns = ref([
const tableRef = ref();
const handleSelectionChange = (val) => {
console.log(val);
selectedListIds.value = val.map((item) => item.userId);
selectedListIds.value = val.map((item) => item.id);
};
const columnsUser = ref([
@ -162,23 +213,10 @@ const isShowDialog = ref(false);
const onOpenMenu = (row) => {
console.log(row);
initParamUser.value.appUserId = row.id;
initParamUser.value.appUserId = row.userId;
isShowDialog.value = true;
};
const onBatchAudit = async () => {
console.log(selectedListIds.value);
const { succeeded, data } = await appuserAuditPost({ ids: selectedListIds.value });
if (succeeded) {
ElMessage.success('操作成功');
// initParam.value.refresh = !initParam.value.refresh;
tableRef.value.clearSelection();
tableRef.value.getTableList();
} else {
ElMessage.error(data);
}
};
const onCancelB = () => {
isShowBook.value = false;
};
@ -194,6 +232,39 @@ const lookBook = async (row) => {
}
};
// 审核弹窗相关
const isShowAuditDialog = ref(false);
const auditForm = reactive({
status: 2, // 默认审核通过
remark: ''
});
const showAuditDialog = () => {
if (selectedListIds.value.length === 0) {
ElMessage.warning('请先选择要审核的记录');
return;
}
auditForm.status = 2;
auditForm.remark = '';
isShowAuditDialog.value = true;
};
const onSubmitAudit = async () => {
console.log(selectedListIds.value);
const { succeeded, data } = await merchantcertificationAuditPost({
ids: selectedListIds.value,
status: auditForm.status,
remark: auditForm.remark
});
if (succeeded) {
ElMessage.success('操作成功');
isShowAuditDialog.value = false;
tableRef.value.clearSelection();
tableRef.value.getTableList();
} else {
ElMessage.error(data);
}
};
// 取消
const onCancel = () => {