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 @@