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