diff --git a/apps/web-antd/src/api/mall/product/brand.ts b/apps/web-antd/src/api/mall/product/brand/index.ts similarity index 100% rename from apps/web-antd/src/api/mall/product/brand.ts rename to apps/web-antd/src/api/mall/product/brand/index.ts diff --git a/apps/web-antd/src/api/mall/product/category.ts b/apps/web-antd/src/api/mall/product/category/index.ts similarity index 100% rename from apps/web-antd/src/api/mall/product/category.ts rename to apps/web-antd/src/api/mall/product/category/index.ts diff --git a/apps/web-antd/src/api/mall/product/comment.ts b/apps/web-antd/src/api/mall/product/comment/index.ts similarity index 79% rename from apps/web-antd/src/api/mall/product/comment.ts rename to apps/web-antd/src/api/mall/product/comment/index.ts index 83a94e9fe..788f94a9a 100644 --- a/apps/web-antd/src/api/mall/product/comment.ts +++ b/apps/web-antd/src/api/mall/product/comment/index.ts @@ -3,12 +3,6 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; export namespace MallCommentApi { - export interface Property { - propertyId: number; // 属性 ID - propertyName: string; // 属性名称 - valueId: number; // 属性值 ID - valueName: string; // 属性值名称 - } /** 商品评论 */ export interface Comment { id: number; // 评论编号 @@ -32,17 +26,22 @@ export namespace MallCommentApi { replyContent: string; // 回复内容 replyTime: Date; // 回复时间 createTime: Date; // 创建时间 - skuProperties: Property[]; // SKU 属性数组 + skuProperties: { + propertyId: number; // 属性 ID + propertyName: string; // 属性名称 + valueId: number; // 属性值 ID + valueName: string; // 属性值名称 + }[]; // SKU 属性数组 } - /** 评论可见性更新 */ - export interface CommentVisibleUpdate { + /** 评论可见性更新请求 */ + export interface CommentVisibleUpdateReqVO { id: number; // 评论编号 visible: boolean; // 是否可见 } - /** 评论回复 */ - export interface CommentReply { + /** 评论回复请求 */ + export interface CommentReplyReqVO { id: number; // 评论编号 replyContent: string; // 回复内容 } @@ -70,12 +69,12 @@ export function createComment(data: MallCommentApi.Comment) { /** 显示 / 隐藏评论 */ export function updateCommentVisible( - data: MallCommentApi.CommentVisibleUpdate, + data: MallCommentApi.CommentVisibleUpdateReqVO, ) { return requestClient.put('/product/comment/update-visible', data); } /** 商家回复 */ -export function replyComment(data: MallCommentApi.CommentReply) { +export function replyComment(data: MallCommentApi.CommentReplyReqVO) { return requestClient.put('/product/comment/reply', data); } diff --git a/apps/web-antd/src/api/mall/product/favorite.ts b/apps/web-antd/src/api/mall/product/favorite/index.ts similarity index 100% rename from apps/web-antd/src/api/mall/product/favorite.ts rename to apps/web-antd/src/api/mall/product/favorite/index.ts diff --git a/apps/web-antd/src/api/mall/product/history.ts b/apps/web-antd/src/api/mall/product/history/index.ts similarity index 92% rename from apps/web-antd/src/api/mall/product/history.ts rename to apps/web-antd/src/api/mall/product/history/index.ts index 5a5599db4..30a892d52 100644 --- a/apps/web-antd/src/api/mall/product/history.ts +++ b/apps/web-antd/src/api/mall/product/history/index.ts @@ -12,9 +12,7 @@ export namespace MallHistoryApi { } } -/** - * 获得商品浏览记录分页 - */ +/** 获得商品浏览记录分页 */ export function getBrowseHistoryPage(params: PageParam) { return requestClient.get>( '/product/browse-history/page', diff --git a/apps/web-antd/src/api/mall/product/property.ts b/apps/web-antd/src/api/mall/product/property/index.ts similarity index 92% rename from apps/web-antd/src/api/mall/product/property.ts rename to apps/web-antd/src/api/mall/product/property/index.ts index 083ce1dab..0834e345e 100644 --- a/apps/web-antd/src/api/mall/product/property.ts +++ b/apps/web-antd/src/api/mall/product/property/index.ts @@ -17,11 +17,6 @@ export namespace MallPropertyApi { name: string; // 名称 remark?: string; // 备注 } - - /** 属性值查询参数 */ - export interface PropertyValueQuery extends PageParam { - propertyId?: number; // 属性编号 - } } /** 创建属性项 */ @@ -62,9 +57,7 @@ export function getPropertySimpleList() { } /** 获得属性值分页 */ -export function getPropertyValuePage( - params: MallPropertyApi.PropertyValueQuery, -) { +export function getPropertyValuePage(params: PageParam) { return requestClient.get>( '/product/property/value/page', { params }, diff --git a/apps/web-antd/src/api/mall/product/spu.ts b/apps/web-antd/src/api/mall/product/spu/index.ts similarity index 95% rename from apps/web-antd/src/api/mall/product/spu.ts rename to apps/web-antd/src/api/mall/product/spu/index.ts index 38e8403ed..4b37151c6 100644 --- a/apps/web-antd/src/api/mall/product/spu.ts +++ b/apps/web-antd/src/api/mall/product/spu/index.ts @@ -3,39 +3,6 @@ import type { PageParam, PageResult } from '@vben/request'; import { requestClient } from '#/api/request'; export namespace MallSpuApi { - /** 商品属性 */ - export interface Property { - propertyId?: number; // 属性编号 - propertyName?: string; // 属性名称 - valueId?: number; // 属性值编号 - valueName?: string; // 属性值名称 - } - - /** 商品 SKU */ - export interface Sku { - id?: number; // 商品 SKU 编号 - name?: string; // 商品 SKU 名称 - spuId?: number; // SPU 编号 - properties?: Property[]; // 属性数组 - price?: number | string; // 商品价格 - marketPrice?: number | string; // 市场价 - costPrice?: number | string; // 成本价 - barCode?: string; // 商品条码 - picUrl?: string; // 图片地址 - stock?: number; // 库存 - weight?: number; // 商品重量,单位:kg 千克 - volume?: number; // 商品体积,单位:m^3 平米 - firstBrokeragePrice?: number | string; // 一级分销的佣金 - secondBrokeragePrice?: number | string; // 二级分销的佣金 - salesCount?: number; // 商品销量 - } - - /** 优惠券模板 */ - export interface GiveCouponTemplate { - id?: number; // 优惠券编号 - name?: string; // 优惠券名称 - } - /** 商品 SPU */ export interface Spu { id?: number; // 商品编号 @@ -68,8 +35,42 @@ export namespace MallSpuApi { browseCount?: number; // 浏览量 } - /** 商品状态更新 */ - export interface StatusUpdate { + /** 商品 SKU */ + export interface Sku { + id?: number; // 商品 SKU 编号 + name?: string; // 商品 SKU 名称 + spuId?: number; // SPU 编号 + properties?: Property[]; // 属性数组 + price?: number | string; // 商品价格 + marketPrice?: number | string; // 市场价 + costPrice?: number | string; // 成本价 + barCode?: string; // 商品条码 + picUrl?: string; // 图片地址 + stock?: number; // 库存 + weight?: number; // 商品重量,单位:kg 千克 + volume?: number; // 商品体积,单位:m^3 平米 + firstBrokeragePrice?: number | string; // 一级分销的佣金 + secondBrokeragePrice?: number | string; // 二级分销的佣金 + salesCount?: number; // 商品销量 + } + + /** 商品属性 */ + export interface Property { + propertyId?: number; // 属性编号 + propertyName?: string; // 属性名称 + valueId?: number; // 属性值编号 + valueName?: string; // 属性值名称 + } + + // TODO @puhui999:这个还要么? + /** 优惠券模板 */ + export interface GiveCouponTemplate { + id?: number; // 优惠券编号 + name?: string; // 优惠券名称 + } + + /** 商品状态更新请求 */ + export interface SpuStatusUpdateReqVO { id: number; // 商品编号 status: number; // 商品状态 } @@ -98,7 +99,7 @@ export function updateSpu(data: MallSpuApi.Spu) { } /** 更新商品 SPU 状态 */ -export function updateStatus(data: MallSpuApi.StatusUpdate) { +export function updateStatus(data: MallSpuApi.SpuStatusUpdateReqVO) { return requestClient.put('/product/spu/update-status', data); } diff --git a/apps/web-ele/src/api/mall/product/brand.ts b/apps/web-ele/src/api/mall/product/brand/index.ts similarity index 81% rename from apps/web-ele/src/api/mall/product/brand.ts rename to apps/web-ele/src/api/mall/product/brand/index.ts index 7b82eb728..d5483e218 100644 --- a/apps/web-ele/src/api/mall/product/brand.ts +++ b/apps/web-ele/src/api/mall/product/brand/index.ts @@ -5,18 +5,12 @@ import { requestClient } from '#/api/request'; export namespace MallBrandApi { /** 商品品牌 */ export interface Brand { - /** 品牌编号 */ - id?: number; - /** 品牌名称 */ - name: string; - /** 品牌图片 */ - picUrl: string; - /** 品牌排序 */ - sort?: number; - /** 品牌描述 */ - description?: string; - /** 开启状态 */ - status: number; + id?: number; // 品牌编号 + name: string; // 品牌名称 + picUrl: string; // 品牌图片 + sort?: number; // 品牌排序 + description?: string; // 品牌描述 + status: number; // 开启状态 } } diff --git a/apps/web-ele/src/api/mall/product/category.ts b/apps/web-ele/src/api/mall/product/category/index.ts similarity index 68% rename from apps/web-ele/src/api/mall/product/category.ts rename to apps/web-ele/src/api/mall/product/category/index.ts index 7ec8bf833..a67662a7a 100644 --- a/apps/web-ele/src/api/mall/product/category.ts +++ b/apps/web-ele/src/api/mall/product/category/index.ts @@ -3,18 +3,12 @@ import { requestClient } from '#/api/request'; export namespace MallCategoryApi { /** 产品分类 */ export interface Category { - /** 分类编号 */ - id?: number; - /** 父分类编号 */ - parentId?: number; - /** 分类名称 */ - name: string; - /** 移动端分类图 */ - picUrl: string; - /** 分类排序 */ - sort: number; - /** 开启状态 */ - status: number; + id?: number; // 分类编号 + parentId?: number; // 父分类编号 + name: string; // 分类名称 + picUrl: string; // 移动端分类图 + sort: number; // 分类排序 + status: number; // 开启状态 } } @@ -49,10 +43,3 @@ export function getCategoryList(params: any) { }, ); } - -/** 获得商品分类列表 */ -export function getCategorySimpleList() { - return requestClient.get( - '/product/category/list', - ); -} diff --git a/apps/web-ele/src/api/mall/product/comment.ts b/apps/web-ele/src/api/mall/product/comment.ts deleted file mode 100644 index 8990c2048..000000000 --- a/apps/web-ele/src/api/mall/product/comment.ts +++ /dev/null @@ -1,81 +0,0 @@ -import type { PageParam, PageResult } from '@vben/request'; - -import { requestClient } from '#/api/request'; - -export namespace MallCommentApi { - export interface Property { - propertyId: number; - propertyName: string; - valueId: number; - valueName: string; - } - /** 商品评论 */ - export interface Comment { - id: number; - userId: number; - userNickname: string; - userAvatar: string; - anonymous: boolean; - orderId: number; - orderItemId: number; - spuId: number; - spuName: string; - skuId: number; - visible: boolean; - scores: number; - descriptionScores: number; - benefitScores: number; - content: string; - picUrls: string[]; - replyStatus: boolean; - replyUserId: number; - replyContent: string; - replyTime: Date; - createTime: Date; - skuProperties: Property[]; - } - - /** 评论可见性更新 */ - export interface CommentVisibleUpdate { - id: number; - visible: boolean; - } - - /** 评论回复 */ - export interface CommentReply { - id: number; - replyContent: string; - } -} - -/** 查询商品评论列表 */ -export function getCommentPage(params: PageParam) { - return requestClient.get>( - '/product/comment/page', - { params }, - ); -} - -/** 查询商品评论详情 */ -export function getComment(id: number) { - return requestClient.get( - `/product/comment/get?id=${id}`, - ); -} - -/** 添加自评 */ -export function createComment(data: MallCommentApi.Comment) { - return requestClient.post('/product/comment/create', data); -} - -/** 显示 / 隐藏评论 */ -export function updateCommentVisible( - data: MallCommentApi.CommentVisibleUpdate, -) { - return requestClient.put('/product/comment/update-visible', data); -} - -/** 商家回复 */ -export function replyComment(data: MallCommentApi.CommentReply) { - return requestClient.put('/product/comment/reply', data); -} diff --git a/apps/web-ele/src/api/mall/product/comment/index.ts b/apps/web-ele/src/api/mall/product/comment/index.ts new file mode 100644 index 000000000..788f94a9a --- /dev/null +++ b/apps/web-ele/src/api/mall/product/comment/index.ts @@ -0,0 +1,80 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MallCommentApi { + /** 商品评论 */ + export interface Comment { + id: number; // 评论编号 + userId: number; // 用户编号 + userNickname: string; // 用户昵称 + userAvatar: string; // 用户头像 + anonymous: boolean; // 是否匿名 + orderId: number; // 订单编号 + orderItemId: number; // 订单项编号 + spuId: number; // 商品SPU编号 + spuName: string; // 商品名称 + skuId: number; // 商品SKU编号 + visible: boolean; // 是否可见 + scores: number; // 总评分 + descriptionScores: number; // 描述评分 + benefitScores: number; // 服务评分 + content: string; // 评论内容 + picUrls: string[]; // 评论图片 + replyStatus: boolean; // 是否回复 + replyUserId: number; // 回复人编号 + replyContent: string; // 回复内容 + replyTime: Date; // 回复时间 + createTime: Date; // 创建时间 + skuProperties: { + propertyId: number; // 属性 ID + propertyName: string; // 属性名称 + valueId: number; // 属性值 ID + valueName: string; // 属性值名称 + }[]; // SKU 属性数组 + } + + /** 评论可见性更新请求 */ + export interface CommentVisibleUpdateReqVO { + id: number; // 评论编号 + visible: boolean; // 是否可见 + } + + /** 评论回复请求 */ + export interface CommentReplyReqVO { + id: number; // 评论编号 + replyContent: string; // 回复内容 + } +} + +/** 查询商品评论列表 */ +export function getCommentPage(params: PageParam) { + return requestClient.get>( + '/product/comment/page', + { params }, + ); +} + +/** 查询商品评论详情 */ +export function getComment(id: number) { + return requestClient.get( + `/product/comment/get?id=${id}`, + ); +} + +/** 添加自评 */ +export function createComment(data: MallCommentApi.Comment) { + return requestClient.post('/product/comment/create', data); +} + +/** 显示 / 隐藏评论 */ +export function updateCommentVisible( + data: MallCommentApi.CommentVisibleUpdateReqVO, +) { + return requestClient.put('/product/comment/update-visible', data); +} + +/** 商家回复 */ +export function replyComment(data: MallCommentApi.CommentReplyReqVO) { + return requestClient.put('/product/comment/reply', data); +} diff --git a/apps/web-ele/src/api/mall/product/favorite.ts b/apps/web-ele/src/api/mall/product/favorite/index.ts similarity index 74% rename from apps/web-ele/src/api/mall/product/favorite.ts rename to apps/web-ele/src/api/mall/product/favorite/index.ts index 23f38d6bb..d9d47f3fc 100644 --- a/apps/web-ele/src/api/mall/product/favorite.ts +++ b/apps/web-ele/src/api/mall/product/favorite/index.ts @@ -5,12 +5,9 @@ import { requestClient } from '#/api/request'; export namespace MallFavoriteApi { /** 商品收藏 */ export interface Favorite { - /** 收藏编号 */ - id?: number; - /** 用户编号 */ - userId?: string; - /** 商品 SPU 编号 */ - spuId?: null | number; + id?: number; // 收藏编号 + userId?: string; // 用户编号 + spuId?: number; // 商品 SPU 编号 } } diff --git a/apps/web-ele/src/api/mall/product/history.ts b/apps/web-ele/src/api/mall/product/history/index.ts similarity index 60% rename from apps/web-ele/src/api/mall/product/history.ts rename to apps/web-ele/src/api/mall/product/history/index.ts index f8505a738..30a892d52 100644 --- a/apps/web-ele/src/api/mall/product/history.ts +++ b/apps/web-ele/src/api/mall/product/history/index.ts @@ -5,22 +5,14 @@ import { requestClient } from '#/api/request'; export namespace MallHistoryApi { /** 商品浏览记录 */ export interface BrowseHistory { - /** 记录编号 */ - id?: number; - /** 用户编号 */ - userId?: number; - /** 商品 SPU 编号 */ - spuId?: number; - /** 浏览时间 */ - createTime?: Date; + id?: number; // 记录编号 + userId?: number; // 用户编号 + spuId?: number; // 商品 SPU 编号 + createTime?: Date; // 浏览时间 } } -/** - * 获得商品浏览记录分页 - * - * @param params 请求参数 - */ +/** 获得商品浏览记录分页 */ export function getBrowseHistoryPage(params: PageParam) { return requestClient.get>( '/product/browse-history/page', diff --git a/apps/web-ele/src/api/mall/product/property.ts b/apps/web-ele/src/api/mall/product/property/index.ts similarity index 82% rename from apps/web-ele/src/api/mall/product/property.ts rename to apps/web-ele/src/api/mall/product/property/index.ts index e13a700fa..0834e345e 100644 --- a/apps/web-ele/src/api/mall/product/property.ts +++ b/apps/web-ele/src/api/mall/product/property/index.ts @@ -5,29 +5,17 @@ import { requestClient } from '#/api/request'; export namespace MallPropertyApi { /** 商品属性 */ export interface Property { - /** 属性编号 */ - id?: number; - /** 名称 */ - name: string; - /** 备注 */ - remark?: string; + id?: number; // 属性编号 + name: string; // 名称 + remark?: string; // 备注 } /** 属性值 */ export interface PropertyValue { - /** 属性值编号 */ - id?: number; - /** 属性项的编号 */ - propertyId?: number; - /** 名称 */ - name: string; - /** 备注 */ - remark?: string; - } - - /** 属性值查询参数 */ - export interface PropertyValueQuery extends PageParam { - propertyId?: number; + id?: number; // 属性值编号 + propertyId?: number; // 属性项的编号 + name: string; // 名称 + remark?: string; // 备注 } } @@ -69,9 +57,7 @@ export function getPropertySimpleList() { } /** 获得属性值分页 */ -export function getPropertyValuePage( - params: MallPropertyApi.PropertyValueQuery, -) { +export function getPropertyValuePage(params: PageParam) { return requestClient.get>( '/product/property/value/page', { params }, diff --git a/apps/web-ele/src/api/mall/product/spu.ts b/apps/web-ele/src/api/mall/product/spu.ts deleted file mode 100644 index 76ca7b55a..000000000 --- a/apps/web-ele/src/api/mall/product/spu.ts +++ /dev/null @@ -1,179 +0,0 @@ -import type { PageParam, PageResult } from '@vben/request'; - -import { requestClient } from '#/api/request'; - -export namespace MallSpuApi { - /** 商品属性 */ - export interface Property { - /** 属性编号 */ - propertyId?: number; - /** 属性名称 */ - propertyName?: string; - /** 属性值编号 */ - valueId?: number; - /** 属性值名称 */ - valueName?: string; - } - - /** 商品 SKU */ - export interface Sku { - /** 商品 SKU 编号 */ - id?: number; - /** 商品 SKU 名称 */ - name?: string; - /** SPU 编号 */ - spuId?: number; - /** 属性数组 */ - properties?: Property[]; - /** 商品价格 */ - price?: number | string; - /** 市场价 */ - marketPrice?: number | string; - /** 成本价 */ - costPrice?: number | string; - /** 商品条码 */ - barCode?: string; - /** 图片地址 */ - picUrl?: string; - /** 库存 */ - stock?: number; - /** 商品重量,单位:kg 千克 */ - weight?: number; - /** 商品体积,单位:m^3 平米 */ - volume?: number; - /** 一级分销的佣金 */ - firstBrokeragePrice?: number | string; - /** 二级分销的佣金 */ - secondBrokeragePrice?: number | string; - /** 商品销量 */ - salesCount?: number; - } - - /** 优惠券模板 */ - export interface GiveCouponTemplate { - /** 优惠券编号 */ - id?: number; - /** 优惠券名称 */ - name?: string; - } - - /** 商品 SPU */ - export interface Spu { - /** 商品编号 */ - id?: number; - /** 商品名称 */ - name?: string; - /** 商品分类 */ - categoryId?: number; - /** 关键字 */ - keyword?: string; - /** 单位 */ - unit?: number | undefined; - /** 商品封面图 */ - picUrl?: string; - /** 商品轮播图 */ - sliderPicUrls?: string[]; - /** 商品简介 */ - introduction?: string; - /** 配送方式 */ - deliveryTypes?: number[]; - /** 运费模版 */ - deliveryTemplateId?: number | undefined; - /** 商品品牌编号 */ - brandId?: number; - /** 商品规格 */ - specType?: boolean; - /** 分销类型 */ - subCommissionType?: boolean; - /** sku数组 */ - skus?: Sku[]; - /** 商品详情 */ - description?: string; - /** 商品排序 */ - sort?: number; - /** 赠送积分 */ - giveIntegral?: number; - /** 虚拟销量 */ - virtualSalesCount?: number; - /** 商品价格 */ - price?: number; - /** 商品拼团价格 */ - combinationPrice?: number; - /** 商品秒杀价格 */ - seckillPrice?: number; - /** 商品销量 */ - salesCount?: number; - /** 市场价 */ - marketPrice?: number; - /** 成本价 */ - costPrice?: number; - /** 商品库存 */ - stock?: number; - /** 商品创建时间 */ - createTime?: Date; - /** 商品状态 */ - status?: number; - /** 浏览量 */ - browseCount?: number; - } - - /** 商品状态更新 */ - export interface StatusUpdate { - /** 商品编号 */ - id: number; - /** 商品状态 */ - status: number; - } -} - -/** 获得商品 SPU 列表 */ -export function getSpuPage(params: PageParam) { - return requestClient.get>('/product/spu/page', { - params, - }); -} - -/** 获得商品 SPU 列表 tabsCount */ -export function getTabsCount() { - return requestClient.get>('/product/spu/get-count'); -} - -/** 创建商品 SPU */ -export function createSpu(data: MallSpuApi.Spu) { - return requestClient.post('/product/spu/create', data); -} - -/** 更新商品 SPU */ -export function updateSpu(data: MallSpuApi.Spu) { - return requestClient.put('/product/spu/update', data); -} - -/** 更新商品 SPU 状态 */ -export function updateStatus(data: MallSpuApi.StatusUpdate) { - return requestClient.put('/product/spu/update-status', data); -} - -/** 获得商品 SPU */ -export function getSpu(id: number) { - return requestClient.get(`/product/spu/get-detail?id=${id}`); -} - -/** 获得商品 SPU 详情列表 */ -export function getSpuDetailList(ids: number[]) { - return requestClient.get(`/product/spu/list?spuIds=${ids}`); -} - -/** 删除商品 SPU */ -export function deleteSpu(id: number) { - return requestClient.delete(`/product/spu/delete?id=${id}`); -} - -/** 导出商品 SPU Excel */ -export function exportSpu(params: PageParam) { - return requestClient.download('/product/spu/export-excel', { params }); -} - -/** 获得商品 SPU 精简列表 */ -export function getSpuSimpleList() { - return requestClient.get('/product/spu/list-all-simple'); -} diff --git a/apps/web-ele/src/api/mall/product/spu/index.ts b/apps/web-ele/src/api/mall/product/spu/index.ts new file mode 100644 index 000000000..4b37151c6 --- /dev/null +++ b/apps/web-ele/src/api/mall/product/spu/index.ts @@ -0,0 +1,129 @@ +import type { PageParam, PageResult } from '@vben/request'; + +import { requestClient } from '#/api/request'; + +export namespace MallSpuApi { + /** 商品 SPU */ + export interface Spu { + id?: number; // 商品编号 + name?: string; // 商品名称 + categoryId?: number; // 商品分类 + keyword?: string; // 关键字 + unit?: number; // 单位 + picUrl?: string; // 商品封面图 + sliderPicUrls?: string[]; // 商品轮播图 + introduction?: string; // 商品简介 + deliveryTypes?: number[]; // 配送方式 + deliveryTemplateId?: number; // 运费模版 + brandId?: number; // 商品品牌编号 + specType?: boolean; // 商品规格 + subCommissionType?: boolean; // 分销类型 + skus?: Sku[]; // sku数组 + description?: string; // 商品详情 + sort?: number; // 商品排序 + giveIntegral?: number; // 赠送积分 + virtualSalesCount?: number; // 虚拟销量 + price?: number; // 商品价格 + combinationPrice?: number; // 商品拼团价格 + seckillPrice?: number; // 商品秒杀价格 + salesCount?: number; // 商品销量 + marketPrice?: number; // 市场价 + costPrice?: number; // 成本价 + stock?: number; // 商品库存 + createTime?: Date; // 商品创建时间 + status?: number; // 商品状态 + browseCount?: number; // 浏览量 + } + + /** 商品 SKU */ + export interface Sku { + id?: number; // 商品 SKU 编号 + name?: string; // 商品 SKU 名称 + spuId?: number; // SPU 编号 + properties?: Property[]; // 属性数组 + price?: number | string; // 商品价格 + marketPrice?: number | string; // 市场价 + costPrice?: number | string; // 成本价 + barCode?: string; // 商品条码 + picUrl?: string; // 图片地址 + stock?: number; // 库存 + weight?: number; // 商品重量,单位:kg 千克 + volume?: number; // 商品体积,单位:m^3 平米 + firstBrokeragePrice?: number | string; // 一级分销的佣金 + secondBrokeragePrice?: number | string; // 二级分销的佣金 + salesCount?: number; // 商品销量 + } + + /** 商品属性 */ + export interface Property { + propertyId?: number; // 属性编号 + propertyName?: string; // 属性名称 + valueId?: number; // 属性值编号 + valueName?: string; // 属性值名称 + } + + // TODO @puhui999:这个还要么? + /** 优惠券模板 */ + export interface GiveCouponTemplate { + id?: number; // 优惠券编号 + name?: string; // 优惠券名称 + } + + /** 商品状态更新请求 */ + export interface SpuStatusUpdateReqVO { + id: number; // 商品编号 + status: number; // 商品状态 + } +} + +/** 获得商品 SPU 列表 */ +export function getSpuPage(params: PageParam) { + return requestClient.get>('/product/spu/page', { + params, + }); +} + +/** 获得商品 SPU 列表 tabsCount */ +export function getTabsCount() { + return requestClient.get>('/product/spu/get-count'); +} + +/** 创建商品 SPU */ +export function createSpu(data: MallSpuApi.Spu) { + return requestClient.post('/product/spu/create', data); +} + +/** 更新商品 SPU */ +export function updateSpu(data: MallSpuApi.Spu) { + return requestClient.put('/product/spu/update', data); +} + +/** 更新商品 SPU 状态 */ +export function updateStatus(data: MallSpuApi.SpuStatusUpdateReqVO) { + return requestClient.put('/product/spu/update-status', data); +} + +/** 获得商品 SPU */ +export function getSpu(id: number) { + return requestClient.get(`/product/spu/get-detail?id=${id}`); +} + +/** 获得商品 SPU 详情列表 */ +export function getSpuDetailList(ids: number[]) { + return requestClient.get(`/product/spu/list?spuIds=${ids}`); +} + +/** 删除商品 SPU */ +export function deleteSpu(id: number) { + return requestClient.delete(`/product/spu/delete?id=${id}`); +} + +/** 导出商品 SPU Excel */ +export function exportSpu(params: PageParam) { + return requestClient.download('/product/spu/export-excel', { params }); +} + +/** 获得商品 SPU 精简列表 */ +export function getSpuSimpleList() { + return requestClient.get('/product/spu/list-all-simple'); +}