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