forked from gxwebsoft/mp-10550
提交代码
This commit is contained in:
117
src/api/shop/shopGoodsSku/index.ts
Normal file
117
src/api/shop/shopGoodsSku/index.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api/index';
|
||||
import { ShopGoodsSpec } from '@/api/shop/shopGoodsSpec/model';
|
||||
import { ShopGoodsSku, ShopGoodsSkuParam } from '@/api/shop/shopGoodsSku/model';
|
||||
|
||||
export async function generateGoodsSku(data: ShopGoodsSpec) {
|
||||
const res = await request.post<ApiResult<ShopGoodsSku[]>>(
|
||||
'/shop/goods-sku/generateGoodsSku',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询商品sku列表
|
||||
*/
|
||||
export async function pageShopGoodsSku(params: ShopGoodsSkuParam) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopGoodsSku>>>(
|
||||
'/shop/shop-goods-sku/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品sku列表列表
|
||||
*/
|
||||
export async function listShopGoodsSku(params?: ShopGoodsSkuParam) {
|
||||
const res = await request.get<ApiResult<ShopGoodsSku[]>>(
|
||||
'/shop/shop-goods-sku',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品sku列表
|
||||
*/
|
||||
export async function addShopGoodsSku(data: ShopGoodsSku) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-goods-sku',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品sku列表
|
||||
*/
|
||||
export async function updateShopGoodsSku(data: ShopGoodsSku) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-goods-sku',
|
||||
data
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品sku列表
|
||||
*/
|
||||
export async function removeShopGoodsSku(id?: number) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-goods-sku/' + id
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品sku列表
|
||||
*/
|
||||
export async function removeBatchShopGoodsSku(data: (number | undefined)[]) {
|
||||
const res = await request.del<ApiResult<unknown>>(
|
||||
'/shop/shop-goods-sku/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.code === 0) {
|
||||
return res.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询商品sku列表
|
||||
*/
|
||||
export async function getShopGoodsSku(id: number) {
|
||||
const res = await request.get<ApiResult<ShopGoodsSku>>(
|
||||
'/shop/shop-goods-sku/' + id
|
||||
);
|
||||
if (res.code === 0 && res.data) {
|
||||
return res.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.message));
|
||||
}
|
||||
50
src/api/shop/shopGoodsSku/model/index.ts
Normal file
50
src/api/shop/shopGoodsSku/model/index.ts
Normal file
@@ -0,0 +1,50 @@
|
||||
import type { PageParam } from '@/api/index';
|
||||
|
||||
/**
|
||||
* 商品sku列表
|
||||
*/
|
||||
export interface ShopGoodsSku {
|
||||
// 主键ID
|
||||
id?: number;
|
||||
// 商品ID
|
||||
goodsId?: number;
|
||||
// 商品属性索引值 (attr_value|attr_value[|....])
|
||||
sku?: string;
|
||||
// 商品图片
|
||||
image?: string;
|
||||
// 商品价格
|
||||
price?: string;
|
||||
// 市场价格
|
||||
salePrice?: string;
|
||||
// 成本价
|
||||
cost?: string;
|
||||
// 库存
|
||||
stock?: number;
|
||||
// sku编码
|
||||
skuNo?: string;
|
||||
// 商品条码
|
||||
barCode?: string;
|
||||
// 重量
|
||||
weight?: string;
|
||||
// 体积
|
||||
volume?: string;
|
||||
// 唯一值
|
||||
uuid?: string;
|
||||
// 状态, 0正常, 1异常
|
||||
status?: number;
|
||||
// 备注
|
||||
comments?: string;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 创建时间
|
||||
createTime?: string;
|
||||
images?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品sku列表搜索条件
|
||||
*/
|
||||
export interface ShopGoodsSkuParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user