Commit 60dbb23a authored by XieZhiXiong's avatar XieZhiXiong

feat: 对接 申请会员 相关

parent 35e88105
......@@ -28,7 +28,7 @@ const schema = new Schema({
properties: {
file: {
type: 'string',
'x-component': 'QualificationUpload',
'x-component': 'QualitiesUpload',
'x-component-props': {
action: '/api/file/file/upload/prefix',
data: {
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-01 20:03:23
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-04 17:33:30
* @LastEditTime: 2021-06-04 20:47:18
* @Description: 补充资质证明抽屉
*/
import React from 'react';
......@@ -16,7 +16,7 @@ import {
import { DatePicker, Checkbox } from '@formily/antd-components'
import NiceForm from '@/components/NiceForm';
import { schema } from './schema';
import QualificationUpload from '../../../components/QualitiesUpload';
import QualitiesUpload from '../../../components/QualitiesUpload';
import QualificationUploadFormItem from '../../../components/QualificationUploadFormItem';
export type FileType = {
......@@ -120,7 +120,7 @@ const UploadQualificationsDrawer: React.FC<IProps> = (props: IProps) => {
DatePicker,
Checkbox,
CheckboxGroup: Checkbox.Group,
QualificationUpload,
QualitiesUpload,
QualificationUploadFormItem,
}}
effects={() => {
......
......@@ -2,35 +2,80 @@
* @Author: XieZhiXiong
* @Date: 2021-05-27 10:51:52
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-05-27 11:20:54
* @LastEditTime: 2021-06-04 20:06:51
* @Description: 注册信息
*/
import React from 'react';
import React, { useState, useEffect } from 'react';
import { Spin } from 'antd';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityInfoApplyDetailResponse } from '@/services/MemberV2Api';
import CustomizeColumn from '@/components/CustomizeColumn';
import PicWrap from '../../../../components/PicWrap';
import styles from './index.less';
const RegisterInfo = () => {
const data = [
{
title: '公司名称',
value: '温州市隆昌皮业有限公司',
},
{
title: '登记机关',
value: '广州市工商局',
},
{
title: '营业执照',
value: '广州市工商局',
},
];
interface IProps {
/**
* 上级会员id
*/
upperMemberId: number,
/**
* 上级会员角色Id
*/
upperRoleId: number,
}
const RegisterInfo: React.FC<IProps> = (props: IProps) => {
const {
upperMemberId,
upperRoleId,
} = props;
const [registerInfo, setRegisterInfo] = useState<GetMemberAbilityInfoApplyDetailResponse>();
const [loading, setLoading] = useState(false);
const getRegisterInfo = async () => {
if (!upperMemberId || !upperRoleId) {
return;
}
setLoading(true);
const res = await PublicApi.getMemberAbilityInfoApplyDetail({
upperMemberId: `${upperMemberId}`,
upperRoleId: `${upperRoleId}`,
});
if (res.code === 1000) {
setRegisterInfo(res.data);
}
setLoading(false);
};
useEffect(() => {
getRegisterInfo();
}, [props.upperMemberId, props.upperRoleId]);
return (
<Spin spinning={loading}>
{registerInfo?.registerDetails.map((item) => (
<CustomizeColumn
key={item.groupName}
title={(
<div className={styles['card-box-title']}>营业执照信息</div>
<div className={styles['card-box-title']}>{item.groupName}</div>
)}
data={(
item.elements.map((ele) => ({
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
: (
<PicWrap
pics={[ele.fieldValue]}
/>
)
),
}))
)}
data={data}
/>
))}
</Spin>
);
};
......
......@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-05-26 16:52:48
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-01 18:11:27
* @LastEditTime: 2021-06-04 21:13:44
* @Description: 申请会员
*/
import React, { useState, useEffect, useRef } from 'react';
......@@ -21,14 +21,51 @@ import { usePageStatus } from '@/hooks/usePageStatus';
import ReutrnEle from '@/components/ReturnEle';
import NiceForm from '@/components/NiceForm';
import MellowCard from '@/components/MellowCard';
// import { PublicApi } from '@/services/api';
// import { GetMemberAbilitySubGetResponse } from '@/services/MemberApi';
import { PublicApi } from '@/services/api';
import { GetMemberAbilityInfoApplyDepositDetailResponse } from '@/services/MemberV2Api';
import schema from './schema';
import ComingAgreement from './components/ComingAgreement';
import RegisterInfo from './components/RegisterInfo';
import SubmitSuccess from './components/SubmitSuccess';
import QualitiesUpload from '../../components/QualitiesUpload';
import QualificationUploadFormItem from '../../components/QualificationUploadFormItem';
type ValueType = {
step3: { [key: string]: any },
step4: {
/**
* 资质文件
*/
qualities: {
/**
* 到期时间
*/
expireDay: string,
/**
* 是否长期有限
*/
permanent: number[],
/**
* 文件
*/
file: {
/**
* 文件名
*/
name: string,
/**
* 路径
*/
url: string,
/**
* 状态
*/
status: string,
},
}[],
},
}
let countDownLen = 3;
const formActions = createFormActions();
......@@ -39,11 +76,13 @@ const onStepNext$ = createEffectHook('onStepNext');
const onStepPrevious$ = createEffectHook('onStepPrevious');
const MemberQueryApplyMember: React.FC = () => {
const { memberTypeId, roleId } = usePageStatus();
const { upperMemberId, upperRoleId } = usePageStatus();
const [ticktack, setTicktack] = useState(countDownLen);
const [currenStep, setCurrenStep] = useState(0);
const [submitLoading, setSubmitLoading] = useState(false);
const [unsaved, setUnsaved] = useState(false);
const [depositInfo, setDepositInfo] = useState<GetMemberAbilityInfoApplyDepositDetailResponse>();
const [loading, setLoading] = useState(false);
const stepRef = useRef(0);
......@@ -70,35 +109,64 @@ const MemberQueryApplyMember: React.FC = () => {
}
}, []);
const handleSubmit = (values: any) => {
if (!memberTypeId || !roleId) {
const getDepositInfo = async () => {
if (!upperMemberId || !upperRoleId) {
return;
}
setLoading(true);
const res = await PublicApi.getMemberAbilityInfoApplyDepositDetail({
upperMemberId: `${upperMemberId}`,
upperRoleId: `${upperRoleId}`,
});
if (res.code === 1000) {
setDepositInfo(res.data);
}
setLoading(false);
};
useEffect(() => {
getDepositInfo();
}, []);
const handleSubmit = (values: ValueType) => {
if (!upperMemberId || !upperRoleId) {
return;
}
const {
step3,
step4: {
qualities = [],
},
} = values;
setSubmitLoading(true);
const msg = message.loading({
content: '正在保存,请稍候...',
duration: 0,
});
// PublicApi.postMemberAbilityInfoAddrole({
// memberTypeId,
// roleId,
// detail: values,
// }).then(res => {
// if (res.code !== 1000) {
// return;
// }
// setUnsaved(false);
// setTimeout(() => {
// history.goBack();
// }, 800);
// }).finally(() => {
// msg();
// setSubmitLoading(false);
// });
PublicApi.postMemberAbilityInfoApply({
upperMemberId,
upperRoleId,
depositDetails: step3,
qualities: qualities.map((item) => ({
expireDay: item.expireDay,
permanent: item.permanent[0] || 0,
url: item.file.url,
name: item.file.name,
})),
}).then(res => {
if (res.code !== 1000) {
return;
}
setUnsaved(false);
formActions.dispatch('onStepNext', {})
}).finally(() => {
msg();
setSubmitLoading(false);
});
};
return (
<Spin spinning={false}>
<Spin spinning={loading}>
<PageHeaderWrapper
style={{
padding: 24,
......@@ -154,8 +222,9 @@ const MemberQueryApplyMember: React.FC = () => {
</Button>
<Button
type="primary"
onClick={() => {
formActions.dispatch('onStepNext', {})
onClick={async () => {
await formActions.validate('step3.*');
formActions.dispatch('onStepNext', {});
}}
>
下一步:上传资质证明
......@@ -178,8 +247,9 @@ const MemberQueryApplyMember: React.FC = () => {
</Button>
<Button
type="primary"
loading={submitLoading}
onClick={() => {
formActions.dispatch('onStepNext', {})
formActions.submit()
}}
>
确认提交
......@@ -198,12 +268,13 @@ const MemberQueryApplyMember: React.FC = () => {
Checkbox,
CheckboxGroup: Checkbox.Group,
DatePicker,
QualitiesUpload,
QualificationUploadFormItem,
}}
expressionScope={{
currenStep,
ComingAgreement: <ComingAgreement />,
RegisterInfo: <RegisterInfo />,
RegisterInfo: <RegisterInfo upperMemberId={upperMemberId} upperRoleId={upperRoleId} />,
SubmitSuccess: <SubmitSuccess />,
}}
effects={($, actions) => {
......@@ -223,7 +294,7 @@ const MemberQueryApplyMember: React.FC = () => {
}
});
}}
schema={schema}
schema={schema(depositInfo?.depositDetails)}
/>
</MellowCard>
</PageHeaderWrapper>
......
......@@ -2,12 +2,62 @@
* @Author: XieZhiXiong
* @Date: 2021-05-26 17:00:39
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-06-01 16:53:42
* @LastEditTime: 2021-06-04 20:31:47
* @Description:
*/
import { ISchema } from '@formily/antd';
import { createMemberSchema, ElementType } from '../../utils';
const schema: ISchema = {
export type GroupItem = {
/**
* 组名
*/
groupName: string,
/**
* 元素
*/
elements: ElementType[],
};
const schema = (groups: GroupItem[]): ISchema => {
const depositSchema: ISchema = {
type: 'object',
properties: {},
};
(groups || []).forEach((item, index) => {
depositSchema.properties[`CARD_BOX_${index}`] = {
type: 'object',
'x-component': 'CardBox',
'x-component-props': {
title: item.groupName,
wrapProps: {
style: {
padding: '24px 16px',
},
},
},
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 2,
labelCol: 6,
wrapperCol: 18,
labelAlign: 'left',
},
properties: createMemberSchema(item.elements),
},
},
};
});
return {
type: 'object',
properties: {
STEP_LAYOUT: {
......@@ -67,104 +117,7 @@ const schema: ISchema = {
},
},
},
step3: {
type: 'object',
properties: {
INCOMING_INFO: {
type: 'object',
'x-component': 'CardBox',
'x-component-props': {
title: '填写入库信息',
wrapProps: {
style: {
padding: '24px 16px',
},
},
},
properties: {
MEGA_LAYOUT: {
type: 'object',
'x-component': 'Mega-Layout',
'x-component-props': {
grid: true,
full: true,
autoRow: true,
columns: 2,
labelCol: 6,
wrapperCol: 18,
labelAlign: 'left',
},
properties: {
mode: {
type: 'string',
title: '商业模式',
enum: [],
'x-component-props': {},
},
description: {
type: 'string',
title: '公司简介',
'x-component': 'textarea',
'x-component-props': {
placeholder: '',
rows: 5,
},
},
industry: {
type: 'string',
title: '主营行业',
'x-component-props': {
placeholder: '',
},
},
partner: {
type: 'string',
title: '合作伙伴',
'x-component-props': {
placeholder: '',
},
},
category: {
type: 'string',
title: '主营品类',
'x-component-props': {
placeholder: '',
},
},
project: {
type: 'string',
title: '代表性合作项目',
'x-component-props': {
placeholder: '',
},
},
scale: {
type: 'string',
title: '公司规模',
'x-component-props': {
placeholder: '',
},
},
brand: {
type: 'string',
title: '代理品牌',
'x-component-props': {
placeholder: '',
},
},
size: {
type: 'string',
title: '工厂面积',
'x-component-props': {
placeholder: '',
},
},
},
},
},
},
},
},
step3: depositSchema,
step4: {
type: 'object',
properties: {
......@@ -180,7 +133,7 @@ const schema: ISchema = {
},
},
properties: {
mode: {
qualities: {
type: 'array',
'x-component': 'QualificationUploadFormItem',
},
......@@ -201,6 +154,7 @@ const schema: ISchema = {
},
},
},
}
};
export default schema;
\ No newline at end of file
......@@ -62,7 +62,7 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
outerStatusName: memberInfo?.outerStatusName,
levelTag: memberInfo?.levelTag,
email: memberInfo?.email,
createTime: memberInfo?.createTime,
createTime: memberInfo?.registerTime,
}}
id="basicInfo"
/>
......@@ -90,14 +90,14 @@ const MemberBasicInfo: React.FC<MemberBasicInfoProps> = ({
{/* 其他注册信息 */}
{
memberInfo && memberInfo.groups
? memberInfo.groups.map((item, index) => (
memberInfo && memberInfo.registerDetails
? memberInfo.registerDetails.map((item, index) => (
<Col span={24} key={`group${index}`}>
<CustomizeColumn
title={item.groupName}
data={(
item.elements.map((ele) => ({
title: ele.fieldCNName,
title: ele.fieldLocalName,
value: (
ele.fieldType !== 'upload'
? ele.fieldValue
......
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