Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
dcc1a3e9
authored
Sep 02, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【代码优化】商城: 满减送活动
parent
9329978f
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
8 deletions
+13
-8
src/api/mall/promotion/reward/rewardActivity.ts
+1
-1
src/views/mall/promotion/rewardActivity/RewardForm.vue
+1
-1
src/views/mall/promotion/rewardActivity/components/RewardRule.vue
+3
-0
src/views/mall/promotion/rewardActivity/components/RewardRuleCouponSelect.vue
+8
-6
No files found.
src/api/mall/promotion/reward/rewardActivity.ts
View file @
dcc1a3e9
...
@@ -22,7 +22,7 @@ export interface RewardRule {
...
@@ -22,7 +22,7 @@ export interface RewardRule {
discountPrice
?:
number
discountPrice
?:
number
freeDelivery
?:
boolean
freeDelivery
?:
boolean
point
:
number
point
:
number
giveCoupons
?:
{
giveCoupon
TemplateCount
s
?:
{
[
key
:
number
]:
number
[
key
:
number
]:
number
}
}
}
}
...
...
src/views/mall/promotion/rewardActivity/RewardForm.vue
View file @
dcc1a3e9
...
@@ -117,7 +117,7 @@ const open = async (type: string, id?: number) => {
...
@@ -117,7 +117,7 @@ const open = async (type: string, id?: number) => {
// 转区段时间
// 转区段时间
data
.
startAndEndTime
=
[
data
.
startTime
,
data
.
endTime
]
data
.
startAndEndTime
=
[
data
.
startTime
,
data
.
endTime
]
// 规则分转元
// 规则分转元
data
.
rules
.
forEach
((
item
:
any
)
=>
{
data
.
rules
?
.
forEach
((
item
:
any
)
=>
{
item
.
discountPrice
=
fenToYuan
(
item
.
discountPrice
||
0
)
item
.
discountPrice
=
fenToYuan
(
item
.
discountPrice
||
0
)
})
})
formData
.
value
=
data
formData
.
value
=
data
...
...
src/views/mall/promotion/rewardActivity/components/RewardRule.vue
View file @
dcc1a3e9
...
@@ -103,6 +103,9 @@ const deleteRule = (ruleIndex: number) => {
...
@@ -103,6 +103,9 @@ const deleteRule = (ruleIndex: number) => {
/** 添加优惠规则 */
/** 添加优惠规则 */
const
addRule
=
()
=>
{
const
addRule
=
()
=>
{
if
(
isEmpty
(
formData
.
value
.
rules
))
{
formData
.
value
.
rules
=
[]
}
formData
.
value
.
rules
.
push
({
formData
.
value
.
rules
.
push
({
limit
:
0
,
limit
:
0
,
discountPrice
:
0
,
discountPrice
:
0
,
...
...
src/views/mall/promotion/rewardActivity/components/RewardRuleCouponSelect.vue
View file @
dcc1a3e9
...
@@ -86,10 +86,12 @@ const deleteCoupon = (index: number) => {
...
@@ -86,10 +86,12 @@ const deleteCoupon = (index: number) => {
/** 初始化赠送的优惠券列表 */
/** 初始化赠送的优惠券列表 */
const
initGiveCouponList
=
async
()
=>
{
const
initGiveCouponList
=
async
()
=>
{
// 校验优惠券存在
// 校验优惠券存在
if
(
isEmpty
(
rewardRule
.
value
)
||
isEmpty
(
rewardRule
.
value
.
giveCoupons
))
{
if
(
isEmpty
(
rewardRule
.
value
)
||
isEmpty
(
rewardRule
.
value
.
giveCoupon
TemplateCount
s
))
{
return
return
}
}
const
tempLateIds
=
Object
.
keys
(
rewardRule
.
value
.
giveCoupons
!
).
map
((
item
)
=>
parseInt
(
item
))
const
tempLateIds
=
Object
.
keys
(
rewardRule
.
value
.
giveCouponTemplateCounts
!
).
map
((
item
)
=>
parseInt
(
item
)
)
const
data
=
await
CouponTemplateApi
.
getCouponTemplateList
(
tempLateIds
)
const
data
=
await
CouponTemplateApi
.
getCouponTemplateList
(
tempLateIds
)
if
(
!
data
)
{
if
(
!
data
)
{
return
return
...
@@ -98,7 +100,7 @@ const initGiveCouponList = async () => {
...
@@ -98,7 +100,7 @@ const initGiveCouponList = async () => {
data
.
forEach
((
coupon
)
=>
{
data
.
forEach
((
coupon
)
=>
{
list
.
value
.
push
({
list
.
value
.
push
({
...
coupon
,
...
coupon
,
giveCount
:
rewardRule
.
value
.
giveCoupons
!
[
coupon
.
id
]
giveCount
:
rewardRule
.
value
.
giveCoupon
TemplateCount
s
!
[
coupon
.
id
]
})
})
})
})
}
}
...
@@ -111,10 +113,10 @@ const setGiveCouponList = () => {
...
@@ -111,10 +113,10 @@ const setGiveCouponList = () => {
// 设置优惠券和其数量的对应
// 设置优惠券和其数量的对应
list
.
value
.
forEach
((
rule
)
=>
{
list
.
value
.
forEach
((
rule
)
=>
{
if
(
!
rewardRule
.
value
.
giveCoupons
)
{
if
(
!
rewardRule
.
value
.
giveCoupon
TemplateCount
s
)
{
rewardRule
.
value
.
giveCoupons
=
{}
rewardRule
.
value
.
giveCoupon
TemplateCount
s
=
{}
}
}
rewardRule
.
value
.
giveCoupons
[
rule
.
id
]
=
rule
.
giveCount
!
rewardRule
.
value
.
giveCoupon
TemplateCount
s
[
rule
.
id
]
=
rule
.
giveCount
!
})
})
}
}
defineExpose
({
setGiveCouponList
})
defineExpose
({
setGiveCouponList
})
...
...
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