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
48a15d1b
Commit
48a15d1b
authored
Nov 15, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 完成优惠券发券逻辑更改
parent
c92b3268
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
34 deletions
+20
-34
index.tsx
...Ability/merchantCoupon/components/DeliverCoupon/index.tsx
+20
-34
No files found.
src/pages/transaction/marketingAbility/merchantCoupon/components/DeliverCoupon/index.tsx
View file @
48a15d1b
...
...
@@ -2,10 +2,10 @@
* @Author: XieZhiXiong
* @Date: 2021-06-29 09:36:25
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-11-15 1
6:44:32
* @LastEditTime: 2021-11-15 1
7:11:36
* @Description: 发券明细
*/
import
React
,
{
useState
,
use
Effect
,
useRef
}
from
'react'
;
import
React
,
{
useState
,
use
Memo
}
from
'react'
;
import
{
Space
,
Button
,
...
...
@@ -28,7 +28,6 @@ import { querySchema, drawerSchema } from './schema';
const
{
confirm
}
=
Modal
;
const
outerFormActions
=
createFormActions
();
const
drawerFormActions
=
createFormActions
();
export
type
SuitableMemberType
=
{
...
...
@@ -156,42 +155,21 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
onChange
,
...
rest
}
=
props
;
const
defaultSuitableMemberList
=
memberList
?
memberList
.
map
((
item
)
=>
({
onlyId
:
`
${
item
.
memberId
}
+
${
item
.
roleId
}
`
,
...
item
}))
:
[];
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
string
[]
>
([]);
const
[
visibleDrawer
,
setVisibleDrawer
]
=
useState
(
false
);
const
[
suitableMemberList
,
setSuitableMemberList
]
=
useState
<
SuitableMemberType
[]
>
(
defaultSuitableMemberList
);
const
[
listLoading
,
setListLoading
]
=
useState
(
false
);
const
[
suitableMemberList
,
setSuitableMemberList
]
=
useState
<
SuitableMemberType
[]
>
(
[]
);
const
[
queryValue
,
setQueryValue
]
=
useState
<
ExtraFetchType
|
null
>
(
null
);
const
[
rowSelection
,
RowCtl
]
=
useRowSelectionTable
({
customKey
:
'onlyId'
,
type
:
'checkbox'
});
// 获取已选择的会员类型列表
const
fetchSuitableMemberIncludeList
=
async
(
params
?:
Omit
<
ExtraFetchType
,
'suitableMemberLevelTypes'
>
&
{
memberList
?:
MemberListItemType
[]
})
=>
{
if
(
!
memberList
)
{
return
;
}
setListLoading
(
true
);
const
res
=
await
PublicApi
.
postMemberManageMarketingSuitableList
({
...(
params
||
{}),
memberList
:
memberList
,
},
{
ctlType
:
'none'
,
});
setListLoading
(
false
);
if
(
res
.
code
===
1000
)
{
setSuitableMemberList
(
res
.
data
?.
map
((
item
)
=>
({
onlyId
:
`
${
item
.
memberId
}
+
${
item
.
roleId
}
`
,
...
item
,
})));
}
// 根据会员名称过滤会员列表
const
handleFilterMemberListByName
=
(
value
:
ExtraFetchType
)
=>
{
setQueryValue
(
value
);
};
useEffect
(()
=>
{
fetchSuitableMemberIncludeList
();
},
[
memberList
]);
// 获取未选择的会员类型列表
const
fetchSuitableMemberExcludeList
=
async
(
params
:
FetchParamsType
&
ExtraFetchType
)
=>
{
const
excludeMemberList
=
suitableM
emberList
.
map
((
item
)
=>
({
const
excludeMemberList
=
m
emberList
.
map
((
item
)
=>
({
memberId
:
item
.
memberId
,
roleId
:
item
.
roleId
,
}));
...
...
@@ -351,6 +329,10 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
</
Button
>
</
Space
>
);
const
filtered
=
useMemo
(()
=>
(
queryValue
&&
queryValue
?.
name
?
suitableMemberList
.
filter
((
item
)
=>
item
.
name
.
includes
(
queryValue
.
name
))
:
suitableMemberList
),
[
queryValue
,
suitableMemberList
]);
return
(
<
MellowCard
...
...
@@ -360,8 +342,7 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
<
PolymericTable
rowKey=
"onlyId"
columns=
{
outerColumns
}
dataSource=
{
suitableMemberList
}
loading=
{
listLoading
}
dataSource=
{
filtered
}
pagination=
{
null
}
rowSelection=
{
outerRowSelection
}
searchFormProps=
{
{
...
...
@@ -370,8 +351,13 @@ const DeliverCoupon: React.FC<IProps> = (props) => {
ControllerBtns
,
RangePicker
:
DatePicker
.
RangePicker
,
},
effects
:
(
$
,
actions
)
=>
{},
onSubmit
:
(
values
:
ExtraFetchType
)
=>
fetchSuitableMemberIncludeList
(
values
),
effects
:
(
$
,
actions
)
=>
{
// 这里不需要单独去监听 reset事件,Search内部点击重置按钮也会触发 submit 事件
// onFormReset$().subscribe(() =>
{
// console.log('重置了')
//
});
},
onSubmit
:
(
values
:
ExtraFetchType
)
=>
handleFilterMemberListByName
(
values
),
}
}
/>
...
...
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