提交 58f5f959 作者: ZhangLingKun

功能:飞手管理,飞手团队列表管理飞手

上级 94603ce8
import { InterFunction, InterItemFunction } from '~/api/interface';
import { InterFunction, InterItemFunction, InterListFunction } from '~/api/interface';
//飞手列表
type flyerItemType = {
......@@ -78,3 +78,85 @@ export type getPilotAuditSumType = InterFunction<
unAuditedPilotSum: number;
}
>;
// 后台-根据飞手电话号码查找飞手
export type selectPilotByPhoneType = InterFunction<
{
phoneNumber?: string;
},
{
abilityUrl: string;
age: number;
areaNumber: number;
auditStatus: string;
createTime: string;
id: number;
individualResume: string;
licenseNumber: number;
licenseType: string;
licenseUrl: string;
phoneNum: number;
pilotAbility: Array<{
abilityId: number;
abilityName: string;
id: number;
}>;
pilotStatus: string;
reason: number;
reasonId: number;
remark: string;
residentCity: string;
sex: number;
status: boolean;
timeOfApplication: string;
updateTime: string;
userAccountId: number;
userImg: string;
userName: number;
yearsOfWorking: number;
}
>;
// 后台-飞手团队添加飞手
export type insertPilotJoinTeamType = InterFunction<{ pilotId?: number }, NonNullable<unknown>>;
// 后台-飞手团队-查找属于飞手团队的飞手
export type selectPilotListByTeamType = InterListFunction<
{
backId?: number;
pilotStatus?: number;
},
{
abilityUrl: string;
age: number;
areaNumber: number;
auditStatus: string;
createTime: string;
id: number;
individualResume: string;
licenseNumber: number;
licenseType: string;
licenseUrl: string;
phoneNum: number;
pilotAbility: Array<{
abilityId: number;
abilityName: string;
id: number;
}>;
pilotStatus: string;
reason: number;
reasonId: number;
remark: string;
residentCity: string;
sex: number;
status: boolean;
timeOfApplication: string;
updateTime: string;
userAccountId: number;
userImg: string;
userName: number;
yearsOfWorking: number;
}
>;
// 后台-飞手团队踢飞手
export type deletePilotFromTeamType = InterFunction<{ pilotId: number }, NonNullable<unknown>>;
......@@ -4,7 +4,11 @@ import {
backListPilotType,
backListReasonType,
backPilotLogListType,
deletePilotFromTeamType,
getPilotAuditSumType,
insertPilotJoinTeamType,
selectPilotByPhoneType,
selectPilotListByTeamType,
updateAuditStatusType,
updateRemarkType,
} from '~/api/interface/flyerCenterType';
......@@ -32,4 +36,20 @@ export class FlyerCenterAPI {
// 飞手审批数据统计
static getPilotAuditSum: getPilotAuditSumType = () =>
axios.get('/userapp/pilot/getPilotAuditSum');
// 后台-根据飞手电话号码查找飞手
static selectPilotByPhone: selectPilotByPhoneType = (params) =>
axios.get('/userapp/pilot/selectPilotByPhone', { params });
// 后台-飞手团队添加飞手
static insertPilotJoinTeam: insertPilotJoinTeamType = (params) =>
axios.get('/userapp/pilot/insertPilotJoinTeam', { params });
// 后台-飞手团队-查找属于飞手团队的飞手
static selectPilotListByTeam: selectPilotListByTeamType = (params) =>
axios.post('/userapp/pilot/selectPilotListByTeam', params);
// 后台-飞手团队踢飞手
static deletePilotFromTeam: deletePilotFromTeamType = (params) =>
axios.get('/userapp/pilot/deletePilotFromTeam', { params });
}
......@@ -47,6 +47,9 @@ interface propsType {
exportEvent?: any;
baseRef?: any;
otherChild?: React.ReactNode;
isReset?: boolean;
isSearch?: boolean;
onRef?: any;
}
const Index: React.FC<propsType> = (props) => {
......@@ -62,9 +65,23 @@ const Index: React.FC<propsType> = (props) => {
exportEvent: null,
baseRef: null,
otherChild: null,
isReset: true,
isSearch: true,
};
// 表单ref
const [form] = Form.useForm();
useImperativeHandle(props.onRef, () => {
// 需要将暴露的接口返回出去
return {
handleSubmit,
handleRest,
handleRestForm,
};
});
// 重置表格
const handleRestForm = () => {
form.resetFields();
};
// 重置表格
const handleRest = () => {
form.resetFields();
......@@ -202,16 +219,20 @@ const Index: React.FC<propsType> = (props) => {
})}
{props?.search && props?.search?.length > 0 && (
<>
<Form.Item style={{ marginBottom: '10px' }}>
<Button type='primary' htmlType='submit' icon={<SearchOutlined />}>
搜索
</Button>
</Form.Item>
<Form.Item style={{ marginBottom: '10px' }}>
<Button type='primary' onClick={handleRest} icon={<ReloadOutlined />}>
重置
</Button>
</Form.Item>
{props?.isSearch && (
<Form.Item style={{ marginBottom: '10px' }}>
<Button type='primary' htmlType='submit' icon={<SearchOutlined />}>
搜索
</Button>
</Form.Item>
)}
{props?.isReset && (
<Form.Item style={{ marginBottom: '10px' }}>
<Button type='primary' onClick={handleRest} icon={<ReloadOutlined />}>
重置
</Button>
</Form.Item>
)}
{!!props.otherChild && (
<Form.Item style={{ marginBottom: '10px' }}>{props.otherChild}</Form.Item>
)}
......
......@@ -6,6 +6,7 @@ import { useEffect, useState } from 'react';
import { InterDataType, InterReqListType, PaginationProps } from '~/api/interface';
import { backPilotLogListType } from '~/api/interface/flyerCenterType';
import { useNavigate } from 'react-router-dom';
import { ArrowLeftOutlined } from '@ant-design/icons';
//日志列表返回类型
type logListType = InterDataType<backPilotLogListType>['list'];
......@@ -97,8 +98,8 @@ const FlyerAuthDaily = () => {
<SearchBox
search={searchColumns}
searchData={searchSuccess}
otherChild={
<Button type='primary' onClick={backRoute}>
child={
<Button type='primary' onClick={backRoute} icon={<ArrowLeftOutlined />}>
返回
</Button>
}
......
......@@ -67,6 +67,11 @@ const FlyerList = () => {
dataIndex: 'userName',
},
{
title: '手机号',
align: 'center',
dataIndex: 'phoneNum',
},
{
title: '执照认证状态',
align: 'center',
dataIndex: 'auditStatus',
......@@ -85,11 +90,7 @@ const FlyerList = () => {
align: 'center',
dataIndex: 'residentCity',
},
{
title: '手机号',
align: 'center',
dataIndex: 'phoneNum',
},
{
title: '申请认证时间',
align: 'center',
......@@ -212,15 +213,15 @@ const FlyerList = () => {
};
//认证日志页面
const toFlyerAuthDaily = () => {
navigate('/flyerCenter/flyerAuthDaily');
navigate('/flyerManage/flyerAuthDaily');
};
//飞手审批页面
const toFlyerApprove = (record: flyerListType[0]) => {
navigate({ pathname: '/customManage/flyerDetail', search: `id=${record.id}&isApprove=1` });
navigate({ pathname: '/flyerManage/flyerDetail', search: `id=${record.id}&isApprove=1` });
};
//飞手详情页面
const toFlyerDetail = (record: flyerListType[0]) => {
navigate({ pathname: '/customManage/flyerApprove', search: `id=${record.id}` });
navigate({ pathname: '/flyerManage/flyerApprove', search: `id=${record.id}` });
};
//修改备注
const updateRemarkClick = (record: flyerListType[0]) => {
......@@ -270,6 +271,7 @@ const FlyerList = () => {
}
/>
<Table
size={'small'}
bordered
columns={tableColumns}
dataSource={tableData}
......
import React, { FC, useState } from 'react';
import { message, Modal, ModalProps, Table, Tag } from 'antd';
import SearchBox from '~/components/search-box';
import { FlyerCenterAPI } from '~/api';
import { ColumnsType } from 'antd/es/table';
import { InterDataType, InterReqType } from '~/api/interface';
import { selectPilotByPhoneType } from '~/api/interface/flyerCenterType';
// 列表的类型
type TableType = InterDataType<selectPilotByPhoneType>[];
// 搜索表单的类型
type ReqType = InterReqType<selectPilotByPhoneType>;
// 参数
interface selfProps {
data?: any;
}
// 搜索表单的数据
let query: ReqType = {};
const AddFlyerModal: FC<ModalProps & selfProps> = ({ open, onCancel, title }) => {
// 创建子组件实例
const SearchBoxRef = React.createRef<any>();
// 表格数据
const [tableData, setTableData] = useState<TableType>([]);
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 新版通用部分(ES6+ for React) ZhangLK 2022/08/30 Start
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await FlyerCenterAPI.selectPilotByPhone({
...value,
...query,
});
if (res && res.code === '200') {
setTableData(res.result ? [res.result] : []);
// console.log('加载列表 --->', list);
} else {
message.warning(res.message);
}
};
// 表单提交
const onFinish = (data: ReqType) => {
query = data;
getTableList(data).then();
};
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 当前选中的项目
const [selectedRowsList, setSelectedRowsList] = useState<number[]>([]);
// 关闭弹窗
const handleCancel = () => {
setTableData([]);
SearchBoxRef.current.handleRestForm();
setSelectedRowsList([]);
onCancel?.({} as any);
};
// 提交数据
const handleSubmit = async () => {
if (!selectedRowsList.length) {
message.warning('请选择飞手').then();
return;
}
// 将选中的数据转换为原始数据
const list = selectedRowsList.map((i) => tableData.find((v) => v.id === i));
// 飞手id
const userAccountId = list?.at(0)?.userAccountId;
// 提交数据
const res = await FlyerCenterAPI.insertPilotJoinTeam({
pilotId: userAccountId,
});
if (res && res.code === '200') {
message.success('添加成功').then();
handleCancel();
}
// console.log('提交数据 --->', userAccountId);
};
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: 'UID',
dataIndex: 'userAccountId',
align: 'center',
},
{
title: '姓名',
align: 'center',
dataIndex: 'userName',
},
{
title: '手机号',
align: 'center',
dataIndex: 'phoneNum',
},
{
title: '能力认证',
align: 'center',
dataIndex: 'pilotAbility',
width: '20%',
render: (text) =>
text ? text.map((v: any) => <Tag key={v.abilityId}>{v.abilityName}</Tag>) : '',
},
{
title: '常驻城市',
align: 'center',
dataIndex: 'residentCity',
},
];
return (
<Modal open={open} onCancel={handleCancel} title={title} onOk={handleSubmit} width={768}>
<SearchBox
search={[
{
label: '手机号',
name: 'phoneNumber',
type: 'Input',
placeholder: '请输入飞手的手机号',
},
]}
searchData={(data: ReqType) => {
if (!data?.phoneNumber) {
message.warning('请输入飞手的手机号').then();
return;
}
onFinish(data);
}}
isReset={false}
onRef={SearchBoxRef}
/>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
// scroll={{ x: 1000 }}
bordered
rowSelection={{
type: 'radio',
selectedRowKeys: selectedRowsList,
onChange: (_selectedRowKeys: React.Key[], selectedRows: TableType) => {
setSelectedRowsList(selectedRows.map((i) => i.id));
// console.log('selectedRows --->', selectedRows);
},
}}
/>
</Modal>
);
};
export default AddFlyerModal;
import React, { useEffect, useState } from 'react';
import SearchBox from '~/components/search-box';
import { Button, message, Modal, Table, Tag } from 'antd';
import { PlusOutlined } from '@ant-design/icons';
import { InterListType, InterReqListType } from '~/api/interface';
import { ColumnsType } from 'antd/es/table';
import { FlyerCenterAPI } from '~/api';
import AddFlyerModal from '~/pages/flyerManage/flyerTeam/comp/addFlyerModal';
import { selectPilotListByTeamType } from '~/api/interface/flyerCenterType';
// 列表的类型
type TableType = InterListType<selectPilotListByTeamType>;
// 搜索表单的类型
type ReqType = InterReqListType<selectPilotListByTeamType>;
// 搜索表单的数据
let query: ReqType = {};
// 邀请状态列表
const pilotStatusList = [
{ label: '同意', value: 1 },
{ label: '拒绝', value: 2 },
{ label: '待操作', value: 0 },
];
// 组件
const FlyerTeamView = () => {
// 是否展示添加飞手弹窗
const [addEditShow, setAddEditShow] = useState(false);
// 表格数据
const [tableData, setTableData] = useState<TableType>([]);
// 表格分页配置
const [pagination, setPagination] = useState({
total: 0,
pageSize: 10,
current: 1,
totalPage: 0,
});
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 新版通用部分(ES6+ for React) ZhangLK 2022/08/30 Start
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await FlyerCenterAPI.selectPilotListByTeam({
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 || []);
// console.log('加载列表 --->', list);
} else {
message.warning(res.message);
}
};
// 翻页
const paginationChange = (pageNo: number, pageSize: number) => {
getTableList({ pageNo, pageSize }).then();
};
// 表单提交
const onFinish = (data: ReqType) => {
pagination.current = 1;
query = data;
getTableList(data).then();
};
// +++++++++++++++++++++++++++++++++++++++++++++++++++ //
// 删除事件
const handleDelete = (record: TableType[0]) => {
Modal.confirm({
title: '提示',
content: '请确认是否删除?',
onOk: async () => {
const res = await FlyerCenterAPI.deletePilotFromTeam({ pilotId: record?.userAccountId });
if (res && res.code === '200') {
message.success('删除成功').then();
paginationChange(pagination.current, pagination.pageSize);
}
},
});
};
// 页面挂载
useEffect(() => {
query = {};
(async () => {
await getTableList();
})();
}, []);
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: 'UID',
dataIndex: 'userAccountId',
align: 'center',
},
{
title: '姓名',
align: 'center',
dataIndex: 'userName',
},
{
title: '手机号',
align: 'center',
dataIndex: 'phoneNum',
},
{
title: '邀请状态',
align: 'center',
dataIndex: 'pilotStatus',
render: (text) => pilotStatusList.find((i) => i.value === text)?.label || text,
},
{
title: '能力认证',
align: 'center',
dataIndex: 'pilotAbility',
width: '20%',
render: (text) =>
text ? text.map((v: any) => <Tag key={v.abilityId}>{v.abilityName}</Tag>) : '',
},
{
title: '常驻城市',
align: 'center',
dataIndex: 'residentCity',
},
{
title: '操作',
align: 'center',
render: (_text, record) => (
<>
<Button type='link' danger onClick={() => handleDelete(record)}>
删除
</Button>
</>
),
},
];
return (
<>
<SearchBox
search={[
{
label: '邀请状态',
name: 'pilotStatus',
type: 'Select',
placeholder: '请选择邀请状态',
options: pilotStatusList,
},
]}
searchData={onFinish}
child={
<>
<Button icon={<PlusOutlined />} type={'primary'} onClick={() => setAddEditShow(true)}>
添加飞手成员
</Button>
</>
}
/>
<Table
size='small'
dataSource={tableData}
columns={columns}
rowKey='id'
// scroll={{ x: 1000 }}
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} 条数据`,
}}
/>
<AddFlyerModal
open={addEditShow}
title={'添加飞手'}
onCancel={() => {
paginationChange(pagination.current, pagination.pageSize);
setAddEditShow(false);
}}
/>
</>
);
};
export default FlyerTeamView;
......@@ -40,6 +40,8 @@ import {
FireOutlined,
InsertRowAboveOutlined,
WechatOutlined,
UsergroupAddOutlined,
ContactsOutlined,
} from '@ant-design/icons';
import { Spin } from 'antd';
......@@ -151,11 +153,9 @@ const AddInstitutionsView = React.lazy(
); //机构上传
//飞手中心
const FlyerListView = React.lazy(() => import('~/pages/customManage/flyerManage/flyerList')); //飞手列表
const FlyerAuthDailyView = React.lazy(
() => import('~/pages/customManage/flyerManage/flyerAuthDaily'),
); //飞手认证日志;
const FlyerDetailsView = React.lazy(() => import('~/pages/customManage/flyerManage/flyerDetail')); //飞手详情、飞手审批
const FlyerListView = React.lazy(() => import('src/pages/flyerManage/flyerList')); //飞手列表
const FlyerAuthDailyView = React.lazy(() => import('~/pages/flyerManage/flyerAuthDaily')); //飞手认证日志;
const FlyerDetailsView = React.lazy(() => import('src/pages/flyerManage/flyerDetail')); //飞手详情、飞手审批
// 系统管理
import AccountManageView from '~/pages/systemManage/accountManage';
......@@ -175,6 +175,7 @@ import ServiceCategoryDetail from '~/pages/categoryManage/serviceCategoryList/de
import RewardsManageView from '~/pages/activityManage/rewardsManage';
import ActivityListView from '~/pages/activityManage/activityList';
import ActivityListDetailView from '~/pages/activityManage/activityList/detail';
import FlyerTeamView from '~/pages/flyerManage/flyerTeam';
const AddressManageView = React.lazy(() => import('~/pages/systemManage/addressManage'));
// const IndustryListView = React.lazy(() => import('~/pages/mallManage/industryManage/industryList')); //行业列表
......@@ -322,17 +323,40 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path: '/customManage/flyerList',
path: '/customManage/customIdentity',
element: withLoadingComponent(<CustomIdentityView />),
errorElement: <ErrorPage />,
meta: {
id: 240,
title: '商家管理',
icon: <AuditOutlined />,
},
},
],
},
{
path: '/flyerManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
meta: {
id: 300,
icon: <ContactsOutlined />,
title: '飞手管理',
develop: true,
},
children: [
{
path: '/flyerManage/flyerList',
element: withLoadingComponent(<FlyerListView />),
errorElement: <ErrorPage />,
meta: {
id: 1810,
title: '飞手管理',
title: '飞手列表',
icon: <SolutionOutlined />,
},
},
{
path: '/customManage/flyerAuthDaily',
path: '/flyerManage/flyerAuthDaily',
element: withLoadingComponent(<FlyerAuthDailyView />),
errorElement: <ErrorPage />,
meta: {
......@@ -344,7 +368,7 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path: '/customManage/flyerDetail',
path: '/flyerManage/flyerDetail',
element: withLoadingComponent(<FlyerDetailsView />),
errorElement: <ErrorPage />,
meta: {
......@@ -356,7 +380,7 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path: '/customManage/flyerApprove',
path: '/flyerManage/flyerApprove',
element: withLoadingComponent(<FlyerDetailsView />),
errorElement: <ErrorPage />,
meta: {
......@@ -368,13 +392,14 @@ export const routerList: Array<RouteObjectType> = [
},
},
{
path: '/customManage/customIdentity',
element: withLoadingComponent(<CustomIdentityView />),
path: '/flyerManage/flyerTeam',
element: withLoadingComponent(<FlyerTeamView />),
errorElement: <ErrorPage />,
meta: {
id: 240,
title: '商家管理',
icon: <AuditOutlined />,
id: 310,
title: '飞手团队',
icon: <UsergroupAddOutlined />,
develop: true,
},
},
],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论