wip: 新增电商模块

This commit is contained in:
ah--desktop
2025-09-11 00:15:25 +08:00
parent a305dcdc3f
commit a79058f1f6
74 changed files with 3841 additions and 241 deletions
@@ -1,20 +1,6 @@
import { requestClient } from '#/api/request';
// 分页查询参数
export interface PageQuery {
page: number;
size: number;
filter?: any;
}
// 分页结果
export interface PageResult<T> {
records: T[];
total: number;
size: number;
current: number;
pages: number;
}
import type { PageQueryDTO, PageResultVO } from '#/types/common';
export namespace CompanyApi {
/** 公司信息 */
@@ -149,8 +135,8 @@ export namespace PositionApi {
}
// 公司管理API
export async function getCompanyPageApi(params: PageQuery & { filter?: CompanyApi.CompanyFilter }) {
return requestClient.post<PageResult<CompanyApi.CompanyInfo>>('/company/page', params);
export async function getCompanyPageApi(params: PageQueryDTO<CompanyApi.CompanyFilter>) {
return requestClient.post<PageResultVO<CompanyApi.CompanyInfo>>('/company/page', params);
}
export async function createCompanyApi(data: CompanyApi.CreateCompanyParams) {
@@ -166,8 +152,8 @@ export async function deleteCompanyApi(id: number) {
}
// 部门管理API
export async function getDepartmentPageApi(params: PageQuery & { filter?: DepartmentApi.DepartmentFilter }) {
return requestClient.post<PageResult<DepartmentApi.DepartmentInfo>>('/department/page', params);
export async function getDepartmentPageApi(params: PageQueryDTO<DepartmentApi.DepartmentFilter>) {
return requestClient.post<PageResultVO<DepartmentApi.DepartmentInfo>>('/department/page', params);
}
export async function createDepartmentApi(data: DepartmentApi.CreateDepartmentParams) {
@@ -183,8 +169,8 @@ export async function deleteDepartmentApi(id: number) {
}
// 岗位管理API
export async function getPositionPageApi(params: PageQuery & { filter?: PositionApi.PositionFilter }) {
return requestClient.post<PageResult<PositionApi.PositionInfo>>('/position/page', params);
export async function getPositionPageApi(params: PageQueryDTO<PositionApi.PositionFilter>) {
return requestClient.post<PageResultVO<PositionApi.PositionInfo>>('/position/page', params);
}
export async function createPositionApi(data: PositionApi.CreatePositionParams) {
@@ -0,0 +1,68 @@
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<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}`);
}
/**
* 商品管理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}`);
}
@@ -0,0 +1,6 @@
/**
* 电商模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 电商模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,77 @@
/**
* 电商模块DTO类型定义
*/
export namespace ShopDTO {
/** 创建店铺参数 */
export interface CreateShopDTO {
/** 店铺名称 */
name: string;
/** logo URL */
logo?: string;
/** 平台(如淘宝、京东、拼多多) */
platform?: string;
}
/** 更新店铺参数 */
export interface UpdateShopDTO {
/** 店铺名称 */
name: string;
/** logo URL */
logo?: string;
/** 平台(如淘宝、京东、拼多多) */
platform?: string;
}
/** 店铺过滤条件 */
export interface ShopFiltersDTO {
/** 店铺名称(模糊查询) */
name?: string;
/** 平台 */
platform?: string;
}
}
export namespace ProductDTO {
/** 创建商品参数 */
export interface CreateProductDTO {
/** 商品名称 */
name: string;
/** 商品编码 */
specCode?: string;
/** 商品SKU */
skuCode?: string;
/** 主图URL */
mainImage?: string;
/** 成本价 */
costPrice: number;
}
/** 更新商品参数 */
export interface UpdateProductDTO {
/** 商品名称 */
name: string;
/** 商品编码 */
specCode?: string;
/** 商品SKU */
skuCode?: string;
/** 主图URL */
mainImage?: string;
/** 成本价 */
costPrice: number;
}
/** 商品过滤条件 */
export interface ProductFiltersDTO {
/** 商品名称(模糊查询) */
name?: string;
/** 商品编码(模糊查询) */
specCode?: string;
/** 商品SKU(模糊查询) */
skuCode?: string;
/** 成本价范围-最小值 */
minCostPrice?: number;
/** 成本价范围-最大值 */
maxCostPrice?: number;
}
}
@@ -0,0 +1,55 @@
/**
* 电商模块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;
/** 商品编码 */
specCode?: string;
/** 商品SKU */
skuCode?: string;
/** 主图URL */
mainImage?: string;
/** 成本价 */
costPrice: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}
@@ -0,0 +1,100 @@
import { requestClient } from '#/api/request';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import type { CompanyDTO, CompanyVO, DepartmentDTO, DepartmentVO, PositionDTO, PositionVO } from './types';
/**
* 公司管理API
*/
/**
* 分页获取公司列表
*/
export async function getCompanyPageApi(params: PageQueryDTO<CompanyDTO.CompanyFiltersDTO>) {
return requestClient.post<PageResultVO<CompanyVO.CompanyInfoVO>>('/company/page', params);
}
/**
* 创建公司
*/
export async function createCompanyApi(data: CompanyDTO.CreateCompanyDTO) {
return requestClient.post<CompanyVO.CompanyInfoVO>('/company/create', data);
}
/**
* 更新公司
*/
export async function updateCompanyApi(id: number, data: CompanyDTO.UpdateCompanyDTO) {
return requestClient.put<CompanyVO.CompanyInfoVO>(`/company/update/${id}`, data);
}
/**
* 删除公司
*/
export async function deleteCompanyApi(id: number) {
return requestClient.delete<void>(`/company/delete/${id}`);
}
/**
* 部门管理API
*/
/**
* 分页获取部门列表
*/
export async function getDepartmentPageApi(params: PageQueryDTO<DepartmentDTO.DepartmentFiltersDTO>) {
return requestClient.post<PageResultVO<DepartmentVO.DepartmentInfoVO>>('/department/page', params);
}
/**
* 创建部门
*/
export async function createDepartmentApi(data: DepartmentDTO.CreateDepartmentDTO) {
return requestClient.post<DepartmentVO.DepartmentInfoVO>('/department/create', data);
}
/**
* 更新部门
*/
export async function updateDepartmentApi(id: number, data: DepartmentDTO.UpdateDepartmentDTO) {
return requestClient.put<DepartmentVO.DepartmentInfoVO>(`/department/update/${id}`, data);
}
/**
* 删除部门
*/
export async function deleteDepartmentApi(id: number) {
return requestClient.delete<void>(`/department/delete/${id}`);
}
/**
* 岗位管理API
*/
/**
* 分页获取岗位列表
*/
export async function getPositionPageApi(params: PageQueryDTO<PositionDTO.PositionFiltersDTO>) {
return requestClient.post<PageResultVO<PositionVO.PositionInfoVO>>('/position/page', params);
}
/**
* 创建岗位
*/
export async function createPositionApi(data: PositionDTO.CreatePositionDTO) {
return requestClient.post<PositionVO.PositionInfoVO>('/position/create', data);
}
/**
* 更新岗位
*/
export async function updatePositionApi(id: number, data: PositionDTO.UpdatePositionDTO) {
return requestClient.put<PositionVO.PositionInfoVO>(`/position/update/${id}`, data);
}
/**
* 删除岗位
*/
export async function deletePositionApi(id: number) {
return requestClient.delete<void>(`/position/delete/${id}`);
}
@@ -0,0 +1,6 @@
/**
* 组织管理模块API导出
*/
export * from './apis';
export * from './types';
@@ -0,0 +1,6 @@
/**
* 组织管理模块类型定义导出
*/
export * from './types.dto';
export * from './types.vo';
@@ -0,0 +1,131 @@
/**
* 组织管理模块DTO类型定义
*/
export namespace CompanyDTO {
/** 创建公司参数 */
export interface CreateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** Logo */
logo?: string;
/** 状态 */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 更新公司参数 */
export interface UpdateCompanyDTO {
/** 公司名称 */
name: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** Logo */
logo?: string;
/** 状态 */
status?: number;
/** 订阅到期时间 */
expireTime?: string;
}
/** 公司过滤条件 */
export interface CompanyFiltersDTO {
/** 公司名称(模糊查询) */
name?: string;
/** 状态 */
status?: number;
}
}
export namespace DepartmentDTO {
/** 创建部门参数 */
export interface CreateDepartmentDTO {
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 更新部门参数 */
export interface UpdateDepartmentDTO {
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 部门过滤条件 */
export interface DepartmentFiltersDTO {
/** 部门名称(模糊查询) */
name?: string;
/** 公司ID */
companyId?: number;
/** 状态 */
status?: number;
}
}
export namespace PositionDTO {
/** 创建岗位参数 */
export interface CreatePositionDTO {
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 更新岗位参数 */
export interface UpdatePositionDTO {
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status?: number;
}
/** 岗位过滤条件 */
export interface PositionFiltersDTO {
/** 岗位名称(模糊查询) */
name?: string;
/** 公司ID */
companyId?: number;
/** 部门ID */
departmentId?: number;
/** 状态 */
status?: number;
}
}
@@ -0,0 +1,91 @@
/**
* 组织管理模块VO类型定义
*/
export namespace CompanyVO {
/** 公司信息 */
export interface CompanyInfoVO {
/** 公司ID */
id: number;
/** 公司名称 */
name: string;
/** 过期时间 */
expiration?: string;
/** 公司地址 */
address?: string;
/** 联系人 */
contactPerson?: string;
/** 联系电话 */
contactPhone?: string;
/** 邮箱 */
email?: string;
/** Logo */
logo?: string;
/** 状态 */
status: number;
/** 订阅到期时间 */
expireTime?: string;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 是否过期 */
expired?: boolean;
}
}
export namespace DepartmentVO {
/** 部门信息 */
export interface DepartmentInfoVO {
/** 部门ID */
id: number;
/** 部门名称 */
name: string;
/** 父部门ID */
parentId?: number;
/** 公司ID */
companyId: number;
/** 备注 */
remark?: string;
/** 状态 */
status: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
/** 子部门 */
children?: DepartmentInfoVO[];
}
}
export namespace PositionVO {
/** 岗位信息 */
export interface PositionInfoVO {
/** 岗位ID */
id: number;
/** 岗位名称 */
name: string;
/** 岗位编码 */
code?: string;
/** 部门ID */
departmentId?: number;
/** 备注 */
remark?: string;
/** 状态 */
status: number;
/** 公司ID */
companyId: number;
/** 创建时间 */
createTime: string;
/** 更新时间 */
updateTime: string;
/** 创建人ID */
createBy?: number;
/** 更新人ID */
updateBy?: number;
}
}