feat:【antd/ele】【mall/product】优化 api 的注释
This commit is contained in:
@@ -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);
|
||||
}
|
||||
@@ -12,9 +12,7 @@ export namespace MallHistoryApi {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得商品浏览记录分页
|
||||
*/
|
||||
/** 获得商品浏览记录分页 */
|
||||
export function getBrowseHistoryPage(params: PageParam) {
|
||||
return requestClient.get<PageResult<MallHistoryApi.BrowseHistory>>(
|
||||
'/product/browse-history/page',
|
||||
@@ -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<PageResult<MallPropertyApi.PropertyValue>>(
|
||||
'/product/property/value/page',
|
||||
{ params },
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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; // 开启状态
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<MallCategoryApi.Category[]>(
|
||||
'/product/category/list',
|
||||
);
|
||||
}
|
||||
@@ -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<PageResult<MallCommentApi.Comment>>(
|
||||
'/product/comment/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商品评论详情 */
|
||||
export function getComment(id: number) {
|
||||
return requestClient.get<MallCommentApi.Comment>(
|
||||
`/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);
|
||||
}
|
||||
80
apps/web-ele/src/api/mall/product/comment/index.ts
Normal file
80
apps/web-ele/src/api/mall/product/comment/index.ts
Normal file
@@ -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<PageResult<MallCommentApi.Comment>>(
|
||||
'/product/comment/page',
|
||||
{ params },
|
||||
);
|
||||
}
|
||||
|
||||
/** 查询商品评论详情 */
|
||||
export function getComment(id: number) {
|
||||
return requestClient.get<MallCommentApi.Comment>(
|
||||
`/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);
|
||||
}
|
||||
@@ -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 编号
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<PageResult<MallHistoryApi.BrowseHistory>>(
|
||||
'/product/browse-history/page',
|
||||
@@ -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<PageResult<MallPropertyApi.PropertyValue>>(
|
||||
'/product/property/value/page',
|
||||
{ params },
|
||||
@@ -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<PageResult<MallSpuApi.Spu>>('/product/spu/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获得商品 SPU 列表 tabsCount */
|
||||
export function getTabsCount() {
|
||||
return requestClient.get<Record<string, number>>('/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<MallSpuApi.Spu>(`/product/spu/get-detail?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商品 SPU 详情列表 */
|
||||
export function getSpuDetailList(ids: number[]) {
|
||||
return requestClient.get<MallSpuApi.Spu[]>(`/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<MallSpuApi.Spu[]>('/product/spu/list-all-simple');
|
||||
}
|
||||
129
apps/web-ele/src/api/mall/product/spu/index.ts
Normal file
129
apps/web-ele/src/api/mall/product/spu/index.ts
Normal file
@@ -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<PageResult<MallSpuApi.Spu>>('/product/spu/page', {
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/** 获得商品 SPU 列表 tabsCount */
|
||||
export function getTabsCount() {
|
||||
return requestClient.get<Record<string, number>>('/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<MallSpuApi.Spu>(`/product/spu/get-detail?id=${id}`);
|
||||
}
|
||||
|
||||
/** 获得商品 SPU 详情列表 */
|
||||
export function getSpuDetailList(ids: number[]) {
|
||||
return requestClient.get<MallSpuApi.Spu[]>(`/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<MallSpuApi.Spu[]>('/product/spu/list-all-simple');
|
||||
}
|
||||
Reference in New Issue
Block a user