From 61218ae71111acff6ba9697314c91963ece5b95f Mon Sep 17 00:00:00 2001 From: puhui999 Date: Sat, 29 Apr 2023 21:39:25 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E7=AE=A1=E7=90=86:=20?= =?UTF-8?q?=E5=88=9D=E6=AD=A5=E5=AE=8C=E6=88=90=E7=9B=B8=E5=85=B3=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/mall/product/management/sku.ts | 0 src/api/mall/product/management/spu.ts | 15 +++ .../mall/product/management/type/skuType.ts | 75 ++++++++++++ .../management/type/{index.ts => spuType.ts} | 3 + src/views/mall/product/management/addForm.vue | 34 ++++-- .../management/components/BasicInfoForm.vue | 109 +++++++++++++----- .../management/components/DescriptionForm.vue | 2 +- .../components/OtherSettingsForm.vue | 2 +- .../components/ProductAttributes.vue | 82 +++++++++++++ .../components/ProductAttributesAddForm.vue | 82 +++++++++++++ .../management/components/SkuList/index.vue | 86 ++++++++++++++ src/views/mall/product/management/index.vue | 22 ++-- src/views/mall/product/property/index.vue | 56 +++++---- 13 files changed, 492 insertions(+), 76 deletions(-) create mode 100644 src/api/mall/product/management/sku.ts create mode 100644 src/api/mall/product/management/spu.ts create mode 100644 src/api/mall/product/management/type/skuType.ts rename src/api/mall/product/management/type/{index.ts => spuType.ts} (92%) create mode 100644 src/views/mall/product/management/components/ProductAttributes.vue create mode 100644 src/views/mall/product/management/components/ProductAttributesAddForm.vue create mode 100644 src/views/mall/product/management/components/SkuList/index.vue diff --git a/src/api/mall/product/management/sku.ts b/src/api/mall/product/management/sku.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/api/mall/product/management/spu.ts b/src/api/mall/product/management/spu.ts new file mode 100644 index 00000000..d5bf52ee --- /dev/null +++ b/src/api/mall/product/management/spu.ts @@ -0,0 +1,15 @@ +import request from '@/config/axios' +import type { SpuType } from './type/spuType' + +// 获得sku列表 +export const getSkuList = (params: any) => { + return request.get({ url: '/product/sku/list', params }) +} +// 创建商品spu +export const createSpu = (data: SpuType) => { + return request.post({ url: '/product/spu/create', data }) +} +// 更新商品spu +export const updateSpu = (data: SpuType) => { + return request.put({ url: '/product/spu/update', data }) +} diff --git a/src/api/mall/product/management/type/skuType.ts b/src/api/mall/product/management/type/skuType.ts new file mode 100644 index 00000000..6de0d893 --- /dev/null +++ b/src/api/mall/product/management/type/skuType.ts @@ -0,0 +1,75 @@ +export interface Property { + /** + * 属性编号 + * + * 关联 {@link ProductPropertyDO#getId()} + */ + propertyId?: number + /** + * 属性值编号 + * + * 关联 {@link ProductPropertyValueDO#getId()} + */ + valueId?: number +} + +export interface SkuType { + /** + * 商品 SKU 编号,自增 + */ + id?: number + /** + * SPU 编号 + */ + spuId?: number + /** + * 属性数组,JSON 格式 + */ + properties?: Property[] + /** + * 商品价格,单位:分 + */ + price?: number + /** + * 市场价,单位:分 + */ + marketPrice?: number + /** + * 成本价,单位:分 + */ + costPrice?: number + /** + * 商品条码 + */ + barCode?: string + /** + * 图片地址 + */ + picUrl?: string + /** + * 库存 + */ + stock?: number + /** + * 商品重量,单位:kg 千克 + */ + weight?: number + /** + * 商品体积,单位:m^3 平米 + */ + volume?: number + + /** + * 一级分销的佣金,单位:分 + */ + subCommissionFirstPrice?: number + /** + * 二级分销的佣金,单位:分 + */ + subCommissionSecondPrice?: number + + /** + * 商品销量 + */ + salesCount?: number +} diff --git a/src/api/mall/product/management/type/index.ts b/src/api/mall/product/management/type/spuType.ts similarity index 92% rename from src/api/mall/product/management/type/index.ts rename to src/api/mall/product/management/type/spuType.ts index a1224d48..f51bc526 100644 --- a/src/api/mall/product/management/type/index.ts +++ b/src/api/mall/product/management/type/spuType.ts @@ -1,3 +1,5 @@ +import { SkuType } from './skuType' + export interface SpuType { name?: string // 商品名称 categoryId?: number | undefined // 商品分类 @@ -10,6 +12,7 @@ export interface SpuType { selectRule?: string // 选择规格 TODO 暂时定义 specType?: boolean // 商品规格 subCommissionType?: boolean // 分销类型 + skus?: SkuType[] // sku数组 description?: string // 商品详情 sort?: string // 商品排序 giveIntegral?: number // 赠送积分 diff --git a/src/views/mall/product/management/addForm.vue b/src/views/mall/product/management/addForm.vue index 9ef24f69..ad973394 100644 --- a/src/views/mall/product/management/addForm.vue +++ b/src/views/mall/product/management/addForm.vue @@ -34,12 +34,14 @@ diff --git a/src/views/mall/product/management/components/ProductAttributesAddForm.vue b/src/views/mall/product/management/components/ProductAttributesAddForm.vue new file mode 100644 index 00000000..70fd2824 --- /dev/null +++ b/src/views/mall/product/management/components/ProductAttributesAddForm.vue @@ -0,0 +1,82 @@ + + diff --git a/src/views/mall/product/management/components/SkuList/index.vue b/src/views/mall/product/management/components/SkuList/index.vue new file mode 100644 index 00000000..fd148126 --- /dev/null +++ b/src/views/mall/product/management/components/SkuList/index.vue @@ -0,0 +1,86 @@ + + + diff --git a/src/views/mall/product/management/index.vue b/src/views/mall/product/management/index.vue index 4fdfed1b..83b52f01 100644 --- a/src/views/mall/product/management/index.vue +++ b/src/views/mall/product/management/index.vue @@ -47,12 +47,7 @@ 重置 - + 新增 @@ -133,8 +128,8 @@