feat(shop): 添加品牌管理和物流公司管理功能
- 新增品牌管理相关接口和页面组件 - 新增物流公司管理相关接口和页面组件 - 优化运费模板和运费模板详情页面的请求路径
This commit is contained in:
105
src/api/shop/shopBrand2/index.ts
Normal file
105
src/api/shop/shopBrand2/index.ts
Normal file
@@ -0,0 +1,105 @@
|
||||
import request from '@/utils/request';
|
||||
import type { ApiResult, PageResult } from '@/api';
|
||||
import type { ShopBrand2, ShopBrand2Param } from './model';
|
||||
|
||||
/**
|
||||
* 分页查询品牌
|
||||
*/
|
||||
export async function pageShopBrand2(params: ShopBrand2Param) {
|
||||
const res = await request.get<ApiResult<PageResult<ShopBrand2>>>(
|
||||
'/shop/shop-brand2/page',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询品牌列表
|
||||
*/
|
||||
export async function listShopBrand2(params?: ShopBrand2Param) {
|
||||
const res = await request.get<ApiResult<ShopBrand2[]>>(
|
||||
'/shop/shop-brand2',
|
||||
{
|
||||
params
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加品牌
|
||||
*/
|
||||
export async function addShopBrand2(data: ShopBrand2) {
|
||||
const res = await request.post<ApiResult<unknown>>(
|
||||
'/shop/shop-brand2',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改品牌
|
||||
*/
|
||||
export async function updateShopBrand2(data: ShopBrand2) {
|
||||
const res = await request.put<ApiResult<unknown>>(
|
||||
'/shop/shop-brand2',
|
||||
data
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除品牌
|
||||
*/
|
||||
export async function removeShopBrand2(id?: number) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-brand2/' + id
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除品牌
|
||||
*/
|
||||
export async function removeBatchShopBrand2(data: (number | undefined)[]) {
|
||||
const res = await request.delete<ApiResult<unknown>>(
|
||||
'/shop/shop-brand2/batch',
|
||||
{
|
||||
data
|
||||
}
|
||||
);
|
||||
if (res.data.code === 0) {
|
||||
return res.data.message;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询品牌
|
||||
*/
|
||||
export async function getShopBrand2(id: number) {
|
||||
const res = await request.get<ApiResult<ShopBrand2>>(
|
||||
'/shop/shop-brand2/' + id
|
||||
);
|
||||
if (res.data.code === 0 && res.data.data) {
|
||||
return res.data.data;
|
||||
}
|
||||
return Promise.reject(new Error(res.data.message));
|
||||
}
|
||||
Reference in New Issue
Block a user