mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 19:49: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);
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ export namespace ShopDTO {
|
||||
export interface CreateShopDTO {
|
||||
/** 店铺名称 */
|
||||
name: string;
|
||||
/** logo URL */
|
||||
logo?: string;
|
||||
/** logo图片ID */
|
||||
logoImageId?: number;
|
||||
/** 平台(如淘宝、京东、拼多多) */
|
||||
platform?: string;
|
||||
}
|
||||
@@ -17,8 +17,8 @@ export namespace ShopDTO {
|
||||
export interface UpdateShopDTO {
|
||||
/** 店铺名称 */
|
||||
name: string;
|
||||
/** logo URL */
|
||||
logo?: string;
|
||||
/** logo图片ID */
|
||||
logoImageId?: number;
|
||||
/** 平台(如淘宝、京东、拼多多) */
|
||||
platform?: string;
|
||||
}
|
||||
@@ -37,14 +37,8 @@ export namespace ProductDTO {
|
||||
export interface CreateProductDTO {
|
||||
/** 商品名称 */
|
||||
name: string;
|
||||
/** 商品编码 */
|
||||
specCode?: string;
|
||||
/** 商品SKU */
|
||||
skuCode?: string;
|
||||
/** 主图URL */
|
||||
mainImage?: string;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
/** 主图图片ID */
|
||||
mainImageId?: number;
|
||||
}
|
||||
|
||||
/** 更新商品参数 */
|
||||
@@ -55,8 +49,50 @@ export namespace ProductDTO {
|
||||
specCode?: string;
|
||||
/** 商品SKU */
|
||||
skuCode?: string;
|
||||
/** 主图URL */
|
||||
mainImage?: string;
|
||||
/** 主图图片ID */
|
||||
mainImageId?: number;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
}
|
||||
|
||||
/** 一键创建商品和规格参数 */
|
||||
export interface CreateProductWithSpecsDTO {
|
||||
/** 商品名称 */
|
||||
name: string;
|
||||
/** 主图图片ID */
|
||||
mainImageId?: number;
|
||||
/** 商品规格列表 */
|
||||
specs: ProductSpecDTO[];
|
||||
}
|
||||
|
||||
/** 商品规格DTO */
|
||||
export interface ProductSpecDTO {
|
||||
/** 规格名称 */
|
||||
name: string;
|
||||
/** 规格编码 */
|
||||
specCode?: string;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
}
|
||||
|
||||
/** 创建商品规格参数 */
|
||||
export interface CreateProductSpecDTO {
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 规格名称 */
|
||||
name: string;
|
||||
/** 规格编码 */
|
||||
specCode?: string;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
}
|
||||
|
||||
/** 更新商品规格参数 */
|
||||
export interface UpdateProductSpecDTO {
|
||||
/** 规格名称 */
|
||||
name: string;
|
||||
/** 规格编码 */
|
||||
specCode?: string;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
}
|
||||
@@ -74,4 +110,84 @@ export namespace ProductDTO {
|
||||
/** 成本价范围-最大值 */
|
||||
maxCostPrice?: number;
|
||||
}
|
||||
|
||||
/** 商品规格过滤条件 */
|
||||
export interface ProductSpecFilterDTO {
|
||||
/** 商品ID */
|
||||
productId?: number;
|
||||
/** 商品名称(模糊查询) */
|
||||
productName?: string;
|
||||
/** 规格名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 规格编码(模糊查询) */
|
||||
specCode?: string;
|
||||
/** 成本价范围-最小值 */
|
||||
minCostPrice?: number;
|
||||
/** 成本价范围-最大值 */
|
||||
maxCostPrice?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderDTO {
|
||||
/** 创建订单参数 */
|
||||
export interface CreateOrderDTO {
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
/** 平台订单号 */
|
||||
platformOrderNo?: string;
|
||||
/** 订单状态ID */
|
||||
statusId: number;
|
||||
/** 商家实收金额 */
|
||||
receivedAmount: number;
|
||||
/** 运费 */
|
||||
shippingFee?: number;
|
||||
/** 下单时间 */
|
||||
orderDate: string;
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId: number;
|
||||
/** 数量 */
|
||||
quantity: number;
|
||||
}
|
||||
|
||||
/** 更新订单参数 */
|
||||
export interface UpdateOrderDTO {
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId: number;
|
||||
/** 订单状态ID */
|
||||
orderStatusId: number;
|
||||
/** 商品数量 */
|
||||
quantity: number;
|
||||
/** 订单编号 */
|
||||
orderNumber: string;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 商品规格名称 */
|
||||
productSpecName: string;
|
||||
/** 店铺实际收入 */
|
||||
shopActualAmount: number;
|
||||
}
|
||||
|
||||
/** 订单过滤条件 */
|
||||
export interface OrderFilterDTO {
|
||||
/** 店铺ID */
|
||||
shopId?: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId?: number;
|
||||
/** 订单状态ID */
|
||||
orderStatusId?: number;
|
||||
/** 订单编号(模糊查询) */
|
||||
orderNumber?: string;
|
||||
/** 商品名称(模糊查询) */
|
||||
productName?: string;
|
||||
}
|
||||
|
||||
/** 批量导入订单参数 */
|
||||
export interface BatchImportOrderDTO {
|
||||
/** 订单列表 */
|
||||
orders: CreateOrderDTO[];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,12 +35,34 @@ export namespace ProductVO {
|
||||
companyId: number;
|
||||
/** 商品名称 */
|
||||
name: string;
|
||||
/** 商品编码 */
|
||||
specCode?: string;
|
||||
/** 商品SKU */
|
||||
skuCode?: string;
|
||||
/** 主图URL */
|
||||
mainImage?: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
/** 商品规格列表 */
|
||||
specs?: ProductSpecInfoVO[];
|
||||
}
|
||||
|
||||
/** 商品规格信息 */
|
||||
export interface ProductSpecInfoVO {
|
||||
/** 规格ID */
|
||||
id: number;
|
||||
/** 公司ID */
|
||||
companyId: number;
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 规格名称 */
|
||||
name: string;
|
||||
/** 规格编码 */
|
||||
specCode?: string;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
/** 创建时间 */
|
||||
@@ -53,3 +75,49 @@ export namespace ProductVO {
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderVO {
|
||||
/** 订单信息 */
|
||||
export interface OrderInfoVO {
|
||||
/** 订单ID */
|
||||
id: number;
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId: number;
|
||||
/** 订单状态ID */
|
||||
orderStatusId: number;
|
||||
/** 商品数量 */
|
||||
quantity: number;
|
||||
/** 订单编号 */
|
||||
orderNumber: string;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 商品规格名称 */
|
||||
productSpecName: string;
|
||||
/** 店铺实际收入 */
|
||||
shopActualAmount: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace BatchImportResultVO {
|
||||
/** 批量导入结果 */
|
||||
export interface BatchImportResultInfoVO {
|
||||
/** 总数量 */
|
||||
totalCount: number;
|
||||
/** 成功数量 */
|
||||
successCount: number;
|
||||
/** 失败数量 */
|
||||
failureCount: number;
|
||||
/** 失败详情 */
|
||||
failureDetails: string[];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user