Skip to content

Commit a61fe17

Browse files
committed
fix: 【MALL 商城】商城-满减送管理功能中,已添加的优惠券删除后保存不成功
1 parent 2e495f1 commit a61fe17

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/views/mall/promotion/rewardActivity/components/RewardRuleCouponSelect.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,16 +107,15 @@ const initGiveCouponList = async () => {
107107
108108
/** 设置赠送的优惠券 */
109109
const setGiveCouponList = () => {
110-
if (isEmpty(rewardRule.value) || isEmpty(list.value)) {
110+
if (isEmpty(rewardRule.value)) {
111111
return
112112
}
113+
// 核心:清空 rewardRule.value.giveCouponTemplateCounts,解决删除不生效的问题
114+
rewardRule.value.giveCouponTemplateCounts = {}
113115
114116
// 设置优惠券和其数量的对应
115117
list.value.forEach((rule) => {
116-
if (!rewardRule.value.giveCouponTemplateCounts) {
117-
rewardRule.value.giveCouponTemplateCounts = {}
118-
}
119-
rewardRule.value.giveCouponTemplateCounts[rule.id] = rule.giveCount!
118+
rewardRule.value.giveCouponTemplateCounts![rule.id] = rule.giveCount!
120119
})
121120
}
122121
defineExpose({ setGiveCouponList })

0 commit comments

Comments
 (0)