mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:49:20 +08:00
小修小补
This commit is contained in:
@@ -1,123 +1,7 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
import type { ShopDTO, ShopVO, ProductDTO, ProductVO, OrderDTO, OrderVO, BatchImportResultVO } from './types';
|
||||
|
||||
/**
|
||||
* 店铺管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取店铺列表
|
||||
*/
|
||||
export async function getShopPageApi(params: PageQueryDTO<ShopDTO.ShopFiltersDTO>) {
|
||||
return requestClient.post<PageResultVO<ShopVO.ShopInfoVO>>('/ec/shop/page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建店铺
|
||||
*/
|
||||
export async function createShopApi(data: ShopDTO.CreateShopDTO) {
|
||||
return requestClient.post<ShopVO.ShopInfoVO>('/ec/shop/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新店铺
|
||||
*/
|
||||
export async function updateShopApi(id: number, data: ShopDTO.UpdateShopDTO) {
|
||||
return requestClient.put<ShopVO.ShopInfoVO>(`/ec/shop/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除店铺
|
||||
*/
|
||||
export async function deleteShopApi(id: number) {
|
||||
return requestClient.delete<void>(`/ec/shop/delete/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传店铺Logo
|
||||
*/
|
||||
export async function uploadShopLogoApi(file: File) {
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
return requestClient.post<ShopVO.ShopInfoVO>('/ec/shop/upload-logo', formData, {
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取商品列表
|
||||
*/
|
||||
export async function getProductPageApi(params: PageQueryDTO<ProductDTO.ProductFiltersDTO>) {
|
||||
return requestClient.post<PageResultVO<ProductVO.ProductInfoVO>>('/ec/product/page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建商品
|
||||
*/
|
||||
export async function createProductApi(data: ProductDTO.CreateProductDTO) {
|
||||
return requestClient.post<ProductVO.ProductInfoVO>('/ec/product/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品
|
||||
*/
|
||||
export async function updateProductApi(id: number, data: ProductDTO.UpdateProductDTO) {
|
||||
return requestClient.put<ProductVO.ProductInfoVO>(`/ec/product/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
*/
|
||||
export async function deleteProductApi(id: number) {
|
||||
return requestClient.delete<void>(`/ec/product/delete/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 一键创建商品和规格
|
||||
*/
|
||||
export async function createProductWithSpecsApi(data: ProductDTO.CreateProductWithSpecsDTO) {
|
||||
return requestClient.post<ProductVO.ProductInfoVO>('/ec/product/create-with-specs', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品规格管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取商品规格列表
|
||||
*/
|
||||
export async function getProductSpecPageApi(params: PageQueryDTO<ProductDTO.ProductSpecFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<ProductVO.ProductSpecInfoVO>>('/ec/product-spec/page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建商品规格
|
||||
*/
|
||||
export async function createProductSpecApi(data: ProductDTO.CreateProductSpecDTO) {
|
||||
return requestClient.post<ProductVO.ProductSpecInfoVO>('/ec/product-spec/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新商品规格
|
||||
*/
|
||||
export async function updateProductSpecApi(id: number, data: ProductDTO.UpdateProductSpecDTO) {
|
||||
return requestClient.put<ProductVO.ProductSpecInfoVO>(`/ec/product-spec/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品规格
|
||||
*/
|
||||
export async function deleteProductSpecApi(id: number) {
|
||||
return requestClient.delete<void>(`/ec/product-spec/delete/${id}`);
|
||||
}
|
||||
import type { OrderDTO, OrderVO, BatchImportResultVO, OrderStatusDTO, OrderStatusVO } from './types';
|
||||
|
||||
/**
|
||||
* 订单管理API
|
||||
@@ -166,47 +50,48 @@ export async function batchImportOrdersApi(data: OrderDTO.BatchImportOrderDTO) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 精准查询API - 用于数据导入
|
||||
* 订单状态管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 根据名称精准查询店铺
|
||||
* 创建订单状态
|
||||
*/
|
||||
export async function getShopByNameApi(name: string) {
|
||||
return requestClient.get<ShopVO.ShopInfoVO>(`/ec/shop/find-by-name/${encodeURIComponent(name)}`);
|
||||
export async function createOrderStatusApi(data: OrderStatusDTO.CreateOrderStatusDTO) {
|
||||
return requestClient.post<number>('/ec/order-status', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据名称查询店铺
|
||||
* 更新订单状态
|
||||
*/
|
||||
export async function getShopsByNamesApi(names: string[]) {
|
||||
return requestClient.post<ShopVO.ShopInfoVO[]>('/ec/shop/find-by-names', names);
|
||||
export async function updateOrderStatusApi(data: OrderStatusDTO.UpdateOrderStatusDTO) {
|
||||
return requestClient.put<void>('/ec/order-status', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称精准查询商品
|
||||
* 删除订单状态
|
||||
*/
|
||||
export async function getProductByNameApi(name: string) {
|
||||
return requestClient.get<ProductVO.ProductInfoVO>(`/ec/product/find-by-name/${encodeURIComponent(name)}`);
|
||||
export async function deleteOrderStatusApi(id: number) {
|
||||
return requestClient.delete<void>(`/ec/order-status/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据名称查询商品
|
||||
* 获取订单状态详情
|
||||
*/
|
||||
export async function getProductsByNamesApi(names: string[]) {
|
||||
return requestClient.post<ProductVO.ProductInfoVO[]>('/ec/product/find-by-names', names);
|
||||
export async function getOrderStatusByIdApi(id: number) {
|
||||
return requestClient.get<OrderStatusVO.OrderStatusInfoVO>(`/ec/order-status/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品名称和规格编码精准查询商品规格
|
||||
* 获取启用的订单状态列表
|
||||
*/
|
||||
export async function getProductSpecByProductAndSpecApi(productName: string, specCode: string) {
|
||||
return requestClient.get<ProductVO.ProductSpecInfoVO>(`/ec/product-spec/find-by-product-and-spec/${encodeURIComponent(productName)}/${encodeURIComponent(specCode)}`);
|
||||
export async function getActiveOrderStatusListApi() {
|
||||
return requestClient.get<OrderStatusVO.OrderStatusInfoVO[]>('/ec/order-status/active');
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据商品名称和规格编码查询商品规格
|
||||
* 获取所有订单状态列表
|
||||
*/
|
||||
export async function getProductSpecsByProductAndSpecsApi(queries: { productName: string; specCode: string }[]) {
|
||||
return requestClient.post<ProductVO.ProductInfoVO[]>('/ec/product-spec/find-by-product-and-specs', queries);
|
||||
export async function getAllOrderStatusListApi() {
|
||||
return requestClient.get<OrderStatusVO.OrderStatusInfoVO[]>('/ec/order-status/all');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user