mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 23:09:19 +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');
|
||||
}
|
||||
|
||||
|
||||
@@ -2,132 +2,6 @@
|
||||
* 电商模块DTO类型定义
|
||||
*/
|
||||
|
||||
export namespace ShopDTO {
|
||||
/** 创建店铺参数 */
|
||||
export interface CreateShopDTO {
|
||||
/** 店铺名称 */
|
||||
name: string;
|
||||
/** logo图片ID */
|
||||
logoImageId?: number;
|
||||
/** 平台(如淘宝、京东、拼多多) */
|
||||
platform?: string;
|
||||
}
|
||||
|
||||
/** 更新店铺参数 */
|
||||
export interface UpdateShopDTO {
|
||||
/** 店铺名称 */
|
||||
name: string;
|
||||
/** logo图片ID */
|
||||
logoImageId?: number;
|
||||
/** 平台(如淘宝、京东、拼多多) */
|
||||
platform?: string;
|
||||
}
|
||||
|
||||
/** 店铺过滤条件 */
|
||||
export interface ShopFiltersDTO {
|
||||
/** 店铺名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 平台 */
|
||||
platform?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace ProductDTO {
|
||||
/** 创建商品参数 */
|
||||
export interface CreateProductDTO {
|
||||
/** 商品名称 */
|
||||
name: string;
|
||||
/** 主图图片ID */
|
||||
mainImageId?: number;
|
||||
}
|
||||
|
||||
/** 更新商品参数 */
|
||||
export interface UpdateProductDTO {
|
||||
/** 商品名称 */
|
||||
name: string;
|
||||
/** 商品编码 */
|
||||
specCode?: string;
|
||||
/** 商品SKU */
|
||||
skuCode?: 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;
|
||||
}
|
||||
|
||||
/** 商品过滤条件 */
|
||||
export interface ProductFiltersDTO {
|
||||
/** 商品名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 商品编码(模糊查询) */
|
||||
specCode?: string;
|
||||
/** 商品SKU(模糊查询) */
|
||||
skuCode?: string;
|
||||
/** 成本价范围-最小值 */
|
||||
minCostPrice?: number;
|
||||
/** 成本价范围-最大值 */
|
||||
maxCostPrice?: number;
|
||||
}
|
||||
|
||||
/** 商品规格过滤条件 */
|
||||
export interface ProductSpecFilterDTO {
|
||||
/** 商品ID */
|
||||
productId?: number;
|
||||
/** 商品名称(模糊查询) */
|
||||
productName?: string;
|
||||
/** 规格名称(模糊查询) */
|
||||
name?: string;
|
||||
/** 规格编码(模糊查询) */
|
||||
specCode?: string;
|
||||
/** 成本价范围-最小值 */
|
||||
minCostPrice?: number;
|
||||
/** 成本价范围-最大值 */
|
||||
maxCostPrice?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderDTO {
|
||||
/** 创建订单参数 */
|
||||
export interface CreateOrderDTO {
|
||||
@@ -155,20 +29,16 @@ export namespace OrderDTO {
|
||||
export interface UpdateOrderDTO {
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId: number;
|
||||
/** 平台订单号 */
|
||||
platformOrderNo?: string;
|
||||
/** 订单状态ID */
|
||||
orderStatusId: number;
|
||||
/** 商品数量 */
|
||||
quantity: number;
|
||||
/** 订单编号 */
|
||||
orderNumber: string;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 商品规格名称 */
|
||||
productSpecName: string;
|
||||
/** 店铺实际收入 */
|
||||
shopActualAmount: number;
|
||||
statusId?: number;
|
||||
/** 商家实收金额 */
|
||||
receivedAmount: number;
|
||||
/** 运费 */
|
||||
shippingFee?: number;
|
||||
/** 下单时间 */
|
||||
orderDate: string;
|
||||
}
|
||||
|
||||
/** 订单过滤条件 */
|
||||
@@ -191,3 +61,31 @@ export namespace OrderDTO {
|
||||
orders: CreateOrderDTO[];
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderStatusDTO {
|
||||
/** 创建订单状态参数 */
|
||||
export interface CreateOrderStatusDTO {
|
||||
/** 状态名称 */
|
||||
name: string;
|
||||
/** 状态描述 */
|
||||
description?: string;
|
||||
/** 是否启用 */
|
||||
enabled: boolean;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
}
|
||||
|
||||
/** 更新订单状态参数 */
|
||||
export interface UpdateOrderStatusDTO {
|
||||
/** 状态ID */
|
||||
id: number;
|
||||
/** 状态名称 */
|
||||
name: string;
|
||||
/** 状态描述 */
|
||||
description?: string;
|
||||
/** 是否启用 */
|
||||
enabled: boolean;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
}
|
||||
}
|
||||
@@ -2,101 +2,29 @@
|
||||
* 电商模块VO类型定义
|
||||
*/
|
||||
|
||||
export namespace ShopVO {
|
||||
/** 店铺信息 */
|
||||
export interface ShopInfoVO {
|
||||
/** 店铺ID */
|
||||
id: number;
|
||||
/** 所属公司ID */
|
||||
companyId: number;
|
||||
/** 店铺名称 */
|
||||
name: string;
|
||||
/** logo URL */
|
||||
logo?: string;
|
||||
/** 平台(如淘宝、京东、拼多多) */
|
||||
platform?: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace ProductVO {
|
||||
/** 商品信息 */
|
||||
export interface ProductInfoVO {
|
||||
/** 商品ID */
|
||||
id: number;
|
||||
/** 公司ID */
|
||||
companyId: number;
|
||||
/** 商品名称 */
|
||||
name: 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;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderVO {
|
||||
/** 订单信息 */
|
||||
export interface OrderInfoVO {
|
||||
/** 订单ID */
|
||||
id: number;
|
||||
/** 公司ID */
|
||||
companyId: number;
|
||||
/** 店铺ID */
|
||||
shopId: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId: number;
|
||||
/** 店铺名称 */
|
||||
shopName: string;
|
||||
/** 平台订单号 */
|
||||
platformOrderNo: string;
|
||||
/** 订单状态ID */
|
||||
orderStatusId: number;
|
||||
/** 商品数量 */
|
||||
quantity: number;
|
||||
/** 订单编号 */
|
||||
orderNumber: string;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 商品规格名称 */
|
||||
productSpecName: string;
|
||||
/** 店铺实际收入 */
|
||||
shopActualAmount: number;
|
||||
statusId: number;
|
||||
/** 订单状态名称 */
|
||||
statusName: string;
|
||||
/** 商家实收金额 */
|
||||
receivedAmount: number;
|
||||
/** 运费 */
|
||||
shippingFee: number;
|
||||
/** 下单时间 */
|
||||
orderDate: string;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
@@ -105,6 +33,42 @@ export namespace OrderVO {
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
/** 订单明细 */
|
||||
orderItem?: OrderItemVO.OrderItemInfoVO;
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderItemVO {
|
||||
/** 订单明细信息 */
|
||||
export interface OrderItemInfoVO {
|
||||
/** 订单明细ID */
|
||||
id: number;
|
||||
/** 订单ID */
|
||||
orderId: number;
|
||||
/** 商品ID */
|
||||
productId: number;
|
||||
/** 商品规格ID */
|
||||
productSpecId: number;
|
||||
/** 商品名称 */
|
||||
productName: string;
|
||||
/** 规格名称 */
|
||||
specName: string;
|
||||
/** 商品主图 */
|
||||
productImage?: string;
|
||||
/** 数量 */
|
||||
quantity: number;
|
||||
/** 销售单价 */
|
||||
unitPrice: number;
|
||||
/** 成本价 */
|
||||
costPrice: number;
|
||||
/** 小计金额 */
|
||||
subtotal: number;
|
||||
/** 成本小计 */
|
||||
costTotal: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,3 +85,27 @@ export namespace BatchImportResultVO {
|
||||
failureDetails: string[];
|
||||
}
|
||||
}
|
||||
|
||||
export namespace OrderStatusVO {
|
||||
/** 订单状态信息 */
|
||||
export interface OrderStatusInfoVO {
|
||||
/** 状态ID */
|
||||
id: number;
|
||||
/** 状态名称 */
|
||||
name: string;
|
||||
/** 状态描述 */
|
||||
description?: string;
|
||||
/** 是否启用 */
|
||||
enabled: boolean;
|
||||
/** 排序 */
|
||||
sortOrder?: number;
|
||||
/** 创建时间 */
|
||||
createTime: string;
|
||||
/** 更新时间 */
|
||||
updateTime: string;
|
||||
/** 创建人ID */
|
||||
createBy?: number;
|
||||
/** 更新人ID */
|
||||
updateBy?: number;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user