From 3198688eb53ae39f76472643c8ee80db903e7ab2 Mon Sep 17 00:00:00 2001 From: owen Date: Sun, 19 Nov 2023 18:27:25 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6=E3=80=90?= =?UTF-8?q?=E5=95=86=E5=93=81=E6=A0=8F=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/mobile/ProductList/config.ts | 64 +++++++++ .../components/mobile/ProductList/index.vue | 128 ++++++++++++++++++ .../mobile/ProductList/property.vue | 99 ++++++++++++++ src/components/DiyEditor/util.ts | 2 +- .../product/spu/components/SpuShowcase.vue | 1 - 5 files changed, 292 insertions(+), 2 deletions(-) create mode 100644 src/components/DiyEditor/components/mobile/ProductList/config.ts create mode 100644 src/components/DiyEditor/components/mobile/ProductList/index.vue create mode 100644 src/components/DiyEditor/components/mobile/ProductList/property.vue diff --git a/src/components/DiyEditor/components/mobile/ProductList/config.ts b/src/components/DiyEditor/components/mobile/ProductList/config.ts new file mode 100644 index 00000000..019be74e --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ProductList/config.ts @@ -0,0 +1,64 @@ +import { ComponentStyle, DiyComponent } from '@/components/DiyEditor/util' + +/** 商品卡片属性 */ +export interface ProductListProperty { + // 布局类型:双列 | 三列 | 水平滑动 + layoutType: 'twoCol' | 'threeCol' | 'horizSwiper' + // 商品字段 + fields: { + // 商品名称 + name: ProductListFieldProperty + // 商品价格 + price: ProductListFieldProperty + } + // 角标 + badge: { + // 是否显示 + show: boolean + // 角标图片 + imgUrl: string + } + // 上圆角 + borderRadiusTop: number + // 下圆角 + borderRadiusBottom: number + // 间距 + space: number + // 商品编号列表 + spuIds: number[] + // 组件样式 + style: ComponentStyle +} +// 商品字段 +export interface ProductListFieldProperty { + // 是否显示 + show: boolean + // 颜色 + color: string +} + +// 定义组件 +export const component = { + id: 'ProductList', + name: '商品栏', + icon: 'system-uicons:carousel', + property: { + layoutType: 'twoCol', + fields: { + name: { show: true, color: '#000' }, + price: { show: true, color: '#ff3000' } + }, + badge: { show: false, imgUrl: '' }, + borderRadiusTop: 8, + borderRadiusBottom: 8, + space: 8, + spuIds: [], + style: { + bgType: 'color', + bgColor: '', + marginLeft: 8, + marginRight: 8, + marginBottom: 8 + } as ComponentStyle + } +} as DiyComponent diff --git a/src/components/DiyEditor/components/mobile/ProductList/index.vue b/src/components/DiyEditor/components/mobile/ProductList/index.vue new file mode 100644 index 00000000..cf644ea1 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ProductList/index.vue @@ -0,0 +1,128 @@ + + + + diff --git a/src/components/DiyEditor/components/mobile/ProductList/property.vue b/src/components/DiyEditor/components/mobile/ProductList/property.vue new file mode 100644 index 00000000..872affc3 --- /dev/null +++ b/src/components/DiyEditor/components/mobile/ProductList/property.vue @@ -0,0 +1,99 @@ + + + + + diff --git a/src/components/DiyEditor/util.ts b/src/components/DiyEditor/util.ts index 8f8c2c0c..5dfcea9e 100644 --- a/src/components/DiyEditor/util.ts +++ b/src/components/DiyEditor/util.ts @@ -107,7 +107,7 @@ export const PAGE_LIBS = [ extended: true, components: ['ImageBar', 'Carousel', 'TitleBar', 'VideoPlayer', 'Divider', 'MagicCube'] }, - { name: '商品组件', extended: true, components: ['ProductCard'] }, + { name: '商品组件', extended: true, components: ['ProductCard', 'ProductList'] }, { name: '会员组件', extended: true, diff --git a/src/views/mall/product/spu/components/SpuShowcase.vue b/src/views/mall/product/spu/components/SpuShowcase.vue index a3f16fba..3d2caf9a 100644 --- a/src/views/mall/product/spu/components/SpuShowcase.vue +++ b/src/views/mall/product/spu/components/SpuShowcase.vue @@ -59,7 +59,6 @@ watch( productSpus.value.length === 0 || productSpus.value.some((spu) => !props.modelValue.includes(spu.id)) ) { - debugger productSpus.value = await ProductSpuApi.getSpuDetailList(props.modelValue) } },