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
f996d00e
authored
Aug 23, 2024
by
puhui999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】MALL: 满减送活动赠送优惠券(100%)
parent
a0868408
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
9 deletions
+25
-9
src/views/mall/promotion/rewardActivity/RewardForm.vue
+8
-7
src/views/mall/promotion/rewardActivity/components/RewardRule.vue
+17
-2
No files found.
src/views/mall/promotion/rewardActivity/RewardForm.vue
View file @
f996d00e
<
template
>
<
template
>
<Dialog
v-model=
"dialogVisible"
:title=
"dialogTitle"
width=
"6
0
%"
>
<Dialog
v-model=
"dialogVisible"
:title=
"dialogTitle"
width=
"6
5
%"
>
<el-form
<el-form
ref=
"formRef"
ref=
"formRef"
v-loading=
"formLoading"
v-loading=
"formLoading"
...
@@ -31,7 +31,7 @@
...
@@ -31,7 +31,7 @@
</el-radio-group>
</el-radio-group>
</el-form-item>
</el-form-item>
<el-form-item
label=
"优惠设置"
>
<el-form-item
label=
"优惠设置"
>
<RewardRule
v-model=
"formData"
/>
<RewardRule
ref=
"rewardRuleRef"
v-model=
"formData"
/>
</el-form-item>
</el-form-item>
<el-form-item
label=
"活动范围"
prop=
"productScope"
>
<el-form-item
label=
"活动范围"
prop=
"productScope"
>
<el-radio-group
v-model=
"formData.productScope"
>
<el-radio-group
v-model=
"formData.productScope"
>
...
@@ -97,7 +97,8 @@ const formRules = reactive({
...
@@ -97,7 +97,8 @@ const formRules = reactive({
productSpuIds
:
[{
required
:
true
,
message
:
'商品不能为空'
,
trigger
:
'blur'
}],
productSpuIds
:
[{
required
:
true
,
message
:
'商品不能为空'
,
trigger
:
'blur'
}],
productCategoryIds
:
[{
required
:
true
,
message
:
'商品分类不能为空'
,
trigger
:
'blur'
}]
productCategoryIds
:
[{
required
:
true
,
message
:
'商品分类不能为空'
,
trigger
:
'blur'
}]
})
})
const
formRef
=
ref
([])
// 表单 Ref
const
formRef
=
ref
()
// 表单 Ref
const
rewardRuleRef
=
ref
<
InstanceType
<
typeof
RewardRule
>>
()
// 活动规则 Ref
/** 打开弹窗 */
/** 打开弹窗 */
const
open
=
async
(
type
:
string
,
id
?:
number
)
=>
{
const
open
=
async
(
type
:
string
,
id
?:
number
)
=>
{
...
@@ -126,14 +127,14 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
...
@@ -126,14 +127,14 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
const
submitForm
=
async
()
=>
{
const
submitForm
=
async
()
=>
{
// 校验表单
// 校验表单
if
(
!
formRef
)
return
if
(
!
formRef
)
return
// TODO puhui999: 规则校验
const
valid
=
await
formRef
.
value
.
validate
()
// const valid = await formRef.value.validate()
if
(
!
valid
)
return
// if (!valid) return
// TODO puhui999: 处理下数据兼容接口
// 提交请求
// 提交请求
formLoading
.
value
=
true
formLoading
.
value
=
true
try
{
try
{
// 设置活动规则优惠券
rewardRuleRef
.
value
?.
setRuleCoupon
()
const
data
=
formData
.
value
const
data
=
formData
.
value
// 设置商品范围
// 设置商品范围
setProductScopeValues
(
data
)
setProductScopeValues
(
data
)
...
...
src/views/mall/promotion/rewardActivity/components/RewardRule.vue
View file @
f996d00e
...
@@ -69,7 +69,11 @@
...
@@ -69,7 +69,11 @@
inactive-text=
"否"
inactive-text=
"否"
inline-prompt
inline-prompt
/>
/>
<RewardRuleCouponShowcase
v-if=
"rule.giveCoupon"
v-model=
"rule!"
/>
<RewardRuleCouponShowcase
v-if=
"rule.giveCoupon"
ref=
"rewardRuleCouponShowcaseRef"
v-model=
"rule!"
/>
</el-col>
</el-col>
</el-form-item>
</el-form-item>
</el-form>
</el-form>
...
@@ -86,6 +90,7 @@ import RewardRuleCouponShowcase from './RewardRuleCouponShowcase.vue'
...
@@ -86,6 +90,7 @@ import RewardRuleCouponShowcase from './RewardRuleCouponShowcase.vue'
import
{
RewardActivityVO
}
from
'@/api/mall/promotion/reward/rewardActivity'
import
{
RewardActivityVO
}
from
'@/api/mall/promotion/reward/rewardActivity'
import
{
PromotionConditionTypeEnum
}
from
'@/utils/constants'
import
{
PromotionConditionTypeEnum
}
from
'@/utils/constants'
import
{
useVModel
}
from
'@vueuse/core'
import
{
useVModel
}
from
'@vueuse/core'
import
{
isEmpty
}
from
'@/utils/is'
defineOptions
({
name
:
'RewardRule'
})
defineOptions
({
name
:
'RewardRule'
})
...
@@ -99,6 +104,7 @@ const emits = defineEmits<{
...
@@ -99,6 +104,7 @@ const emits = defineEmits<{
}
>
()
}
>
()
const
formData
=
useVModel
(
props
,
'modelValue'
,
emits
)
// 活动数据
const
formData
=
useVModel
(
props
,
'modelValue'
,
emits
)
// 活动数据
const
rewardRuleCouponShowcaseRef
=
ref
<
InstanceType
<
typeof
RewardRuleCouponShowcase
>
[]
>
()
// 活动规则优惠券 Ref
/** 删除优惠规则 */
/** 删除优惠规则 */
const
deleteRule
=
(
ruleIndex
:
number
)
=>
{
const
deleteRule
=
(
ruleIndex
:
number
)
=>
{
...
@@ -119,7 +125,16 @@ const addRule = () => {
...
@@ -119,7 +125,16 @@ const addRule = () => {
})
})
}
}
// TODO puhui999: 规则校验完善
/** 设置规则优惠券-提交时 */
const
setRuleCoupon
=
()
=>
{
if
(
isEmpty
(
rewardRuleCouponShowcaseRef
.
value
))
{
return
}
rewardRuleCouponShowcaseRef
.
value
?.
forEach
((
item
)
=>
item
.
setGiveCouponList
())
}
defineExpose
({
setRuleCoupon
})
</
script
>
</
script
>
<
style
lang=
"scss"
scoped
></
style
>
<
style
lang=
"scss"
scoped
></
style
>
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