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
a33add65
Commit
a33add65
authored
Jul 02, 2021
by
XieZhiXiong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 待提交审核商家优惠劵
parent
5e8725eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
143 additions
and
94 deletions
+143
-94
index.tsx
...bility/merchantCoupon/merchantCouponUnsubmitted/index.tsx
+142
-90
schema.ts
...bility/merchantCoupon/merchantCouponUnsubmitted/schema.ts
+1
-4
No files found.
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/index.tsx
View file @
a33add65
...
...
@@ -2,7 +2,7 @@
* @Author: XieZhiXiong
* @Date: 2021-06-22 11:08:16
* @LastEditors: XieZhiXiong
* @LastEditTime: 2021-0
6-28 10:27:45
* @LastEditTime: 2021-0
7-02 15:19:32
* @Description: 待提交审核商家优惠劵
*/
import
React
,
{
useState
,
useRef
}
from
'react'
;
...
...
@@ -11,123 +11,127 @@ import {
Card
,
Space
,
Button
,
message
,
Modal
,
}
from
'antd'
;
import
{
PlusOutlined
,
QuestionCircleOutlined
,
}
from
'@ant-design/icons'
;
import
{
StandardTable
}
from
'god'
;
import
{
ColumnType
}
from
'antd/lib/table/interface'
;
import
{
createFormActions
}
from
'@formily/antd'
;
import
{
DatePicker
}
from
'@formily/antd-components'
;
import
moment
from
'moment'
;
import
{
useStateFilterSearchLinkageEffect
}
from
'@/formSchema/effects/useFilterSearch'
;
import
{
useAsyncInitSelect
}
from
'@/formSchema/effects/useAsyncInitSelect'
;
import
{
FORM_FILTER_PATH
}
from
'@/formSchema/const'
;
import
EyePreview
from
'@/components/EyePreview'
;
import
NiceForm
from
'@/components/NiceForm'
;
import
{
PublicApi
}
from
'@/services/api'
;
import
{
GetMarketingCouponWaitAuditPageResponseDetail
}
from
'@/services/MarketingApi'
;
import
useSpliceArray
from
'@/hooks/useSpliceArray'
;
import
{
querySchema
}
from
'./schema'
;
import
commonColumn
from
'../common/columns/coupon'
;
const
{
confirm
}
=
Modal
;
const
formActions
=
createFormActions
();
type
fetchParams
=
{
name
:
string
,
id
:
number
,
effectiveTimeStart
:
string
|
number
,
effectiveTimeEnd
:
string
|
number
,
type
:
number
,
}
const
MerchantCouponUnsubmitted
:
React
.
FC
=
()
=>
{
const
ref
=
useRef
<
any
>
({});
const
[
selectedRowKeys
,
setSelectedRowKeys
]
=
useState
<
number
[]
>
([]);
const
fetchData
=
async
(
params
:
any
)
=>
{
let
res
=
await
PublicApi
.
getMemberAbilityMaintenancePage
(
params
);
const
fetchData
=
async
(
params
:
fetchParams
)
=>
{
const
{
effectiveTimeStart
=
null
,
effectiveTimeEnd
=
null
}
=
params
;
const
newParams
:
fetchParams
=
{
...
params
};
if
(
effectiveTimeStart
)
{
newParams
.
effectiveTimeStart
=
moment
(
effectiveTimeStart
).
valueOf
();
}
if
(
effectiveTimeEnd
)
{
newParams
.
effectiveTimeEnd
=
moment
(
effectiveTimeEnd
).
valueOf
();
}
let
res
=
await
PublicApi
.
getMarketingCouponWaitAuditPage
(
newParams
as
any
);
return
res
.
data
;
};
const
defaultColumns
:
ColumnType
<
any
>
[]
=
[
{
title
:
'ID'
,
dataIndex
:
'id'
,
align
:
'center'
,
},
{
title
:
'优惠劵名称'
,
dataIndex
:
'name'
,
align
:
'center'
,
render
:
(
text
,
record
)
=>
(
<
EyePreview
url=
{
`/memberCenter/marketingAbility/merchantCoupon/unsubmitted/detail?id=${record.validateId}`
}
>
{
text
}
</
EyePreview
>
),
},
{
title
:
'优惠劵类型'
,
dataIndex
:
'memberTypeName'
,
align
:
'center'
,
},
{
title
:
'领(发)劵起始时间'
,
dataIndex
:
'registerTime'
,
align
:
'center'
,
},
{
title
:
'领(发)劵截止时间'
,
dataIndex
:
'registerTime'
,
align
:
'center'
,
},
{
title
:
'劵有效期起始时间'
,
dataIndex
:
'registerTime'
,
align
:
'center'
,
},
{
title
:
'劵有效期截止时间'
,
dataIndex
:
'registerTime'
,
align
:
'center'
,
},
{
title
:
'领劵方式'
,
dataIndex
:
'depositTime'
,
align
:
'center'
,
},
{
title
:
'劵面额'
,
dataIndex
:
'statusName'
,
},
{
title
:
'发劵数量'
,
dataIndex
:
'statusName'
,
},
{
title
:
'内部状态'
,
dataIndex
:
'statusName'
,
},
const
handleCommit
=
(
ids
:
number
[])
=>
{
const
mesInstance
=
message
.
loading
({
content
:
'正在提交'
,
duration
:
0
,
});
PublicApi
.
postMarketingCouponWaitAuditSubmitBatch
({
ids
,
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
;
}
ref
.
current
.
reload
();
}).
finally
(()
=>
{
mesInstance
();
});
};
const
handleDelete
=
(
ids
:
number
[])
=>
{
const
mesInstance
=
message
.
loading
({
content
:
'正在删除'
,
duration
:
0
,
});
PublicApi
.
postMarketingCouponWaitAuditDelete
({
ids
,
}).
then
(
res
=>
{
if
(
res
.
code
!==
1000
)
{
return
;
}
ref
.
current
.
reload
();
}).
finally
(()
=>
{
mesInstance
();
});
};
const
defaultColumns
:
ColumnType
<
GetMarketingCouponWaitAuditPageResponseDetail
>
[]
=
commonColumn
().
concat
([
{
title
:
'操作'
,
dataIndex
:
'option'
,
align
:
'center'
,
render
:
(
_
,
record
)
=>
(
<>
{
record
.
submit
&&
(
<
Button
type=
"link"
onClick=
{
()
=>
{}
}
onClick=
{
()
=>
handleCommit
([
record
.
id
])
}
>
提交
</
Button
>
)
}
{
record
.
update
&&
(
<
Button
type=
"link"
onClick=
{
()
=>
history
.
push
(
`/memberCenter/marketingAbility/merchantCoupon/unsubmitted/edit
`
)
}
onClick=
{
()
=>
history
.
push
(
`/memberCenter/marketingAbility/merchantCoupon/unsubmitted/edit?id=${record.id}
`
)
}
>
修改
</
Button
>
)
}
{
record
.
delete
&&
(
<
Button
type=
"link"
onClick=
{
()
=>
{}
}
onClick=
{
()
=>
handleDelete
([
record
.
id
])
}
>
删除
</
Button
>
)
}
</>
),
},
];
]);
const
[
columns
,
columnsHandle
]
=
useSpliceArray
<
ColumnType
<
any
>>
(
defaultColumns
);
const
rowSelection
=
{
...
...
@@ -138,31 +142,79 @@ const MerchantCouponUnsubmitted: React.FC = () => {
};
// 初始化高级筛选选项
const
fetch
SelectOption
s
=
async
()
=>
{
const
res
=
await
PublicApi
.
getM
emberAbilityInfoPageitems
();
const
fetch
TypeEnum
s
=
async
()
=>
{
const
res
=
await
PublicApi
.
getM
arketingCouponTypeList
();
if
(
res
.
code
===
1000
)
{
const
{
data
=
{}
}:
any
=
res
;
const
{
outerStatus
=
[],
}
=
data
;
const
outerIndex
=
columns
.
findIndex
((
item
)
=>
item
.
dataIndex
===
'memberTypeName'
);
if
(
outerIndex
)
{
columnsHandle
.
replace
(
outerIndex
,
{
...
columns
[
outerIndex
],
filters
:
outerStatus
.
map
(
item
=>
({
text
:
item
.
text
,
value
:
item
.
id
})).
filter
(
item
=>
item
.
value
!==
0
),
});
}
const
{
data
=
[]
}
=
res
;
return
{
innerStatus
:
outerStatus
.
map
(
item
=>
({
label
:
item
.
text
,
value
:
item
.
id
})),
type
:
data
.
map
(
item
=>
({
label
:
item
.
name
,
value
:
item
.
value
})),
};
}
return
{};
};
const
handleBatchCommit
=
()
=>
{
if
(
!
selectedRowKeys
.
length
)
{
message
.
warning
(
'未选择任何优惠券'
);
return
;
}
confirm
({
title
:
'提示'
,
icon
:
<
QuestionCircleOutlined
/>,
content
:
'确定要提交选中的优惠券吗?'
,
onOk
()
{
return
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
PublicApi
.
postMarketingCouponWaitAuditSubmitBatch
({
ids
:
selectedRowKeys
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
();
setSelectedRowKeys
([]);
resolve
();
}
reject
();
})
.
catch
(()
=>
{
reject
();
});
});
},
});
};
const
handleBatchDelete
=
()
=>
{
if
(
!
selectedRowKeys
.
length
)
{
message
.
warning
(
'未选择任何优惠券'
);
return
;
}
confirm
({
title
:
'提示'
,
icon
:
<
QuestionCircleOutlined
/>,
content
:
'确定要删除选中的优惠券吗?'
,
onOk
()
{
return
new
Promise
<
void
>
((
resolve
,
reject
)
=>
{
PublicApi
.
postMarketingCouponWaitAuditDelete
({
ids
:
selectedRowKeys
,
})
.
then
(
res
=>
{
if
(
res
.
code
===
1000
)
{
ref
.
current
.
reload
();
setSelectedRowKeys
([]);
resolve
();
}
reject
();
})
.
catch
(()
=>
{
reject
();
});
});
},
});
};
const
ControllerBtns
=
()
=>
(
<
Space
size=
{
16
}
>
<
Button
...
...
@@ -173,12 +225,12 @@ const MerchantCouponUnsubmitted: React.FC = () => {
新增优惠券
</
Button
>
<
Button
onClick=
{
()
=>
{}
}
onClick=
{
handleBatchCommit
}
>
批量提交
</
Button
>
<
Button
onClick=
{
()
=>
{}
}
onClick=
{
handleBatchDelete
}
>
批量删除
</
Button
>
...
...
@@ -189,7 +241,7 @@ const MerchantCouponUnsubmitted: React.FC = () => {
<
Card
>
<
StandardTable
tableProps=
{
{
rowKey
:
'
validateI
d'
,
rowKey
:
'
i
d'
,
}
}
columns=
{
columns
}
currentRef=
{
ref
}
...
...
@@ -211,8 +263,8 @@ const MerchantCouponUnsubmitted: React.FC = () => {
FORM_FILTER_PATH
,
);
useAsyncInitSelect
(
[
'
outerStatus
'
],
fetch
SelectOption
s
,
[
'
type
'
],
fetch
TypeEnum
s
,
);
}
}
schema=
{
querySchema
}
...
...
src/pages/transaction/marketingAbility/merchantCoupon/merchantCouponUnsubmitted/schema.ts
View file @
a33add65
...
...
@@ -50,12 +50,9 @@ export const querySchema: ISchema = {
'x-component-props'
:
{
placeholder
:
'优惠劵ID'
,
allowClear
:
true
,
style
:
{
width
:
160
,
},
},
},
'[startTime2, endTime2]'
:
{
'[effectiveTimeStart, effectiveTimeEnd]'
:
{
type
:
'object'
,
'x-component'
:
'RangePicker'
,
'x-component-props'
:
{
...
...
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