From a08684089d539b09fe2c00e92d63071f8fdb9a14 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 23 Aug 2024 16:22:46 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91MALL:?= =?UTF-8?q?=20=E6=BB=A1=E5=87=8F=E9=80=81=E6=B4=BB=E5=8A=A8=E8=B5=A0?= =?UTF-8?q?=E9=80=81=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=8880%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mall/promotion/coupon/couponTemplate.ts | 2 +- src/utils/is.ts | 4 +- .../coupon/components/CouponSelect.vue | 5 +- .../rewardActivity/components/RewardRule.vue | 20 +-- .../components/RewardRuleCouponShowcase.vue | 139 ++++++++++++------ 5 files changed, 111 insertions(+), 59 deletions(-) diff --git a/src/api/mall/promotion/coupon/couponTemplate.ts b/src/api/mall/promotion/coupon/couponTemplate.ts index 50ae226c..7e0a68c7 100755 --- a/src/api/mall/promotion/coupon/couponTemplate.ts +++ b/src/api/mall/promotion/coupon/couponTemplate.ts @@ -74,7 +74,7 @@ export function getCouponTemplatePage(params: PageParam) { } // 获得优惠劵模板分页 -export function getCouponTemplateList(ids: number[]) { +export function getCouponTemplateList(ids: number[]): Promise { return request.get({ url: `/promotion/coupon-template/list?ids=${ids}` }) diff --git a/src/utils/is.ts b/src/utils/is.ts index eec86a93..cd2dcc37 100644 --- a/src/utils/is.ts +++ b/src/utils/is.ts @@ -18,8 +18,8 @@ export const isObject = (val: any): val is Record => { return val !== null && is(val, 'Object') } -export const isEmpty = (val: T): val is T => { - if (val === null) { +export const isEmpty = (val: any): boolean => { + if (val === null || val === undefined || typeof val === 'undefined') { return true } if (isArray(val) || isString(val)) { diff --git a/src/views/mall/promotion/coupon/components/CouponSelect.vue b/src/views/mall/promotion/coupon/components/CouponSelect.vue index c232095e..c7dc3b86 100644 --- a/src/views/mall/promotion/coupon/components/CouponSelect.vue +++ b/src/views/mall/promotion/coupon/components/CouponSelect.vue @@ -176,6 +176,7 @@ const queryParams = reactive({ createTime: [] }) const queryFormRef = ref() // 搜索的表单 +const selectedCouponList = ref([]) // 选择的数据 /** 查询列表 */ const getList = async () => { @@ -214,11 +215,11 @@ const handleSelectionChange = (val: CouponTemplateApi.CouponTemplateVO[]) => { emit('update:multipleSelection', val) return } - emit('change', val) + selectedCouponList.value = val } const submitForm = () => { dialogVisible.value = false + emit('change', selectedCouponList.value) } -// TODO @puhui999:提前 todo,先不用改;未来单独成组件,其它模块可以服用;例如说,满减送,可以选择优惠劵; diff --git a/src/views/mall/promotion/rewardActivity/components/RewardRule.vue b/src/views/mall/promotion/rewardActivity/components/RewardRule.vue index 2d3f37e9..6261180a 100644 --- a/src/views/mall/promotion/rewardActivity/components/RewardRule.vue +++ b/src/views/mall/promotion/rewardActivity/components/RewardRule.vue @@ -2,13 +2,11 @@ - + 添加优惠规则 diff --git a/src/views/mall/promotion/rewardActivity/components/RewardRuleCouponShowcase.vue b/src/views/mall/promotion/rewardActivity/components/RewardRuleCouponShowcase.vue index 79e3a832..b4f356da 100644 --- a/src/views/mall/promotion/rewardActivity/components/RewardRuleCouponShowcase.vue +++ b/src/views/mall/promotion/rewardActivity/components/RewardRuleCouponShowcase.vue @@ -1,57 +1,61 @@ - + From f996d00e926300b2d78b83b7350d78652523dd99 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Fri, 23 Aug 2024 16:57:36 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E3=80=90=E6=96=B0=E5=A2=9E=E3=80=91MALL:?= =?UTF-8?q?=20=E6=BB=A1=E5=87=8F=E9=80=81=E6=B4=BB=E5=8A=A8=E8=B5=A0?= =?UTF-8?q?=E9=80=81=E4=BC=98=E6=83=A0=E5=88=B8=EF=BC=88100%=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/rewardActivity/RewardForm.vue | 15 ++++++++------- .../rewardActivity/components/RewardRule.vue | 19 +++++++++++++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/views/mall/promotion/rewardActivity/RewardForm.vue b/src/views/mall/promotion/rewardActivity/RewardForm.vue index 46ad2ff1..13cad845 100644 --- a/src/views/mall/promotion/rewardActivity/RewardForm.vue +++ b/src/views/mall/promotion/rewardActivity/RewardForm.vue @@ -1,5 +1,5 @@