Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jinfa-platform
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
黄庭坚
jinfa-platform
Commits
529ba5cc
Commit
529ba5cc
authored
Jun 01, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 对接完毕 会员导入 相关
parent
0bff1a67
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
98 deletions
+113
-98
constant.tsx
src/pages/member/constant.tsx
+2
-2
index.tsx
...pages/member/memberImport/components/MemberForm/index.tsx
+107
-85
editMember.tsx
src/pages/member/memberImport/editMember.tsx
+1
-2
index.tsx
src/pages/member/memberImport/index.tsx
+3
-9
No files found.
src/pages/member/constant.tsx
View file @
529ba5cc
...
...
@@ -86,10 +86,10 @@ export const MEMBER_OUTER_COLUMNS: EditableColumns[] = [
},
{
title
:
'状态'
,
dataIndex
:
'
statusDescription
'
,
dataIndex
:
'
outerStatusName
'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
Badge
color=
{
MEMBER_OUTER_STATUS_BADGE_COLOR
[
record
.
s
tatus
]
}
text=
{
text
}
/>
<
Badge
color=
{
MEMBER_OUTER_STATUS_BADGE_COLOR
[
record
.
outerS
tatus
]
}
text=
{
text
}
/>
),
},
{
...
...
src/pages/member/memberImport/components/MemberForm/index.tsx
View file @
529ba5cc
...
...
@@ -37,13 +37,14 @@ interface MemberFormProps {
* 是否是可编辑的
*/
isEdit
?:
boolean
,
mode
?:
'myself'
|
"any"
// mode?: 'myself' | "any"
};
const
MemberForm
:
React
.
FC
<
MemberFormProps
>
=
({
id
,
validateId
,
mode
,
//
mode,
isEdit
=
false
,
})
=>
{
const
[
memberItems
,
setMemberItems
]
=
useState
<
any
>
({});
...
...
@@ -53,19 +54,20 @@ const MemberForm: React.FC<MemberFormProps> = ({
const
[
unsaved
,
setUnsaved
]
=
useState
(
false
);
const
getDetailedInfo
=
async
()
=>
{
if
(
id
&&
validateId
&&
isEdit
||
mode
===
'myself'
)
{
if
(
id
&&
validateId
)
{
setInfoLoading
(
true
);
let
infoRes
=
null
;
if
(
mode
===
'myself'
)
{
infoRes
=
await
PublicApi
.
getMemberMainpageDetailGet
();
//
if (mode === 'myself') {
//
infoRes = await PublicApi.getMemberMainpageDetailGet();
}
else
{
infoRes
=
await
PublicApi
.
getMemberAbilitySubGet
({
memberId
:
`
${
id
}
`
,
validateId
:
`
${
validateId
}
`
,
});
}
// } else {
// }
infoRes
=
await
PublicApi
.
getMemberAbilitySubGet
({
memberId
:
`
${
id
}
`
,
validateId
:
`
${
validateId
}
`
,
});
if
(
infoRes
.
code
!==
1000
)
{
return
;
...
...
@@ -74,6 +76,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
memberTypeEnum
,
groups
=
[],
areaCodes
,
upperMemberId
,
account
,
channelLevelTag
,
...
...
@@ -90,7 +93,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
roleName
,
verifySteps
,
...
rest
}
:
any
=
infoRes
.
data
;
}
=
infoRes
.
data
;
// 注册资料处理
const
detail
=
{};
for
(
let
i
=
0
;
i
<
groups
.
length
;
i
++
)
{
...
...
@@ -119,32 +122,45 @@ const MemberForm: React.FC<MemberFormProps> = ({
return
;
}
const
{
areas
=
[],
//
areas = [],
channelTypes
=
[],
upperMembers
=
[],
}
=
channelRes
.
data
;
const
areasOptions
=
areas
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
code
}));
//
const areasOptions = areas.map(item => ({ label: item.name, value: item.code }));
const
channelType
=
channelTypes
.
map
(
item
=>
({
label
:
item
.
channelTypeName
,
value
:
item
.
channelTypeId
}));
if
(
areasOptions
.
length
)
{
formActions
.
setFieldState
(
'areas.*.provinceCode'
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.enum'
,
areasOptions
);
// if (areasOptions.length) {
// formActions.setFieldState('areas.*.provinceCode', state => {
// FormPath.setIn(state, 'props.enum', areasOptions);
// });
// areaCodes && areaCodes.forEach((area, index) => {
// const { provinceCode, cityCode } = area;
// const province = areas.find(item => item.code === provinceCode);
// if (province && province.children) {
// const citys =
// province.children.map((item: { code: string, name: string }) => ({ label: item.name, value: item.code }));
// formActions.setFieldState(
// `areas.${index}.cityCode`,
// state => {
// FormPath.setIn(state, 'props.enum', citys);
// }
// );
// }
// });
// }
// 渠道上级id,如果没有也是返回只有一项的数组
if
(
upperMembers
.
length
===
1
&&
!
upperMembers
[
0
].
upperRelationId
)
{
formActions
.
setFieldState
(
'upperRelationId'
,
state
=>
{
FormPath
.
setIn
(
state
,
'visible'
,
false
);
});
areaCodes
&&
areaCodes
.
forEach
((
area
,
index
)
=>
{
const
{
provinceCode
,
cityCode
}
=
area
;
const
province
=
areas
.
find
(
item
=>
item
.
code
===
provinceCode
);
if
(
province
&&
province
.
children
)
{
const
citys
=
province
.
children
.
map
((
item
:
{
code
:
string
,
name
:
string
})
=>
({
label
:
item
.
name
,
value
:
item
.
code
}));
formActions
.
setFieldState
(
`areas.
${
index
}
.cityCode`
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.enum'
,
citys
);
}
);
}
}
else
{
const
upperMembersOptions
=
upperMembers
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
upperRelationId
}));
formActions
.
setFieldState
(
'upperRelationId'
,
state
=>
{
FormPath
.
setIn
(
state
,
'props.enum'
,
upperMembersOptions
);
});
}
...
...
@@ -157,6 +173,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
...
rest
,
areas
:
areaCodes
,
channelLevel
:
channelLevelTag
,
upperRelationId
:
upperMemberId
,
...
detail
,
});
...
...
@@ -168,13 +185,13 @@ const MemberForm: React.FC<MemberFormProps> = ({
getDetailedInfo
();
},
[]);
useEffect
(()
=>
{
if
(
mode
===
"myself"
)
{
formActions
.
setFieldState
(
'tabs.tab-1.MEGA_LAYOUT1.*(memberTypeId, MEGA_LAYOUT1_1.*, roleId, level)'
,
state
=>
{
state
.
editable
=
false
;
});
}
},
[
mode
])
//
useEffect(() => {
//
if (mode === "myself") {
//
formActions.setFieldState('tabs.tab-1.MEGA_LAYOUT1.*(memberTypeId, MEGA_LAYOUT1_1.*, roleId, level)', state => {
//
state.editable = false;
//
});
//
}
//
}, [mode])
const
handleSubmit
=
(
values
:
any
)
=>
{
const
{
...
...
@@ -241,18 +258,9 @@ const MemberForm: React.FC<MemberFormProps> = ({
duration
:
0
,
});
PublicApi
.
postMemberAbilitySubUpdate
({
...
payload
,
memberId
:
id
,
validateId
,
memberTypeId
,
roleId
,
level
,
countryCodeId
,
phone
,
email
,
channelTypeId
,
areas
:
filtered
,
remark
,
detail
:
rest
,
},
{
timeout
:
0
,
}).
then
(
res
=>
{
...
...
@@ -267,39 +275,40 @@ const MemberForm: React.FC<MemberFormProps> = ({
msg
();
setSubmitLoading
(
false
);
});
return
;
}
if
(
mode
===
'myself'
)
{
setSubmitLoading
(
true
);
const
msg
=
message
.
loading
({
content
:
'正在保存,请稍候...'
,
duration
:
0
,
});
PublicApi
.
postMemberMainpageDetailUpdate
({
email
,
detail
:
rest
,
}).
then
(({
data
,
code
})
=>
{
if
(
code
!==
1000
)
{
return
;
}
const
auth
=
getAuth
();
localStorage
.
setItem
(
"auth"
,
JSON
.
stringify
({
...
auth
,
company
:
rest
.
company_name
,
validateMsg
:
null
,
validateStatus
:
1
,
validateStatusDesc
:
"待审核"
}))
setUnsaved
(
false
);
setTimeout
(()
=>
{
history
.
push
(
'/memberCenter/home'
)
},
800
);
}).
finally
(()
=>
{
msg
();
setSubmitLoading
(
false
);
});
}
//
if (mode === 'myself') {
//
setSubmitLoading(true);
//
const msg = message.loading({
//
content: '正在保存,请稍候...',
//
duration: 0,
//
});
//
PublicApi.postMemberMainpageDetailUpdate({
//
email,
//
detail: rest,
//
}).then(({ data, code }) => {
//
if (code !== 1000) {
//
return;
//
}
//
const auth = getAuth();
//
localStorage.setItem("auth", JSON.stringify({
//
...auth,
//
company: rest.company_name,
//
validateMsg: null,
//
validateStatus: 1,
//
validateStatusDesc: "待审核"
//
}))
//
setUnsaved(false);
//
setTimeout(() => {
//
history.push('/memberCenter/home')
//
}, 800);
//
}).finally(() => {
//
msg();
//
setSubmitLoading(false);
//
});
//
}
};
// 会员类型、注册手机下拉框
...
...
@@ -456,12 +465,16 @@ const MemberForm: React.FC<MemberFormProps> = ({
});
// 渠道上级改变时,请求出对应的省级数据
onFieldInputChange$
(
'upperRelationId'
).
subscribe
(
fieldState
=>
{
// 清空渠道原来数据
linkage
.
value
(
'areas'
,
[]);
});
// 渠道上级改变时,请求出对应的省级数据
onFieldValueChange$
(
'upperRelationId'
).
subscribe
(
fieldState
=>
{
if
(
fieldState
.
value
===
undefined
)
{
return
;
}
// 清空渠道原来数据
linkage
.
value
(
'areas'
,
[]);
PublicApi
.
getMemberAbilitySubPageitemsProvince
({
upperRelationId
:
fieldState
.
value
,
...
...
@@ -478,6 +491,16 @@ const MemberForm: React.FC<MemberFormProps> = ({
// 省级改变时,,请求出对应的市级数据
onFieldInputChange$
(
'areas.*.provinceCode'
).
subscribe
(
fieldState
=>
{
formActions
.
setFieldState
(
FormPath
.
transform
(
fieldState
.
name
,
/
\d
/
,
$1
=>
`areas.
${
$1
}
.cityCode`
),
state
=>
{
FormPath
.
setIn
(
state
,
'value'
,
undefined
);
}
);
});
// 省级改变时,,请求出对应的市级数据
onFieldValueChange$
(
'areas.*.provinceCode'
).
subscribe
(
fieldState
=>
{
if
(
fieldState
.
value
===
undefined
)
{
return
;
}
...
...
@@ -501,7 +524,6 @@ const MemberForm: React.FC<MemberFormProps> = ({
formActions
.
setFieldState
(
FormPath
.
transform
(
fieldState
.
name
,
/
\d
/
,
$1
=>
`areas.
${
$1
}
.cityCode`
),
state
=>
{
FormPath
.
setIn
(
state
,
'value'
,
undefined
);
FormPath
.
setIn
(
state
,
'props.enum'
,
options
);
FormPath
.
setIn
(
state
,
'loading'
,
false
);
}
...
...
@@ -519,7 +541,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
}
}
onBack=
{
()
=>
history
.
goBack
()
}
backIcon=
{
<
ReutrnEle
description=
"返回"
/>
}
title=
{
!
id
&&
mode
!==
"myself"
?
'新建会员'
:
'编辑会员'
}
title=
{
!
id
?
'新建会员'
:
'编辑会员'
}
extra=
{
[
<
Button
key=
"1"
...
...
@@ -567,7 +589,7 @@ const MemberForm: React.FC<MemberFormProps> = ({
};
MemberForm
.
defaultProps
=
{
mode
:
'any'
,
//
mode: 'any',
}
export
default
MemberForm
;
src/pages/member/memberImport/editMember.tsx
View file @
529ba5cc
...
...
@@ -4,9 +4,8 @@ import MemberForm from './components/MemberForm';
const
EditMember
:
React
.
FC
=
()
=>
{
const
{
id
,
validateId
}
=
usePageStatus
();
return
(
<
MemberForm
id=
{
+
id
}
validateId=
{
+
validateId
}
isEdit
=
{
true
}
/>
<
MemberForm
id=
{
+
id
}
validateId=
{
+
validateId
}
isEdit
/>
);
};
...
...
src/pages/member/memberImport/index.tsx
View file @
529ba5cc
...
...
@@ -144,7 +144,7 @@ const MemberMaintain: React.FC<[]> = () => {
render
:
(
text
:
any
,
record
:
any
)
=>
(
<>
{
/* 外部审核状态等于 待提交 可进行提交操作 */
}
{
record
.
outerStatus
===
MEMBER_OUTER_STATUS_UNCOMMITTED
&&
(
{
record
.
showCommit
&&
(
<>
<
Button
type=
"link"
...
...
@@ -155,10 +155,7 @@ const MemberMaintain: React.FC<[]> = () => {
</>
)
}
{
/* 外部审核状态等于 待提交 或者 审核失败 可进行编辑操作 */
}
{
(
record
.
outerStatus
===
MEMBER_OUTER_STATUS_UNCOMMITTED
||
record
.
outerStatus
===
MEMBER_OUTER_STATUS_FAILED
)
&&
(
{
record
.
showUpdate
&&
(
<>
<
Button
type=
"link"
...
...
@@ -171,10 +168,7 @@ const MemberMaintain: React.FC<[]> = () => {
</>
)
}
{
/* 外部审核状态不等于 审核通过 可进行删除操作 */
}
{
(
record
.
outerStatus
===
MEMBER_OUTER_STATUS_UNCOMMITTED
||
record
.
outerStatus
===
MEMBER_OUTER_STATUS_FAILED
)
&&
(
{
record
.
showDelete
&&
(
<
Popconfirm
title=
"确定要删除吗?"
okText=
"是"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment