diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/apis.ts deleted file mode 100644 index 81c2397f..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/apis.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { requestClient } from '#/api/request'; - -import type { PageQueryDTO, PageResultVO } from '#/types/common'; -import type { OrderDTO, OrderVO, BatchImportResultVO, OrderStatusDTO, OrderStatusVO, PromotionFeeTypeDTO, PromotionFeeTypeVO } from './types'; - -/** - * 订单管理API - */ - -/** - * 分页获取订单列表 - */ -export async function getOrderPageApi(params: PageQueryDTO) { - return requestClient.post>('/ec/order/page', params); -} - -/** - * 创建订单 - */ -export async function createOrderApi(data: OrderDTO.CreateOrderDTO) { - return requestClient.post('/ec/order/create', data); -} - -/** - * 更新订单 - */ -export async function updateOrderApi(id: number, data: OrderDTO.UpdateOrderDTO) { - return requestClient.put(`/ec/order/update/${id}`, data); -} - -/** - * 删除订单 - */ -export async function deleteOrderApi(id: number) { - return requestClient.delete(`/ec/order/delete/${id}`); -} - -/** - * 获取订单详情 - */ -export async function getOrderByIdApi(id: number) { - return requestClient.get(`/ec/order/detail/${id}`); -} - -/** - * 批量导入订单 - */ -export async function batchImportOrdersApi(data: OrderDTO.BatchImportOrderDTO) { - return requestClient.post('/ec/order/batch-import', data); -} - -/** - * 订单状态管理API - */ - -/** - * 创建订单状态 - */ -export async function createOrderStatusApi(data: OrderStatusDTO.CreateOrderStatusDTO) { - return requestClient.post('/ec/order-status', data); -} - -/** - * 更新订单状态 - */ -export async function updateOrderStatusApi(data: OrderStatusDTO.UpdateOrderStatusDTO) { - return requestClient.put('/ec/order-status', data); -} - -/** - * 删除订单状态 - */ -export async function deleteOrderStatusApi(id: number) { - return requestClient.delete(`/ec/order-status/${id}`); -} - -/** - * 获取订单状态详情 - */ -export async function getOrderStatusByIdApi(id: number) { - return requestClient.get(`/ec/order-status/${id}`); -} - -/** - * 获取启用的订单状态列表 - */ -export async function getActiveOrderStatusListApi() { - return requestClient.get('/ec/order-status/active'); -} - -/** - * 获取所有订单状态列表 - */ -export async function getAllOrderStatusListApi() { - return requestClient.get('/ec/order-status/all'); -} - -/** - * 推广费类型管理API - */ - -/** - * 创建推广费类型 - */ -export async function createPromotionFeeTypeApi(data: PromotionFeeTypeDTO.CreatePromotionFeeTypeDTO) { - return requestClient.post('/ec/promotion-fee-type', data); -} - -/** - * 更新推广费类型 - */ -export async function updatePromotionFeeTypeApi(data: PromotionFeeTypeDTO.UpdatePromotionFeeTypeDTO) { - return requestClient.put('/ec/promotion-fee-type', data); -} - -/** - * 删除推广费类型 - */ -export async function deletePromotionFeeTypeApi(id: number) { - return requestClient.delete(`/ec/promotion-fee-type/${id}`); -} - -/** - * 获取推广费类型详情 - */ -export async function getPromotionFeeTypeByIdApi(id: number) { - return requestClient.get(`/ec/promotion-fee-type/${id}`); -} - -/** - * 获取启用的推广费类型列表 - */ -export async function getActivePromotionFeeTypeListApi() { - return requestClient.get('/ec/promotion-fee-type/active'); -} - -/** - * 获取所有推广费类型列表 - */ -export async function getAllPromotionFeeTypeListApi() { - return requestClient.get('/ec/promotion-fee-type/all'); -} - diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/index.ts index 9f8f8d01..c74de9a8 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/index.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/index.ts @@ -2,5 +2,11 @@ * 电商模块API导出 */ -export * from './apis'; -export * from './types'; +// 订单相关API +export * from './order.apis'; + +// 订单状态相关API +export * from './order-status.apis'; + +// 推广费类型相关API +export * from './promotion-fee-type.apis'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/order-status.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/order-status.apis.ts new file mode 100644 index 00000000..8f5df6ac --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/order-status.apis.ts @@ -0,0 +1,49 @@ +import { requestClient } from '#/api/request'; + +import type { OrderStatusDTO, OrderStatusVO } from './types'; + +/** + * 订单状态管理API + */ + +/** + * 创建订单状态 + */ +export async function createOrderStatusApi(data: OrderStatusDTO.Create) { + return requestClient.post('/ec/order-status', data); +} + +/** + * 更新订单状态 + */ +export async function updateOrderStatusApi(data: OrderStatusDTO.Update) { + return requestClient.put('/ec/order-status', data); +} + +/** + * 删除订单状态 + */ +export async function deleteOrderStatusApi(id: number) { + return requestClient.delete(`/ec/order-status/${id}`); +} + +/** + * 获取订单状态详情 + */ +export async function getOrderStatusByIdApi(id: number) { + return requestClient.get(`/ec/order-status/${id}`); +} + +/** + * 获取启用的订单状态列表 + */ +export async function getActiveOrderStatusListApi() { + return requestClient.get('/ec/order-status/active'); +} + +/** + * 获取所有订单状态列表 + */ +export async function getAllOrderStatusListApi() { + return requestClient.get('/ec/order-status/all'); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/order.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/order.apis.ts new file mode 100644 index 00000000..635bb4ac --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/order.apis.ts @@ -0,0 +1,50 @@ +import { requestClient } from '#/api/request'; + +import type { PageQueryDTO, PageResultVO } from '#/types/common'; +import type { OrderDTO, OrderVO, BatchImportResultVO } from './types'; + +/** + * 订单管理API + */ + +/** + * 分页获取订单列表 + */ +export async function getOrderPageApi(params: PageQueryDTO) { + return requestClient.post>('/ec/order/page', params); +} + +/** + * 创建订单 + */ +export async function createOrderApi(data: OrderDTO.Create) { + return requestClient.post('/ec/order/create', data); +} + +/** + * 更新订单 + */ +export async function updateOrderApi(id: number, data: OrderDTO.Update) { + return requestClient.put(`/ec/order/update/${id}`, data); +} + +/** + * 删除订单 + */ +export async function deleteOrderApi(id: number) { + return requestClient.delete(`/ec/order/delete/${id}`); +} + +/** + * 获取订单详情 + */ +export async function getOrderByIdApi(id: number) { + return requestClient.get(`/ec/order/detail/${id}`); +} + +/** + * 批量导入订单 + */ +export async function batchImportOrdersApi(data: OrderDTO.BatchImport) { + return requestClient.post('/ec/order/batch-import', data); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/promotion-fee-type.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/promotion-fee-type.apis.ts new file mode 100644 index 00000000..6cf2e07f --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/promotion-fee-type.apis.ts @@ -0,0 +1,49 @@ +import { requestClient } from '#/api/request'; + +import type { PromotionFeeTypeDTO, PromotionFeeTypeVO } from './types'; + +/** + * 推广费类型管理API + */ + +/** + * 创建推广费类型 + */ +export async function createPromotionFeeTypeApi(data: PromotionFeeTypeDTO.Create) { + return requestClient.post('/ec/promotion-fee-type', data); +} + +/** + * 更新推广费类型 + */ +export async function updatePromotionFeeTypeApi(data: PromotionFeeTypeDTO.Update) { + return requestClient.put('/ec/promotion-fee-type', data); +} + +/** + * 删除推广费类型 + */ +export async function deletePromotionFeeTypeApi(id: number) { + return requestClient.delete(`/ec/promotion-fee-type/${id}`); +} + +/** + * 获取推广费类型详情 + */ +export async function getPromotionFeeTypeByIdApi(id: number) { + return requestClient.get(`/ec/promotion-fee-type/${id}`); +} + +/** + * 获取启用的推广费类型列表 + */ +export async function getActivePromotionFeeTypeListApi() { + return requestClient.get('/ec/promotion-fee-type/active'); +} + +/** + * 获取所有推广费类型列表 + */ +export async function getAllPromotionFeeTypeListApi() { + return requestClient.get('/ec/promotion-fee-type/all'); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.order-status.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.order-status.ts new file mode 100644 index 00000000..775693de --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.order-status.ts @@ -0,0 +1,31 @@ +/** + * 订单状态相关DTO类型定义 + */ + +export namespace OrderStatusDTO { + /** 创建订单状态参数 */ + export interface Create { + /** 状态名称 */ + statusName: string; + /** 状态描述 */ + description?: string; + /** 排序 */ + sortOrder?: number; + /** 是否启用 0禁用 1启用 */ + isActive?: number; + } + + /** 更新订单状态参数 */ + export interface Update { + /** 状态ID */ + id: number; + /** 状态名称 */ + statusName: string; + /** 状态描述 */ + description?: string; + /** 排序 */ + sortOrder?: number; + /** 是否启用 0禁用 1启用 */ + isActive?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.order.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.order.ts new file mode 100644 index 00000000..f69ce79b --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.order.ts @@ -0,0 +1,89 @@ +/** + * 订单相关DTO类型定义 + */ + +export namespace OrderDTO { + /** 创建订单参数 */ + export interface Create { + /** 店铺ID */ + shopId: number; + /** 平台订单号 */ + platformOrderNo?: string; + /** 订单状态ID */ + statusId: number; + /** 商家实收金额 */ + receivedAmount: number; + /** 运费 */ + shippingFee?: number; + /** 下单时间 */ + orderDate: string; + /** 商品ID */ + productId: number; + /** 商品规格ID */ + productSpecId?: number; + /** 商品名称(冗余存储) */ + productName: string; + /** 规格名称(冗余存储) */ + specName?: string; + /** 数量 */ + quantity: number; + /** 销售单价 */ + unitPrice: number; + /** 成本价(下单时快照) */ + costPrice: number; + /** 成本小计 */ + costTotal: number; + } + + /** 更新订单参数 */ + export interface Update { + /** 店铺ID */ + shopId: number; + /** 平台订单号 */ + platformOrderNo?: string; + /** 订单状态ID */ + statusId?: number; + /** 商家实收金额 */ + receivedAmount: number; + /** 运费 */ + shippingFee?: number; + /** 下单时间 */ + orderDate: string; + /** 商品ID */ + productId?: number; + /** 商品规格ID */ + productSpecId?: number; + /** 商品名称(冗余存储) */ + productName?: string; + /** 规格名称(冗余存储) */ + specName?: string; + /** 数量 */ + quantity?: number; + /** 销售单价 */ + unitPrice?: number; + /** 成本价(下单时快照) */ + costPrice?: number; + /** 成本小计 */ + costTotal?: number; + } + + /** 订单过滤条件 */ + export interface Filters { + /** 店铺ID */ + shopId?: number; + /** 商品规格ID */ + productSpecId?: number; + /** 订单状态ID */ + orderStatusId?: number; + /** 订单编号(模糊查询) */ + orderNumber?: string; + /** 商品名称(模糊查询) */ + productName?: string; + } + + /** 批量导入订单参数 */ + export interface BatchImport { + /** 订单列表 */ + orders: Create[]; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.promotion-fee-type.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.promotion-fee-type.ts new file mode 100644 index 00000000..83a451e4 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/dto.promotion-fee-type.ts @@ -0,0 +1,35 @@ +/** + * 推广费类型相关DTO类型定义 + */ + +export namespace PromotionFeeTypeDTO { + /** 创建推广费类型参数 */ + export interface Create { + /** 类型名称 */ + typeName: string; + /** 类型描述 */ + description?: string; + /** 计算方式 1固定金额 2按比例 3按点击 4按展示 */ + calculationMethod?: number; + /** 排序 */ + sortOrder?: number; + /** 是否启用 0禁用 1启用 */ + isActive?: number; + } + + /** 更新推广费类型参数 */ + export interface Update { + /** 推广费类型ID */ + id: number; + /** 类型名称 */ + typeName: string; + /** 类型描述 */ + description?: string; + /** 计算方式 1固定金额 2按比例 3按点击 4按展示 */ + calculationMethod?: number; + /** 排序 */ + sortOrder?: number; + /** 是否启用 0禁用 1启用 */ + isActive?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/index.ts index bb7d7a45..10303f33 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/index.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/index.ts @@ -2,5 +2,13 @@ * 电商模块类型定义导出 */ -export * from './types.dto'; -export * from './types.vo'; +// DTO类型导出 +export * from './dto.order'; +export * from './dto.order-status'; +export * from './dto.promotion-fee-type'; + +// VO类型导出 +export * from './vo.order'; +export * from './vo.order-status'; +export * from './vo.promotion-fee-type'; +export * from './vo.batch-import-result'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/types.dto.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/types.dto.ts deleted file mode 100644 index 9e1d1311..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/types.dto.ts +++ /dev/null @@ -1,131 +0,0 @@ -/** - * 电商模块DTO类型定义 - */ - -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; - /** 平台订单号 */ - platformOrderNo?: string; - /** 订单状态ID */ - statusId?: number; - /** 商家实收金额 */ - receivedAmount: number; - /** 运费 */ - shippingFee?: number; - /** 下单时间 */ - orderDate: string; - } - - /** 订单过滤条件 */ - export interface OrderFilterDTO { - /** 店铺ID */ - shopId?: number; - /** 商品规格ID */ - productSpecId?: number; - /** 订单状态ID */ - orderStatusId?: number; - /** 订单编号(模糊查询) */ - orderNumber?: string; - /** 商品名称(模糊查询) */ - productName?: string; - } - - /** 批量导入订单参数 */ - export interface BatchImportOrderDTO { - /** 订单列表 */ - orders: CreateOrderDTO[]; - } -} - -export namespace OrderStatusDTO { - /** 创建订单状态参数 */ - export interface CreateOrderStatusDTO { - /** 状态码 */ - statusCode: number; - /** 状态名称 */ - statusName: string; - /** 状态描述 */ - description?: string; - /** 排序 */ - sortOrder?: number; - /** 是否启用 0禁用 1启用 */ - isActive?: number; - } - - /** 更新订单状态参数 */ - export interface UpdateOrderStatusDTO { - /** 状态ID */ - id: number; - /** 状态码 */ - statusCode: number; - /** 状态名称 */ - statusName: string; - /** 状态描述 */ - description?: string; - /** 排序 */ - sortOrder?: number; - /** 是否启用 0禁用 1启用 */ - isActive?: number; - } -} - -export namespace PromotionFeeTypeDTO { - /** 创建推广费类型参数 */ - export interface CreatePromotionFeeTypeDTO { - /** 类型编码 */ - typeCode: string; - /** 类型名称 */ - typeName: string; - /** 类型描述 */ - description?: string; - /** 计算方式 1固定金额 2按比例 3按点击 4按展示 */ - calculationMethod?: number; - /** 排序 */ - sortOrder?: number; - /** 是否启用 0禁用 1启用 */ - isActive?: number; - } - - /** 更新推广费类型参数 */ - export interface UpdatePromotionFeeTypeDTO { - /** 推广费类型ID */ - id: number; - /** 类型编码 */ - typeCode: string; - /** 类型名称 */ - typeName: string; - /** 类型描述 */ - description?: string; - /** 计算方式 1固定金额 2按比例 3按点击 4按展示 */ - calculationMethod?: number; - /** 排序 */ - sortOrder?: number; - /** 是否启用 0禁用 1启用 */ - isActive?: number; - } -} \ No newline at end of file diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/types.vo.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/types.vo.ts deleted file mode 100644 index 8aba3eb6..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/types.vo.ts +++ /dev/null @@ -1,147 +0,0 @@ -/** - * 电商模块VO类型定义 - */ - -export namespace OrderVO { - /** 订单信息 */ - export interface OrderInfoVO { - /** 订单ID */ - id: number; - /** 公司ID */ - companyId: number; - /** 店铺ID */ - shopId: number; - /** 店铺名称 */ - shopName: string; - /** 平台订单号 */ - platformOrderNo: string; - /** 订单状态ID */ - statusId: number; - /** 订单状态名称 */ - statusName: string; - /** 商家实收金额 */ - receivedAmount: number; - /** 运费 */ - shippingFee: number; - /** 下单时间 */ - orderDate: string; - /** 创建时间 */ - createTime: string; - /** 更新时间 */ - updateTime: string; - /** 创建人ID */ - 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; - } -} - -export namespace BatchImportResultVO { - /** 批量导入结果 */ - export interface BatchImportResultInfoVO { - /** 总数量 */ - totalCount: number; - /** 成功数量 */ - successCount: number; - /** 失败数量 */ - failureCount: number; - /** 失败详情 */ - failureDetails: string[]; - } -} - -export namespace OrderStatusVO { - /** 订单状态信息 */ - export interface OrderStatusInfoVO { - /** 状态ID */ - id: number; - /** 公司ID */ - companyId: number; - /** 状态码 */ - statusCode: number; - /** 状态名称 */ - statusName: string; - /** 状态描述 */ - description?: string; - /** 排序 */ - sortOrder?: number; - /** 是否启用 0禁用 1启用 */ - isActive: number; - /** 创建时间 */ - createTime: string; - /** 更新时间 */ - updateTime: string; - /** 创建人ID */ - createBy?: number; - /** 更新人ID */ - updateBy?: number; - } -} - -export namespace PromotionFeeTypeVO { - /** 推广费类型信息 */ - export interface PromotionFeeTypeInfoVO { - /** 推广费类型ID */ - id: number; - /** 公司ID */ - companyId: number; - /** 类型编码 */ - typeCode: string; - /** 类型名称 */ - typeName: string; - /** 类型描述 */ - description?: string; - /** 计算方式 1固定金额 2按比例 3按点击 4按展示 */ - calculationMethod?: number; - /** 计算方式描述 */ - calculationMethodDesc?: string; - /** 排序 */ - sortOrder?: number; - /** 是否启用 0禁用 1启用 */ - isActive?: number; - /** 创建时间 */ - createTime: string; - /** 更新时间 */ - updateTime: string; - /** 创建人ID */ - createBy?: number; - /** 更新人ID */ - updateBy?: number; - } -} \ No newline at end of file diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.batch-import-result.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.batch-import-result.ts new file mode 100644 index 00000000..de5eb194 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.batch-import-result.ts @@ -0,0 +1,17 @@ +/** + * 批量导入结果相关VO类型定义 + */ + +export namespace BatchImportResultVO { + /** 批量导入结果 */ + export interface Info { + /** 总数量 */ + totalCount: number; + /** 成功数量 */ + successCount: number; + /** 失败数量 */ + failureCount: number; + /** 失败详情 */ + failureDetails: string[]; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.order-status.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.order-status.ts new file mode 100644 index 00000000..76aeaa9c --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.order-status.ts @@ -0,0 +1,31 @@ +/** + * 订单状态相关VO类型定义 + */ + +export namespace OrderStatusVO { + /** 订单状态信息 */ + export interface Info { + /** 状态ID */ + id: number; + /** 公司ID */ + companyId: number; + /** 状态码 */ + statusCode: number; + /** 状态名称 */ + statusName: string; + /** 状态描述 */ + description?: string; + /** 排序 */ + sortOrder?: number; + /** 是否启用 0禁用 1启用 */ + isActive: number; + /** 创建时间 */ + createTime: string; + /** 更新时间 */ + updateTime: string; + /** 创建人ID */ + createBy?: number; + /** 更新人ID */ + updateBy?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.order.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.order.ts new file mode 100644 index 00000000..4d64dc40 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.order.ts @@ -0,0 +1,53 @@ +/** + * 订单相关VO类型定义 + */ + +export namespace OrderVO { + /** 订单信息 */ + export interface Info { + /** 订单ID */ + id: number; + /** 公司ID */ + companyId: number; + /** 店铺ID */ + shopId: number; + /** 店铺名称 */ + shopName: string; + /** 平台订单号 */ + platformOrderNo: string; + /** 订单状态ID */ + statusId: number; + /** 订单状态名称 */ + statusName: string; + /** 商家实收金额 */ + receivedAmount: number; + /** 运费 */ + shippingFee: number; + /** 下单时间 */ + orderDate: string; + /** 创建时间 */ + createTime: string; + /** 更新时间 */ + updateTime: string; + /** 创建人ID */ + createBy?: number; + /** 更新人ID */ + updateBy?: number; + /** 商品ID */ + productId: number; + /** 商品规格ID */ + productSpecId?: number; + /** 商品名称(冗余存储) */ + productName: string; + /** 规格名称(冗余存储) */ + specName?: string; + /** 数量 */ + quantity: number; + /** 销售单价 */ + unitPrice: number; + /** 成本价(下单时快照) */ + costPrice: number; + /** 成本小计 */ + costTotal: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.promotion-fee-type.ts b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.promotion-fee-type.ts new file mode 100644 index 00000000..bd97b89a --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/ecommerce/types/vo.promotion-fee-type.ts @@ -0,0 +1,35 @@ +/** + * 推广费类型相关VO类型定义 + */ + +export namespace PromotionFeeTypeVO { + /** 推广费类型信息 */ + export interface Info { + /** 推广费类型ID */ + id: number; + /** 公司ID */ + companyId: number; + /** 类型编码 */ + typeCode: string; + /** 类型名称 */ + typeName: string; + /** 类型描述 */ + description?: string; + /** 计算方式 1固定金额 2按比例 3按点击 4按展示 */ + calculationMethod?: number; + /** 计算方式描述 */ + calculationMethodDesc?: string; + /** 排序 */ + sortOrder?: number; + /** 是否启用 0禁用 1启用 */ + isActive?: number; + /** 创建时间 */ + createTime: string; + /** 更新时间 */ + updateTime: string; + /** 创建人ID */ + createBy?: number; + /** 更新人ID */ + updateBy?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/apis.ts deleted file mode 100644 index 063f516f..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/api/media/apis.ts +++ /dev/null @@ -1,110 +0,0 @@ -import { requestClient } from '#/api/request'; - -import type { MediaFileDTO, MediaFileVO, MediaImageDTO, MediaImageVO } from './types'; -import type { PageQueryDTO, PageResultVO } from '#/types/common'; - -/** - * 文件管理相关API - */ - -// 文件上传 -export async function uploadFileApi(file: File) { - const formData = new FormData(); - formData.append('file', file); - return requestClient.post('/media/file/upload', formData, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); -} - -// 批量文件上传 -export async function batchUploadFilesApi(files: File[]) { - const formData = new FormData(); - files.forEach(file => { - formData.append('files', file); - }); - return requestClient.post('/media/file/batch-upload', formData, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); -} - -// 更新文件信息 -export async function updateFileApi(data: MediaFileDTO.UpdateFileDTO) { - return requestClient.put('/media/file/update', data); -} - -// 删除文件 -export async function deleteFileApi(id: number) { - return requestClient.delete(`/media/file/delete/${id}`); -} - -// 根据哈希查询文件 -export async function getFileByHashApi(fileHash: string) { - return requestClient.get(`/media/file/hash/${fileHash}`); -} - -// 批量根据哈希查询文件 -export async function getFilesByHashesApi(fileHashes: string[]) { - return requestClient.post('/media/file/batch-hash', fileHashes); -} - -// 分页获取文件列表 -export async function getFilePageApi(params: PageQueryDTO) { - return requestClient.post>('/media/file/page', params); -} - -/** - * 图片管理相关API - */ - -// 图片上传 -export async function uploadImageApi(file: File) { - const formData = new FormData(); - formData.append('file', file); - return requestClient.post('/media/image/upload', formData, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); -} - -// 批量图片上传 -export async function batchUploadImagesApi(files: File[]) { - const formData = new FormData(); - files.forEach(file => { - formData.append('files', file); - }); - return requestClient.post('/media/image/batch-upload', formData, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); -} - -// 更新图片信息 -export async function updateImageApi(data: MediaImageDTO.UpdateImageDTO) { - return requestClient.put('/media/image/update', data); -} - -// 删除图片 -export async function deleteImageApi(id: number) { - return requestClient.delete(`/media/image/delete/${id}`); -} - -// 根据哈希查询图片 -export async function getImageByHashApi(fileHash: string) { - return requestClient.get(`/media/image/hash/${fileHash}`); -} - -// 批量根据哈希查询图片 -export async function getImagesByHashesApi(fileHashes: string[]) { - return requestClient.post('/media/image/batch-hash', fileHashes); -} - -// 分页获取图片列表 -export async function getImagePageApi(params: PageQueryDTO) { - return requestClient.post>('/media/image/page', params); -} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/file.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/file.apis.ts new file mode 100644 index 00000000..59f34dd8 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/file.apis.ts @@ -0,0 +1,80 @@ +import { requestClient } from '#/api/request'; + +import type { PageQueryDTO, PageResultVO } from '#/types/common'; +import type { FileDTO, FileVO } from './types'; + +/** + * 文件管理API + */ + +/** + * 分页获取文件列表 + */ +export async function getFilePageApi(params: PageQueryDTO) { + return requestClient.post>('/media/file/page', params); +} + +/** + * 上传文件 + */ +export async function uploadFileApi(file: File) { + const formData = new FormData(); + formData.append('file', file); + return requestClient.post('/media/file/upload', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +/** + * 批量上传文件 + */ +export async function batchUploadFilesApi(files: File[]) { + const formData = new FormData(); + files.forEach(file => { + formData.append('files', file); + }); + return requestClient.post('/media/file/batch-upload', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +/** + * 更新文件信息 + */ +export async function updateFileApi(id: number, data: FileDTO.Update) { + return requestClient.put(`/media/file/update/${id}`, data); +} + +/** + * 删除文件 + */ +export async function deleteFileApi(id: number) { + return requestClient.delete(`/media/file/delete/${id}`); +} + +/** + * 获取文件详情 + */ +export async function getFileByIdApi(id: number) { + return requestClient.get(`/media/file/detail/${id}`); +} + +/** + * 批量删除文件 + */ +export async function batchDeleteFilesApi(ids: number[]) { + return requestClient.delete('/media/file/batch-delete', { data: { ids } }); +} + +/** + * 下载文件 + */ +export async function downloadFileApi(id: number) { + return requestClient.get(`/media/file/download/${id}`, { + responseType: 'blob', + }); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/image.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/image.apis.ts new file mode 100644 index 00000000..37efb1b9 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/image.apis.ts @@ -0,0 +1,84 @@ +import { requestClient } from '#/api/request'; + +import type { PageQueryDTO, PageResultVO } from '#/types/common'; +import type { ImageDTO, ImageVO } from './types'; + +/** + * 图片管理API + */ + +/** + * 分页获取图片列表 + */ +export async function getImagePageApi(params: PageQueryDTO) { + return requestClient.post>('/media/image/page', params); +} + +/** + * 上传图片 + */ +export async function uploadImageApi(file: File) { + const formData = new FormData(); + formData.append('file', file); + return requestClient.post('/media/image/upload', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +/** + * 批量上传图片 + */ +export async function batchUploadImagesApi(files: File[]) { + const formData = new FormData(); + files.forEach(file => { + formData.append('files', file); + }); + return requestClient.post('/media/image/batch-upload', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +/** + * 更新图片信息 + */ +export async function updateImageApi(id: number, data: ImageDTO.Update) { + return requestClient.put(`/media/image/update/${id}`, data); +} + +/** + * 删除图片 + */ +export async function deleteImageApi(id: number) { + return requestClient.delete(`/media/image/delete/${id}`); +} + +/** + * 获取图片详情 + */ +export async function getImageByIdApi(id: number) { + return requestClient.get(`/media/image/detail/${id}`); +} + +/** + * 批量删除图片 + */ +export async function batchDeleteImagesApi(ids: number[]) { + return requestClient.delete('/media/image/batch-delete', { data: { ids } }); +} + +/** + * 获取图片缩略图 + */ +export async function getImageThumbnailApi(id: number, width?: number, height?: number) { + const params = new URLSearchParams(); + if (width) params.append('width', width.toString()); + if (height) params.append('height', height.toString()); + + return requestClient.get(`/media/image/thumbnail/${id}?${params.toString()}`, { + responseType: 'blob', + }); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/index.ts index daf76d51..306724bd 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/media/index.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/index.ts @@ -1,2 +1,12 @@ -export * from './apis'; -export * from './types'; +/** + * 媒体管理模块API导出 + */ + +// 文件相关API +export * from './file.apis'; + +// 图片相关API +export * from './image.apis'; + +// 类型定义 +export * from './types'; \ No newline at end of file diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/types.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/types.ts deleted file mode 100644 index 0e7dfe3f..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/api/media/types.ts +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 媒体文件相关类型定义 - */ - -export namespace MediaFileVO { - export interface MediaFileInfoVO { - id: number; - companyId: number; - url: string; - filename: string; - fileType: string; - fileHash: string; - tags: string; - remark: string; - uploadBy: number; - uploadTime: string; - } -} - -export namespace MediaImageVO { - export interface MediaImageInfoVO { - id: number; - companyId: number; - url: string; - filename: string; - type: string; - fileHash: string; - tags: string; - remark: string; - uploadBy: number; - uploadTime: string; - } -} - -export namespace MediaFileDTO { - export interface UpdateFileDTO { - id: number; - fileType?: string; - tags?: string; - remark?: string; - } - - export interface MediaFileFilterDTO { - filename?: string; - fileType?: string; - tags?: string; - } -} - -export namespace MediaImageDTO { - export interface UpdateImageDTO { - id: number; - type?: string; - tags?: string; - remark?: string; - } - - export interface MediaImageFilterDTO { - filename?: string; - type?: string; - tags?: string; - } -} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/types/dto.file.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/dto.file.ts new file mode 100644 index 00000000..cdd51ca0 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/dto.file.ts @@ -0,0 +1,34 @@ +/** + * 文件管理相关DTO类型定义 + */ + +export namespace FileDTO { + /** 文件查询过滤条件 */ + export interface Filters { + /** 文件名 */ + filename?: string; + /** 文件格式 */ + fileFormat?: string; + /** 标签 */ + tags?: string; + /** 上传人ID */ + uploadBy?: number; + /** 上传时间范围-开始 */ + uploadTimeStart?: string; + /** 上传时间范围-结束 */ + uploadTimeEnd?: string; + } + + /** 更新文件 */ + export interface Update { + tags?: string; + /** 文件描述 */ + remark?: string; + } + + /** 批量上传文件 */ + export interface BatchUpload { + /** 文件列表 */ + files: File[]; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/types/dto.image.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/dto.image.ts new file mode 100644 index 00000000..8df050ff --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/dto.image.ts @@ -0,0 +1,36 @@ +/** + * 图片管理相关DTO类型定义 + */ + +export namespace ImageDTO { + /** 图片查询过滤条件 */ + export interface Filters { + /** 文件名 */ + filename?: string; + /** 图片分类 (image,avatar,logo) */ + category?: string; + /** 图片格式 */ + imageFormat?: string; + /** 标签 */ + tags?: string; + /** 上传人ID */ + uploadBy?: number; + /** 上传时间范围-开始 */ + uploadTimeStart?: string; + /** 上传时间范围-结束 */ + uploadTimeEnd?: string; + } + + /** 更新图片 */ + export interface Update { + tags?: string; + /** 图片说明 */ + remark?: string; + } + + /** 批量上传图片 */ + export interface BatchUpload { + /** 图片文件列表 */ + files: File[]; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/types/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/index.ts new file mode 100644 index 00000000..992612f7 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/index.ts @@ -0,0 +1,11 @@ +/** + * 媒体管理模块类型定义导出 + */ + +// DTO类型导出 +export * from './dto.file'; +export * from './dto.image'; + +// VO类型导出 +export * from './vo.file'; +export * from './vo.image'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/types/vo.file.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/vo.file.ts new file mode 100644 index 00000000..296f3da1 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/vo.file.ts @@ -0,0 +1,37 @@ +/** + * 文件管理相关VO类型定义 + */ + +export namespace FileVO { + /** 文件信息 */ + export interface Info { + /** 文件ID */ + id: number; + /** 公司ID */ + companyId: number; + /** 文件URL */ + url: string; + /** 文件名 */ + filename: string; + /** 文件格式,如 pdf/cad/xlsx/doc */ + fileFormat?: string; + /** 文件哈希值,用于去重 */ + fileHash?: string; + /** 标签,逗号分隔 */ + tags?: string; + /** 文件描述 */ + remark?: string; + /** 上传人ID */ + uploadBy?: number; + /** 上传时间 */ + uploadTime: string; + /** 更新时间 */ + updateTime?: string; + /** 更新人ID */ + updateBy?: number; + /** 删除时间 */ + deleteTime?: string; + /** 删除人ID */ + deleteBy?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/media/types/vo.image.ts b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/vo.image.ts new file mode 100644 index 00000000..7172055e --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/media/types/vo.image.ts @@ -0,0 +1,39 @@ +/** + * 图片管理相关VO类型定义 + */ + +export namespace ImageVO { + /** 图片信息 */ + export interface Info { + /** 图片ID */ + id: number; + /** 公司ID */ + companyId: number; + /** 图片URL */ + url: string; + /** 原始文件名 */ + filename?: string; + /** 图片分类 (image,avatar,logo) */ + category?: string; + /** 图片格式,如 jpg/png/gif/webp */ + imageFormat?: string; + /** 文件哈希值,用于去重 */ + fileHash?: string; + /** 标签,逗号分隔 */ + tags?: string; + /** 图片说明 */ + remark?: string; + /** 上传人ID */ + uploadBy?: number; + /** 上传时间 */ + uploadTime: string; + /** 更新时间 */ + updateTime?: string; + /** 更新人ID */ + updateBy?: number; + /** 删除时间 */ + deleteTime?: string; + /** 删除人ID */ + deleteBy?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/apis.ts deleted file mode 100644 index bac6e65c..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/api/shop/apis.ts +++ /dev/null @@ -1,166 +0,0 @@ -import { requestClient } from '#/api/request'; - -import type { PageQueryDTO, PageResultVO } from '#/types/common'; -import type { ShopDTO, ShopVO, ProductDTO, ProductVO } from './types'; - -/** - * 店铺管理API - */ - -/** - * 分页获取店铺列表 - */ -export async function getShopPageApi(params: PageQueryDTO) { - return requestClient.post>('/ec/shop/page', params); -} - -/** - * 创建店铺 - */ -export async function createShopApi(data: ShopDTO.CreateShopDTO) { - return requestClient.post('/ec/shop/create', data); -} - -/** - * 更新店铺 - */ -export async function updateShopApi(id: number, data: ShopDTO.UpdateShopDTO) { - return requestClient.put(`/ec/shop/update/${id}`, data); -} - -/** - * 删除店铺 - */ -export async function deleteShopApi(id: number) { - return requestClient.delete(`/ec/shop/delete/${id}`); -} - -/** - * 上传店铺Logo - */ -export async function uploadShopLogoApi(file: File) { - const formData = new FormData(); - formData.append('file', file); - return requestClient.post('/ec/shop/upload-logo', formData, { - headers: { - 'Content-Type': 'multipart/form-data', - }, - }); -} - -/** - * 商品管理API - */ - -/** - * 分页获取商品列表 - */ -export async function getProductPageApi(params: PageQueryDTO) { - return requestClient.post>('/ec/product/page', params); -} - -/** - * 创建商品 - */ -export async function createProductApi(data: ProductDTO.CreateProductDTO) { - return requestClient.post('/ec/product/create', data); -} - -/** - * 更新商品 - */ -export async function updateProductApi(id: number, data: ProductDTO.UpdateProductDTO) { - return requestClient.put(`/ec/product/update/${id}`, data); -} - -/** - * 删除商品 - */ -export async function deleteProductApi(id: number) { - return requestClient.delete(`/ec/product/delete/${id}`); -} - -/** - * 一键创建商品和规格 - */ -export async function createProductWithSpecsApi(data: ProductDTO.CreateProductWithSpecsDTO) { - return requestClient.post('/ec/product/create-with-specs', data); -} - -/** - * 商品规格管理API - */ - -/** - * 分页获取商品规格列表 - */ -export async function getProductSpecPageApi(params: PageQueryDTO) { - return requestClient.post>('/ec/product-spec/page', params); -} - -/** - * 创建商品规格 - */ -export async function createProductSpecApi(data: ProductDTO.CreateProductSpecDTO) { - return requestClient.post('/ec/product-spec/create', data); -} - -/** - * 更新商品规格 - */ -export async function updateProductSpecApi(id: number, data: ProductDTO.UpdateProductSpecDTO) { - return requestClient.put(`/ec/product-spec/update/${id}`, data); -} - -/** - * 删除商品规格 - */ -export async function deleteProductSpecApi(id: number) { - return requestClient.delete(`/ec/product-spec/delete/${id}`); -} - -/** - * 精准查询API - 用于数据导入 - */ - -/** - * 根据名称精准查询店铺 - */ -export async function getShopByNameApi(name: string) { - return requestClient.get(`/ec/shop/find-by-name/${encodeURIComponent(name)}`); -} - -/** - * 批量根据名称查询店铺 - */ -export async function getShopsByNamesApi(names: string[]) { - return requestClient.post('/ec/shop/find-by-names', names); -} - -/** - * 根据名称精准查询商品 - */ -export async function getProductByNameApi(name: string) { - return requestClient.get(`/ec/product/find-by-name/${encodeURIComponent(name)}`); -} - -/** - * 批量根据名称查询商品 - */ -export async function getProductsByNamesApi(names: string[]) { - return requestClient.post('/ec/product/find-by-names', names); -} - -/** - * 根据商品名称和规格编码精准查询商品规格 - */ -export async function getProductSpecByProductAndSpecApi(productName: string, specCode: string) { - return requestClient.get(`/ec/product-spec/find-by-product-and-spec/${encodeURIComponent(productName)}/${encodeURIComponent(specCode)}`); -} - -/** - * 批量根据商品名称和规格编码查询商品规格 - */ -export async function getProductSpecsByProductAndSpecsApi(queries: { productName: string; specCode: string }[]) { - return requestClient.post('/ec/product-spec/find-by-product-and-specs', queries); -} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/index.ts index 1cf3c73c..c686df5d 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/shop/index.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/index.ts @@ -2,5 +2,8 @@ * 店铺管理模块API导出 */ -export * from './apis'; -export * from './types'; +// 店铺相关API +export * from './shop.apis'; + +// 商品相关API +export * from './product.apis'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/product.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/product.apis.ts new file mode 100644 index 00000000..7c5ebb6f --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/product.apis.ts @@ -0,0 +1,107 @@ +import { requestClient } from '#/api/request'; + +import type { PageQueryDTO, PageResultVO } from '#/types/common'; +import type { ProductDTO, ProductVO } from './types'; + +/** + * 商品管理API + */ + +/** + * 分页获取商品列表 + */ +export async function getProductPageApi(params: PageQueryDTO) { + return requestClient.post>('/ec/product/page', params); +} + +/** + * 创建商品 + */ +export async function createProductApi(data: ProductDTO.Create) { + return requestClient.post('/ec/product/create', data); +} + +/** + * 更新商品 + */ +export async function updateProductApi(id: number, data: ProductDTO.Update) { + return requestClient.put(`/ec/product/update/${id}`, data); +} + +/** + * 删除商品 + */ +export async function deleteProductApi(id: number) { + return requestClient.delete(`/ec/product/delete/${id}`); +} + +/** + * 一键创建商品和规格 + */ +export async function createProductWithSpecsApi(data: ProductDTO.CreateWithSpecs) { + return requestClient.post('/ec/product/create-with-specs', data); +} + +/** + * 商品规格管理API + */ + +/** + * 分页获取商品规格列表 + */ +export async function getProductSpecPageApi(params: PageQueryDTO) { + return requestClient.post>('/ec/product-spec/page', params); +} + +/** + * 创建商品规格 + */ +export async function createProductSpecApi(data: ProductDTO.CreateSpec) { + return requestClient.post('/ec/product-spec/create', data); +} + +/** + * 更新商品规格 + */ +export async function updateProductSpecApi(id: number, data: ProductDTO.UpdateSpec) { + return requestClient.put(`/ec/product-spec/update/${id}`, data); +} + +/** + * 删除商品规格 + */ +export async function deleteProductSpecApi(id: number) { + return requestClient.delete(`/ec/product-spec/delete/${id}`); +} + +/** + * 精准查询API - 用于数据导入 + */ + +/** + * 根据名称精准查询商品 + */ +export async function getProductByNameApi(name: string) { + return requestClient.get(`/ec/product/find-by-name/${encodeURIComponent(name)}`); +} + +/** + * 批量根据名称查询商品 + */ +export async function getProductsByNamesApi(names: string[]) { + return requestClient.post('/ec/product/find-by-names', names); +} + +/** + * 根据商品名称和规格编码精准查询商品规格 + */ +export async function getProductSpecByProductAndSpecApi(productName: string, specCode: string) { + return requestClient.get(`/ec/product-spec/find-by-product-and-spec/${encodeURIComponent(productName)}/${encodeURIComponent(specCode)}`); +} + +/** + * 批量根据商品名称和规格编码查询商品规格 + */ +export async function getProductSpecsByProductAndSpecsApi(queries: { productName: string; specCode: string }[]) { + return requestClient.post('/ec/product-spec/find-by-product-and-specs', queries); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/shop.apis.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/shop.apis.ts new file mode 100644 index 00000000..f4b05db4 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/shop.apis.ts @@ -0,0 +1,67 @@ +import { requestClient } from '#/api/request'; + +import type { PageQueryDTO, PageResultVO } from '#/types/common'; +import type { ShopDTO, ShopVO } from './types'; + +/** + * 店铺管理API + */ + +/** + * 分页获取店铺列表 + */ +export async function getShopPageApi(params: PageQueryDTO) { + return requestClient.post>('/ec/shop/page', params); +} + +/** + * 创建店铺 + */ +export async function createShopApi(data: ShopDTO.Create) { + return requestClient.post('/ec/shop/create', data); +} + +/** + * 更新店铺 + */ +export async function updateShopApi(id: number, data: ShopDTO.Update) { + return requestClient.put(`/ec/shop/update/${id}`, data); +} + +/** + * 删除店铺 + */ +export async function deleteShopApi(id: number) { + return requestClient.delete(`/ec/shop/delete/${id}`); +} + +/** + * 上传店铺Logo + */ +export async function uploadShopLogoApi(file: File) { + const formData = new FormData(); + formData.append('file', file); + return requestClient.post('/ec/shop/upload-logo', formData, { + headers: { + 'Content-Type': 'multipart/form-data', + }, + }); +} + +/** + * 精准查询API - 用于数据导入 + */ + +/** + * 根据名称精准查询店铺 + */ +export async function getShopByNameApi(name: string) { + return requestClient.get(`/ec/shop/find-by-name/${encodeURIComponent(name)}`); +} + +/** + * 批量根据名称查询店铺 + */ +export async function getShopsByNamesApi(names: string[]) { + return requestClient.post('/ec/shop/find-by-names', names); +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/types.dto.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/dto.product.ts similarity index 64% rename from ecom-dmb-frontend/apps/web-antd/src/api/shop/types/types.dto.ts rename to ecom-dmb-frontend/apps/web-antd/src/api/shop/types/dto.product.ts index b2c01137..672385a6 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/types.dto.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/dto.product.ts @@ -1,40 +1,10 @@ /** - * 店铺管理模块DTO类型定义 + * 商品相关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 { + export interface Create { /** 商品名称 */ name: string; /** 主图图片ID */ @@ -42,7 +12,7 @@ export namespace ProductDTO { } /** 更新商品参数 */ - export interface UpdateProductDTO { + export interface Update { /** 商品名称 */ name: string; /** 商品编码 */ @@ -56,17 +26,17 @@ export namespace ProductDTO { } /** 一键创建商品和规格参数 */ - export interface CreateProductWithSpecsDTO { + export interface CreateWithSpecs { /** 商品名称 */ name: string; /** 主图图片ID */ mainImageId?: number; /** 商品规格列表 */ - specs: ProductSpecDTO[]; + specs: Spec[]; } /** 商品规格DTO */ - export interface ProductSpecDTO { + export interface Spec { /** 规格名称 */ name: string; /** 规格编码 */ @@ -76,7 +46,7 @@ export namespace ProductDTO { } /** 创建商品规格参数 */ - export interface CreateProductSpecDTO { + export interface CreateSpec { /** 商品ID */ productId: number; /** 规格名称 */ @@ -88,7 +58,7 @@ export namespace ProductDTO { } /** 更新商品规格参数 */ - export interface UpdateProductSpecDTO { + export interface UpdateSpec { /** 规格名称 */ name: string; /** 规格编码 */ @@ -98,7 +68,7 @@ export namespace ProductDTO { } /** 商品过滤条件 */ - export interface ProductFiltersDTO { + export interface Filters { /** 商品名称(模糊查询) */ name?: string; /** 商品编码(模糊查询) */ @@ -112,7 +82,7 @@ export namespace ProductDTO { } /** 商品规格过滤条件 */ - export interface ProductSpecFilterDTO { + export interface SpecFilters { /** 商品ID */ productId?: number; /** 商品名称(模糊查询) */ diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/dto.shop.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/dto.shop.ts new file mode 100644 index 00000000..ae1d18a1 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/dto.shop.ts @@ -0,0 +1,33 @@ +/** + * 店铺相关DTO类型定义 + */ + +export namespace ShopDTO { + /** 创建店铺参数 */ + export interface Create { + /** 店铺名称 */ + name: string; + /** logo图片ID */ + logoImageId?: number; + /** 平台(如淘宝、京东、拼多多) */ + platform?: string; + } + + /** 更新店铺参数 */ + export interface Update { + /** 店铺名称 */ + name: string; + /** logo图片ID */ + logoImageId?: number; + /** 平台(如淘宝、京东、拼多多) */ + platform?: string; + } + + /** 店铺过滤条件 */ + export interface Filters { + /** 店铺名称(模糊查询) */ + name?: string; + /** 平台 */ + platform?: string; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/index.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/index.ts index bd5befa1..875a82f4 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/index.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/index.ts @@ -2,5 +2,10 @@ * 店铺管理模块类型定义导出 */ -export * from './types.dto'; -export * from './types.vo'; +// DTO类型导出 +export * from './dto.shop'; +export * from './dto.product'; + +// VO类型导出 +export * from './vo.shop'; +export * from './vo.product'; diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/types.vo.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/vo.product.ts similarity index 58% rename from ecom-dmb-frontend/apps/web-antd/src/api/shop/types/types.vo.ts rename to ecom-dmb-frontend/apps/web-antd/src/api/shop/types/vo.product.ts index ea031fe1..0fe71b2f 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/types.vo.ts +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/vo.product.ts @@ -1,42 +1,20 @@ /** - * 店铺管理模块VO类型定义 + * 商品相关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 { + export interface Info { /** 商品ID */ id: number; /** 公司ID */ companyId: number; /** 商品名称 */ name: string; - /** 主图URL */ + /** 主图URL(冗余字段) */ mainImage?: string; + /** 主图图片ID */ + mainImageId?: number; /** 创建时间 */ createTime: string; /** 更新时间 */ @@ -46,11 +24,11 @@ export namespace ProductVO { /** 更新人ID */ updateBy?: number; /** 商品规格列表 */ - specs?: ProductSpecInfoVO[]; + specs?: SpecInfo[]; } /** 商品规格信息 */ - export interface ProductSpecInfoVO { + export interface SpecInfo { /** 规格ID */ id: number; /** 公司ID */ diff --git a/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/vo.shop.ts b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/vo.shop.ts new file mode 100644 index 00000000..5e2439fc --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/api/shop/types/vo.shop.ts @@ -0,0 +1,29 @@ +/** + * 店铺相关VO类型定义 + */ + +export namespace ShopVO { + /** 店铺信息 */ + export interface Info { + /** 店铺ID */ + id: number; + /** 所属公司ID */ + companyId: number; + /** 店铺名称 */ + name: string; + /** logo URL(冗余字段) */ + logo?: string; + /** logo图片ID */ + logoImageId?: number; + /** 平台(如淘宝、京东、拼多多) */ + platform?: string; + /** 创建时间 */ + createTime: string; + /** 更新时间 */ + updateTime: string; + /** 创建人ID */ + createBy?: number; + /** 更新人ID */ + updateBy?: number; + } +} diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/README.md b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/README.md deleted file mode 100644 index 2e3fb5d9..00000000 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/README.md +++ /dev/null @@ -1,174 +0,0 @@ -# 电商数据中台系统 - -## 功能概述 - -这是一个基于Vue Vben Admin框架开发的电商数据中台系统,主要用于处理电商店铺的营业数据。 - -## 主要功能 - -### 1. 数据导入 (Data Import) - -- **CSV文件上传**: 支持拖拽或点击上传CSV格式的营业数据文件 -- **数据预览**: 上传后可以预览前10条数据,了解数据结构 -- **字段映射**: 将CSV字段映射到标准字段,支持自定义字段名 -- **数据清洗**: 自动清洗和格式化数据(去除空格、数字格式化等) -- **JSON导出**: 将处理后的数据导出为JSON格式 - -### 2. 数据分析 (Data Analysis) - -- 数据统计和分析功能(开发中) - -### 3. 店铺管理 (Shop Management) - -- **店铺信息管理**: 支持店铺的增删改查操作 -- **平台管理**: 支持淘宝、京东、拼多多、天猫等主流电商平台 -- **Logo管理**: 支持店铺Logo的URL设置和预览 -- **搜索过滤**: 支持按店铺名称和平台进行搜索过滤 -- **分页展示**: 支持分页展示店铺列表 - -### 4. 商品管理 (Product Management) - -- **商品信息管理**: 支持商品的增删改查操作 -- **商品编码管理**: 支持商品编码和SKU管理 -- **价格管理**: 支持成本价设置和价格范围搜索 -- **图片管理**: 支持商品主图URL设置和预览 -- **高级搜索**: 支持按商品名称、编码、SKU和价格范围进行搜索过滤 -- **分页展示**: 支持分页展示商品列表 - -## 使用流程 - -### 数据导入流程 - -1. **上传CSV文件** - - 点击"电商数据中台" -> "数据导入" - - 拖拽或点击上传CSV文件 - - 系统会自动解析和验证数据 - -2. **预览数据** - - 查看解析后的数据预览 - - 确认数据格式正确 - -3. **配置字段映射** - - 点击"配置字段映射"按钮 - - 为每个CSV字段选择对应的标准字段 - - 可选择自定义字段名称 - - 实时预览映射后的数据 - -4. **导出JSON** - - 确认字段映射无误后,点击"导出JSON" - - 系统会生成包含元数据的JSON文件 - - 文件会保存到本地下载目录 - -## 支持的数据格式 - -### CSV文件要求 - -- 文件格式:`.csv` -- 文件大小:最大10MB -- 编码格式:UTF-8 -- 必要字段: - - 商品 - - 订单号 - - 订单状态 - - 商品数量(件) - - 商家实收金额(元) - -### 标准字段映射 - -系统支持以下标准字段: - -- `product_name`: 商品名称 -- `order_id`: 订单号 -- `order_status`: 订单状态 -- `quantity`: 商品数量 -- `product_id`: 商品ID -- `product_spec`: 商品规格 -- `after_sale_status`: 售后状态 -- `amount`: 实收金额 -- `shop_name`: 店铺名称 -- `order_date`: 订单日期 -- `customer_id`: 客户ID -- `payment_method`: 支付方式 -- `delivery_address`: 收货地址 -- `remark`: 备注 - -## 导出的JSON格式 - -```json -{ - "metadata": { - "source": "CSV导入", - "totalRecords": 100, - "exportTime": "2024-01-15T10:30:00.000Z", - "fieldMappings": { - "商品": "product_name", - "订单号": "order_id" - }, - "customFieldNames": {}, - "shopName": "店铺名称" - }, - "data": [ - { - "product_name": "商品名称", - "order_id": "订单号", - "order_status": "订单状态" - } - ] -} -``` - -## 技术栈 - -- **前端框架**: Vue 3 + TypeScript -- **UI组件库**: Ant Design Vue -- **构建工具**: Vite -- **CSV解析**: PapaParse -- **状态管理**: Pinia -- **路由**: Vue Router - -## 开发说明 - -### 项目结构 - -``` -src/views/ecommerce/ -├── data-import/ -│ ├── components/ -│ │ └── FieldMapping.vue # 字段映射组件 -│ └── index.vue # 数据导入主页面 -├── data-analysis/ -│ └── index.vue # 数据分析页面 -├── shop-management/ -│ └── index.vue # 店铺管理页面 -├── product-management/ -│ └── index.vue # 商品管理页面 -└── README.md # 说明文档 -``` - -### 工具函数 - -`src/utils/csv-utils.ts` 提供了以下工具函数: - -- `parseCSV()`: 解析CSV文件 -- `transformDataWithMapping()`: 根据字段映射转换数据 -- `generateExportData()`: 生成导出数据 -- `downloadJSON()`: 下载JSON文件 -- `validateCSVData()`: 验证CSV数据格式 -- `cleanAndFormatData()`: 数据清洗和格式化 - -## 注意事项 - -1. 确保CSV文件格式正确,包含必要的字段 -2. 字段映射时,建议保留所有重要字段 -3. 导出的JSON文件包含完整的元数据,便于后续处理 -4. 系统会自动从文件名提取店铺名称 -5. 数据清洗会自动处理数字字段和去除空格 - -## 后续开发计划 - -- [ ] 数据分析功能 -- [ ] 店铺管理功能 -- [ ] 数据可视化图表 -- [ ] 批量数据处理 -- [ ] 数据导入历史记录 -- [ ] 数据导出模板管理 diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/data-import/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/data-import/index.vue index 0c73d041..822f63ef 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/data-import/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/data-import/index.vue @@ -17,17 +17,25 @@ diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageCard.vue b/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageCard.vue index b0df06ba..40de7737 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageCard.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageCard.vue @@ -1,7 +1,7 @@ diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageGridView.vue b/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageGridView.vue new file mode 100644 index 00000000..b367bd06 --- /dev/null +++ b/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/components/ImageGridView.vue @@ -0,0 +1,272 @@ + + + + + diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/index.vue index 83cbfd15..83f89475 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/media/image-repository/index.vue @@ -1,256 +1,196 @@ diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/order-status-config/components/OrderStatusFormModal.vue b/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/order-status-config/components/OrderStatusFormModal.vue index dc8daf29..ff5d90b3 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/order-status-config/components/OrderStatusFormModal.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/order-status-config/components/OrderStatusFormModal.vue @@ -6,10 +6,10 @@ import { Modal, Form, Input, InputNumber, Switch, message } from 'ant-design-vue import { createOrderStatusApi, updateOrderStatusApi, - type OrderStatusDTO, - type OrderStatusVO } from '#/api/ecommerce'; +import type { OrderStatusDTO, OrderStatusVO } from '#/api/ecommerce/types'; + defineProps<{ visible?: boolean; }>(); @@ -23,11 +23,10 @@ const emit = defineEmits<{ const visible = ref(false); const loading = ref(false); const isEdit = ref(false); -const currentRecord = ref(null); +const currentRecord = ref(null); // 表单数据 -const formData = ref>({ - statusCode: 0, +const formData = ref>({ statusName: '', description: '', isActive: 1, @@ -36,7 +35,6 @@ const formData = ref>({ // 表单验证规则 const rules = { - statusCode: [{ required: true, message: '请输入状态码', trigger: 'blur' }], statusName: [{ required: true, message: '请输入状态名称', trigger: 'blur' }], sortOrder: [{ required: true, message: '请输入排序', trigger: 'blur' }], }; @@ -45,7 +43,7 @@ const rules = { const formRef = ref(); // 打开模态框 -function open(edit: boolean, record?: OrderStatusVO.OrderStatusInfoVO) { +function open(edit: boolean, record?: OrderStatusVO.Info) { isEdit.value = edit; currentRecord.value = record || null; visible.value = true; @@ -53,7 +51,6 @@ function open(edit: boolean, record?: OrderStatusVO.OrderStatusInfoVO) { if (edit && record) { // 编辑模式,填充表单数据 formData.value = { - statusCode: record.statusCode, statusName: record.statusName, description: record.description || '', isActive: record.isActive, @@ -62,7 +59,6 @@ function open(edit: boolean, record?: OrderStatusVO.OrderStatusInfoVO) { } else { // 新增模式,重置表单 formData.value = { - statusCode: 0, statusName: '', description: '', isActive: 1, @@ -86,9 +82,8 @@ async function handleSubmit() { if (isEdit.value && currentRecord.value) { // 更新订单状态 - const updateData: OrderStatusDTO.UpdateOrderStatusDTO = { + const updateData: OrderStatusDTO.Update = { id: currentRecord.value.id, - statusCode: formData.value.statusCode!, statusName: formData.value.statusName!, description: formData.value.description, isActive: formData.value.isActive, @@ -98,8 +93,7 @@ async function handleSubmit() { message.success('更新订单状态成功'); } else { // 创建订单状态 - const createData: OrderStatusDTO.CreateOrderStatusDTO = { - statusCode: formData.value.statusCode!, + const createData: OrderStatusDTO.Create = { statusName: formData.value.statusName!, description: formData.value.description, isActive: formData.value.isActive, @@ -112,8 +106,7 @@ async function handleSubmit() { close(); emit('success'); } catch (error) { - console.error('提交订单状态失败:', error); - message.error('提交订单状态失败'); + console.error('提交订单状态失败:', ( error as any).message ); } finally { loading.value = false; } @@ -149,15 +142,6 @@ defineExpose({ layout="vertical" >
- - - - = { width: 80, title: '序号', }, - { - field: 'statusCode', - title: '状态码', - minWidth: 'auto', - showOverflow: 'tooltip' as const, - }, { field: 'statusName', title: '状态名称', @@ -167,12 +161,12 @@ function handleAdd() { } // 处理编辑订单状态 -function handleEdit(record: OrderStatusVO.OrderStatusInfoVO) { +function handleEdit(record: OrderStatusVO.Info) { orderStatusFormModalRef.value?.open(true, record); } // 处理删除订单状态 -async function handleDelete(record: OrderStatusVO.OrderStatusInfoVO) { +async function handleDelete(record: OrderStatusVO.Info) { try { await deleteOrderStatusApi(record.id); message.success('删除成功'); diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/promotion-fee-type-config/components/PromotionFeeTypeFormModal.vue b/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/promotion-fee-type-config/components/PromotionFeeTypeFormModal.vue index 063fa0ac..2ef009ac 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/promotion-fee-type-config/components/PromotionFeeTypeFormModal.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/shop/config-management/promotion-fee-type-config/components/PromotionFeeTypeFormModal.vue @@ -6,10 +6,10 @@ import { Modal, Form, Input, InputNumber, Select, Switch, message } from 'ant-de import { createPromotionFeeTypeApi, updatePromotionFeeTypeApi, - type PromotionFeeTypeDTO, - type PromotionFeeTypeVO } from '#/api/ecommerce'; +import type { PromotionFeeTypeDTO, PromotionFeeTypeVO } from '#/api/ecommerce/types'; + defineProps<{ visible?: boolean; }>(); @@ -23,11 +23,10 @@ const emit = defineEmits<{ const visible = ref(false); const loading = ref(false); const isEdit = ref(false); -const currentRecord = ref(null); +const currentRecord = ref(null); // 表单数据 -const formData = ref>({ - typeCode: '', +const formData = ref>({ typeName: '', description: '', calculationMethod: 1, @@ -54,7 +53,7 @@ const rules = { const formRef = ref(); // 打开模态框 -function open(edit: boolean, record?: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) { +function open(edit: boolean, record?: PromotionFeeTypeVO.Info) { isEdit.value = edit; currentRecord.value = record || null; visible.value = true; @@ -62,7 +61,6 @@ function open(edit: boolean, record?: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) if (edit && record) { // 编辑模式,填充表单数据 formData.value = { - typeCode: record.typeCode, typeName: record.typeName, description: record.description || '', calculationMethod: record.calculationMethod || 1, @@ -72,7 +70,6 @@ function open(edit: boolean, record?: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) } else { // 新增模式,重置表单 formData.value = { - typeCode: '', typeName: '', description: '', calculationMethod: 1, @@ -97,9 +94,8 @@ async function handleSubmit() { if (isEdit.value && currentRecord.value) { // 更新推广费类型 - const updateData: PromotionFeeTypeDTO.UpdatePromotionFeeTypeDTO = { + const updateData: PromotionFeeTypeDTO.Update = { id: currentRecord.value.id, - typeCode: formData.value.typeCode!, typeName: formData.value.typeName!, description: formData.value.description, calculationMethod: formData.value.calculationMethod, @@ -110,8 +106,7 @@ async function handleSubmit() { message.success('更新推广费类型成功'); } else { // 创建推广费类型 - const createData: PromotionFeeTypeDTO.CreatePromotionFeeTypeDTO = { - typeCode: formData.value.typeCode!, + const createData: PromotionFeeTypeDTO.Create = { typeName: formData.value.typeName!, description: formData.value.description, calculationMethod: formData.value.calculationMethod, @@ -125,8 +120,7 @@ async function handleSubmit() { close(); emit('success'); } catch (error) { - console.error('提交推广费类型失败:', error); - message.error('提交推广费类型失败'); + console.error('提交推广费类型失败:', ( error as any).message ); } finally { loading.value = false; } @@ -162,12 +156,6 @@ defineExpose({ layout="vertical" >
- - - = { width: 80, title: '序号', }, - { - field: 'typeCode', - title: '类型编码', - minWidth: 'auto', - showOverflow: 'tooltip' as const, - }, { field: 'typeName', title: '类型名称', @@ -180,12 +174,12 @@ function handleAdd() { } // 处理编辑推广费类型 -function handleEdit(record: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) { +function handleEdit(record: PromotionFeeTypeVO.Info) { promotionFeeTypeFormModalRef.value?.open(true, record); } // 处理删除推广费类型 -async function handleDelete(record: PromotionFeeTypeVO.PromotionFeeTypeInfoVO) { +async function handleDelete(record: PromotionFeeTypeVO.Info) { try { await deletePromotionFeeTypeApi(record.id); message.success('删除成功'); diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/shop/order-management/components/OrderFormModal.vue b/ecom-dmb-frontend/apps/web-antd/src/views/shop/order-management/components/OrderFormModal.vue index ae182a73..e5c19525 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/shop/order-management/components/OrderFormModal.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/shop/order-management/components/OrderFormModal.vue @@ -8,11 +8,10 @@ import { createOrderApi, updateOrderApi, getActiveOrderStatusListApi, - type OrderDTO, - type OrderVO, - type OrderStatusVO } from '#/api/ecommerce'; -import { getShopPageApi, type ShopVO } from '#/api/shop'; +import type { OrderDTO, OrderVO, OrderStatusVO } from '#/api/ecommerce/types'; +import { getShopPageApi } from '#/api/shop'; +import type { ShopVO } from '#/api/shop/types'; defineProps<{ visible?: boolean; @@ -27,10 +26,10 @@ const emit = defineEmits<{ const visible = ref(false); const loading = ref(false); const isEdit = ref(false); -const currentRecord = ref(null); +const currentRecord = ref(null); // 表单数据 -const formData = ref>({ +const formData = ref>({ shopId: undefined, platformOrderNo: '', statusId: undefined, @@ -39,7 +38,12 @@ const formData = ref>({ orderDate: dayjs().format('YYYY-MM-DD'), productId: undefined, productSpecId: undefined, + productName: '', + specName: '', quantity: 1, + unitPrice: 0, + costPrice: 0, + costTotal: 0, }); // 下拉选项数据 @@ -49,11 +53,15 @@ const orderStatusOptions = ref<{ label: string; value: number }[]>([]); // 表单验证规则 const rules = { shopId: [{ required: true, message: '请选择店铺', trigger: 'change' }], + statusId: [{ required: true, message: '请选择订单状态', trigger: 'change' }], receivedAmount: [{ required: true, message: '请输入实收金额', trigger: 'blur' }], orderDate: [{ required: true, message: '请选择下单时间', trigger: 'change' }], productId: [{ required: true, message: '请输入商品ID', trigger: 'blur' }], - productSpecId: [{ required: true, message: '请输入商品规格ID', trigger: 'blur' }], + productName: [{ required: true, message: '请输入商品名称', trigger: 'blur' }], quantity: [{ required: true, message: '请输入数量', trigger: 'blur' }], + unitPrice: [{ required: true, message: '请输入销售单价', trigger: 'blur' }], + costPrice: [{ required: true, message: '请输入成本价', trigger: 'blur' }], + costTotal: [{ required: true, message: '请输入成本小计', trigger: 'blur' }], }; // 表单引用 @@ -68,7 +76,7 @@ async function fetchShopOptions() { filters: {}, }; const data = await getShopPageApi(params); - shopOptions.value = data.records.map((shop: ShopVO.ShopInfoVO) => ({ + shopOptions.value = data.records.map((shop: ShopVO.Info) => ({ label: shop.name, value: shop.id, })); @@ -81,8 +89,8 @@ async function fetchShopOptions() { async function fetchOrderStatusOptions() { try { const data = await getActiveOrderStatusListApi(); - orderStatusOptions.value = data.map((status: OrderStatusVO.OrderStatusInfoVO) => ({ - label: status.name, + orderStatusOptions.value = data.map((status: OrderStatusVO.Info) => ({ + label: status.statusName, value: status.id, })); } catch (error) { @@ -91,7 +99,7 @@ async function fetchOrderStatusOptions() { } // 打开模态框 -function open(edit: boolean, record?: OrderVO.OrderInfoVO) { +function open(edit: boolean, record?: OrderVO.Info) { isEdit.value = edit; currentRecord.value = record || null; visible.value = true; @@ -105,9 +113,14 @@ function open(edit: boolean, record?: OrderVO.OrderInfoVO) { receivedAmount: record.receivedAmount, shippingFee: record.shippingFee || 0, orderDate: record.orderDate ? dayjs(record.orderDate).format('YYYY-MM-DD') : dayjs().format('YYYY-MM-DD'), - productId: record.orderItem?.productId, - productSpecId: record.orderItem?.productSpecId, - quantity: record.orderItem?.quantity || 1, + productId: record.productId, + productSpecId: record.productSpecId, + productName: record.productName, + specName: record.specName, + quantity: record.quantity, + unitPrice: record.unitPrice, + costPrice: record.costPrice, + costTotal: record.costTotal, }; } else { // 新增模式,重置表单 @@ -120,7 +133,12 @@ function open(edit: boolean, record?: OrderVO.OrderInfoVO) { orderDate: dayjs().format('YYYY-MM-DD'), productId: undefined, productSpecId: undefined, + productName: '', + specName: '', quantity: 1, + unitPrice: 0, + costPrice: 0, + costTotal: 0, }; } } @@ -140,19 +158,27 @@ async function handleSubmit() { if (isEdit.value && currentRecord.value) { // 更新订单 - const updateData: OrderDTO.UpdateOrderDTO = { + const updateData: OrderDTO.Update = { shopId: formData.value.shopId!, platformOrderNo: formData.value.platformOrderNo, statusId: formData.value.statusId, receivedAmount: formData.value.receivedAmount!, shippingFee: formData.value.shippingFee, orderDate: formData.value.orderDate!, + productId: formData.value.productId, + productSpecId: formData.value.productSpecId, + productName: formData.value.productName, + specName: formData.value.specName, + quantity: formData.value.quantity, + unitPrice: formData.value.unitPrice, + costPrice: formData.value.costPrice, + costTotal: formData.value.costTotal, }; await updateOrderApi(currentRecord.value.id, updateData); message.success('更新订单成功'); } else { // 创建订单 - const createData: OrderDTO.CreateOrderDTO = { + const createData: OrderDTO.Create = { shopId: formData.value.shopId!, platformOrderNo: formData.value.platformOrderNo, statusId: formData.value.statusId!, @@ -160,8 +186,13 @@ async function handleSubmit() { shippingFee: formData.value.shippingFee, orderDate: formData.value.orderDate!, productId: formData.value.productId!, - productSpecId: formData.value.productSpecId!, + productSpecId: formData.value.productSpecId, + productName: formData.value.productName!, + specName: formData.value.specName, quantity: formData.value.quantity!, + unitPrice: formData.value.unitPrice!, + costPrice: formData.value.costPrice!, + costTotal: formData.value.costTotal!, }; await createOrderApi(createData); message.success('创建订单成功'); @@ -257,13 +288,29 @@ defineExpose({
+
+ + + + + + + +
+
+ + + + + + + +
+ +
+ + + + = { query: async ({ page }) => { try { loading.value = true; - const params: PageQueryDTO = { + const params: PageQueryDTO = { page: page.currentPage, pageSize: page.pageSize, filters: { @@ -216,7 +215,7 @@ async function fetchShopOptions() { filters: {}, }; const data = await getShopPageApi(params); - shopOptions.value = data.records.map((shop: ShopVO.ShopInfoVO) => ({ + shopOptions.value = data.records.map((shop: ShopVO.Info) => ({ label: shop.name, value: shop.id, })); @@ -229,7 +228,7 @@ async function fetchShopOptions() { async function fetchOrderStatusOptions() { try { const data = await getActiveOrderStatusListApi(); - orderStatusOptions.value = data.map((status: OrderStatusVO.OrderStatusInfoVO) => ({ + orderStatusOptions.value = data.map((status: OrderStatusVO.Info) => ({ label: status.statusName, value: status.id, })); @@ -257,12 +256,12 @@ function handleAdd() { } // 处理编辑订单 -function handleEdit(record: OrderVO.OrderInfoVO) { +function handleEdit(record: OrderVO.Info) { orderFormModalRef.value?.open(true, record); } // 处理删除订单 -async function handleDelete(record: OrderVO.OrderInfoVO) { +async function handleDelete(record: OrderVO.Info) { try { await deleteOrderApi(record.id); message.success('删除成功'); @@ -324,16 +323,16 @@ onMounted(async () => { diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/shop/product-management/components/ProductCard.vue b/ecom-dmb-frontend/apps/web-antd/src/views/shop/product-management/components/ProductCard.vue index a34e18df..3f3d38b2 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/shop/product-management/components/ProductCard.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/shop/product-management/components/ProductCard.vue @@ -1,7 +1,7 @@