feat(@vben/web-antd): add finance overview cockpit and fee rate

This commit is contained in:
2026-03-05 10:48:43 +08:00
parent 1e3f1be961
commit 13212d7ff5
28 changed files with 2180 additions and 0 deletions

View File

@@ -3,6 +3,7 @@
*/
export * from './cost';
export * from './invoice';
export * from './overview';
export * from './report';
export * from './settlement';
export * from './transaction';

View File

@@ -0,0 +1,122 @@
/**
* 文件职责:财务概览 API 契约与请求封装。
*/
import { requestClient } from '#/api/request';
/** 财务概览维度。 */
export type FinanceOverviewDimension = 'store' | 'tenant';
/** 趋势周期值。 */
export type FinanceOverviewTrendRange = '7' | '30';
/** 财务概览查询参数。 */
export interface FinanceOverviewDashboardQuery {
dimension: FinanceOverviewDimension;
storeId?: string;
}
/** KPI 卡片数据。 */
export interface FinanceOverviewKpiCardDto {
amount: number;
changeRate: number;
compareAmount: number;
compareLabel: string;
trend: 'down' | 'flat' | 'up';
}
/** 收入趋势点。 */
export interface FinanceOverviewIncomeTrendPointDto {
amount: number;
date: string;
dateLabel: string;
}
/** 收入趋势数据。 */
export interface FinanceOverviewIncomeTrendDto {
last30Days: FinanceOverviewIncomeTrendPointDto[];
last7Days: FinanceOverviewIncomeTrendPointDto[];
}
/** 利润趋势点。 */
export interface FinanceOverviewProfitTrendPointDto {
costAmount: number;
date: string;
dateLabel: string;
netProfitAmount: number;
revenueAmount: number;
}
/** 利润趋势数据。 */
export interface FinanceOverviewProfitTrendDto {
last30Days: FinanceOverviewProfitTrendPointDto[];
last7Days: FinanceOverviewProfitTrendPointDto[];
}
/** 收入构成项。 */
export interface FinanceOverviewIncomeCompositionItemDto {
amount: number;
channel: 'delivery' | 'dine_in' | 'pickup';
channelText: string;
percentage: number;
}
/** 收入构成数据。 */
export interface FinanceOverviewIncomeCompositionDto {
items: FinanceOverviewIncomeCompositionItemDto[];
totalAmount: number;
}
/** 成本构成项。 */
export interface FinanceOverviewCostCompositionItemDto {
amount: number;
category: 'fixed' | 'food' | 'labor' | 'packaging' | 'platform';
categoryText: string;
percentage: number;
}
/** 成本构成数据。 */
export interface FinanceOverviewCostCompositionDto {
items: FinanceOverviewCostCompositionItemDto[];
totalAmount: number;
}
/** TOP 商品项。 */
export interface FinanceOverviewTopProductItemDto {
percentage: number;
productName: string;
rank: number;
revenueAmount: number;
salesQuantity: number;
}
/** TOP 商品排行。 */
export interface FinanceOverviewTopProductDto {
items: FinanceOverviewTopProductItemDto[];
periodDays: number;
}
/** 财务概览驾驶舱数据。 */
export interface FinanceOverviewDashboardDto {
actualReceived: FinanceOverviewKpiCardDto;
costComposition: FinanceOverviewCostCompositionDto;
dimension: FinanceOverviewDimension;
incomeComposition: FinanceOverviewIncomeCompositionDto;
incomeTrend: FinanceOverviewIncomeTrendDto;
netIncome: FinanceOverviewKpiCardDto;
profitTrend: FinanceOverviewProfitTrendDto;
refundAmount: FinanceOverviewKpiCardDto;
storeId?: string;
todayRevenue: FinanceOverviewKpiCardDto;
topProducts: FinanceOverviewTopProductDto;
withdrawableBalance: FinanceOverviewKpiCardDto;
}
/** 查询财务概览驾驶舱。 */
export async function getFinanceOverviewDashboardApi(
params: FinanceOverviewDashboardQuery,
) {
return requestClient.get<FinanceOverviewDashboardDto>(
'/finance/overview/dashboard',
{ params },
);
}

View File

@@ -46,6 +46,8 @@ export interface StoreOtherFeesDto {
export interface StoreFeesSettingsDto {
/** 基础配送费 */
baseDeliveryFee: number;
/** 平台服务费率(% */
platformServiceRate: number;
/** 固定包装费 */
fixedPackagingFee: number;
/** 免配送费门槛,空值表示关闭 */
@@ -70,6 +72,8 @@ export interface StoreFeesSettingsDto {
export interface SaveStoreFeesSettingsParams {
/** 基础配送费 */
baseDeliveryFee: number;
/** 平台服务费率(% */
platformServiceRate: number;
/** 固定包装费 */
fixedPackagingFee: number;
/** 免配送费门槛,空值表示关闭 */