From c38abc365c779528d5ea5d2926a895aa1211eaf9 Mon Sep 17 00:00:00 2001 From: puhui999 Date: Wed, 26 Apr 2023 17:17:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=A1=A8=E5=8D=95=E6=A0=A1=E9=AA=8C=EF=BC=8C?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=BF=A1=E6=81=AF=E6=8F=90=E7=A4=BA=EF=BC=8C?= =?UTF-8?q?=E5=AE=8C=E6=88=90=E6=96=B0=E5=BB=BA=E3=80=81=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E3=80=81=E6=8F=90=E4=BA=A4=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/product/management/type/index.ts | 22 ++++ src/utils/object.ts | 17 +++ src/views/mall/product/management/addForm.vue | 90 +++++++++++-- .../management/components/BasicInfoForm.vue | 118 +++++++++--------- .../management/components/DescriptionForm.vue | 82 ++++++++++-- .../components/OtherSettingsForm.vue | 87 ++++++++++--- src/views/system/dict/index.vue | 91 ++++++++------ 7 files changed, 374 insertions(+), 133 deletions(-) create mode 100644 src/api/mall/product/management/type/index.ts create mode 100644 src/utils/object.ts diff --git a/src/api/mall/product/management/type/index.ts b/src/api/mall/product/management/type/index.ts new file mode 100644 index 00000000..3d372c45 --- /dev/null +++ b/src/api/mall/product/management/type/index.ts @@ -0,0 +1,22 @@ +export interface SpuType { + name?: string // 商品名称 + categoryId?: number // 商品分类 + keyword?: string // 关键字 + unit?: string // 单位 + picUrl?: string // 商品封面图 + sliderPicUrls?: string[] // 商品轮播图 + introduction?: string // 商品简介 + deliveryTemplateId?: number // 运费模版 + selectRule?: string // 选择规格 TODO 暂时定义 + specType?: boolean // 商品规格 + subCommissionType?: boolean // 分销类型 + description?: string // 商品详情 + sort?: string // 商品排序 + giveIntegral?: number // 赠送积分 + virtualSalesCount?: number // 虚拟销量 + recommendHot?: boolean // 是否热卖 + recommendBenefit?: boolean // 是否优惠 + recommendBest?: boolean // 是否精品 + recommendNew?: boolean // 是否新品 + recommendGood?: boolean // 是否优品 +} diff --git a/src/utils/object.ts b/src/utils/object.ts new file mode 100644 index 00000000..8edd1888 --- /dev/null +++ b/src/utils/object.ts @@ -0,0 +1,17 @@ +/** + * 将值复制到目标对象,且以目标对象属性为准,例:target: {a:1} source:{a:2,b:3} 结果为:{a:2} + * @param target 目标对象 + * @param source 源对象 + */ +export const copyValueToTarget = (target, source) => { + const newObj = Object.assign({}, target, source) + // 删除多余属性 + Object.keys(newObj).forEach((key) => { + // 如果不是target中的属性则删除 + if (Object.keys(target).indexOf(key) === -1) { + delete newObj[key] + } + }) + // 更新目标对象值 + Object.assign(target, newObj) +} diff --git a/src/views/mall/product/management/addForm.vue b/src/views/mall/product/management/addForm.vue index d077df5b..f915b204 100644 --- a/src/views/mall/product/management/addForm.vue +++ b/src/views/mall/product/management/addForm.vue @@ -2,13 +2,25 @@ - + - + - + @@ -22,6 +34,7 @@ - diff --git a/src/views/mall/product/management/components/DescriptionForm.vue b/src/views/mall/product/management/components/DescriptionForm.vue index 53609705..f29f29b4 100644 --- a/src/views/mall/product/management/components/DescriptionForm.vue +++ b/src/views/mall/product/management/components/DescriptionForm.vue @@ -1,13 +1,79 @@ diff --git a/src/views/mall/product/management/components/OtherSettingsForm.vue b/src/views/mall/product/management/components/OtherSettingsForm.vue index e8152883..155a0aba 100644 --- a/src/views/mall/product/management/components/OtherSettingsForm.vue +++ b/src/views/mall/product/management/components/OtherSettingsForm.vue @@ -1,19 +1,19 @@