提交 7a7bd083 作者: ZhangLingKun

功能:加盟入驻联调

上级 906de882
......@@ -75,3 +75,70 @@ export type changeUserTagType = InterFunction<
},
NonNullable<unknown>
>;
// 加盟标签列表
export type cooperationListTag = InterFunction<
NonNullable<unknown>,
{
createTime: string;
id: number;
tagDescription: string;
tagImg: string;
tagName: string;
}[]
>;
// 后台申请列表
export type listUserApplyTag = InterListFunction<
{
applyStatus?: number;
cooperationTagId?: number;
endTime?: string;
startTime?: string;
},
{
applyName: string;
applyPhone: string;
applyTime: string;
approvalStatus: number;
attachmentList: null;
cooperationTagId: number;
cooperationTagName: string;
id: number;
remark: string;
userAccountId: number;
}
>;
// 审批详情
export type applyTagDetails = InterFunction<
{
id?: number;
userAccountId?: number;
},
{
attachmentList: {
/**
* 附件类型:0:图片 1:文件
*/
type: number;
url: string;
}[];
companyName: string;
creditCode: string;
licenseImg: string;
remark: string;
}
>;
// 审批
export type approvalApplyTag = InterFunction<
{
id: number;
status: boolean;
},
NonNullable<unknown>
>;
// 强制删除
export type deleteApplyTag = InterFunction<
{
id: number;
},
NonNullable<unknown>
>;
import axios from '../request';
import {
applyTagDetails,
approvalApplyTag,
changeUserTagType,
CompanyListTag,
cooperationListTag,
deleteApplyTag,
listAppUserType,
listUserApplyTag,
userAccountUpdateType,
} from '~/api/interface/customManageType';
......@@ -19,4 +24,20 @@ export class CustomManageAPI {
// 后台设置小程序用户标签
static changeUserTag: changeUserTagType = (params) =>
axios.get('/userapp/cooperation/changeUserTag', { params });
// 加盟标签列表
static cooperationListTag: cooperationListTag = (params) =>
axios.get('/userapp/cooperation/listTag', { params });
// 后台申请列表
static listUserApplyTag: listUserApplyTag = (params) =>
axios.post('/userapp/cooperation/listUserApplyTag', params);
// 审批详情
static applyTagDetails: applyTagDetails = (params) =>
axios.get('/userapp/cooperation/applyTagDetails', { params });
// 审批
static approvalApplyTag: approvalApplyTag = (params) =>
axios.get('/userapp/cooperation/approvalApplyTag', { params });
// 强制删除
static deleteApplyTag: deleteApplyTag = (params) =>
axios.get('/userapp/cooperation/deleteApplyTag', { params });
}
......@@ -19,6 +19,7 @@ interface PropsType {
}[],
) => void; // 上传文件改变时的状态
defaultFileList?: any[]; // 默认文件列表
disabled?: boolean; // 是否禁用
}
export const Uploader: React.FC<PropsType> = (props) => {
Uploader.defaultProps = {
......@@ -29,6 +30,7 @@ export const Uploader: React.FC<PropsType> = (props) => {
// eslint-disable-next-line @typescript-eslint/no-empty-function
onChange: () => {},
defaultFileList: [],
disabled: false,
};
const {
fileType = ['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp'],
......@@ -39,6 +41,7 @@ export const Uploader: React.FC<PropsType> = (props) => {
fileLength,
onChange,
defaultFileList,
disabled,
} = props;
const [fileList, setFileList] = useState<any[]>([]);
// 上传文件配置
......@@ -124,11 +127,11 @@ export const Uploader: React.FC<PropsType> = (props) => {
return (
<div className='uploader-view'>
{listType === 'text' ? (
<Upload {...uploadProps} style={{ width: '100%' }}>
<Upload {...uploadProps} style={{ width: '100%' }} disabled={disabled}>
<>{fileList.length < (fileLength || 1) && children}</>
</Upload>
) : (
<Upload {...uploadProps} style={{ width: '100%' }}>
<Upload {...uploadProps} style={{ width: '100%' }} disabled={disabled}>
{fileList.length < (fileLength || 1) && children}
</Upload>
)}
......
.apply-detail{
position: relative;
.detail-title{
font-size: 13px;
font-weight: bold;
margin-bottom: 10px;
}
.detail-text{
width: 100%;
text-align: center;
margin: 30px 0;
}
.detail-action{
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
margin-bottom: 20px;
.ant-btn{
width: 100px;
}
.ant-btn:first-child{
margin-right: 20px;
}
}
.detail-item{
width: 100%;
display: flex;
justify-content: flex-start;
align-items: flex-start;
margin-bottom: 15px;
.item-label{
width: 100px;
font-weight: normal;
text-align: right;
box-sizing: border-box;
padding-right: 20px;
}
}
}
import { FC, useEffect, useState } from 'react';
import { Button, message, Modal } from 'antd';
import { InterDataType, InterListType, InterReqType } from '~/api/interface';
import { CustomManageAPI } from '~/api';
import {
applyTagDetails,
approvalApplyTag,
listUserApplyTag,
} from '~/api/interface/customManageType';
import './index.scss';
import { PlusOutlined } from '@ant-design/icons';
import { Uploader } from '~/components/uploader';
// 列表的类型
type DataType = InterDataType<applyTagDetails>;
// 列表的类型
type TableType = InterListType<listUserApplyTag>;
// 请求的表单类型
type ReqType = InterReqType<approvalApplyTag>;
// 传参类型
interface propType {
title: string;
open: boolean;
closed: any;
data?: TableType[0];
}
const AddEditModal: FC<propType> = (props) => {
AddEditModal.defaultProps = {
data: undefined,
};
// 参数
const { title, open, closed, data } = props;
const [applyTagDetail, setApplyTagDetail] = useState<DataType>();
// 关闭弹窗
const handleCancel = () => {
closed();
};
// 点击事件
const handleOk = async (status: boolean) => {
await handleSubmit({ id: Number(data?.id), status });
};
// 提交事件
const handleSubmit = async (values: ReqType) => {
const res = await CustomManageAPI.approvalApplyTag(values);
if (res && res.code === '200') {
message.success('操作成功');
handleCancel();
}
};
// 获取审批详情
const getApplyTagDetails = async () => {
const res = await CustomManageAPI.applyTagDetails({
id: data?.id,
userAccountId: data?.userAccountId,
});
if (res && res.code === '200') {
const { result } = res;
setApplyTagDetail(result);
}
};
// componentDidMount
useEffect(() => {
if (!open) return;
if (!data) return;
getApplyTagDetails().then();
// console.log('data --->', data);
}, [open]);
return (
<Modal open={open} title={title} onCancel={handleCancel} destroyOnClose footer={null}>
<div className='apply-detail'>
<div className='detail-text'>确定通过用户提交的加盟申请成为加盟商吗?</div>
<div className='detail-action'>
<Button type={'default'} onClick={() => handleOk(false)}>
驳回
</Button>
<Button type={'primary'} onClick={() => handleOk(true)}>
通过
</Button>
</div>
<div className='detail-title'>企业认证信息</div>
<div className='detail-item'>
<div className='item-label'>企业名称:</div>
<div className='item-value'>{applyTagDetail?.companyName || '无'}</div>
</div>
<div className='detail-item'>
<div className='item-label'>社会信用代码:</div>
<div className='item-value'>{applyTagDetail?.creditCode || '无'}</div>
</div>
<div className='detail-item'>
<div className='item-label'>工商营业执照:</div>
<div className='item-value'>
<Uploader
listType={'picture-card'}
fileUpload
fileLength={1}
fileSize={10}
fileType={['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp']}
defaultFileList={
applyTagDetail?.licenseImg ? [{ url: applyTagDetail?.licenseImg }] : []
}
disabled={true}
>
<PlusOutlined />
</Uploader>
</div>
</div>
<div className='detail-item'>
<div className='item-label'>附件信息:</div>
<div className='item-value'>
<Uploader
listType={'picture-card'}
fileUpload
fileLength={1}
fileSize={10}
fileType={['image/png', 'image/jpeg', 'image/jpg', 'image/gif', 'image/bmp']}
defaultFileList={
applyTagDetail?.attachmentList?.length
? applyTagDetail?.attachmentList.map((i) => ({ url: i.url }))
: []
}
disabled={true}
>
<PlusOutlined />
</Uploader>
</div>
</div>
<div className='detail-item'>
<div className='item-label'>备注:</div>
<div className='item-value'>{applyTagDetail?.remark || '无'}</div>
</div>
</div>
</Modal>
);
};
export default AddEditModal;
import { useEffect, useState } from 'react';
import SearchBox from '~/components/search-box';
import { CustomManageAPI } from '~/api';
import { Button, message, Modal, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { InterListType, InterReqListType } from '~/api/interface';
import { listUserApplyTag } from '~/api/interface/customManageType';
import AddEditModal from './comp/addEditModal';
// 列表类型
type TableType = InterListType<listUserApplyTag>;
// 请求的参数
type ReqType = InterReqListType<listUserApplyTag>;
// 搜索表单的数据
let query: ReqType = {};
// 审批状态
const applyStatusList = [
{ label: '待审核', value: 0 },
{ label: '已通过', value: 1 },
{ label: '不通过', value: 2 },
];
const CustomIdentityView = () => {
const { confirm } = Modal;
// 加盟列表
const [cooperationList, setCooperationList] = useState<{ label: string; value: number }[]>([]);
// 新增弹窗
const [addModalVisible, setAddModalVisible] = useState<boolean>(false);
// 需要编辑的数据
const [editData, setEditData] = useState<TableType[0]>();
// 表格数据
const [tableData, setTableData] = useState<TableType>([]);
// 表格分页配置
const [pagination, setPagination] = useState({
total: 0,
pageSize: 10,
current: 1,
totalPage: 0,
});
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await CustomManageAPI.listUserApplyTag({
pageNo: pagination.current,
pageSize: pagination.pageSize,
...value,
...query,
});
if (res && res.code === '200') {
const { list, pageNo, totalCount, pageSize, totalPage } = res.result; // 解构
setPagination({
total: totalCount,
current: pageNo,
pageSize,
totalPage,
});
setTableData(list);
}
};
// 翻页
const paginationChange = (pageNo: number, pageSize: number) => {
getTableList({ pageNo, pageSize }).then();
};
// 表单提交
const onFinish = (data: ReqType) => {
pagination.current = 1;
query = data;
getTableList(data).then();
};
// 获取加盟列表
const getCooperationList = async () => {
const res = await CustomManageAPI.cooperationListTag({});
if (res && res.code === '200') {
const list = res.result || [];
setCooperationList(list.map((i) => ({ label: i.tagName, value: i.id })));
}
};
// 删除数据
const handleDelete = (record: TableType[0]) => {
confirm({
title: '提示',
content: '是否删除该记录?',
onOk: async () => {
const res = await CustomManageAPI.deleteApplyTag({ id: record.id });
if (res && res.code === '200') {
message.success('删除成功');
paginationChange(
tableData.length === 1 ? pagination.current - 1 : pagination.current,
pagination.pageSize,
);
}
},
});
};
useEffect(() => {
getCooperationList().then();
getTableList().then();
}, []);
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: '序号',
dataIndex: 'accountNo',
align: 'center',
width: '50px',
render: (_text, _record, index) => (pagination.current - 1) * pagination.pageSize + index + 1,
},
{
title: '申请加盟类型',
dataIndex: 'cooperationTagId',
align: 'center',
render: (text) => cooperationList.find((i) => i.value === text)?.label || text,
},
{
title: '联系人',
dataIndex: 'applyName',
align: 'center',
},
{
title: '联系方式',
dataIndex: 'applyPhone',
align: 'center',
},
{
title: '申请时间',
dataIndex: 'applyTime',
align: 'center',
},
{
title: '审核状态',
dataIndex: 'approvalStatus',
align: 'center',
render: (text) => applyStatusList.find((i) => i.value === text)?.label || text,
},
{
title: '操作',
dataIndex: 'action',
align: 'center',
fixed: 'right',
width: '120px',
render: (_text, record) => (
<>
<Button
type={'link'}
onClick={() => {
setAddModalVisible(true);
setEditData(JSON.parse(JSON.stringify(record)));
}}
disabled={record.approvalStatus !== 0}
>
审批
</Button>
<Button type={'link'} danger onClick={() => handleDelete(record)}>
强制删除
</Button>
</>
),
},
];
return (
<>
<SearchBox
search={[
{
name: 'cooperationTagId',
label: '申请加盟类型',
type: 'Select',
placeholder: '请选择加盟类型',
options: cooperationList,
},
{
name: 'applyStatus',
label: '申请状态',
type: 'Select',
placeholder: '请选择申请状态',
options: applyStatusList,
},
{
name: 'rangeTime',
label: '申请时间',
type: 'rangePicker',
placeholder: '请选择开始时间和结束时间',
},
]}
searchData={onFinish}
/>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
// scroll={{ x: 1500 }}
bordered
pagination={{
total: pagination.total,
pageSize: pagination.pageSize,
current: pagination.current,
showSizeChanger: true,
showQuickJumper: true,
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
/>
<AddEditModal
open={addModalVisible}
title={editData?.id ? '审批' : '新增'}
data={editData}
closed={() => {
setAddModalVisible(false);
setEditData(undefined);
paginationChange(pagination.current, pagination.pageSize);
}}
/>
</>
);
};
export default CustomIdentityView;
......@@ -26,6 +26,7 @@ import {
DribbbleOutlined,
MessageOutlined,
AliwangwangOutlined,
AuditOutlined,
} from '@ant-design/icons';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
......@@ -100,6 +101,7 @@ import TenderManageView from '~/pages/resourceManage/tenderManage';
import TenderManageDetail from '~/pages/resourceManage/tenderManage/detail';
import TenderManageFeedback from '~/pages/resourceManage/tenderManage/feedback';
import BusinessCaseManage from '~/pages/resourceManage/businessCaseManage';
import CustomIdentityView from '~/pages/customManage/customIdentity';
// const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); //行业列表
// const IndustryDetailView = React.lazy(
......@@ -205,6 +207,15 @@ export const routerList: Array<RouteObjectType> = [
hidden: true,
},
},
{
path: '/customManage/customIdentity',
element: withLoadingComponent(<CustomIdentityView />),
meta: {
id: 26300,
title: '加盟入驻',
icon: <AuditOutlined />,
},
},
],
},
{
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论