Commit 32e3974f authored by XieZhiXiong's avatar XieZhiXiong

feat: 完成 会员待入库分类 相关UI

parent 4c144cd4
@import '~antd/es/style/themes/default.less';
.description {
margin-bottom: @margin-md;
}
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-05-24 17:47:32
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 16:54:24
* @Description: 审核Form抽屉
*/
import React from 'react';
import {
Drawer,
Button,
} from 'antd';
import NiceForm from '@/components/NiceForm';
import {
createFormActions,
} from '@formily/antd';
import { ArrayCards } from '@formily/antd-components';
import {
schema,
} from './schema';
import styles from './index.less';
interface IProps {
/**
* 是否可见
*/
visible: boolean,
/**
* Form 确认事件
*/
onSubmit: (values: any) => void,
/**
* 抽屉关闭事件
*/
onClose: () => void,
}
const formActions = createFormActions();
const ComingClassifyDrawer: React.FC<IProps> = (props: IProps) => {
const {
visible,
onSubmit,
onClose,
} = props;
const handleClose = () => {
if (onClose) {
onClose();
}
};
const handleSubmit = (values: any) => {
if (onSubmit) {
onSubmit(values);
}
};
const MemberCodeDescription = (
<div className={styles.description}>
<div>长度最多10位,不可重复</div>
<div>不支持特殊符号(除英文"_-";下划线和中划线)</div>
</div>
);
const MemberCypher = (
<div className={styles.description}>
<div>允许单次采购最大金额</div>
</div>
);
return (
<Drawer
title="入库分类信息"
width={620}
onClose={handleClose}
visible={visible}
getContainer="#root"
footer={
<div
style={{
textAlign: 'right',
}}
>
<Button onClick={handleClose} style={{ marginRight: 16 }}>
取消
</Button>
<Button onClick={() => formActions.submit()} type="primary">
确 定
</Button>
</div>
}
>
<NiceForm
previewPlaceholder="' '"
components={{
ArrayCards,
}}
expressionScope={{
MemberCodeDescription,
MemberCypher,
}}
effects={() => {
}}
actions={formActions}
schema={schema}
onSubmit={values => handleSubmit(values)}
/>
</Drawer>
);
};
export default ComingClassifyDrawer;
/*
* @Author: XieZhiXiong
* @Date: 2021-05-24 18:00:52
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 17:36:13
* @Description:
*/
import { ISchema } from '@formily/antd';
export const schema: ISchema = {
type: 'object',
properties: {
INVESTIGATE_INFO: {
type: 'object',
'x-component': 'CardBox',
'x-component-props': {
title: '入库分类信息',
},
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 20,
labelAlign: 'left',
},
properties: {
channelLevel: {
type: 'string',
title: '会员编码',
required: true,
description: '{{MemberCodeDescription}}',
},
channelTypeId: {
type: 'string',
enum: [],
title: '合作关系',
required: true,
},
channelLevel2: {
type: 'string',
title: '单次合作金额',
required: true,
'x-component-props': {
addonBefore: '¥',
},
description: '{{MemberCypher}}',
},
areas: {
type: 'array',
title: '适用区域',
required: true,
'x-component': 'CustomAddArray',
default: [],
items: {
type: 'object',
properties: {
pcode: {
type: 'string',
enum: [],
'x-component-props': {
allowClear: true,
},
},
ccode: {
type: 'string',
enum: [],
'x-component-props': {
allowClear: true,
},
}
}
}
},
managementCategory: {
type: 'array',
title: '主营品类',
required: true,
'x-component': 'ArrayCards',
'x-component-props': {
title: ' ',
renderMoveDown: () => null,
renderMoveUp: () => null,
},
items: {
type: 'object',
'x-mega-props': {
labelCol: 5,
wrapperCol: 19,
},
properties: {
CATEGORY_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 3,
label: '品类',
},
properties: {
provinceId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
cityId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
areaId: {
type: 'string',
enum: [],
'x-component-props': {
placeholder: '请选择',
},
required: true,
},
},
},
cycle: {
type: 'string',
enum: [],
title: '付款周期(天)',
required: true,
},
invoiceType: {
type: 'string',
enum: [],
title: '发票类型',
required: true,
},
taxPoint: {
type: 'string',
title: '税点',
required: true,
},
},
},
},
},
},
},
},
VERIFY_APPLY: {
type: 'object',
'x-component': 'CardBox',
'x-component-props': {
title: '单据审核',
},
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
labelCol: 4,
wrapperCol: 18,
labelAlign: 'left',
},
properties: {
agree: {
type: 'string',
title: '是否通过',
default: 1,
'x-component': 'Radio',
required: true,
enum: [
{ label: '审核通过', value: 1 },
{ label: '审核不通过', value: 0 },
],
'x-component-props': {},
},
reason: {
type: 'string',
title: '不通过原因',
'x-component': 'Textarea',
required: true,
'x-component-props': {
placeholder: '在此输入你的内容,最长120个字符,60个汉字',
rows: 5,
},
'x-rules': [
{
limitByte: true, // 自定义校验规则
maxByte: 120,
}
],
},
},
},
},
},
},
};
\ No newline at end of file
/*
* @Author: XieZhiXiong
* @Date: 2021-05-25 14:35:56
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 15:55:52
* @Description: 待入库分类详情
*/
import React, { useState, useEffect } from 'react';
import {
Row,
Col,
Spin,
} from 'antd';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailBasicResponse } from '@/services/MemberApi';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import AuditProcess from '@/components/AuditProcess';
import LevelBrand from '@/components/LevelBrand';
import FlowRecords from '@/components/FlowRecords';
import CustomizeColumn from '@/components/CustomizeColumn';
import {
MEMBER_OUTER_COLUMNS,
MEMBER_INNER_COLUMNS,
} from '../constant';
import MemberBasicInfo from '../components/MemberBasicInfo';
import MemberChannelInfo from '../components/MemberChannelInfo';
import MemberDocIncomingInfo from '../components/MemberDocIncomingInfo';
import MemberInvestigateInfo from '../components/MemberInvestigateInfo';
import PicWrap from '../components/PicWrap';
const MemberPrComingClassify: React.FC<{}> = () => {
const { id, validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailBasicResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false);
const getBasicInfo = () => {
if (!id || !validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetailBasic({
memberId: id,
validateId,
}).then(res => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).finally(() => {
setInfoLoaading(false);
});
};
useEffect(() => {
getBasicInfo();
}, []);
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: 'incomingInfo',
name: '入库信息',
},
{
key: 'investigateInfo',
name: '考察信息',
},
{
key: 'flowRecords',
name: '流转记录',
},
].filter(Boolean);
return (
<Spin spinning={infoLoading}>
<AnchorPage
title={(
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<LevelBrand level={2} />
)}
/>
)}
anchors={anchorsArr}
>
<Row gutter={[16, 16]}>
{/* 会员审核流程 */}
<Col span={24}>
<AuditProcess
outerVerifySteps={memberInfo?.outerVerifySteps}
outerVerifyCurrent={memberInfo?.currentOuterStep}
innerVerifySteps={memberInfo?.innerVerifySteps}
innerVerifyCurrent={memberInfo?.currentInnerStep}
id="verifySteps"
/>
</Col>
{/* 基本信息 */}
<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?.createTime,
}}
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.fieldCNName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
id={`group${index}`}
/>
</Col>
))
: null
}
{/* 入库信息 */}
<Col span={24}>
<MemberDocIncomingInfo
id="incomingInfo"
/>
</Col>
{/* 考察信息 */}
<Col span={24}>
<MemberInvestigateInfo
id="investigateInfo"
/>
</Col>
{/* 流转记录 */}
<Col span={24}>
<FlowRecords
outerColumns={MEMBER_OUTER_COLUMNS}
innerColumns={MEMBER_INNER_COLUMNS}
outerRowkey="id"
innerRowkey="id"
outerDataSource={memberInfo?.outerHistory}
id="flowRecords"
/>
</Col>
</Row>
</AnchorPage>
</Spin>
);
};
export default MemberPrComingClassify;
/*
* @Author: XieZhiXiong
* @Date: 2021-05-25 14:34:56
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 14:34:57
* @Description: 待入库分类
*/
import React, { useState, useRef } from 'react';
import { history } from 'umi';
import { Card, Space, Button, Modal, message } from 'antd';
import { QuestionCircleOutlined } from '@ant-design/icons';
import { StandardTable } from 'god';
import moment from 'moment';
import { ColumnType } from 'antd/lib/table/interface';
import { createFormActions } from '@formily/antd';
import NiceForm from '@/components/NiceForm';
import { useStateFilterSearchLinkageEffect } from '@/formSchema/effects/useFilterSearch';
import { FORM_FILTER_PATH } from '@/formSchema/const';
import { useAsyncInitSelect } from '@/formSchema/effects/useAsyncInitSelect';
import { PublicApi } from '@/services/api';
import useSpliceArray from '@/hooks/useSpliceArray';
import comingSchema from '../common/schames/comingSchema';
import verifyComingColumn from '../common/columns/verifyComingColumn';
const { confirm } = Modal;
const formActions = createFormActions();
const MemberPrComingClassify: React.FC<{}> = props => {
const ref = useRef<any>({});
const [selectedRowKeys, setSelectedRowKeys] = useState<Array<string>>([]);
const [selectedList, setSelectList] = useState<any>([]);
const handleJumpAudit = record => {
history.push(`/memberCenter/memberAbility/manage/memberPrComingClassify/verify?id=${record.memberId}&validateId=${record.validateId}`);
};
const defaultColumns = verifyComingColumn('/memberCenter/memberAbility/manage/memberPrComingClassify/detail').concat([
{
title: '操作',
dataIndex: 'option',
align: 'center',
render: (_, record) => (
<Button
type="link"
onClick={() => handleJumpAudit(record)}
>
审核
</Button>
),
},
]);
const [columns, columnsHandle] = useSpliceArray<ColumnType<any>>(defaultColumns);
const rowSelection = {
onChange: (keys: any, rows: {}[]) => {
setSelectedRowKeys(keys);
setSelectList(rows);
},
selectedRowKeys: selectedRowKeys,
};
const fetchListData = async (params: any) => {
const { startDate = null, endDate = null } = params;
const payload = { ...params };
if (startDate) {
payload.startDate = moment(+startDate).format('YYYY-MM-DD');
}
if (endDate) {
payload.endDate = moment(+endDate).format('YYYY-MM-DD');
}
const res = await PublicApi.getMemberAbilityMaintenancePage(payload);
if (res.code === 1000) {
return res.data;
}
return [];
};
const handleBatch = () => {
if (!selectedList.length) {
message.warning('未选择任何会员');
return;
}
confirm({
title: '提示',
icon: <QuestionCircleOutlined />,
content: '确定要审核通过选中的会员吗?',
onOk() {
const members = selectedList.map(item => ({ memberId: item.memberId, validateId: item.validateId }));
return new Promise<void>((resolve, reject) => {
PublicApi.postMemberAbilityValidateCommitBatch(members)
.then(res => {
if (res.code === 1000) {
ref.current.reload();
setSelectedRowKeys([]);
resolve();
}
reject();
})
.catch(() => {
reject();
});
});
},
});
};
// 初始化高级筛选选项
const fetchSearchItems = async () => {
const res = await PublicApi.getMemberAbilityValidateCommitPageitems();
if (res.code === 1000) {
const { data = {} }: any = res;
const {
memberTypes = [],
roles = [],
sources = [],
} = data;
const memberTypeIndex = columns.findIndex((item) => item.dataIndex === 'memberTypeName');
const roleIndex = columns.findIndex((item) => item.dataIndex === 'roleName');
if (memberTypeIndex) {
columnsHandle.replace(memberTypeIndex, {
...columns[memberTypeIndex],
filters: memberTypes.map(item => ({ text: item.memberTypeName, value: item.memberTypeId })),
});
}
if (roleIndex) {
columnsHandle.replace(roleIndex, {
...columns[roleIndex],
filters: roles.map(item => ({ text: item.roleName, value: item.roleId })),
});
}
return {
memberTypeId: memberTypes.map(item => ({ label: item.memberTypeName, value: item.memberTypeId })),
roleId: roles.map(item => ({ label: item.roleName, value: item.roleId })),
source: sources.map(item => ({ label: item.text, value: item.id })),
};
}
return {};
};
return (
<Card>
<StandardTable
tableProps={{
rowKey: 'validateId',
}}
columns={columns}
currentRef={ref}
fetchTableData={(params: any) => fetchListData(params)}
rowSelection={rowSelection}
controlRender={
<NiceForm
actions={formActions}
onSubmit={values => ref.current.reload(values)}
effects={($, actions) => {
useStateFilterSearchLinkageEffect(
$,
actions,
'name',
FORM_FILTER_PATH,
);
useAsyncInitSelect(
['memberTypeId', 'roleId', 'source'],
fetchSearchItems,
);
}}
schema={comingSchema}
/>
}
/>
</Card>
);
};
export default MemberPrComingClassify;
/*
* @Author: XieZhiXiong
* @Date: 2021-05-25 14:36:14
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-25 14:36:15
* @Description: 入库分类
*/
import React, { useState, useEffect } from 'react';
import {
Row,
Col,
Spin,
Button,
} from 'antd';
import {
CheckCircleOutlined,
} from '@ant-design/icons';
import { usePageStatus } from '@/hooks/usePageStatus';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityMaintenanceDetailBasicResponse } from '@/services/MemberApi';
import {
MEMBER_TYPE_CHANNEL_CORPORATE,
MEMBER_TYPE_CHANNEL_INDIVIDUAL,
} from '@/constants/member';
import AnchorPage from '@/layouts/AnchorPage';
import AvatarWrap from '@/components/AvatarWrap';
import AuditProcess from '@/components/AuditProcess';
import LevelBrand from '@/components/LevelBrand';
import FlowRecords from '@/components/FlowRecords';
import CustomizeColumn from '@/components/CustomizeColumn';
import {
MEMBER_OUTER_COLUMNS,
MEMBER_INNER_COLUMNS,
} from '../constant';
import MemberBasicInfo from '../components/MemberBasicInfo';
import MemberChannelInfo from '../components/MemberChannelInfo';
import MemberDocIncomingInfo from '../components/MemberDocIncomingInfo';
import MemberInvestigateInfo from '../components/MemberInvestigateInfo';
import PicWrap from '../components/PicWrap';
import ComingClassifyDrawer from './components/ComingClassifyDrawer';
const MemberPrComingClassifyVerify: React.FC<{}> = () => {
const { id, validateId } = usePageStatus();
const [memberInfo, setMemberInfo] = useState<GetMemberAbilityMaintenanceDetailBasicResponse>(null);
const [infoLoading, setInfoLoaading] = useState(false);
const [visibleVerifyDrawer, setVisibleVerifyDrawer] = useState(false);
const getBasicInfo = () => {
if (!id || !validateId) {
return;
}
setInfoLoaading(true);
PublicApi.getMemberAbilityMaintenanceDetailBasic({
memberId: id,
validateId,
}).then(res => {
if (res.code === 1000) {
setMemberInfo(res.data);
}
}).finally(() => {
setInfoLoaading(false);
});
};
useEffect(() => {
getBasicInfo();
}, []);
const handleVisibleVerifyDrawer = (flag?) => {
setVisibleVerifyDrawer(!!flag);
};
const handleSubmit = () => {
console.log('表单提交')
};
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: 'incomingInfo',
name: '入库信息',
},
{
key: 'investigateInfo',
name: '考察信息',
},
{
key: 'flowRecords',
name: '流转记录',
},
].filter(Boolean);
return (
<Spin spinning={infoLoading}>
<AnchorPage
title={(
<AvatarWrap
info={{
name: memberInfo?.name,
}}
extra={(
<LevelBrand level={2} />
)}
/>
)}
anchors={anchorsArr}
extra={(
<Button
type="primary"
icon={<CheckCircleOutlined />}
onClick={() => handleVisibleVerifyDrawer(true)}
>
单据审核
</Button>
)}
>
<Row gutter={[16, 16]}>
{/* 会员审核流程 */}
<Col span={24}>
<AuditProcess
outerVerifySteps={memberInfo?.outerVerifySteps}
outerVerifyCurrent={memberInfo?.currentOuterStep}
innerVerifySteps={memberInfo?.innerVerifySteps}
innerVerifyCurrent={memberInfo?.currentInnerStep}
id="verifySteps"
/>
</Col>
{/* 基本信息 */}
<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?.createTime,
}}
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.fieldCNName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
id={`group${index}`}
/>
</Col>
))
: null
}
{/* 入库信息 */}
<Col span={24}>
<MemberDocIncomingInfo
id="incomingInfo"
/>
</Col>
{/* 考察信息 */}
<Col span={24}>
<MemberInvestigateInfo
id="investigateInfo"
/>
</Col>
{/* 流转记录 */}
<Col span={24}>
<FlowRecords
outerColumns={MEMBER_OUTER_COLUMNS}
innerColumns={MEMBER_INNER_COLUMNS}
outerRowkey="id"
innerRowkey="id"
outerDataSource={memberInfo?.outerHistory}
id="flowRecords"
/>
</Col>
</Row>
</AnchorPage>
<ComingClassifyDrawer
visible={visibleVerifyDrawer}
onClose={() => handleVisibleVerifyDrawer(false)}
onSubmit={handleSubmit}
/>
</Spin>
);
};
export default MemberPrComingClassifyVerify;
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