mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 19:49:28 +08:00
refactor: 重构电商模块目录结构
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 326 KiB |
@@ -0,0 +1,135 @@
|
|||||||
|
import type { ProductDTO, ProductVO } from './types';
|
||||||
|
|
||||||
|
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||||
|
|
||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品管理API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取商品列表
|
||||||
|
*/
|
||||||
|
export async function getProductPageApi(
|
||||||
|
params: PageQueryDTO<ProductDTO.Filters>,
|
||||||
|
) {
|
||||||
|
return requestClient.post<PageResultVO<ProductVO.Info>>(
|
||||||
|
'/ec/product/page',
|
||||||
|
params,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建商品
|
||||||
|
*/
|
||||||
|
export async function createProductApi(data: ProductDTO.Create) {
|
||||||
|
return requestClient.post<ProductVO.Info>('/ec/product/create', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新商品
|
||||||
|
*/
|
||||||
|
export async function updateProductApi(id: number, data: ProductDTO.Update) {
|
||||||
|
return requestClient.put<ProductVO.Info>(`/ec/product/update/${id}`, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除商品
|
||||||
|
*/
|
||||||
|
export async function deleteProductApi(id: number) {
|
||||||
|
return requestClient.delete(`/ec/product/delete/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品规格管理API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取商品规格列表
|
||||||
|
*/
|
||||||
|
export async function getProductSpecPageApi(
|
||||||
|
params: PageQueryDTO<ProductDTO.SpecFilters>,
|
||||||
|
) {
|
||||||
|
return requestClient.post<PageResultVO<ProductVO.SpecInfo>>(
|
||||||
|
'/ec/product-spec/page',
|
||||||
|
params,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建商品规格
|
||||||
|
*/
|
||||||
|
export async function createProductSpecApi(data: ProductDTO.CreateSpec) {
|
||||||
|
return requestClient.post<ProductVO.SpecInfo>(
|
||||||
|
'/ec/product-spec/create',
|
||||||
|
data,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新商品规格
|
||||||
|
*/
|
||||||
|
export async function updateProductSpecApi(
|
||||||
|
id: number,
|
||||||
|
data: ProductDTO.UpdateSpec,
|
||||||
|
) {
|
||||||
|
return requestClient.put<ProductVO.SpecInfo>(
|
||||||
|
`/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<ProductVO.Info>(
|
||||||
|
`/ec/product/find-by-name/${encodeURIComponent(name)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量根据名称查询商品
|
||||||
|
*/
|
||||||
|
export async function getProductsByNamesApi(names: string[]) {
|
||||||
|
return requestClient.post<ProductVO.Info[]>(
|
||||||
|
'/ec/product/find-by-names',
|
||||||
|
names,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据商品名称和规格编码精准查询商品规格
|
||||||
|
*/
|
||||||
|
export async function getProductSpecByProductAndSpecApi(
|
||||||
|
productName: string,
|
||||||
|
specCode: string,
|
||||||
|
) {
|
||||||
|
return requestClient.get<ProductVO.SpecInfo>(
|
||||||
|
`/ec/product-spec/find-by-product-and-spec/${encodeURIComponent(productName)}/${encodeURIComponent(specCode)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量根据商品名称和规格编码查询商品规格
|
||||||
|
*/
|
||||||
|
export async function getProductSpecsByProductAndSpecsApi(
|
||||||
|
queries: { productName: string; specCode: string }[],
|
||||||
|
) {
|
||||||
|
return requestClient.post<ProductVO.Info[]>(
|
||||||
|
'/ec/product-spec/find-by-product-and-specs',
|
||||||
|
queries,
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './apis';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from './types.dto';
|
||||||
|
export * from './types.vo';
|
||||||
@@ -0,0 +1,97 @@
|
|||||||
|
/**
|
||||||
|
* 商品相关DTO类型定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
export namespace ProductDTO {
|
||||||
|
/** 创建商品参数 */
|
||||||
|
export interface Create {
|
||||||
|
/** 商品名称 */
|
||||||
|
name: string;
|
||||||
|
/** 商品编码 */
|
||||||
|
productCode?: string;
|
||||||
|
/** 主图图片ID */
|
||||||
|
mainImageId?: number;
|
||||||
|
/** 商品规格列表(可选) */
|
||||||
|
specs?: Spec[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新商品参数 */
|
||||||
|
export interface Update {
|
||||||
|
/** 商品名称 */
|
||||||
|
name: string;
|
||||||
|
/** 商品编码 */
|
||||||
|
productCode?: string;
|
||||||
|
/** 商品编码 */
|
||||||
|
specCode?: string;
|
||||||
|
/** 商品SKU */
|
||||||
|
skuCode?: string;
|
||||||
|
/** 主图图片ID */
|
||||||
|
mainImageId?: number;
|
||||||
|
/** 成本价 */
|
||||||
|
costPrice: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 商品规格DTO */
|
||||||
|
export interface Spec {
|
||||||
|
/** 规格名称 */
|
||||||
|
name: string;
|
||||||
|
/** 规格编码 */
|
||||||
|
specCode?: string;
|
||||||
|
/** 成本价 */
|
||||||
|
costPrice: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 创建商品规格参数 */
|
||||||
|
export interface CreateSpec {
|
||||||
|
/** 商品ID */
|
||||||
|
productId: number;
|
||||||
|
/** 规格名称 */
|
||||||
|
name: string;
|
||||||
|
/** 规格编码 */
|
||||||
|
specCode?: string;
|
||||||
|
/** 成本价 */
|
||||||
|
costPrice: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新商品规格参数 */
|
||||||
|
export interface UpdateSpec {
|
||||||
|
/** 规格名称 */
|
||||||
|
name: string;
|
||||||
|
/** 规格编码 */
|
||||||
|
specCode?: string;
|
||||||
|
/** 成本价 */
|
||||||
|
costPrice: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 商品过滤条件 */
|
||||||
|
export interface Filters {
|
||||||
|
/** 商品名称(模糊查询) */
|
||||||
|
name?: string;
|
||||||
|
/** 商品编码(模糊查询) */
|
||||||
|
productCode?: string;
|
||||||
|
/** 商品编码(模糊查询) */
|
||||||
|
specCode?: string;
|
||||||
|
/** 商品SKU(模糊查询) */
|
||||||
|
skuCode?: string;
|
||||||
|
/** 成本价范围-最小值 */
|
||||||
|
minCostPrice?: number;
|
||||||
|
/** 成本价范围-最大值 */
|
||||||
|
maxCostPrice?: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 商品规格过滤条件 */
|
||||||
|
export interface SpecFilters {
|
||||||
|
/** 商品ID */
|
||||||
|
productId?: number;
|
||||||
|
/** 商品名称(模糊查询) */
|
||||||
|
productName?: string;
|
||||||
|
/** 规格名称(模糊查询) */
|
||||||
|
name?: string;
|
||||||
|
/** 规格编码(模糊查询) */
|
||||||
|
specCode?: string;
|
||||||
|
/** 成本价范围-最小值 */
|
||||||
|
minCostPrice?: number;
|
||||||
|
/** 成本价范围-最大值 */
|
||||||
|
maxCostPrice?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
/**
|
||||||
|
* 商品相关VO类型定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
export namespace ProductVO {
|
||||||
|
/** 商品信息 */
|
||||||
|
export interface Info {
|
||||||
|
/** 商品ID */
|
||||||
|
id: number;
|
||||||
|
/** 公司ID */
|
||||||
|
companyId: number;
|
||||||
|
/** 商品名称 */
|
||||||
|
name: string;
|
||||||
|
/** 商品编码 */
|
||||||
|
productCode?: string;
|
||||||
|
/** 主图URL(冗余字段) */
|
||||||
|
mainImage?: string;
|
||||||
|
/** 主图图片ID */
|
||||||
|
mainImageId?: number;
|
||||||
|
/** 创建时间 */
|
||||||
|
createTime: string;
|
||||||
|
/** 更新时间 */
|
||||||
|
updateTime: string;
|
||||||
|
/** 创建人ID */
|
||||||
|
createBy?: number;
|
||||||
|
/** 更新人ID */
|
||||||
|
updateBy?: number;
|
||||||
|
/** 商品规格列表 */
|
||||||
|
specs?: SpecInfo[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 商品规格信息 */
|
||||||
|
export interface SpecInfo {
|
||||||
|
/** 规格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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
import { requestClient } from '#/api/request';
|
||||||
|
|
||||||
|
import type { PageQueryDTO, PageResultVO } from '#/types/common';
|
||||||
|
import type { PromotionFeeDTO, PromotionFeeVO } from './types';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推广费管理API
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 分页获取推广费记录列表
|
||||||
|
*/
|
||||||
|
export async function getPromotionFeePageApi(params: PageQueryDTO<PromotionFeeDTO.Filters>) {
|
||||||
|
return requestClient.post<PageResultVO<PromotionFeeVO.Info>>('/ec/promotion-fee/page', params);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建推广费记录
|
||||||
|
*/
|
||||||
|
export async function createPromotionFeeApi(data: PromotionFeeDTO.Create) {
|
||||||
|
return requestClient.post<number>('/ec/promotion-fee', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新推广费记录
|
||||||
|
*/
|
||||||
|
export async function updatePromotionFeeApi(data: PromotionFeeDTO.Update) {
|
||||||
|
return requestClient.put<void>('/ec/promotion-fee', data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除推广费记录
|
||||||
|
*/
|
||||||
|
export async function deletePromotionFeeApi(id: number) {
|
||||||
|
return requestClient.delete<void>(`/ec/promotion-fee/${id}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取推广费记录详情
|
||||||
|
*/
|
||||||
|
export async function getPromotionFeeByIdApi(id: number) {
|
||||||
|
return requestClient.get<PromotionFeeVO.Info>(`/ec/promotion-fee/${id}`);
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
export * from './apis';
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
export * from './types.dto';
|
||||||
|
export * from './types.vo';
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
/**
|
||||||
|
* 推广费管理相关DTO类型定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
export namespace PromotionFeeDTO {
|
||||||
|
/** 推广费查询过滤条件 */
|
||||||
|
export interface Filters {
|
||||||
|
/** 店铺ID */
|
||||||
|
shopId?: number;
|
||||||
|
/** 推广费类型ID */
|
||||||
|
feeTypeId?: number;
|
||||||
|
/** 平台 */
|
||||||
|
platform?: string;
|
||||||
|
/** 推广费发生日期开始 */
|
||||||
|
feeDateStart?: string;
|
||||||
|
/** 推广费发生日期结束 */
|
||||||
|
feeDateEnd?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 创建推广费记录 */
|
||||||
|
export interface Create {
|
||||||
|
/** 店铺ID */
|
||||||
|
shopId: number;
|
||||||
|
/** 推广费类型ID */
|
||||||
|
feeTypeId: number;
|
||||||
|
/** 推广费名称 */
|
||||||
|
feeName: string;
|
||||||
|
/** 平台(淘宝、京东、拼多多等) */
|
||||||
|
platform?: string;
|
||||||
|
/** 推广活动名称 */
|
||||||
|
campaignName?: string;
|
||||||
|
/** 推广费金额 */
|
||||||
|
feeAmount: number;
|
||||||
|
/** 基础金额(用于按比例计算) */
|
||||||
|
baseAmount?: number;
|
||||||
|
/** 费率(用于按比例计算) */
|
||||||
|
feeRate?: number;
|
||||||
|
/** 点击次数 */
|
||||||
|
clickCount?: number;
|
||||||
|
/** 展示次数 */
|
||||||
|
impressionCount?: number;
|
||||||
|
/** 转化次数 */
|
||||||
|
conversionCount?: number;
|
||||||
|
/** 推广费发生日期 */
|
||||||
|
feeDate: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 更新推广费记录 */
|
||||||
|
export interface Update {
|
||||||
|
/** 推广费记录ID */
|
||||||
|
id: number;
|
||||||
|
/** 店铺ID */
|
||||||
|
shopId: number;
|
||||||
|
/** 推广费类型ID */
|
||||||
|
feeTypeId: number;
|
||||||
|
/** 推广费名称 */
|
||||||
|
feeName: string;
|
||||||
|
/** 平台(淘宝、京东、拼多多等) */
|
||||||
|
platform?: string;
|
||||||
|
/** 推广活动名称 */
|
||||||
|
campaignName?: string;
|
||||||
|
/** 推广费金额 */
|
||||||
|
feeAmount: number;
|
||||||
|
/** 基础金额(用于按比例计算) */
|
||||||
|
baseAmount?: number;
|
||||||
|
/** 费率(用于按比例计算) */
|
||||||
|
feeRate?: number;
|
||||||
|
/** 点击次数 */
|
||||||
|
clickCount?: number;
|
||||||
|
/** 展示次数 */
|
||||||
|
impressionCount?: number;
|
||||||
|
/** 转化次数 */
|
||||||
|
conversionCount?: number;
|
||||||
|
/** 推广费发生日期 */
|
||||||
|
feeDate: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/**
|
||||||
|
* 推广费管理相关VO类型定义
|
||||||
|
*/
|
||||||
|
|
||||||
|
export namespace PromotionFeeVO {
|
||||||
|
/** 推广费记录信息 */
|
||||||
|
export interface Info {
|
||||||
|
/** 推广费记录ID */
|
||||||
|
id: number;
|
||||||
|
/** 公司ID */
|
||||||
|
companyId: number;
|
||||||
|
/** 店铺ID */
|
||||||
|
shopId: number;
|
||||||
|
/** 店铺名称 */
|
||||||
|
shopName?: string;
|
||||||
|
/** 推广费类型ID */
|
||||||
|
feeTypeId: number;
|
||||||
|
/** 推广费类型名称 */
|
||||||
|
feeTypeName?: string;
|
||||||
|
/** 推广费名称 */
|
||||||
|
feeName: string;
|
||||||
|
/** 平台(淘宝、京东、拼多多等) */
|
||||||
|
platform?: string;
|
||||||
|
/** 推广活动名称 */
|
||||||
|
campaignName?: string;
|
||||||
|
/** 推广费金额 */
|
||||||
|
feeAmount: number;
|
||||||
|
/** 基础金额(用于按比例计算) */
|
||||||
|
baseAmount?: number;
|
||||||
|
/** 费率(用于按比例计算) */
|
||||||
|
feeRate?: number;
|
||||||
|
/** 点击次数 */
|
||||||
|
clickCount?: number;
|
||||||
|
/** 展示次数 */
|
||||||
|
impressionCount?: number;
|
||||||
|
/** 转化次数 */
|
||||||
|
conversionCount?: number;
|
||||||
|
/** 推广费发生日期 */
|
||||||
|
feeDate: string;
|
||||||
|
/** 备注 */
|
||||||
|
remark?: string;
|
||||||
|
/** 创建时间 */
|
||||||
|
createTime: string;
|
||||||
|
/** 更新时间 */
|
||||||
|
updateTime?: string;
|
||||||
|
/** 创建人ID */
|
||||||
|
createBy?: number;
|
||||||
|
/** 更新人ID */
|
||||||
|
updateBy?: number;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -76,6 +76,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
+1
@@ -89,6 +89,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
@@ -56,6 +56,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
data: [],
|
data: [],
|
||||||
@@ -83,18 +84,47 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
| 'Total'
|
| 'Total'
|
||||||
)[],
|
)[],
|
||||||
},
|
},
|
||||||
|
// 配置远程加载,实现真正的分页
|
||||||
|
proxyConfig: {
|
||||||
|
ajax: {
|
||||||
|
query: async ({ page }) => {
|
||||||
|
// 如果没有数据,返回空
|
||||||
|
if (csvData.value.length === 0) {
|
||||||
|
return {
|
||||||
|
items: [],
|
||||||
|
total: 0,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 计算分页参数
|
||||||
|
const currentPage = page.currentPage || 1;
|
||||||
|
const pageSize = page.pageSize || 50;
|
||||||
|
const startIndex = (currentPage - 1) * pageSize;
|
||||||
|
const endIndex = startIndex + pageSize;
|
||||||
|
|
||||||
|
// 从 csvData 中截取当前页的数据
|
||||||
|
const pageData = csvData.value.slice(startIndex, endIndex);
|
||||||
|
|
||||||
|
return {
|
||||||
|
items: pageData,
|
||||||
|
total: csvData.value.length,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const [Grid, gridApi] = useVbenVxeGrid({
|
const [Grid, gridApi] = useVbenVxeGrid({
|
||||||
gridOptions,
|
gridOptions,
|
||||||
});
|
});
|
||||||
|
|
||||||
// 更新表格数据和列
|
// 更新表格列配置(不再更新 data,data 由 proxyConfig 管理)
|
||||||
const updateTable = () => {
|
const updateTable = () => {
|
||||||
gridApi.setGridOptions({
|
gridApi.setGridOptions({
|
||||||
columns: gridColumns.value,
|
columns: gridColumns.value,
|
||||||
data: csvData.value,
|
|
||||||
});
|
});
|
||||||
|
// 触发重新加载数据
|
||||||
|
gridApi.reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 处理文件上传
|
// 处理文件上传
|
||||||
|
|||||||
+1
@@ -99,6 +99,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
+1
@@ -135,6 +135,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
+1
@@ -108,6 +108,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
+17
-7
@@ -48,6 +48,12 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
width: 80,
|
width: 80,
|
||||||
title: '序号',
|
title: '序号',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: 'Logo',
|
||||||
|
width: 100,
|
||||||
|
align: 'center' as const,
|
||||||
|
slots: { default: 'logo' },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'name',
|
field: 'name',
|
||||||
title: '店铺名称',
|
title: '店铺名称',
|
||||||
@@ -60,11 +66,6 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
minWidth: 'auto',
|
minWidth: 'auto',
|
||||||
showOverflow: 'tooltip' as const,
|
showOverflow: 'tooltip' as const,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
title: 'Logo',
|
|
||||||
minWidth: 'auto',
|
|
||||||
slots: { default: 'logo' },
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
field: 'createTime',
|
field: 'createTime',
|
||||||
title: '创建时间',
|
title: '创建时间',
|
||||||
@@ -85,6 +86,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
@@ -242,7 +244,10 @@ function handleModalSuccess() {
|
|||||||
|
|
||||||
<!-- Logo列 -->
|
<!-- Logo列 -->
|
||||||
<template #logo="{ row }: { row: any }">
|
<template #logo="{ row }: { row: any }">
|
||||||
<div v-if="row.logo">
|
<div
|
||||||
|
v-if="row.logo"
|
||||||
|
style="display: flex; justify-content: center; align-items: center"
|
||||||
|
>
|
||||||
<img
|
<img
|
||||||
:src="row.logo"
|
:src="row.logo"
|
||||||
:alt="row.name"
|
:alt="row.name"
|
||||||
@@ -254,7 +259,12 @@ function handleModalSuccess() {
|
|||||||
"
|
"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
<span v-else style="color: #999">暂无Logo</span>
|
<div
|
||||||
|
v-else
|
||||||
|
style="display: flex; justify-content: center; align-items: center"
|
||||||
|
>
|
||||||
|
<span style="color: #999">暂无Logo</span>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- 操作列 -->
|
<!-- 操作列 -->
|
||||||
@@ -107,6 +107,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -144,6 +144,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -141,6 +141,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -116,6 +116,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
resizable: true,
|
resizable: true,
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
resizable: true, // 启用列宽调整
|
resizable: true, // 启用列宽调整
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ const gridOptions: VxeGridProps<any> = {
|
|||||||
height: 'auto',
|
height: 'auto',
|
||||||
border: true,
|
border: true,
|
||||||
stripe: true,
|
stripe: true,
|
||||||
|
highlightHoverRow: true,
|
||||||
showOverflow: true,
|
showOverflow: true,
|
||||||
size: 'small',
|
size: 'small',
|
||||||
toolbarConfig: {
|
toolbarConfig: {
|
||||||
|
|||||||
Reference in New Issue
Block a user