Commit 94730a23 authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接 会员信息 相关

parent 0b6b068c
......@@ -102,11 +102,35 @@ const MemberRoute: RouterChild = {
},
// 会员信息-冻结
{
path: '/memberCenter/memberAbility/manage/maintain/frozen',
name: 'maintainFrozen',
path: '/memberCenter/memberAbility/manage/maintain/freeze',
name: 'maintainFreeze',
hideInMenu: true,
noMargin: true,
component: '@/pages/member/memberMaintain/frozen',
component: '@/pages/member/memberMaintain/freeze',
},
// 会员信息-解冻
{
path: '/memberCenter/memberAbility/manage/maintain/unfreeze',
name: 'maintainUnfreeze',
hideInMenu: true,
noMargin: true,
component: '@/pages/member/memberMaintain/unfreeze',
},
// 会员信息-解除关系
{
path: '/memberCenter/memberAbility/manage/maintain/eliminate',
name: 'maintainEliminate',
hideInMenu: true,
noMargin: true,
component: '@/pages/member/memberMaintain/eliminate',
},
// 会员信息-加入黑名单
{
path: '/memberCenter/memberAbility/manage/maintain/black',
name: 'maintainBlack',
hideInMenu: true,
noMargin: true,
component: '@/pages/member/memberMaintain/black',
},
// // 待提交审核
// {
......
......@@ -130,7 +130,10 @@ export default {
'menu.memberAbility.memberManage.maintainDetail.levelInfo': '会员等级信息',
'menu.memberAbility.memberManage.maintainDetail.equityInfo': '权益信息',
'menu.memberAbility.memberManage.maintainDetail.sincerityInfo': '诚信信息',
'menu.memberAbility.memberManage.maintainFrozen': '会员冻结与解除',
'menu.memberAbility.memberManage.maintainFreeze': '会员冻结',
'menu.memberAbility.memberManage.maintainUnfreeze': '会员解除',
'menu.memberAbility.memberManage.maintainEliminate': '解除关系',
'menu.memberAbility.memberManage.maintainBlack': '加入黑名单',
'menu.memberAbility.memberQuery': '会员信息查询',
'menu.memberAbility.memberQueryDetail': '会员信息详情',
'menu.memberAbility.memberQueryDetail.basicInfo': '会员基本信息',
......
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:39:42
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 10:47:51
* @Description:
*/
import { ISchema } from '@formily/antd';
export const blockedModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
date: {
type: 'string',
title: '进入黑名单日期',
'x-component': 'DatePicker',
'x-component-props': {
placeholder: '请选择',
style: {
width: '100%',
},
},
'x-rules': [
{
required: true,
message: '请选择进入黑名单日期',
},
],
},
reason: {
type: 'string',
title: '进入黑名单原因',
'x-component': 'Textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
{
required: true,
message: '请填写原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:36:43
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 10:53:48
* @Description: 会员整改详情
*/
import React, { useState, useEffect } from 'react';
import {
Button,
Modal,
Row,
Col,
Spin,
Tooltip,
Space,
} from 'antd';
import { history } from 'umi';
import { StopOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
import {
DatePicker,
} from '@formily/antd-components'
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailResponse } from '@/services/MemberV2Api';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import LevelBrand from '@/components/LevelBrand';
import FlowRecords from '@/components/FlowRecords';
import CustomizeColumn from '@/components/CustomizeColumn';
import NiceForm from '@/components/NiceForm';
import { unfriendModalSchema } from './schema';
import {
MEMBER_OUTER_COLUMNS,
MEMBER_INNER_COLUMNS,
} from '../../constant';
import MemberBasicInfo from '../../components/MemberBasicInfo';
import MemberChannelInfo from '../../components/MemberChannelInfo';
import PicWrap from '../../components/PicWrap';
type ValueType = {
/**
* 日期
*/
date: string,
/**
* 理由
*/
reason: string,
}
const formActions = createFormActions();
const MemberMaintainCorrect: React.FC<{}> = () => {
const { validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const [unfriendModalVisible, setUnfriendModalVisible] = useState(false);
const getBasicInfo = () => {
if (!validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetail({
validateId,
}).then(res => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).finally(() => {
setInfoLoaading(false);
});
};
useEffect(() => {
getBasicInfo();
}, []);
const handleSubmit = (values: ValueType) => {
setConfirmLoading(true);
return PublicApi.postMemberAbilityMaintenanceEliminate({
validateId: validateId,
...values,
}).then(res => {
if (res.code !== 1000) {
return;
}
setUnfriendModalVisible(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setConfirmLoading(false);
});
};
const anchorsArr = [
{
key: 'basicInfo',
name: '基本信息',
},
(
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? {
key: 'channelInfo',
name: '渠道信息',
}
: null
),
...(
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({
key: `group${index}`,
name: item.groupName,
}))
: []
),
{
key: 'flowRecords',
name: '流转记录',
},
].filter(Boolean);
return (
<Spin spinning={infoLoading}>
<AnchorPage
title={(
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<LevelBrand level={2} />
)}
/>
)}
anchors={anchorsArr}
extra={(
<Space size={16}>
<Button
icon={<StopOutlined />}
onClick={() => setUnfriendModalVisible(true)}
>
解除关系
</Button>
</Space>
)}
>
<Row gutter={[16, 16]}>
{/* 基本信息 */}
<Col span={24}>
<MemberBasicInfo
dataSource={{
memberId: memberInfo?.memberId,
memberTypeName: memberInfo?.memberTypeName,
account: memberInfo?.account,
name: memberInfo?.name,
roleName: memberInfo?.roleName,
phone: memberInfo?.phone,
outerStatus: memberInfo?.outerStatus,
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
</Col>
{/* 渠道信息 */}
{
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? (
<Col span={24}>
<MemberChannelInfo
dataSource={{
level: memberInfo?.channelLevelTag,
type: memberInfo?.channelTypeName,
areas: memberInfo?.areas,
desc: memberInfo?.remark,
}}
id="channelInfo"
/>
</Col>
)
: null
}
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
id={`group${index}`}
/>
</Col>
))
: null
}
{/* 流转记录 */}
<Col span={24}>
<FlowRecords
outerColumns={MEMBER_OUTER_COLUMNS}
innerColumns={MEMBER_INNER_COLUMNS}
outerRowkey="id"
innerRowkey="id"
outerDataSource={memberInfo?.outerHistory}
id="flowRecords"
/>
</Col>
</Row>
</AnchorPage>
{/* 解除关系相关 */}
<Modal
title={(
<div>
会员关系解除
<Tooltip title="解除当前会员关系,不在享用会员权益;可重新申请会员关系">
<QuestionCircleOutlined
style={{ marginLeft: 8 }}
/>
</Tooltip>
</div>
)}
visible={unfriendModalVisible}
confirmLoading={confirmLoading}
onOk={() => formActions.submit()}
onCancel={() => setUnfriendModalVisible(false)}
destroyOnClose
>
<NiceForm
previewPlaceholder="' '"
components={{
DatePicker,
}}
effects={() => {
}}
actions={formActions}
schema={unfriendModalSchema}
onSubmit={handleSubmit}
/>
</Modal>
</Spin>
);
};
export default MemberMaintainCorrect;
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:39:42
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 10:47:51
* @Description:
*/
import { ISchema } from '@formily/antd';
export const unfriendModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
date: {
type: 'string',
title: '解除日期',
'x-component': 'DatePicker',
'x-component-props': {
placeholder: '请选择',
style: {
width: '100%',
},
},
'x-rules': [
{
required: true,
message: '请选择解除日期',
},
],
},
reason: {
type: 'string',
title: '解除原因',
'x-component': 'Textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
{
required: true,
message: '请填写原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:36:43
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 10:56:09
* @Description: 解除关系
*/
import React, { useState, useEffect } from 'react';
import {
Button,
Modal,
Row,
Col,
Spin,
Tooltip,
Space,
} from 'antd';
import { history } from 'umi';
import { StopOutlined, QuestionCircleOutlined } from '@ant-design/icons';
import { createFormActions } from '@formily/antd';
import {
DatePicker,
} from '@formily/antd-components'
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailResponse } from '@/services/MemberV2Api';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import LevelBrand from '@/components/LevelBrand';
import FlowRecords from '@/components/FlowRecords';
import CustomizeColumn from '@/components/CustomizeColumn';
import NiceForm from '@/components/NiceForm';
import { unfriendModalSchema } from './schema';
import {
MEMBER_OUTER_COLUMNS,
MEMBER_INNER_COLUMNS,
} from '../../constant';
import MemberBasicInfo from '../../components/MemberBasicInfo';
import MemberChannelInfo from '../../components/MemberChannelInfo';
import PicWrap from '../../components/PicWrap';
type ValueType = {
/**
* 日期
*/
date: string,
/**
* 理由
*/
reason: string,
}
const formActions = createFormActions();
const MemberMaintainEliminate: React.FC<{}> = () => {
const { validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const [unfriendModalVisible, setUnfriendModalVisible] = useState(false);
const getBasicInfo = () => {
if (!validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetail({
validateId,
}).then(res => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).finally(() => {
setInfoLoaading(false);
});
};
useEffect(() => {
getBasicInfo();
}, []);
const handleSubmit = (values: ValueType) => {
setConfirmLoading(true);
return PublicApi.postMemberAbilityMaintenanceEliminate({
validateId: validateId,
...values,
}).then(res => {
if (res.code !== 1000) {
return;
}
setUnfriendModalVisible(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setConfirmLoading(false);
});
};
const anchorsArr = [
{
key: 'basicInfo',
name: '基本信息',
},
(
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? {
key: 'channelInfo',
name: '渠道信息',
}
: null
),
...(
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({
key: `group${index}`,
name: item.groupName,
}))
: []
),
{
key: 'flowRecords',
name: '流转记录',
},
].filter(Boolean);
return (
<Spin spinning={infoLoading}>
<AnchorPage
title={(
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<LevelBrand level={2} />
)}
/>
)}
anchors={anchorsArr}
extra={(
<Space size={16}>
<Button
icon={<StopOutlined />}
onClick={() => setUnfriendModalVisible(true)}
>
解除关系
</Button>
</Space>
)}
>
<Row gutter={[16, 16]}>
{/* 基本信息 */}
<Col span={24}>
<MemberBasicInfo
dataSource={{
memberId: memberInfo?.memberId,
memberTypeName: memberInfo?.memberTypeName,
account: memberInfo?.account,
name: memberInfo?.name,
roleName: memberInfo?.roleName,
phone: memberInfo?.phone,
outerStatus: memberInfo?.outerStatus,
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
</Col>
{/* 渠道信息 */}
{
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? (
<Col span={24}>
<MemberChannelInfo
dataSource={{
level: memberInfo?.channelLevelTag,
type: memberInfo?.channelTypeName,
areas: memberInfo?.areas,
desc: memberInfo?.remark,
}}
id="channelInfo"
/>
</Col>
)
: null
}
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
id={`group${index}`}
/>
</Col>
))
: null
}
{/* 流转记录 */}
<Col span={24}>
<FlowRecords
outerColumns={MEMBER_OUTER_COLUMNS}
innerColumns={MEMBER_INNER_COLUMNS}
outerRowkey="id"
innerRowkey="id"
outerDataSource={memberInfo?.outerHistory}
id="flowRecords"
/>
</Col>
</Row>
</AnchorPage>
{/* 解除关系相关 */}
<Modal
title={(
<div>
会员关系解除
<Tooltip title="解除当前会员关系,不在享用会员权益;可重新申请会员关系">
<QuestionCircleOutlined
style={{ marginLeft: 8 }}
/>
</Tooltip>
</div>
)}
visible={unfriendModalVisible}
confirmLoading={confirmLoading}
onOk={() => formActions.submit()}
onCancel={() => setUnfriendModalVisible(false)}
destroyOnClose
>
<NiceForm
previewPlaceholder="' '"
components={{
DatePicker,
}}
effects={() => {
}}
actions={formActions}
schema={unfriendModalSchema}
onSubmit={handleSubmit}
/>
</Modal>
</Spin>
);
};
export default MemberMaintainEliminate;
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:39:42
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 10:47:51
* @Description:
*/
import { ISchema } from '@formily/antd';
export const unfriendModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
date: {
type: 'string',
title: '解除日期',
'x-component': 'DatePicker',
'x-component-props': {
placeholder: '请选择',
style: {
width: '100%',
},
},
'x-rules': [
{
required: true,
message: '请选择解除日期',
},
],
},
reason: {
type: 'string',
title: '解除原因',
'x-component': 'Textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
{
required: true,
message: '请填写原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 11:31:48
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 11:42:18
* @Description: 会员冻结
*/
import React, { useState, useEffect } from 'react';
import {
Button,
Modal,
Row,
Col,
Spin,
} from 'antd';
import { history } from 'umi';
import { StopOutlined } from '@ant-design/icons';
import {
createFormActions,
FormEffectHooks,
} from '@formily/antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailResponse } from '@/services/MemberV2Api';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import LevelBrand from '@/components/LevelBrand';
import FlowRecords from '@/components/FlowRecords';
import CustomizeColumn from '@/components/CustomizeColumn';
import NiceForm from '@/components/NiceForm';
import { freezeSchema } from './schema';
import {
MEMBER_OUTER_COLUMNS,
MEMBER_INNER_COLUMNS,
} from '../../constant';
import MemberBasicInfo from '../../components/MemberBasicInfo';
import MemberChannelInfo from '../../components/MemberChannelInfo';
import PicWrap from '../../components/PicWrap';
type ValueType = {
/**
* 理由
*/
reason: string,
}
const formActions = createFormActions();
const MemberFrozen: React.FC<{}> = () => {
const { validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailResponse>(null);
const [modalVisible, setModalVisible] = useState(false);
const [infoLoading, setInfoLoaading] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const getBasicInfo = () => {
if (!validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetail({
validateId,
}).then(res => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).finally(() => {
setInfoLoaading(false);
});
};
useEffect(() => {
getBasicInfo();
}, []);
// 冻结与解冻
const handleSubmit = (values: ValueType) => {
setConfirmLoading(true);
return PublicApi.postMemberAbilityMaintenanceFreeze({
validateId: validateId,
status: 2,
reason: values.reason || '',
}).then(res => {
if (res.code !== 1000) {
return;
}
setModalVisible(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setConfirmLoading(false);
});
};
const anchorsArr = [
{
key: 'verifySteps',
name: '流转进度',
},
{
key: 'basicInfo',
name: '基本信息',
},
(
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? {
key: 'channelInfo',
name: '渠道信息',
}
: null
),
...(
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({
key: `group${index}`,
name: item.groupName,
}))
: []
),
{
key: 'flowRecords',
name: '流转记录',
},
].filter(Boolean);
return (
<Spin spinning={infoLoading}>
<AnchorPage
title={(
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<LevelBrand level={2} />
)}
/>
)}
anchors={anchorsArr}
extra={(
<Button
icon={<StopOutlined />}
onClick={() => setModalVisible(true)}
>
冻结
</Button>
)}
>
<Row gutter={[16, 16]}>
{/* 基本信息 */}
<Col span={24}>
<MemberBasicInfo
dataSource={{
memberId: memberInfo?.memberId,
memberTypeName: memberInfo?.memberTypeName,
account: memberInfo?.account,
name: memberInfo?.name,
roleName: memberInfo?.roleName,
phone: memberInfo?.phone,
outerStatus: memberInfo?.outerStatus,
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
</Col>
{/* 渠道信息 */}
{
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? (
<Col span={24}>
<MemberChannelInfo
dataSource={{
level: memberInfo?.channelLevelTag,
type: memberInfo?.channelTypeName,
areas: memberInfo?.areas,
desc: memberInfo?.remark,
}}
id="channelInfo"
/>
</Col>
)
: null
}
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
id={`group${index}`}
/>
</Col>
))
: null
}
{/* 流转记录 */}
<Col span={24}>
<FlowRecords
outerColumns={MEMBER_OUTER_COLUMNS}
innerColumns={MEMBER_INNER_COLUMNS}
outerRowkey="id"
innerRowkey="id"
outerDataSource={memberInfo?.outerHistory}
id="flowRecords"
/>
</Col>
</Row>
{/* 冻结相关 */}
<Modal
title="会员冻结"
visible={modalVisible}
confirmLoading={confirmLoading}
onOk={() => formActions.submit()}
onCancel={() => setModalVisible(false)}
destroyOnClose
>
<NiceForm
previewPlaceholder="' '"
effects={($, { setFieldState }) => {
FormEffectHooks.onFieldInit$('reason').subscribe(() => {
setFieldState('reason', fieldState => {
fieldState.props.title = '会员冻结原因';
});
});
}}
actions={formActions}
schema={freezeSchema}
onSubmit={handleSubmit}
/>
</Modal>
</AnchorPage>
</Spin>
);
};
export default MemberFrozen;
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 11:27:42
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 11:27:43
* @Description:
*/
import { ISchema } from '@formily/antd';
export const freezeSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
reason: {
type: 'string',
title: '会员解冻原因',
'x-component': 'Textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
{
required: true,
message: '请填写原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
\ No newline at end of file
import React, { useState, useRef } from 'react';
import React, { useRef } from 'react';
import { Link } from 'umi';
import {
Card,
......@@ -8,7 +8,7 @@ import {
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions, FormEffectHooks } from '@formily/antd';
import { createFormActions } from '@formily/antd';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { FORM_FILTER_PATH } from '@/formSchema/const';
......@@ -17,18 +17,13 @@ import NiceForm from '@/components/NiceForm';
import LevelBrand from '@/components/LevelBrand';
import StatusTag from '../components/StatusTag';
import { PublicApi } from '@/services/api';
import {
MEMBER_STATUS_NORMAL,
MEMBER_INNER_STATUS_SUCCESS,
MEMBER_OUTER_STATUS_SUCCESS,
} from '@/constants/member';
import { maintianSchema } from './schema';
import useSpliceArray from '@/hooks/useSpliceArray';
import { querySchema } from './schema';
import {
MEMBER_STATUS_TAG_MAP,
MEMBER_INNER_STATUS_BADGE_COLOR,
MEMBER_OUTER_STATUS_TYPE,
} from '../constant';
import { coverColFiltersItem } from '../utils';
import styles from './index.less';
const formActions = createFormActions();
......@@ -120,23 +115,56 @@ const MemberMaintain: React.FC<[]> = () => {
filters: [],
align: 'center',
onFilter: (value, record) => record.innerStatus === value,
render: (text, record) => <Badge color={MEMBER_INNER_STATUS_BADGE_COLOR[record.innerStatus]} text={text} />,
render: (text, record) => <Badge color={MEMBER_INNER_STATUS_BADGE_COLOR[record.innerStatus] || '#606266'} text={text} />,
},
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (text, record) => (
render: (_, record) => (
<>
{(
record.innerStatus === MEMBER_INNER_STATUS_SUCCESS &&
record.outerStatus === MEMBER_OUTER_STATUS_SUCCESS
) && (
<Link to={`/memberCenter/memberAbility/manage/maintain/frozen?id=${record.memberId}&validateId=${record.validateId}`}>
{record.showFreeze && (
<Link to={`/memberCenter/memberAbility/manage/maintain/freeze?validateId=${record.validateId}`}>
<Button
type="link"
>
冻结
</Button>
</Link>
)}
{record.showUnfreeze && (
<Link to={`/memberCenter/memberAbility/manage/maintain/unfreeze?validateId=${record.validateId}`}>
<Button
type="link"
>
解冻
</Button>
</Link>
)}
{record.showCorrect && (
<Link to={`/memberCenter/memberAbility/memberRectification/rectificationAdd/add?validateId=${record.validateId}`}>
<Button
type="link"
>
整改
</Button>
</Link>
)}
{record.showEliminate && (
<Link to={`/memberCenter/memberAbility/manage/maintain/eliminate?validateId=${record.validateId}`}>
<Button
type="link"
>
{record.status === MEMBER_STATUS_NORMAL ? '冻结' : '解冻'}
淘汰
</Button>
</Link>
)}
{record.showBlacklist && (
<Link to={`/memberCenter/memberAbility/manage/maintain/black?validateId=${record.validateId}`}>
<Button
type="link"
>
黑名单
</Button>
</Link>
)}
......@@ -145,18 +173,7 @@ const MemberMaintain: React.FC<[]> = () => {
},
];
const [columns, setColumns] = useState<any[]>(defaultColumns);
// 更改会员状态
const handleModify = record => {
PublicApi.postMemberMaintenanceStatus({
memberId: record.memberId,
validateId: record.validateId,
status: record.status === 1 ? 0 : 1,
}).then(res => {
if (res.code === 1000) return ref.current.reload();
});
};
const [columns, columnsHandle] = useSpliceArray<ColumnType<any>>(defaultColumns);
// 初始化高级筛选选项
const fetchSelectOptions = async () => {
......@@ -174,26 +191,28 @@ const MemberMaintain: React.FC<[]> = () => {
sources = [],
} = data;
const newColumns = columns.slice();
// filter 0 过滤掉全部选项
coverColFiltersItem(
newColumns,
'statusName',
status.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
);
coverColFiltersItem(
newColumns,
'outerStatusName',
outerStatus.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
);
coverColFiltersItem(
newColumns,
'innerStatusName',
innerStatus.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
);
setColumns(newColumns);
const statusIndex = columns.findIndex((item) => item.dataIndex === 'statusName');
const outerIndex = columns.findIndex((item) => item.dataIndex === 'outerStatusName');
const innerIndex = columns.findIndex((item) => item.dataIndex === 'innerStatusName');
if (statusIndex) {
columnsHandle.replace(statusIndex, {
...columns[statusIndex],
filters: status.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
});
}
if (outerIndex) {
columnsHandle.replace(outerIndex, {
...columns[outerIndex],
filters: outerStatus.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
});
}
if (innerIndex) {
columnsHandle.replace(innerIndex, {
...columns[innerIndex],
filters: innerStatus.map(item => ({ text: item.text, value: item.id })).filter(item => item.value !== 0),
});
}
return {
memberTypeId: memberTypes.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
......@@ -233,7 +252,7 @@ const MemberMaintain: React.FC<[]> = () => {
fetchSelectOptions,
);
}}
schema={maintianSchema}
schema={querySchema}
/>
}
/>
......
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 11:49:18
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 11:49:18
* @Description:
*/
import { ISchema } from '@formily/antd';
import { FORM_FILTER_PATH } from '@/formSchema/const';
export const querySchema: ISchema = {
type: 'object',
properties: {
megaLayout: {
type: 'object',
'x-component': 'mega-layout',
properties: {
name: {
type: 'string',
'x-component': 'Search',
'x-component-props': {
placeholder: '搜索',
align: 'flex-left',
tip: '输入 会员名称 进行搜索',
},
},
[FORM_FILTER_PATH]: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 6,
},
properties: {
memberTypeId: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员类型(全部)',
allowClear: true,
},
},
roleId: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员角色(全部)',
allowClear: true,
},
},
level: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '会员等级(全部)',
allowClear: true,
},
},
source: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '申请来源(全部)',
allowClear: true,
},
},
innerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '内部状态(全部)',
allowClear: true,
},
},
outerStatus: {
type: 'string',
default: undefined,
enum: [],
'x-component-props': {
placeholder: '外部状态(全部)',
allowClear: true,
},
},
status: {
type: 'string',
enum: [],
default: undefined,
'x-component-props': {
placeholder: '会员状态(全部)',
allowClear: true,
},
},
'[startDate, endDate]': {
type: 'string',
default: '',
'x-component': 'dateSelect',
'x-component-props': {
placeholder: '时间范围(全部)',
allowClear: true,
},
},
submit: {
'x-component': 'Submit',
'x-mega-props': {
span: 1,
},
'x-component-props': {
children: '查询',
},
},
},
},
},
},
},
};
This diff is collapsed.
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:36:43
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 11:40:54
* @Description: 解除解冻
*/
import React, { useState, useEffect } from 'react';
import {
Button,
Modal,
Row,
Col,
Spin,
} from 'antd';
import { history } from 'umi';
import { StopOutlined } from '@ant-design/icons';
import {
createFormActions,
FormEffectHooks,
} from '@formily/antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailResponse } from '@/services/MemberV2Api';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import LevelBrand from '@/components/LevelBrand';
import FlowRecords from '@/components/FlowRecords';
import CustomizeColumn from '@/components/CustomizeColumn';
import NiceForm from '@/components/NiceForm';
import { freezeSchema } from '../freeze/schema';
import {
MEMBER_OUTER_COLUMNS,
MEMBER_INNER_COLUMNS,
} from '../../constant';
import MemberBasicInfo from '../../components/MemberBasicInfo';
import MemberChannelInfo from '../../components/MemberChannelInfo';
import PicWrap from '../../components/PicWrap';
type ValueType = {
/**
* 理由
*/
reason: string,
}
const formActions = createFormActions();
const MemberMaintainUnfreeze: React.FC<{}> = () => {
const { validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailResponse>(null);
const [modalVisible, setModalVisible] = useState(false);
const [infoLoading, setInfoLoaading] = useState(false);
const [confirmLoading, setConfirmLoading] = useState(false);
const getBasicInfo = () => {
if (!validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetail({
validateId,
}).then(res => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).finally(() => {
setInfoLoaading(false);
});
};
useEffect(() => {
getBasicInfo();
}, []);
// 解冻与解冻
const handleSubmit = (values: ValueType) => {
setConfirmLoading(true);
return PublicApi.postMemberAbilityMaintenanceFreeze({
validateId: validateId,
status: 1,
reason: values.reason || '',
}).then(res => {
if (res.code !== 1000) {
return;
}
setModalVisible(false);
setTimeout(() => {
history.goBack();
}, 800);
}).finally(() => {
setConfirmLoading(false);
});
};
const anchorsArr = [
{
key: 'verifySteps',
name: '流转进度',
},
{
key: 'basicInfo',
name: '基本信息',
},
(
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? {
key: 'channelInfo',
name: '渠道信息',
}
: null
),
...(
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => ({
key: `group${index}`,
name: item.groupName,
}))
: []
),
{
key: 'flowRecords',
name: '流转记录',
},
].filter(Boolean);
return (
<Spin spinning={infoLoading}>
<AnchorPage
title={(
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<LevelBrand level={2} />
)}
/>
)}
anchors={anchorsArr}
extra={(
<Button
icon={<StopOutlined />}
onClick={() => setModalVisible(true)}
>
解冻
</Button>
)}
>
<Row gutter={[16, 16]}>
{/* 基本信息 */}
<Col span={24}>
<MemberBasicInfo
dataSource={{
memberId: memberInfo?.memberId,
memberTypeName: memberInfo?.memberTypeName,
account: memberInfo?.account,
name: memberInfo?.name,
roleName: memberInfo?.roleName,
phone: memberInfo?.phone,
outerStatus: memberInfo?.outerStatus,
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
</Col>
{/* 渠道信息 */}
{
memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_CORPORATE
|| memberInfo?.memberTypeEnum === MEMBER_TYPE_CHANNEL_INDIVIDUAL
? (
<Col span={24}>
<MemberChannelInfo
dataSource={{
level: memberInfo?.channelLevelTag,
type: memberInfo?.channelTypeName,
areas: memberInfo?.areas,
desc: memberInfo?.remark,
}}
id="channelInfo"
/>
</Col>
)
: null
}
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
id={`group${index}`}
/>
</Col>
))
: null
}
{/* 流转记录 */}
<Col span={24}>
<FlowRecords
outerColumns={MEMBER_OUTER_COLUMNS}
innerColumns={MEMBER_INNER_COLUMNS}
outerRowkey="id"
innerRowkey="id"
outerDataSource={memberInfo?.outerHistory}
id="flowRecords"
/>
</Col>
</Row>
{/* 解冻相关 */}
<Modal
title="会员解冻"
visible={modalVisible}
confirmLoading={confirmLoading}
onOk={() => formActions.submit()}
onCancel={() => setModalVisible(false)}
destroyOnClose
>
<NiceForm
previewPlaceholder="' '"
effects={($, { setFieldState }) => {
FormEffectHooks.onFieldInit$('reason').subscribe(() => {
setFieldState('reason', fieldState => {
fieldState.props.title = '会员解冻原因';
});
});
}}
actions={formActions}
schema={freezeSchema}
onSubmit={handleSubmit}
/>
</Modal>
</AnchorPage>
</Spin>
);
};
export default MemberMaintainUnfreeze;
/*
* @Author: XieZhiXiong
* @Date: 2021-06-04 10:39:42
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 10:47:51
* @Description:
*/
import { ISchema } from '@formily/antd';
export const unfriendModalSchema: ISchema = {
type: 'object',
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'mega-layout',
'x-component-props': {
labelAlign: 'top',
},
properties: {
date: {
type: 'string',
title: '解除日期',
'x-component': 'DatePicker',
'x-component-props': {
placeholder: '请选择',
style: {
width: '100%',
},
},
'x-rules': [
{
required: true,
message: '请选择解除日期',
},
],
},
reason: {
type: 'string',
title: '解除原因',
'x-component': 'Textarea',
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
maxLength: 60,
rows: 5,
},
'x-rules': [
{
required: true,
message: '请填写原因',
},
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
};
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment