From 2e207ddef93de3e4960a6824a72230a6b8f01728 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 8 Sep 2024 21:19:48 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=95=86=E5=9F=8E:=20spu=20=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E4=BB=B7=E6=A0=BC=E5=9B=9E=E6=98=BE=E9=94=99=E8=AF=AF?= =?UTF-8?q?=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/mall/product/spu/components/SkuList.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/views/mall/product/spu/components/SkuList.vue b/src/views/mall/product/spu/components/SkuList.vue index 25475cf8..2ffb37d0 100644 --- a/src/views/mall/product/spu/components/SkuList.vue +++ b/src/views/mall/product/spu/components/SkuList.vue @@ -180,17 +180,17 @@ @@ -211,12 +211,12 @@ From 7bb482a8296930b7c7d960e8aef77a06684b9aea Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sun, 8 Sep 2024 22:29:35 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E3=80=90=E4=BB=A3=E7=A0=81=E4=BC=98?= =?UTF-8?q?=E5=8C=96=E3=80=91=E5=95=86=E5=9F=8E:=20=E9=99=90=E6=97=B6?= =?UTF-8?q?=E6=8A=98=E6=89=A3=E6=B4=BB=E5=8A=A8=20sku=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=AF=B9=E5=BA=94=E7=9A=84=E6=BB=A1=E5=87=8F?= =?UTF-8?q?/=E6=8A=98=E6=89=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../promotion/components/SpuAndSkuList.vue | 18 ++-- .../discountActivity/DiscountActivityForm.vue | 94 ++++++++++++------- 2 files changed, 71 insertions(+), 41 deletions(-) diff --git a/src/views/mall/promotion/components/SpuAndSkuList.vue b/src/views/mall/promotion/components/SpuAndSkuList.vue index 5a96ddc3..1a0598ca 100644 --- a/src/views/mall/promotion/components/SpuAndSkuList.vue +++ b/src/views/mall/promotion/components/SpuAndSkuList.vue @@ -30,13 +30,13 @@ @@ -56,13 +56,13 @@ const props = defineProps<{ spuList: T[] ruleConfig: RuleConfig[] spuPropertyListP: SpuProperty[] - isDelete?: boolean // SPU 是否可删除;TODO deletable 换成这个名字好点。 + deletable?: boolean // SPU 是否可删除; }>() const spuData = ref([]) // spu 详情数据列表 const skuListRef = ref() // 商品属性列表Ref const spuPropertyList = ref[]>([]) // spuId 对应的 sku 的属性列表 -const expandRowKeys = ref() // 控制展开行需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。 +const expandRowKeys = ref([]) // 控制展开行需要设置 row-key 属性才能使用,该属性为展开行的 keys 数组。 /** * 获取所有 sku 活动配置 @@ -71,10 +71,10 @@ const expandRowKeys = ref() // 控制展开行需要设置 row-key 属 */ const getSkuConfigs = (extendedAttribute: string) => { skuListRef.value.validateSku() - const seckillProducts = [] + const seckillProducts: any[] = [] spuPropertyList.value.forEach((item) => { - item.spuDetail.skus.forEach((sku) => { - seckillProducts.push(sku[extendedAttribute]) + item.spuDetail.skus?.forEach((sku: any) => { + seckillProducts.push(sku[extendedAttribute] as any) }) }) return seckillProducts @@ -124,10 +124,10 @@ watch( () => props.spuPropertyListP, (data) => { if (!data) return - spuPropertyList.value = data as SpuProperty[] + spuPropertyList.value = data as SpuProperty[] as any // 解决如果之前选择的是单规格 spu 的话后面选择多规格 sku 多规格属性信息不展示的问题。解决方法:让 SkuList 组件重新渲染(行折叠会干掉包含的组件展开时会重新加载) setTimeout(() => { - expandRowKeys.value = data.map((item) => item.spuId) + expandRowKeys.value = data.map((item) => item.spuId + '') }, 200) }, { diff --git a/src/views/mall/promotion/discountActivity/DiscountActivityForm.vue b/src/views/mall/promotion/discountActivity/DiscountActivityForm.vue index 915af43c..e9ddcdbc 100644 --- a/src/views/mall/promotion/discountActivity/DiscountActivityForm.vue +++ b/src/views/mall/promotion/discountActivity/DiscountActivityForm.vue @@ -8,28 +8,40 @@ :schema="allSchemas.formSchema" > - - - -