mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 03:09:19 +08:00
完成订单批量导入功能
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||
import type { ShopDTO, ShopVO, ProductDTO, ProductVO } from './types';
|
||||
import type { ShopDTO, ShopVO, ProductDTO, ProductVO, OrderDTO, OrderVO, BatchImportResultVO } from './types';
|
||||
|
||||
/**
|
||||
* 店铺管理API
|
||||
@@ -35,6 +35,19 @@ 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
|
||||
*/
|
||||
@@ -66,3 +79,134 @@ export async function updateProductApi(id: number, data: ProductDTO.UpdateProduc
|
||||
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}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单管理API
|
||||
*/
|
||||
|
||||
/**
|
||||
* 分页获取订单列表
|
||||
*/
|
||||
export async function getOrderPageApi(params: PageQueryDTO<OrderDTO.OrderFilterDTO>) {
|
||||
return requestClient.post<PageResultVO<OrderVO.OrderInfoVO>>('/ec/order/page', params);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
*/
|
||||
export async function createOrderApi(data: OrderDTO.CreateOrderDTO) {
|
||||
return requestClient.post<OrderVO.OrderInfoVO>('/ec/order/create', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新订单
|
||||
*/
|
||||
export async function updateOrderApi(id: number, data: OrderDTO.UpdateOrderDTO) {
|
||||
return requestClient.put<OrderVO.OrderInfoVO>(`/ec/order/update/${id}`, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除订单
|
||||
*/
|
||||
export async function deleteOrderApi(id: number) {
|
||||
return requestClient.delete<void>(`/ec/order/delete/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单详情
|
||||
*/
|
||||
export async function getOrderByIdApi(id: number) {
|
||||
return requestClient.get<OrderVO.OrderInfoVO>(`/ec/order/detail/${id}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量导入订单
|
||||
*/
|
||||
export async function batchImportOrdersApi(data: OrderDTO.BatchImportOrderDTO) {
|
||||
return requestClient.post<BatchImportResultVO.BatchImportResultInfoVO>('/ec/order/batch-import', data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 精准查询API - 用于数据导入
|
||||
*/
|
||||
|
||||
/**
|
||||
* 根据名称精准查询店铺
|
||||
*/
|
||||
export async function getShopByNameApi(name: string) {
|
||||
return requestClient.get<ShopVO.ShopInfoVO>(`/ec/shop/find-by-name/${encodeURIComponent(name)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据名称查询店铺
|
||||
*/
|
||||
export async function getShopsByNamesApi(names: string[]) {
|
||||
return requestClient.post<ShopVO.ShopInfoVO[]>('/ec/shop/find-by-names', names);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据名称精准查询商品
|
||||
*/
|
||||
export async function getProductByNameApi(name: string) {
|
||||
return requestClient.get<ProductVO.ProductInfoVO>(`/ec/product/find-by-name/${encodeURIComponent(name)}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量根据名称查询商品
|
||||
*/
|
||||
export async function getProductsByNamesApi(names: string[]) {
|
||||
return requestClient.post<ProductVO.ProductInfoVO[]>('/ec/product/find-by-names', names);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据商品名称和规格编码精准查询商品规格
|
||||
*/
|
||||
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 getProductSpecsByProductAndSpecsApi(queries: { productName: string; specCode: string }[]) {
|
||||
return requestClient.post<ProductVO.ProductInfoVO[]>('/ec/product-spec/find-by-product-and-specs', queries);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user