提交 a4db0386 作者: ZhangLingKun

功能:用户标签

上级 7a7bd083
......@@ -29,6 +29,14 @@ export type listAppUserType = InterListFunction<
cooperationTagId: number;
companyName: null;
tagName: null;
cooperationTagVOS: {
createTime: string;
id: number;
tagDescription: string;
tagImg: string;
tagName: string;
tagRequire: string;
}[];
}
>;
// 加盟标签列表
......@@ -75,6 +83,14 @@ export type changeUserTagType = InterFunction<
},
NonNullable<unknown>
>;
// 后台设置小程序用户标签
export type changeUserTagNew = InterFunction<
{
cooperationTagIds: number[];
userAccountId: number;
},
NonNullable<unknown>
>;
// 加盟标签列表
export type cooperationListTag = InterFunction<
NonNullable<unknown>,
......
......@@ -2,6 +2,7 @@ import axios from '../request';
import {
applyTagDetails,
approvalApplyTag,
changeUserTagNew,
changeUserTagType,
CompanyListTag,
cooperationListTag,
......@@ -24,7 +25,9 @@ export class CustomManageAPI {
// 后台设置小程序用户标签
static changeUserTag: changeUserTagType = (params) =>
axios.get('/userapp/cooperation/changeUserTag', { params });
// 后台设置小程序用户标签
static changeUserTagNew: changeUserTagNew = (params) =>
axios.post('/userapp/cooperation/changeUserTag', params);
// 加盟标签列表
static cooperationListTag: cooperationListTag = (params) =>
axios.get('/userapp/cooperation/listTag', { params });
......
import { FC, useEffect, useState } from 'react';
import { Form, Modal, Select } from 'antd';
import { InterListType } from '~/api/interface';
import { listAppUserType } from '~/api/interface/customManageType';
import { InterListType, InterReqType } from '~/api/interface';
import { changeUserTagNew, listAppUserType } from '~/api/interface/customManageType';
import { CustomManageAPI } from '~/api';
// 表单参数
type ReqType = InterReqType<changeUserTagNew>;
// 表格数据类型
type TableType = InterListType<listAppUserType>;
// 数据的类型
......@@ -13,11 +15,6 @@ interface PropsType {
data?: TableType[0];
}
// 修改等级标签
interface tagLevelForm {
cooperationTagId: number;
}
export const ChangeModal: FC<PropsType> = (props) => {
ChangeModal.defaultProps = {
data: undefined,
......@@ -25,7 +22,7 @@ export const ChangeModal: FC<PropsType> = (props) => {
// 父组件传参
const { open, closed, data } = props;
// 个人等级标签
const [form] = Form.useForm<tagLevelForm>();
const [form] = Form.useForm<ReqType>();
// 相关运营列表
const [operationList] = useState<{ value: number; label: string }[]>([]);
// 等级标签列表
......@@ -40,9 +37,9 @@ export const ChangeModal: FC<PropsType> = (props) => {
// 提交数据
const handleSubmit = () => {
form.validateFields().then(async (value) => {
const res = await CustomManageAPI.changeUserTag({
const res = await CustomManageAPI.changeUserTagNew({
userAccountId: Number(data?.id),
cooperationTagId: value.cooperationTagId,
cooperationTagIds: value?.cooperationTagIds || [],
});
if (res && res.code === '200') {
handleClosed();
......@@ -62,18 +59,19 @@ export const ChangeModal: FC<PropsType> = (props) => {
if (!data) return;
getCompanyListTag().then();
form.setFieldsValue({
cooperationTagId: data.cooperationTagId,
cooperationTagIds: data.cooperationTagVOS?.map((i) => i.id),
});
}, [open]);
return (
<Modal open={open} title='变更' onCancel={handleClosed} destroyOnClose onOk={handleSubmit}>
<Form form={form} labelCol={{ span: 5 }} wrapperCol={{ span: 16 }}>
<Form.Item label='等级标签' name='cooperationTagId'>
<Form.Item label='等级标签' name='cooperationTagIds'>
<Select
placeholder='请选择等级标签'
disabled={!data?.userName && !data?.companyName}
allowClear
options={cooperationTagIdList}
mode='multiple'
/>
</Form.Item>
<Form.Item label='相关运营' name='mallOperator'>
......
import { useEffect, useState } from 'react';
import SearchBox from '~/components/search-box';
import { Button, message, Modal, Table } from 'antd';
import { Button, message, Modal, Table, Tag } from 'antd';
import { ColumnsType } from 'antd/es/table';
import { ChangeModal } from '~/pages/customManage/customList/comp/changeModal';
import { InterListType, InterReqType } from '~/api/interface';
......@@ -25,10 +25,6 @@ const portTypeList = [
function CustomListView() {
const { confirm } = Modal;
// 等级标签列表
const [cooperationTagIdList, setCooperationTagIdList] = useState<
{ value: number; label: string }[]
>([]);
// 是否打开变更弹窗
const [isChangeVisModal, setIsChangeVisModal] = useState<boolean>(false);
// 表格分页配置
......@@ -73,14 +69,6 @@ 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);
}
};
// 删除用户
const handleDelete = (value: TableType[0]) => {
confirm({
......@@ -102,7 +90,6 @@ function CustomListView() {
useEffect(() => {
query = {};
(async () => {
await getCompanyListTag();
await getTableList();
})();
}, []);
......@@ -161,9 +148,14 @@ function CustomListView() {
},
{
title: '渠道等级',
dataIndex: 'cooperationTagId',
dataIndex: 'cooperationTagVOS',
align: 'center',
render: (text) => cooperationTagIdList.find((i) => i.value === text)?.label || text,
render: (_text, record) =>
record.cooperationTagVOS?.map((i, j) => (
<Tag color='processing' key={j} style={{ marginBottom: '10px' }}>
{i.tagName}
</Tag>
)),
},
{
title: '上级推荐人',
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论