From c868268bbbb9275260f689847b06040d77d6f181 Mon Sep 17 00:00:00 2001 From: MSuMshk <2039814060@qq.com> Date: Sat, 28 Feb 2026 13:07:25 +0800 Subject: [PATCH] =?UTF-8?q?feat(project):=20=E5=AF=B9=E9=BD=90=E4=BC=98?= =?UTF-8?q?=E6=83=A0=E5=88=B8=E6=8A=BD=E5=B1=89=E7=BB=86=E8=8A=82=E4=B8=8E?= =?UTF-8?q?=E9=A2=86=E5=8F=96=E7=8A=B6=E6=80=81=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../coupon/components/CouponEditorDrawer.vue | 73 +++--- .../coupon/components/CouponTemplateCard.vue | 4 +- .../composables/coupon-page/card-actions.ts | 59 ++++- .../composables/coupon-page/constants.ts | 6 +- .../composables/coupon-page/drawer-actions.ts | 5 - .../composables/useMarketingCouponPage.ts | 2 - .../src/views/marketing/coupon/index.vue | 2 - .../views/marketing/coupon/styles/card.less | 4 +- .../views/marketing/coupon/styles/drawer.less | 218 ++++++++++++++++-- 9 files changed, 301 insertions(+), 72 deletions(-) diff --git a/apps/web-antd/src/views/marketing/coupon/components/CouponEditorDrawer.vue b/apps/web-antd/src/views/marketing/coupon/components/CouponEditorDrawer.vue index 7a9b2e3..321f7dc 100644 --- a/apps/web-antd/src/views/marketing/coupon/components/CouponEditorDrawer.vue +++ b/apps/web-antd/src/views/marketing/coupon/components/CouponEditorDrawer.vue @@ -12,7 +12,6 @@ import type { import { Button, - Checkbox, DatePicker, Drawer, Form, @@ -21,7 +20,6 @@ import { Radio, Select, Spin, - Switch, } from 'ant-design-vue'; /** * 文件职责:优惠券编辑抽屉。 @@ -55,7 +53,6 @@ const emit = defineEmits<{ (event: 'setName', value: string): void; (event: 'setPerUserLimit', value: null | number): void; (event: 'setRelativeValidDays', value: null | number): void; - (event: 'setStatus', value: boolean): void; (event: 'setStoreIds', value: string[]): void; (event: 'setStoreScopeMode', value: MarketingCouponStoreScopeMode): void; (event: 'setTotalQuantity', value: null | number): void; @@ -65,16 +62,6 @@ const emit = defineEmits<{ (event: 'submit'): void; }>(); -function onChannelsChange(value: Array) { - emit( - 'setChannels', - value.filter( - (item): item is MarketingCouponChannel => - item === 'delivery' || item === 'pickup' || item === 'dine_in', - ), - ); -} - function onStoreIdsChange(value: Array) { emit('setStoreIds', value.map(String)); } @@ -140,19 +127,11 @@ function onRelativeValidDaysChange(value: null | number | string) { emit('setRelativeValidDays', parseNullableNumber(value)); } -function onChannelsGroupChange(value: unknown[]) { - onChannelsChange((value ?? []).map(String)); -} - function onStoreIdsSelectChange(value: unknown) { const values = Array.isArray(value) ? value : []; onStoreIdsChange(values.map(String)); } -function onStatusChange(value: unknown) { - emit('setStatus', value === true || value === 'true'); -} - function parseNullableNumber(value: null | number | string) { if (value === null || value === undefined || value === '') { return null; @@ -160,6 +139,16 @@ function parseNullableNumber(value: null | number | string) { const numeric = Number(value); return Number.isNaN(numeric) ? null : numeric; } + +function resolveToggledChannels( + channels: MarketingCouponChannel[], + channel: MarketingCouponChannel, +) { + if (channels.includes(channel)) { + return channels.filter((item) => item !== channel); + } + return [...channels, channel]; +}