提交 fc671864 作者: 翁进城

Merge branch 'master' into develop

......@@ -8,6 +8,7 @@ import { CouponManageAPI } from './modules/couponManage';
import { MakeManageAPI } from './modules/makeManage';
import { CategoryManageAPI } from './modules/categoryManage';
import { SystemManageAPI } from './modules/systemManage';
import { CustomManageAPI } from './modules/customManage';
export {
CommonAPI,
......@@ -20,4 +21,5 @@ export {
MakeManageAPI,
CategoryManageAPI,
SystemManageAPI,
CustomManageAPI,
};
import { InterListFunction } from '~/api/interface';
// 客户列表
export type listAppUserType = InterListFunction<
{
companyAuthStatus?: number;
endTime?: string;
keyword?: string;
phoneNum?: string;
startTime?: string;
},
{
id: number;
accountType: number;
uid: string;
accountNo: null;
phoneNum: string;
userName: null;
nickName: string;
userImg: string;
userSex: number;
email: null;
source: null;
accountStatus: number;
remark: null;
portType: number;
createTime: string;
companyAuthStatus: number;
cooperationTagId: null;
companyName: null;
tagName: null;
}
>;
import axios from '../request';
import { listAppUserType } from '~/api/interface/customManageType';
export class CustomManageAPI {
// 客户列表
static listAppUser: listAppUserType = (params) =>
axios.post('/userapp/user-account/listAppUser', params);
}
......@@ -9,7 +9,7 @@ import './index.scss';
function Index(props: any) {
const headers: any = {
token: Cookies.get('SXTB-TOKEN'),
token: Cookies.get('SHAREFLY-TOKEN'),
};
const [form] = Form.useForm();
const [imageUrl, setImageUrl] = useState('');
......
import { Modal, Form, Input, Button, Row, Col, message } from 'antd';
import React, { useEffect, useState } from 'react';
import { PlusOutlined, MinusOutlined } from '@ant-design/icons';
import { PropsType } from '~/common/interface/modal';
import { categoryDec } from '~/api/modules/goods';
import { CategoryManageAPI } from '~/api';
interface selfPropsType {
directoryList: categoryDec[];
refreshDec: Function;
}
const AddOrEditDec: React.FC<PropsType & selfPropsType> = ({
isModalVisible,
handleOk,
handleCancel,
directoryList,
refreshDec,
}) => {
const [form] = Form.useForm<any>();
// 表单目录标题列表
const [addOrEditDirectoryList, setAddOrEditDirectoryList] = useState<categoryDec[]>([]);
// 是否点击删除按钮
const [isClickDle, setIsClickDle] = useState<boolean>(false);
useEffect(() => {
if (directoryList.length != 0 && !isClickDle) {
setAddOrEditDirectoryList(directoryList);
const defaultFormValue = directoryList.reduce((pre: any, cur: categoryDec) => {
Object.keys(cur).map((item: string) => {
if (item === 'id') {
pre[cur[item]] = cur.sortName;
}
});
return pre;
}, {});
form.setFieldsValue(defaultFormValue);
}
}, [directoryList]);
// 新增或修改目录
const addDirectoryTitle = () => {
const decList: categoryDec[] = [...addOrEditDirectoryList].sort(
(a: categoryDec, b: categoryDec) => a.id - b.id,
);
setAddOrEditDirectoryList([
...addOrEditDirectoryList,
{
id: decList[decList.length - 1].id + 1,
defaultType: 1,
sortName: '',
},
]);
};
// 删除目录
const deleteDirectory = async (id: number) => {
const bol: boolean = directoryList.some((item: categoryDec) => item.id === id);
const index = addOrEditDirectoryList.findIndex((item: categoryDec) => item.id === id);
if (bol) {
const res: any = await CategoryManageAPI.removeDirectory(id);
if (res.code === '200') {
message.success('删除成功');
setIsClickDle(true);
refreshDec(id);
} else {
return message.warning(res.message);
}
}
const obj: any = {};
obj[id] = undefined;
form.setFieldsValue(obj);
addOrEditDirectoryList.splice(index, 1);
setAddOrEditDirectoryList([...addOrEditDirectoryList]);
};
const directorySureEvent = () => {
form.validateFields().then(async (value: any) => {
const requestList = Object.keys(value).reduce((pre: any, cur: string) => {
const bol: boolean = directoryList.some((item: any) => item.id === Number(cur));
if (bol) {
pre.push({
id: Number(cur),
directoryName: value[cur],
});
} else {
pre.push({
directoryName: value[cur],
});
}
return pre;
}, []);
const res: any = await CategoryManageAPI.addOrEditDirectory(requestList);
if (res.code === '200') {
message.success('操作成功');
form.resetFields();
setIsClickDle(false);
handleOk();
} else {
message.warning(res.message);
}
});
};
const directoryCancel = () => {
form.resetFields();
setIsClickDle(false);
handleCancel();
};
return (
<Modal
title='目录管理'
open={isModalVisible}
onOk={directorySureEvent}
onCancel={directoryCancel}
>
<Form form={form} labelCol={{ span: 6 }} wrapperCol={{ span: 16 }}>
<Form.Item label='添加目录' labelCol={{ span: 4 }} wrapperCol={{ span: 16 }}>
<Button icon={<PlusOutlined />} onClick={addDirectoryTitle} />
</Form.Item>
{addOrEditDirectoryList.map((item: categoryDec) => (
<Row key={item.id} gutter={{ xs: 8, sm: 16, md: 24 }}>
<Col span={16}>
<Form.Item
label='目录名称'
name={item.id}
rules={[{ required: true, message: '请输入目录名称' }]}
>
<Input placeholder='请输入目录名称' maxLength={30} />
</Form.Item>
</Col>
<Col>
{item.defaultType ? (
<Button
icon={<MinusOutlined />}
type='primary'
onClick={() => deleteDirectory(item.id)}
/>
) : (
''
)}
</Col>
</Row>
))}
</Form>
</Modal>
);
};
export default AddOrEditDec;
import { useState } from 'react';
import { useEffect, useState } from 'react';
import SearchBox from '~/components/search-box';
import { Button, Table } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { ChangeModal } from '~/pages/customManage/customList/comp/changeModal';
import { InterListType, InterReqType } from '~/api/interface';
import { listAppUserType } from '~/api/interface/customManageType';
import { CustomManageAPI } from '~/api';
// 表格数据类型
type TableType = any;
type TableType = InterListType<listAppUserType>;
// 请求数据的类型
type ReqType = InterReqType<listAppUserType>;
// 搜索表单的数据
let query: ReqType = {};
//来源列表
const portTypeList = [
{ value: 100, label: '自然流' },
{ value: 200, label: '海报' },
{ value: 300, label: '抖音' },
{ value: 400, label: '公众号' },
{ value: 500, label: '社群' },
{ value: 600, label: '招投标' },
];
function CustomListView() {
// 是否打开变更弹窗
const [isChangeVisModal, setIsChangeVisModal] = useState<boolean>(false);
// 表格分页配置
const [pagination] = useState({
const [pagination, setPagination] = useState({
total: 0,
pageSize: 10,
current: 1,
totalPage: 0,
});
// 表格数据
const [tableData] = useState<TableType>([{ id: 1 }]);
const [tableData, setTableData] = useState<TableType>([]);
// 需要编辑的数据
const [editData] = useState<TableType[0]>();
// 加载列表
const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可
const res = await CustomManageAPI.listAppUser({
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);
}
};
// 翻页
const paginationChange = (pageNo: number, pageSize: number) => {
getTableList({ pageNo, pageSize }).then();
};
// 表单提交
const onFinish = (data: ReqType) => {
pagination.current = 1;
query = data;
getTableList(data).then();
};
// componentDidMount
useEffect(() => {
query = {};
getTableList().then();
}, []);
// 表格结构
const columns: ColumnsType<TableType[0]> = [
{
title: '用户UID',
dataIndex: 'userName',
dataIndex: 'uid',
align: 'center',
render: (_text, _record) => `--`,
width: '100px',
render: (text) => `UID${text}`,
},
{
title: '用户名称',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
render: (text, record) => text || record.nickName,
},
{
title: '手机号',
dataIndex: 'userName',
dataIndex: 'phoneNum',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '认证企业',
dataIndex: 'userName',
dataIndex: 'companyName',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '企业认证',
dataIndex: 'userName',
dataIndex: 'companyAuthStatus',
align: 'center',
render: (_text, _record) => `--`,
render: (text) => (text === 0 ? '未认证' : '已认证'),
},
{
title: '电子签约认证',
dataIndex: 'userName',
align: 'center',
render: (_text, _record) => `--`,
render: (_text) => `未认证`,
},
{
title: '用户来源',
dataIndex: 'userName',
dataIndex: 'portType',
align: 'center',
render: (_text, _record) => `--`,
render: (text) => portTypeList.find((i) => i.value === text)?.label || text,
},
{
title: '创建时间',
dataIndex: 'userName',
dataIndex: 'createTime',
align: 'center',
render: (_text, _record) => `--`,
},
{
title: '账号类型',
dataIndex: 'userName',
dataIndex: 'phoneNum',
align: 'center',
render: (_text, _record) => `--`,
render: (text) => (text ? '普通用户' : '游客用户'),
},
{
title: '渠道等级',
dataIndex: 'remark',
dataIndex: 'cooperationTagId',
align: 'center',
render: (_text, _record) => `--`,
render: (text) => text,
},
{
title: '上级推荐人',
dataIndex: 'remark',
align: 'center',
render: (_text, _record) => `--`,
render: (_text) => `--`,
},
{
title: '推荐伙伴',
dataIndex: 'remark',
align: 'center',
render: (_text, _record) => `--`,
render: (_text) => `--`,
},
{
title: '相关运营',
dataIndex: 'remark',
align: 'center',
render: (_text, _record) => `--`,
render: (_text) => `--`,
},
{
title: '相关销售',
dataIndex: 'remark',
align: 'center',
render: (_text, _record) => `--`,
render: (_text) => `--`,
},
{
title: '操作',
......@@ -113,7 +163,7 @@ function CustomListView() {
align: 'center',
fixed: 'right',
width: '150px',
render: (_text, _record) => (
render: (_text) => (
<>
<Button
type={'link'}
......@@ -151,14 +201,7 @@ function CustomListView() {
name: 'form',
type: 'Select',
placeholder: '请选择相关来源',
options: [
{ value: 1, label: '自然流' },
{ value: 2, label: '海报' },
{ value: 3, label: '抖音' },
{ value: 4, label: '公众号' },
{ value: 5, label: '社群' },
{ value: 6, label: '招投标' },
],
options: portTypeList,
},
{
label: '创建时间',
......@@ -187,7 +230,7 @@ function CustomListView() {
],
},
]}
searchData={(e: any) => console.log('提交数据 --->', e)}
searchData={onFinish}
/>
<Table
size='small'
......@@ -201,8 +244,7 @@ function CustomListView() {
current: pagination.current,
showSizeChanger: true,
showQuickJumper: true,
// onChange: (page: number, pageSize: number) =>
// paginationChange(page, pageSize),
onChange: (page: number, pageSize: number) => paginationChange(page, pageSize),
showTotal: (total, range) => `当前 ${range[0]}-${range[1]} 条记录 / 共 ${total} 条数据`,
}}
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
......
......@@ -18,7 +18,6 @@ import {
RedEnvelopeOutlined,
SettingOutlined,
UserOutlined,
SisternodeOutlined,
SendOutlined,
RocketOutlined,
AppstoreAddOutlined,
......@@ -343,6 +342,82 @@ export const routerList: Array<RouteObjectType> = [
],
},
{
path: '/categoryManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
meta: {
id: 18000,
icon: <ReconciliationOutlined />,
title: '分类管理',
},
children: [
{
path: '/categoryManage/jobServicesCategory/1',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18100,
title: '作业服务分类',
icon: <SendOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/2',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18200,
title: '设备租赁分类',
icon: <RocketOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/3',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18300,
title: '飞手培训分类',
icon: <AppstoreAddOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/4',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18400,
title: '产品商城分类',
icon: <AppstoreOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/0',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18500,
title: '通用分类',
icon: <CoffeeOutlined />,
},
},
{
path: '/categoryManage/detail/:id',
element: withLoadingComponent(<CategoryDetail />),
meta: {
id: 18600,
title: '分类详情',
icon: '',
hidden: true,
},
},
{
path: '/categoryManage/DirectoryManage',
element: withLoadingComponent(<DirectoryManage />),
meta: {
id: 18700,
title: '目录管理',
icon: <UnorderedListOutlined />,
},
},
],
},
{
path: '/customManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
......@@ -550,77 +625,22 @@ export const routerList: Array<RouteObjectType> = [
],
},
{
path: '/categoryManage',
path: '/systemManage',
element: <LayoutView />,
errorElement: <ErrorPage />,
meta: {
id: 18000,
icon: <ReconciliationOutlined />,
title: '分类管理',
id: 28000,
icon: <SettingOutlined />,
title: '系统管理',
},
children: [
{
path: '/categoryManage/jobServicesCategory/1',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18100,
title: '作业服务分类',
icon: <SendOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/2',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18200,
title: '设备租赁分类',
icon: <RocketOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/3',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18300,
title: '飞手培训分类',
icon: <AppstoreAddOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/4',
element: withLoadingComponent(<CategoryManage />),
meta: {
id: 18400,
title: '产品商城分类',
icon: <AppstoreOutlined />,
},
},
{
path: '/categoryManage/jobServicesCategory/0',
element: withLoadingComponent(<CategoryManage />),
path: '/systemManage/accountManage',
element: withLoadingComponent(<AccountManageView />),
meta: {
id: 18500,
title: '通用分类',
icon: <CoffeeOutlined />,
},
},
{
path: '/categoryManage/detail/:id',
element: withLoadingComponent(<CategoryDetail />),
meta: {
id: 18600,
title: '分类详情',
icon: '',
hidden: true,
},
},
{
path: '/categoryManage/DirectoryManage',
element: withLoadingComponent(<DirectoryManage />),
meta: {
id: 18700,
title: '目录管理',
icon: <UnorderedListOutlined />,
id: 28100,
title: '账号管理',
icon: <UserOutlined />,
},
},
],
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论