提交 22f1d493 作者: 翁进城
...@@ -14,4 +14,4 @@ patches: ...@@ -14,4 +14,4 @@ patches:
images: images:
- name: REGISTRY/NAMESPACE/IMAGE:TAG - name: REGISTRY/NAMESPACE/IMAGE:TAG
newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin newName: mmc-registry.cn-shenzhen.cr.aliyuncs.com/sharefly-dev/admin
newTag: 1fdaab4f81ec6fb14f23e31f2238db2f1386909c newTag: fc6718648897f381269cb10c9fafa0c95dacf0e1
import { InterListFunction } from '~/api/interface'; import { InterFunction, InterListFunction } from '~/api/interface';
// 客户列表 // 客户列表
export type listAppUserType = InterListFunction< export type listAppUserType = InterListFunction<
...@@ -26,8 +26,52 @@ export type listAppUserType = InterListFunction< ...@@ -26,8 +26,52 @@ export type listAppUserType = InterListFunction<
portType: number; portType: number;
createTime: string; createTime: string;
companyAuthStatus: number; companyAuthStatus: number;
cooperationTagId: null; cooperationTagId: number;
companyName: null; companyName: null;
tagName: null; tagName: null;
} }
>; >;
// 加盟标签列表
export type CompanyListTag = InterFunction<
NonNullable<unknown>,
{
id: number;
tagName: string;
tagImg: null;
tagDescription: string;
createTime: string;
}[]
>;
// 修改用户信息
export type userAccountUpdateType = InterFunction<
{
accountNo?: string;
accountStatus?: number;
accountType?: number;
companyAuthStatus?: number;
companyName?: string;
cooperationTagId?: number;
createTime?: string;
email?: string;
id: number;
nickName?: string;
phoneNum?: string;
portType?: number;
remark?: string;
source?: number;
tagName?: string;
uid?: string;
userImg?: string;
userName?: string;
userSex?: number;
},
NonNullable<unknown>
>;
// 后台设置小程序用户标签
export type changeUserTagType = InterFunction<
{
cooperationTagId: number;
userAccountId: number;
},
NonNullable<unknown>
>;
import axios from '../request'; import axios from '../request';
import { listAppUserType } from '~/api/interface/customManageType'; import {
changeUserTagType,
CompanyListTag,
listAppUserType,
userAccountUpdateType,
} from '~/api/interface/customManageType';
export class CustomManageAPI { export class CustomManageAPI {
// 客户列表 // 客户列表
static listAppUser: listAppUserType = (params) => static listAppUser: listAppUserType = (params) =>
axios.post('/userapp/user-account/listAppUser', params); axios.post('/userapp/user-account/listAppUser', params);
// 加盟列表
static CompanyListTag: CompanyListTag = (params) =>
axios.get('/userapp/cooperation/listTag', { params });
// 客户列表
static userAccountUpdate: userAccountUpdateType = (params) =>
axios.post('/userapp/user-account/update', params);
// 后台设置小程序用户标签
static changeUserTag: changeUserTagType = (params) =>
axios.get('/userapp/cooperation/changeUserTag', { params });
} }
import { FC, useEffect, useState } from 'react'; import { FC, useEffect, useState } from 'react';
import { Form, Modal, Select } from 'antd'; import { Form, Modal, Select } from 'antd';
// import { tagLevelEntity } from "@/api/modules/user"; import { InterListType } from '~/api/interface';
// import { UserAPI } from "@/api"; import { listAppUserType } from '~/api/interface/customManageType';
import { CustomManageAPI } from '~/api';
// 表格数据类型
type TableType = InterListType<listAppUserType>;
// 数据的类型
interface PropsType { interface PropsType {
visible: boolean; open: boolean;
closed: any; closed: any;
data: any; data?: TableType[0];
state: any;
} }
// 修改等级标签 // 修改等级标签
interface tagLevelForm { interface tagLevelForm {
channelLevelId: number; cooperationTagId: number;
mallOperator: number;
mallSaleManager: number;
} }
export const ChangeModal: FC<PropsType> = (props) => { export const ChangeModal: FC<PropsType> = (props) => {
ChangeModal.defaultProps = {
data: undefined,
};
// 父组件传参 // 父组件传参
const { visible, closed, data, state } = props; const { open, closed, data } = props;
// 个人等级标签 // 个人等级标签
const [tagLevelForm] = Form.useForm<tagLevelForm>(); const [form] = Form.useForm<tagLevelForm>();
// 相关运营列表 // 相关运营列表
const [operationList] = useState([]); const [operationList] = useState<{ value: number; label: string }[]>([]);
// 等级标签列表
const [cooperationTagIdList, setCooperationTagIdList] = useState<
{ value: number; label: string }[]
>([]);
// 关闭事件 // 关闭事件
const handleClosed = () => { const handleClosed = () => {
tagLevelForm.resetFields(); form.resetFields();
closed(); closed();
}; };
// 提交数据 // 提交数据
const handleSubmit = () => { const handleSubmit = () => {
tagLevelForm.validateFields().then(async (value: tagLevelForm) => { form.validateFields().then(async (value) => {
// 提交表单数据 const res = await CustomManageAPI.changeUserTag({
const SubmitFuc = async () => { userAccountId: Number(data?.id),
// const res: any = await UserAPI.mallUserChangeInfo({ cooperationTagId: value.cooperationTagId,
// ...value, });
// userAccountId: data.id, if (res && res.code === '200') {
// }); handleClosed();
// if (res.code === '200') {
// message.success('修改成功');
// handleClosed();
// } else {
// message.warning(res.message);
// }
};
// 如果之前填过等级标签,现在又删除了的话,调用删除等级标签的接口
if (data.channelClass && !value.channelLevelId) {
// 删除等级标签
// const res: any = await UserAPI.mallUserDeleteInfo({
// userAccountId: data.id,
// });
// if (res && res.code === '200') {
// await SubmitFuc();
// } else {
// message.warning(res.message);
// }
} else {
await SubmitFuc();
} }
}); });
}; };
// 获取运营人员列表 // 获取加盟列表
const getListOperate = () => { const getCompanyListTag = async () => {
// UserAPI.getKbtUserList({ keyword: '' }).then(({ result }) => { const res = await CustomManageAPI.CompanyListTag({});
// if (result) { if (res && res.code === '200') {
// setOperationList( setCooperationTagIdList(res.result.map((i) => ({ value: i.id, label: i.tagName })));
// result.map((i: any) => { // console.log(res.result);
// return { }
// label: `${i.userName || i.nickName}(${i.uid})`,
// value: i.id,
// };
// }),
// );
// }
// });
}; };
// 组件启动 // 组件启动
useEffect(() => { useEffect(() => {
if (data) { if (!data) return;
getListOperate(); getCompanyListTag().then();
tagLevelForm.setFieldsValue({ form.setFieldsValue({
channelLevelId: data.channelClass || undefined, cooperationTagId: data.cooperationTagId,
mallOperator: data.mallOperator || undefined, });
mallSaleManager: data.mallSaleManager || undefined, }, [open]);
});
}
}, [data]);
return ( return (
<Modal open={visible} title='变更' onCancel={handleClosed} destroyOnClose onOk={handleSubmit}> <Modal open={open} title='变更' onCancel={handleClosed} destroyOnClose onOk={handleSubmit}>
<Form form={tagLevelForm} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}> <Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}>
<Form.Item label='等级标签' name='channelLevelId'> <Form.Item label='等级标签' name='cooperationTagId'>
<Select <Select
placeholder='请选择等级标签' placeholder='请选择等级标签'
disabled={!data?.realAuthStatus && !data?.entAuthStatus} disabled={!data?.userName && !data?.companyName}
allowClear allowClear
> options={cooperationTagIdList}
{state.levelTags.map((item: any, index: number) => ( />
<Select.Option value={item.id} key={index}>
{item.tagName}
</Select.Option>
))}
</Select>
</Form.Item> </Form.Item>
<Form.Item label='相关运营' name='mallOperator'> <Form.Item label='相关运营' name='mallOperator'>
<Select placeholder='请选择相关运营' allowClear> <Select placeholder='请选择相关运营' allowClear disabled>
{operationList.map((item: any, index: number) => ( {operationList.map((item: any, index: number) => (
<Select.Option value={item.value} key={index}> <Select.Option value={item.value} key={index}>
{item.label} {item.label}
...@@ -113,7 +86,7 @@ export const ChangeModal: FC<PropsType> = (props) => { ...@@ -113,7 +86,7 @@ export const ChangeModal: FC<PropsType> = (props) => {
</Select> </Select>
</Form.Item> </Form.Item>
<Form.Item label='相关销售' name='mallSaleManager'> <Form.Item label='相关销售' name='mallSaleManager'>
<Select placeholder='请选择相关销售' allowClear> <Select placeholder='请选择相关销售' allowClear disabled>
{operationList.map((item: any, index: number) => ( {operationList.map((item: any, index: number) => (
<Select.Option value={item.value} key={index}> <Select.Option value={item.value} key={index}>
{item.label} {item.label}
......
...@@ -24,6 +24,10 @@ const portTypeList = [ ...@@ -24,6 +24,10 @@ const portTypeList = [
]; ];
function CustomListView() { function CustomListView() {
// 等级标签列表
const [cooperationTagIdList, setCooperationTagIdList] = useState<
{ value: number; label: string }[]
>([]);
// 是否打开变更弹窗 // 是否打开变更弹窗
const [isChangeVisModal, setIsChangeVisModal] = useState<boolean>(false); const [isChangeVisModal, setIsChangeVisModal] = useState<boolean>(false);
// 表格分页配置 // 表格分页配置
...@@ -36,7 +40,7 @@ function CustomListView() { ...@@ -36,7 +40,7 @@ function CustomListView() {
// 表格数据 // 表格数据
const [tableData, setTableData] = useState<TableType>([]); const [tableData, setTableData] = useState<TableType>([]);
// 需要编辑的数据 // 需要编辑的数据
const [editData] = useState<TableType[0]>(); const [editData, setEditData] = useState<TableType[0]>();
// 加载列表 // 加载列表
const getTableList = async (value = {}) => { const getTableList = async (value = {}) => {
// 只需要修改这个地方的接口即可 // 只需要修改这个地方的接口即可
...@@ -68,10 +72,21 @@ function CustomListView() { ...@@ -68,10 +72,21 @@ function CustomListView() {
query = data; query = data;
getTableList(data).then(); getTableList(data).then();
}; };
// 获取加盟列表
const getCompanyListTag = async () => {
const res = await CustomManageAPI.CompanyListTag({});
if (res && res.code === '200') {
setCooperationTagIdList(res.result.map((i) => ({ value: i.id, label: i.tagName })));
// console.log(res.result);
}
};
// componentDidMount // componentDidMount
useEffect(() => { useEffect(() => {
query = {}; query = {};
getTableList().then(); (async () => {
await getCompanyListTag();
await getTableList();
})();
}, []); }, []);
// 表格结构 // 表格结构
const columns: ColumnsType<TableType[0]> = [ const columns: ColumnsType<TableType[0]> = [
...@@ -131,7 +146,7 @@ function CustomListView() { ...@@ -131,7 +146,7 @@ function CustomListView() {
title: '渠道等级', title: '渠道等级',
dataIndex: 'cooperationTagId', dataIndex: 'cooperationTagId',
align: 'center', align: 'center',
render: (text) => text, render: (text) => cooperationTagIdList.find((i) => i.value === text)?.label || text,
}, },
{ {
title: '上级推荐人', title: '上级推荐人',
...@@ -162,12 +177,13 @@ function CustomListView() { ...@@ -162,12 +177,13 @@ function CustomListView() {
dataIndex: 'action', dataIndex: 'action',
align: 'center', align: 'center',
fixed: 'right', fixed: 'right',
width: '150px', width: '100px',
render: (_text) => ( render: (_text, record) => (
<> <>
<Button <Button
type={'link'} type={'link'}
onClick={() => { onClick={() => {
setEditData(JSON.parse(JSON.stringify(record)));
setIsChangeVisModal(true); setIsChangeVisModal(true);
}} }}
> >
...@@ -198,37 +214,37 @@ function CustomListView() { ...@@ -198,37 +214,37 @@ function CustomListView() {
}, },
{ {
label: '来源', label: '来源',
name: 'form', name: 'portType',
type: 'Select', type: 'Select',
placeholder: '请选择相关来源', placeholder: '请选择相关来源',
options: portTypeList, options: portTypeList,
}, },
{ {
label: '创建时间', label: '创建时间',
name: 'time', name: 'rangeTime',
type: 'rangePicker', type: 'rangePicker',
placeholder: '请选择创建时间', placeholder: '请选择创建时间',
}, },
{ {
label: '企业认证', label: '企业认证',
name: 'enterprise', name: 'companyAuthStatus',
type: 'Select',
placeholder: '请选择是否认证',
options: [
{ value: 1, label: '未认证' },
{ value: 2, label: '已认证' },
],
},
{
label: '电子签约认证',
name: 'contract',
type: 'Select', type: 'Select',
placeholder: '请选择是否认证', placeholder: '请选择是否认证',
options: [ options: [
{ value: 1, label: '未认证' }, { value: 0, label: '未认证' },
{ value: 2, label: '已认证' }, { value: 1, label: '已认证' },
], ],
}, },
// {
// label: '电子签约认证',
// name: 'contract',
// type: 'Select',
// placeholder: '请选择是否认证',
// options: [
// { value: 1, label: '未认证' },
// { value: 2, label: '已认证' },
// ],
// },
]} ]}
searchData={onFinish} searchData={onFinish}
/> />
...@@ -250,12 +266,12 @@ function CustomListView() { ...@@ -250,12 +266,12 @@ function CustomListView() {
// rowSelection={{ selectedRowKeys, onChange: onSelectChange }} // rowSelection={{ selectedRowKeys, onChange: onSelectChange }}
/> />
<ChangeModal <ChangeModal
visible={isChangeVisModal} open={isChangeVisModal}
closed={() => { closed={() => {
setIsChangeVisModal(false); setIsChangeVisModal(false);
paginationChange(pagination.current, pagination.pageSize);
}} }}
data={editData} data={editData}
state={{ levelTags: [] }}
/> />
</> </>
); );
......
...@@ -443,6 +443,7 @@ export const routerList: Array<RouteObjectType> = [ ...@@ -443,6 +443,7 @@ export const routerList: Array<RouteObjectType> = [
id: 26200, id: 26200,
title: '现金管理', title: '现金管理',
icon: <RedEnvelopeOutlined />, icon: <RedEnvelopeOutlined />,
hidden: true,
}, },
}, },
{ {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论