mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 00:29:19 +08:00
refactor: 调整api和页面组件位置
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import type { WorkbenchDTO, WorkbenchVO } from './types';
|
||||
|
||||
import { requestClient } from '#/api/request';
|
||||
|
||||
/** 经营概览 Tab:KPI/趋势/饼图 + 底部四表 */
|
||||
export async function getWorkbenchFinanceApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.FinanceSlice>(
|
||||
'/bi/workbench/finance',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 多维分析 Tab */
|
||||
export async function getWorkbenchMultiAnalysisApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.MultiPanel>(
|
||||
'/bi/workbench/multi-analysis',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 销售额排行 Tab */
|
||||
export async function getWorkbenchSalesRankApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.MultiPanel>(
|
||||
'/bi/workbench/sales-rank',
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
/** 区间对比:单段日期,返回店铺汇总「合计」行(轻量) */
|
||||
export async function getWorkbenchPeriodCompareSliceApi(data: WorkbenchDTO.Query) {
|
||||
return requestClient.post<WorkbenchVO.PeriodCompareSlice>(
|
||||
'/bi/workbench/period-compare/slice',
|
||||
data,
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './apis';
|
||||
export * from './types';
|
||||
@@ -0,0 +1,2 @@
|
||||
export * from './types.dto';
|
||||
export * from './types.vo';
|
||||
@@ -0,0 +1,23 @@
|
||||
/**
|
||||
* 工作台查询 DTO(与后端 WorkbenchQueryDTO 对齐)
|
||||
*/
|
||||
export namespace WorkbenchDTO {
|
||||
export interface Query {
|
||||
/** 日期范围 [开始, 结束],单元素表示当天 */
|
||||
dateRange: string[];
|
||||
/** 税率,默认 0.04 */
|
||||
taxRate?: number;
|
||||
/** 平台代码,不传表示全平台 */
|
||||
platformCode?: string;
|
||||
/** 店铺 ID,不传表示当前筛选下全部门店 */
|
||||
shopId?: number;
|
||||
}
|
||||
|
||||
/** 工作台四表导出(与后端 WorkbenchExportDTO 对齐) */
|
||||
export interface ExportPayload extends Query {
|
||||
shopIds?: number[];
|
||||
platformCodes?: string[];
|
||||
categoryIds?: number[];
|
||||
productIds?: number[];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
/**
|
||||
* 工作台聚合 VO(与后端 Workbench*VO 对齐)
|
||||
*/
|
||||
import type { CompanyOverviewVO } from '#/api/ec/store-overview/types';
|
||||
|
||||
export namespace WorkbenchVO {
|
||||
export interface DimRow {
|
||||
key: string;
|
||||
name: string;
|
||||
/** 实际销售额(元,两位小数):计入「销售额」的订单状态配置下的商家实收合计 */
|
||||
salesYuan?: number;
|
||||
grossProfitYuan?: number;
|
||||
netProfitYuan?: number;
|
||||
refundYuan?: number;
|
||||
grossMarginPct?: number;
|
||||
netMarginPct?: number;
|
||||
}
|
||||
|
||||
export interface KpiItem {
|
||||
label: string;
|
||||
value: string;
|
||||
unit: string;
|
||||
changePct?: number;
|
||||
up?: boolean;
|
||||
/** 同比去年变化 %(相对去年同期时段) */
|
||||
yoyChangePct?: number | null;
|
||||
/** 同比是否上涨 */
|
||||
yoyUp?: boolean | null;
|
||||
sub?: string;
|
||||
/** 主指标金额(元),用于换算万与悬停显示 */
|
||||
amountYuan?: number | null;
|
||||
/** true 时主数字建议按「万」展示 */
|
||||
preferWanDisplay?: boolean | null;
|
||||
}
|
||||
|
||||
export interface TrendPoint {
|
||||
date: string;
|
||||
/** 日成交金额(元):全部订单状态商家实收 */
|
||||
dealYuan?: number;
|
||||
/** 日实际销售额(元),与 KPI「实际销售额」同口径 */
|
||||
salesYuan?: number;
|
||||
/** 日毛利润(元)= 销售额−成本−退款 */
|
||||
profitYuan?: number;
|
||||
/** 日净利润(元),与 KPI「净利润」及多维分析分摊口径一致 */
|
||||
netProfitYuan?: number;
|
||||
refundYuan?: number;
|
||||
}
|
||||
|
||||
/** 饼图扇区(平台销售额占比等) */
|
||||
export interface PieSlice {
|
||||
name: string;
|
||||
/** 金额(元,两位小数) */
|
||||
value?: number;
|
||||
/** 占实际销售额合计的比例 % */
|
||||
pct?: number;
|
||||
}
|
||||
|
||||
export interface FinancePanel {
|
||||
kpis: KpiItem[];
|
||||
dealTrend: TrendPoint[];
|
||||
/** 各平台实际销售额占比 */
|
||||
platformSalesShare: PieSlice[];
|
||||
/** 环比对比期起(yyyy-MM-dd) */
|
||||
momCompareDateStart?: string | null;
|
||||
momCompareDateEnd?: string | null;
|
||||
/** 同比对比期起止(yyyy-MM-dd) */
|
||||
yoyCompareDateStart?: string | null;
|
||||
yoyCompareDateEnd?: string | null;
|
||||
}
|
||||
|
||||
export interface MultiPanel {
|
||||
platform: DimRow[];
|
||||
shop: DimRow[];
|
||||
category: DimRow[];
|
||||
product: DimRow[];
|
||||
}
|
||||
|
||||
/** 经营概览 Tab 专用 */
|
||||
export interface FinanceSlice {
|
||||
finance: FinancePanel;
|
||||
summaryTables?: CompanyOverviewVO.WorkbenchTableBundle | null;
|
||||
}
|
||||
|
||||
/** 区间对比:单段日期对应的店铺汇总「合计」行(与 /period-compare/slice 对齐) */
|
||||
export interface PeriodCompareSlice {
|
||||
startDate: string;
|
||||
endDate: string;
|
||||
total: CompanyOverviewVO.ShopSummary;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user