refactor: 重构电商模块目录结构

This commit is contained in:
ah--desktop
2025-12-07 23:02:48 +08:00
parent d3d9fd47d8
commit 407c650973
43 changed files with 669 additions and 9 deletions
@@ -0,0 +1,70 @@
import type { ShopDTO, ShopVO } from './types';
import type { PageQueryDTO, PageResultVO } from '#/types/common';
import { requestClient } from '#/api/request';
/**
* 店铺管理API
*/
/**
* 分页获取店铺列表
*/
export async function getShopPageApi(params: PageQueryDTO<ShopDTO.Filters>) {
return requestClient.post<PageResultVO<ShopVO.Info>>('/ec/shop/page', params);
}
/**
* 创建店铺
*/
export async function createShopApi(data: ShopDTO.Create) {
return requestClient.post<ShopVO.Info>('/ec/shop/create', data);
}
/**
* 更新店铺
*/
export async function updateShopApi(id: number, data: ShopDTO.Update) {
return requestClient.put<ShopVO.Info>(`/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<ShopVO.Info>('/ec/shop/upload-logo', formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
});
}
/**
* 精准查询API - 用于数据导入
*/
/**
* 根据名称精准查询店铺
*/
export async function getShopByNameApi(name: string) {
return requestClient.get<ShopVO.Info>(
`/ec/shop/find-by-name/${encodeURIComponent(name)}`,
);
}
/**
* 批量根据名称查询店铺
*/
export async function getShopsByNamesApi(names: string[]) {
return requestClient.post<ShopVO.Info[]>('/ec/shop/find-by-names', names);
}
@@ -0,0 +1 @@
export * from './apis';
@@ -0,0 +1,2 @@
export * from './types.dto';
export * from './types.vo';
@@ -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;
}
}
@@ -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;
}
}