Commit 90f2c422 authored by GuanHua's avatar GuanHua
parents b6d3b129 7a5f11e4
...@@ -40,6 +40,14 @@ const MemberRoute: RouterChild = { ...@@ -40,6 +40,14 @@ const MemberRoute: RouterChild = {
noMargin: true, noMargin: true,
component: '@/pages/member/memberImport/editMember', component: '@/pages/member/memberImport/editMember',
}, },
// 修改 自己个人信息
{
path: '/memberCenter/memberAbility/manage/import/editMySelf',
name: 'editMySelf',
hideInMenu: true,
noMargin: true,
component: '@/pages/member/memberImport/editMySelf',
},
// 会员导入-详情 // 会员导入-详情
{ {
path: '/memberCenter/memberAbility/manage/import/detail', path: '/memberCenter/memberAbility/manage/import/detail',
......
...@@ -81,6 +81,7 @@ export default { ...@@ -81,6 +81,7 @@ export default {
'menu.memberAbility.memberManage.memberImport': '会员导入', 'menu.memberAbility.memberManage.memberImport': '会员导入',
'menu.memberAbility.memberManage.addMember': '新建会员', 'menu.memberAbility.memberManage.addMember': '新建会员',
'menu.memberAbility.memberManage.editMember': '编辑会员', 'menu.memberAbility.memberManage.editMember': '编辑会员',
'menu.memberAbility.memberManage.editMySelf': '修改会员信息',
'menu.memberAbility.memberManage.memberImportDetail': '会员导入详情', 'menu.memberAbility.memberManage.memberImportDetail': '会员导入详情',
'menu.memberAbility.memberManage.memberMaintain': '会员维护', 'menu.memberAbility.memberManage.memberMaintain': '会员维护',
'menu.memberAbility.memberManage.maintianDetail': '会员详情', 'menu.memberAbility.memberManage.maintianDetail': '会员详情',
......
...@@ -64,7 +64,7 @@ const PaycodeVerifyPanel: React.FC<IProps> = (props) => { ...@@ -64,7 +64,7 @@ const PaycodeVerifyPanel: React.FC<IProps> = (props) => {
// 验证旧的支付密码 // 验证旧的支付密码
const handleVerifySuccess = () => { const handleVerifySuccess = () => {
const payPassword = form.getFieldValue('paycode'); const payPassword = encryptedByAES(form.getFieldValue('paycode'));
const service = PublicApi.postMemberSecurityPayCheck; const service = PublicApi.postMemberSecurityPayCheck;
service({payPassword: payPassword}, { ctlType: "none" }).then((data) => { service({payPassword: payPassword}, { ctlType: "none" }).then((data) => {
console.log(data); console.log(data);
...@@ -96,7 +96,7 @@ const PaycodeVerifyPanel: React.FC<IProps> = (props) => { ...@@ -96,7 +96,7 @@ const PaycodeVerifyPanel: React.FC<IProps> = (props) => {
noStyle noStyle
rules={[{ required: true, message: '请填写支付密码' }]} rules={[{ required: true, message: '请填写支付密码' }]}
> >
<Input autoComplete="off" /> <Input.Password autoComplete="off" />
</Form.Item> </Form.Item>
</Col> </Col>
</Row> </Row>
......
...@@ -76,7 +76,7 @@ const InvoiceArray = (props) => { ...@@ -76,7 +76,7 @@ const InvoiceArray = (props) => {
{toArr(value).map((item, index) => { {toArr(value).map((item, index) => {
return ( return (
<RowStyleLayout {...componentProps} key={index}> <RowStyleLayout {...componentProps} key={index}>
<div style={{display: 'flex'}}> <div style={{display: 'flex', position: 'relative'}}>
<SchemaField path={FormPath.parse(path).concat(index)} /> <SchemaField path={FormPath.parse(path).concat(index)} />
{ {
length - 1 === index length - 1 === index
...@@ -84,15 +84,15 @@ const InvoiceArray = (props) => { ...@@ -84,15 +84,15 @@ const InvoiceArray = (props) => {
: null : null
} }
<Button <Button
style={{marginLeft: length - 1 === index ? '0' : '-16px'}} style={{marginLeft: length - 1 === index ? '0' : '-16px'}}
onClick={() => mutators.remove(index)} onClick={() => mutators.remove(index)}
> >
<MinusOutlined width={44}/> <MinusOutlined width={44}/>
</Button> </Button>
</div> </div>
</RowStyleLayout> </RowStyleLayout>
) )
})} })}
...@@ -117,5 +117,5 @@ const InvoiceArray = (props) => { ...@@ -117,5 +117,5 @@ const InvoiceArray = (props) => {
) )
} }
InvoiceArray.isFieldComponent = true; InvoiceArray.isFieldComponent = true;
export default InvoiceArray export default InvoiceArray
\ No newline at end of file
...@@ -132,46 +132,51 @@ const InvoiceDrawer: React.FC<Iprops> = (props) => { ...@@ -132,46 +132,51 @@ const InvoiceDrawer: React.FC<Iprops> = (props) => {
getContainer={false} getContainer={false}
destroyOnClose destroyOnClose
visible={visible} visible={visible}
bodyStyle={{overflow: 'auto'}}
title={title} title={title}
width={width} width={width}
onClose={onCancel} onClose={onCancel}
footer={renderFooter()} footer={renderFooter()}
> >
<InvoiceInfo infos={invoiceInfo} /> <div style={{display: 'flex', flexDirection: 'column'}}>
{ <InvoiceInfo infos={invoiceInfo} />
type === TypeEnum.edit {
? ( type === TypeEnum.edit
<> ? (
<div className={styles.formHeader}> <>
<div className={styles.invoiceNum}>发票号码</div> <div className={styles.formHeader}>
<div className={styles.invoiceDate}>开票日期</div> <div className={styles.invoiceNum}>发票号码</div>
<div>备注</div> <div className={styles.invoiceDate}>开票日期</div>
</div> <div>备注</div>
<SchemaForm onSubmit={handleForm} actions={formActions} components={{ InvoiceArray, Input, DatePicker }}> </div>
<Field {/* getPopupContainer={triggerNode => { console.log(triggerNode, triggerNode.parentElement); return triggerNode.parentNode}} */}
name="list" <SchemaForm onSubmit={handleForm} actions={formActions} components={{ InvoiceArray, Input, DatePicker }}>
type="array" <Field
x-component="InvoiceArray" name="list"
> type="array"
<Field type="object"> x-component="InvoiceArray"
<Field name="number" x-component="Input" x-rules={[{required: true, message: '请填写发票号'}]} /> >
<Field name="invoiceDate" x-component="DatePicker" x-rules={[{required: true, message: '请选择发票日期'}]} /> <Field type="object">
<Field name="remark" x-component="Input" x-component-props={{style: {width: '240px'}}} /> <Field name="number" x-component="Input" x-rules={[{required: true, message: '请填写发票号'}]} />
<Field name="invoiceDate" x-component-props={{
getPopupContainer: (triggernode) => triggernode.parentElement
}} x-component="DatePicker" x-rules={[{required: true, message: '请选择发票日期'}]} />
<Field name="remark" x-component="Input" x-component-props={{style: {width: '240px'}}} />
</Field>
</Field> </Field>
</Field> </SchemaForm>
</SchemaForm> </>
</> )
) : (
: ( <Table
<Table columns={columns}
columns={columns} dataSource={tableList}
dataSource={tableList} rowKey={record => record.id}
rowKey={record => record.id} />
/>
)
}
)
}
</div>
</Drawer> </Drawer>
) )
} }
......
...@@ -21,7 +21,7 @@ interface Iprops {} ...@@ -21,7 +21,7 @@ interface Iprops {}
const WEEKDAYS = ["天", "一","二", "三", "四", "五","六"]; const WEEKDAYS = ["天", "一","二", "三", "四", "五","六"];
const LEVEL_IMAGE = [level1, level1, level2, level3, level4]; const LEVEL_IMAGE = [level1, level1, level2, level3, level4];
const EDIT_USER_URL = '/memberCenter/memberAbility/query'; const EDIT_USER_URL = '/memberCenter/memberAbility/manage/import/editMySelf';
const USER_CENTER_URL = '/memberCenter/memberAbility/manage/maintain' const USER_CENTER_URL = '/memberCenter/memberAbility/manage/maintain'
const STATUS_COLOR: ("default" | "processing" | "error" | "success")[] = ["default", "processing", "error", "success"] const STATUS_COLOR: ("default" | "processing" | "error" | "success")[] = ["default", "processing", "error", "success"]
...@@ -64,7 +64,7 @@ const UserCenter: React.FC<Iprops> = (props) => { ...@@ -64,7 +64,7 @@ const UserCenter: React.FC<Iprops> = (props) => {
if (info.file.status === 'done') { if (info.file.status === 'done') {
const { code, data } = info.file.response const { code, data } = info.file.response
if(code === 1000) { if(code === 1000) {
PublicApi.postMemberBusinessLogoAdd({logo: data}) PublicApi.postMemberMainpageLogoAdd({logo: data})
.then((res) => { .then((res) => {
if(res.code === 1000) { if(res.code === 1000) {
dispatch({type: 'done', payload: {url: data}}) dispatch({type: 'done', payload: {url: data}})
...@@ -134,7 +134,10 @@ const UserCenter: React.FC<Iprops> = (props) => { ...@@ -134,7 +134,10 @@ const UserCenter: React.FC<Iprops> = (props) => {
</div> </div>
</div> </div>
</div> </div>
<Link to={EDIT_USER_URL} className={styles.link}>修改会员信息</Link> {
userAuth.validateStatus === 2 &&
<Link to={EDIT_USER_URL} className={styles.link}>修改会员信息</Link>
}
</div> </div>
<div className={styles.otherValues}> <div className={styles.otherValues}>
<div className={styles.divider}> <div className={styles.divider}>
......
...@@ -17,23 +17,25 @@ import { GetMemberAbilitySubGetResponse } from '@/services/MemberApi'; ...@@ -17,23 +17,25 @@ import { GetMemberAbilitySubGetResponse } from '@/services/MemberApi';
import { initDetailSchema } from './schema'; import { initDetailSchema } from './schema';
const formActions = createFormActions(); const formActions = createFormActions();
const { const {
onFieldValueChange$, onFieldValueChange$,
onFieldInputChange$, onFieldInputChange$,
onFormInputChange$, onFormInputChange$,
} = FormEffectHooks; } = FormEffectHooks;
interface MemberFormProps { interface MemberFormProps {
id?: number; id?: number;
validateId?: number; validateId?: number;
// 是否是编辑的 // 是否是编辑的
isEdit?: boolean, isEdit?: boolean,
mode?: 'myself' | "any"
}; };
const MemberForm: React.FC<MemberFormProps> = ({ const MemberForm: React.FC<MemberFormProps> = ({
id, id,
validateId, validateId,
isEdit = false, mode,
isEdit = false,
}) => { }) => {
const areaRef = useRef<any[]>([]) const areaRef = useRef<any[]>([])
const [memberItems, setMemberItems] = useState<any>({}); const [memberItems, setMemberItems] = useState<any>({});
...@@ -43,35 +45,42 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -43,35 +45,42 @@ const MemberForm: React.FC<MemberFormProps> = ({
const [unsaved, setUnsaved] = useState(false); const [unsaved, setUnsaved] = useState(false);
const getDetailedInfo = async () => { const getDetailedInfo = async () => {
if (id && validateId && isEdit) { if (id && validateId && isEdit || mode === 'myself') {
setInfoLoading(true); setInfoLoading(true);
const infoRes = await PublicApi.getMemberAbilitySubGet({ let infoRes = null;
memberId: `${id}`, if (mode === 'myself') {
validateId: `${validateId}`, infoRes = await PublicApi.getMemberMainpageDetailGet();
});
} else {
infoRes = await PublicApi.getMemberAbilitySubGet({
memberId: `${id}`,
validateId: `${validateId}`,
});
}
if (infoRes.code !== 1000) { if (infoRes.code !== 1000) {
return; return;
} }
const { const {
memberTypeEnum, memberTypeEnum,
groups = [], groups = [],
areaCodes, areaCodes,
account, account,
channelLevelTag, channelLevelTag,
channelTypeName, channelTypeName,
countryCode, countryCode,
createTime, createTime,
currentStep, currentStep,
levelTag, levelTag,
memberId, memberId,
memberTypeName, memberTypeName,
name, name,
outerHistory, outerHistory,
outerStatusName, outerStatusName,
roleName, roleName,
verifySteps, verifySteps,
...rest ...rest
}: any = infoRes.data; }: any = infoRes.data;
// 注册资料处理 // 注册资料处理
...@@ -101,9 +110,9 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -101,9 +110,9 @@ const MemberForm: React.FC<MemberFormProps> = ({
if (channelRes.code !== 1000) { if (channelRes.code !== 1000) {
return; return;
} }
const { const {
areas = [], areas = [],
channelTypes = [], channelTypes = [],
} = channelRes.data; } = channelRes.data;
const areasOptions = areas.map(item => ({ label: item.name, value: item.code })); const areasOptions = areas.map(item => ({ label: item.name, value: item.code }));
...@@ -117,9 +126,9 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -117,9 +126,9 @@ const MemberForm: React.FC<MemberFormProps> = ({
areaCodes.forEach((area, index) => { areaCodes.forEach((area, index) => {
const { pcode, ccode } = area; const { pcode, ccode } = area;
const province = areas.find(item => item.code === pcode); const province = areas.find(item => item.code === pcode);
if (province && province.children) { if (province && province.children) {
const citys = const citys =
province.children.map((item: { code: string, name: string }) => ({ label: item.name, value: item.code })); province.children.map((item: { code: string, name: string }) => ({ label: item.name, value: item.code }));
formActions.setFieldState( formActions.setFieldState(
`areas.${index}.ccode`, `areas.${index}.ccode`,
...@@ -138,11 +147,11 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -138,11 +147,11 @@ const MemberForm: React.FC<MemberFormProps> = ({
areaRef.current = areas; areaRef.current = areas;
setMemberInfo({ setMemberInfo({
memberTypeId: memberTypeEnum, memberTypeId: memberTypeEnum,
...rest, ...rest,
areas: areaCodes, areas: areaCodes,
channelLevel: channelLevelTag, channelLevel: channelLevelTag,
...detail, ...detail,
}); });
setInfoLoading(false); setInfoLoading(false);
...@@ -153,23 +162,31 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -153,23 +162,31 @@ const MemberForm: React.FC<MemberFormProps> = ({
getDetailedInfo(); getDetailedInfo();
}, []); }, []);
useEffect(() => {
if (mode === "myself") {
formActions.setFieldState('tabs.tab-1.*', state => {
state.editable = false;
});
}
}, [mode])
const handleSubmit = (values: any) => { const handleSubmit = (values: any) => {
const { const {
memberTypeId, memberTypeId,
roleId, roleId,
level, level,
countryCodeId, countryCodeId,
phone, phone,
email, email,
channelLevel, channelLevel,
channelTypeId, channelTypeId,
areas = [], areas = [],
remark, remark,
outerStatus, outerStatus,
status, status,
statusName, statusName,
...rest ...rest
} = values; } = values;
const filtered = areas.filter(item => item.pcode || item.ccode); const filtered = areas.filter(item => item.pcode || item.ccode);
...@@ -177,22 +194,22 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -177,22 +194,22 @@ const MemberForm: React.FC<MemberFormProps> = ({
if (!id && !isEdit) { if (!id && !isEdit) {
setSubmitLoading(true); setSubmitLoading(true);
const msg = message.loading({ const msg = message.loading({
content: '正在添加,请稍候...', content: '正在添加,请稍候...',
duration: 0, duration: 0,
}); });
PublicApi.postMemberAbilitySubAdd({ PublicApi.postMemberAbilitySubAdd({
memberTypeId, memberTypeId,
roleId, roleId,
level, level,
countryCodeId, countryCodeId,
phone, phone,
email, email,
channelTypeId, channelTypeId,
areas: filtered, areas: filtered,
remark, remark,
detail: rest, detail: rest,
}, { }, {
timeout: 0, timeout: 0,
}).then(res => { }).then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
return; return;
...@@ -207,28 +224,28 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -207,28 +224,28 @@ const MemberForm: React.FC<MemberFormProps> = ({
}); });
return; return;
} }
if (id && validateId && isEdit) { if (id && validateId && isEdit) {
setSubmitLoading(true); setSubmitLoading(true);
const msg = message.loading({ const msg = message.loading({
content: '正在保存,请稍候...', content: '正在保存,请稍候...',
duration: 0, duration: 0,
}); });
PublicApi.postMemberAbilitySubUpdate({ PublicApi.postMemberAbilitySubUpdate({
memberId: id, memberId: id,
validateId, validateId,
memberTypeId, memberTypeId,
roleId, roleId,
level, level,
countryCodeId, countryCodeId,
phone, phone,
email, email,
channelTypeId, channelTypeId,
areas: filtered, areas: filtered,
remark, remark,
detail: rest, detail: rest,
}, { }, {
timeout: 0, timeout: 0,
}).then(res => { }).then(res => {
if (res.code !== 1000) { if (res.code !== 1000) {
return; return;
...@@ -242,6 +259,28 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -242,6 +259,28 @@ const MemberForm: React.FC<MemberFormProps> = ({
setSubmitLoading(false); setSubmitLoading(false);
}); });
} }
if (mode === 'myself') {
setSubmitLoading(true);
const msg = message.loading({
content: '正在保存,请稍候...',
duration: 0,
});
PublicApi.postMemberMainpageDetailUpdate({
detail: rest,
}).then(({ data, code }) => {
if (code !== 1000) {
return;
}
setUnsaved(false);
setTimeout(() => {
history.push('/memberCenter/home')
}, 800);
}).finally(() => {
msg();
setSubmitLoading(false);
});
}
}; };
// 会员类型、注册手机下拉框 // 会员类型、注册手机下拉框
...@@ -251,8 +290,8 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -251,8 +290,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
if (res.code === 1000) { if (res.code === 1000) {
const { data = {} }: any = res; const { data = {} }: any = res;
const { const {
memberTypes = [], memberTypes = [],
countryCodes = [], countryCodes = [],
} = data; } = data;
return { return {
...@@ -285,7 +324,7 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -285,7 +324,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
linkage.loaded('roleId'); linkage.loaded('roleId');
}); });
}); });
// 根据会员类型 // 根据会员类型
onFieldInputChange$('memberTypeId').subscribe(fieldState => { onFieldInputChange$('memberTypeId').subscribe(fieldState => {
if (!fieldState.value) { if (!fieldState.value) {
...@@ -309,10 +348,10 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -309,10 +348,10 @@ const MemberForm: React.FC<MemberFormProps> = ({
if (res.code !== 1000) { if (res.code !== 1000) {
return; return;
} }
const { const {
channelLevelTag = '', channelLevelTag = '',
areas = [], areas = [],
channelTypes = [], channelTypes = [],
} = res.data; } = res.data;
formActions.setFieldState('tabs', state => { formActions.setFieldState('tabs', state => {
state.props['x-component-props'] = state.props['x-component-props'] =
...@@ -356,7 +395,7 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -356,7 +395,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
} }
}); });
}); });
// 手动触发改变的话重置等级下拉框 // 手动触发改变的话重置等级下拉框
onFieldInputChange$('*(memberTypeId,roleId)').subscribe(() => { onFieldInputChange$('*(memberTypeId,roleId)').subscribe(() => {
linkage.value('level', undefined); linkage.value('level', undefined);
...@@ -371,15 +410,15 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -371,15 +410,15 @@ const MemberForm: React.FC<MemberFormProps> = ({
setTimeout(() => { setTimeout(() => {
const otherValue = formActions.getFieldState(otherName, state => state.value); const otherValue = formActions.getFieldState(otherName, state => state.value);
if (selfValue && otherValue) { if (selfValue && otherValue) {
linkage.loading('level'); linkage.loading('level');
PublicApi.getMemberAbilitySubPageitemsLevel({ PublicApi.getMemberAbilitySubPageitemsLevel({
memberTypeId: selfName == 'memberTypeId' ? selfValue : otherValue, memberTypeId: selfName == 'memberTypeId' ? selfValue : otherValue,
roleId: selfName == 'memberTypeId' ? otherValue : selfValue, roleId: selfName == 'memberTypeId' ? otherValue : selfValue,
}, { }, {
useCache: true, useCache: true,
}).then(res => { }).then(res => {
if (res.code === 1000) { if (res.code === 1000) {
const { data = [] } = res; const { data = [] } = res;
...@@ -412,13 +451,13 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -412,13 +451,13 @@ const MemberForm: React.FC<MemberFormProps> = ({
return ( return (
<Spin spinning={infoLoading}> <Spin spinning={infoLoading}>
<PageHeaderWrapper <PageHeaderWrapper
style={{ style={{
padding: 24, padding: 24,
}} }}
onBack={() => history.goBack()} onBack={() => history.goBack()}
backIcon={<ReutrnEle description="返回" />} backIcon={<ReutrnEle description="返回" />}
title={!id ? '新建会员' : '编辑会员'} title={!id && mode !== "myself" ? '新建会员' : '编辑会员'}
extra={[ extra={[
<Button <Button
key="1" key="1"
...@@ -460,4 +499,8 @@ const MemberForm: React.FC<MemberFormProps> = ({ ...@@ -460,4 +499,8 @@ const MemberForm: React.FC<MemberFormProps> = ({
); );
}; };
MemberForm.defaultProps = {
mode: 'any',
}
export default MemberForm; export default MemberForm;
...@@ -10,4 +10,4 @@ const EditMember: React.FC = () => { ...@@ -10,4 +10,4 @@ const EditMember: React.FC = () => {
); );
}; };
export default EditMember; export default EditMember;
\ No newline at end of file
import React from 'react';
import { usePageStatus } from '@/hooks/usePageStatus';
import MemberForm from './components/MemberForm';
const EditMySelf: React.FC = () => {
const { id, validateId } = usePageStatus();
console.log(123);
return (
<MemberForm id={+id} validateId={+validateId} isEdit={true} mode={"myself"} />
);
};
export default EditMySelf;
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