初始化
This commit is contained in:
106
api/shop/goodsAttrValue/index.ts
Normal file
106
api/shop/goodsAttrValue/index.ts
Normal file
@@ -0,0 +1,106 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { GoodsAttrValue, GoodsAttrValueParam } from './model';
|
||||
import { MODULES_API_URL } from '@/config';
|
||||
|
||||
/**
|
||||
* 分页查询商品属性值表
|
||||
*/
|
||||
export async function pageGoodsAttrValue(params: GoodsAttrValueParam) {
|
||||
const res = await request.get<ApiResult<PageResult<GoodsAttrValue>>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询商品属性值表列表
|
||||
*/
|
||||
export async function listGoodsAttrValue(params?: GoodsAttrValueParam) {
|
||||
const res = await request.get<ApiResult<GoodsAttrValue[]>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加商品属性值表
|
||||
*/
|
||||
export async function addGoodsAttrValue(data: GoodsAttrValue) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品属性值表
|
||||
*/
|
||||
export async function updateGoodsAttrValue(data: GoodsAttrValue) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品属性值表
|
||||
*/
|
||||
export async function removeGoodsAttrValue(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除商品属性值表
|
||||
*/
|
||||
export async function removeBatchGoodsAttrValue(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询商品属性值表
|
||||
*/
|
||||
export async function getGoodsAttrValue(id: number) {
|
||||
const res = await request.get<ApiResult<GoodsAttrValue>>(
|
||||
MODULES_API_URL + '/shop/goods-attr-value/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
59
api/shop/goodsAttrValue/model/index.ts
Normal file
59
api/shop/goodsAttrValue/model/index.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import type { PageParam } from '@/api';
|
||||
|
||||
/**
|
||||
* 商品属性值表
|
||||
*/
|
||||
export interface GoodsAttrValue {
|
||||
// 主键
|
||||
id?: number;
|
||||
// 商品ID
|
||||
goodsId?: number;
|
||||
// 商品属性索引值 (attr_value|attr_value[|....])
|
||||
suk?: string;
|
||||
// 属性对应的库存
|
||||
stock?: number;
|
||||
// 销量
|
||||
sales?: number;
|
||||
// 属性金额
|
||||
price?: number;
|
||||
// 图片
|
||||
image?: string;
|
||||
// 唯一值
|
||||
unique?: string;
|
||||
// 成本价
|
||||
cost?: string;
|
||||
// 商品条码
|
||||
barCode?: string;
|
||||
// 原价
|
||||
otPrice?: string;
|
||||
// 重量
|
||||
weight?: string;
|
||||
// 体积
|
||||
volume?: string;
|
||||
// 一级返佣
|
||||
brokerage?: string;
|
||||
// 二级返佣
|
||||
brokerageTwo?: string;
|
||||
// 活动类型 0=商品,1=秒杀,2=砍价,3=拼团
|
||||
type?: string;
|
||||
// 活动限购数量
|
||||
quota?: number;
|
||||
// 活动限购数量显示
|
||||
quotaShow?: number;
|
||||
// attr_values 创建更新时的属性对应
|
||||
attrValue?: string;
|
||||
// 是否删除, 0否, 1是
|
||||
deleted?: number;
|
||||
// 租户id
|
||||
tenantId?: number;
|
||||
// 注册时间
|
||||
createTime?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品属性值表搜索条件
|
||||
*/
|
||||
export interface GoodsAttrValueParam extends PageParam {
|
||||
id?: number;
|
||||
keywords?: string;
|
||||
}
|
||||
Reference in New Issue
Block a user