refactor: 统一字段命名从 *Comparisons 改为 *Summary

后端:
- CompanyOverviewVO: shopComparisons -> shopSummary, categoryComparisons -> categorySummary
- ShopOverviewStatisticsVO: ProductComparison/CategoryComparison -> ProductSummary/CategorySummary
- CompanyOverviewServiceImpl/ShopOverviewStatisticsServiceImpl: 方法和变量重命名
- CategoryExportExcelServiceImpl, ShopExportServiceImpl: 类型引用更新

前端:
- store-overview/types/types.vo.ts: 接口重命名 ShopSummary/CategorySummary
- shop/types/types.vo.ts: 接口重命名 ProductSummary/CategorySummary
- 组件 props 从 shopComparisons/categoryComparisons 改为 shopSummary/categorySummary
- 修复 ShopComparisonTable 导出类型引用

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
小蟑螂
2026-05-08 02:10:21 +08:00
co-authored by Claude Opus 4.7
parent 499881514e
commit 7761667904
14 changed files with 217 additions and 217 deletions
@@ -113,7 +113,7 @@ export namespace ShopVO {
}
/** 商品汇总数据 */
export interface ProductComparison {
export interface ProductSummary {
/** 商品ID */
productId: number;
/** 商品名称 */
@@ -153,7 +153,7 @@ export namespace ShopVO {
}
/** 品类汇总数据 */
export interface CategoryComparison {
export interface CategorySummary {
/** 品类ID */
categoryId: number;
/** 品类名称 */
@@ -209,17 +209,17 @@ export namespace ShopVO {
/** 商品概览(含合计行和商品列表) */
export interface ProductOverview {
/** 合计行 */
total: ProductComparison;
total: ProductSummary;
/** 各商品汇总列表 */
products: ProductComparison[];
products: ProductSummary[];
}
/** 品类概览(含合计行和品类列表) */
export interface CategoryOverview {
/** 合计行 */
total: CategoryComparison;
total: CategorySummary;
/** 各品类汇总列表 */
categories: CategoryComparison[];
categories: CategorySummary[];
}
// ========== 店铺详情看板 ==========
@@ -28,9 +28,9 @@ export namespace CompanyOverviewVO {
/** 单量趋势分析 */
orderCountTrend?: TrendData;
/** 多店铺数据横向汇总 */
shopComparisons?: ShopOverview;
shopSummary?: ShopOverview;
/** 多品类数据横向汇总 */
categoryComparisons?: CategoryOverview;
categorySummary?: CategoryOverview;
/** 平台维度概览(包含合计行和平台列表) */
platformSummary?: PlatformOverview;
/** 汇总ROI */
@@ -90,7 +90,7 @@ export namespace CompanyOverviewVO {
}
/** 店铺汇总数据(16维度) */
export interface ShopComparison {
export interface ShopSummary {
/** 店铺ID */
shopId: number;
/** 店铺名称 */
@@ -138,7 +138,7 @@ export namespace CompanyOverviewVO {
}
/** 品类汇总数据 */
export interface CategoryComparison {
export interface CategorySummary {
/** 品类ID(未分配为null) */
categoryId?: number;
/** 品类名称(未分配为"未分配品类") */
@@ -232,16 +232,16 @@ export namespace CompanyOverviewVO {
/** 多店铺概览 */
export interface ShopOverview {
/** 合计行 */
total: ShopComparison;
total: ShopSummary;
/** 各店铺汇总列表 */
shops: ShopComparison[];
shops: ShopSummary[];
}
/** 多品类概览 */
export interface CategoryOverview {
/** 合计行 */
total: CategoryComparison;
total: CategorySummary;
/** 各品类汇总列表 */
categories: CategoryComparison[];
categories: CategorySummary[];
}
}
@@ -15,7 +15,7 @@ import {
defineOptions({ name: 'CategoryComparisonTable' });
interface Props {
categoryComparisons?: CompanyOverviewVO.CategoryOverview;
categorySummary?: CompanyOverviewVO.CategoryOverview;
taxRate: number;
categoryExportMode?: boolean;
selectedExportCategoryIds?: number[];
@@ -35,7 +35,7 @@ const props = withDefaults(defineProps<Props>(), {
const emit = defineEmits<Emits>();
const allCategoriesSelected = computed(() => {
const total = props.categoryComparisons?.categories?.length || 0;
const total = props.categorySummary?.categories?.length || 0;
return total > 0 && props.selectedExportCategoryIds.length === total;
});
@@ -122,7 +122,7 @@ const cellRoi = (v: number | null | undefined) =>
'update:selectedExportCategoryIds',
allCategoriesSelected
? []
: (categoryComparisons?.categories ?? []).map((c) => c.categoryId!)
: (categorySummary?.categories ?? []).map((c) => c.categoryId!)
)
"
/>
@@ -210,7 +210,7 @@ const cellRoi = (v: number | null | undefined) =>
</thead>
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
<tr
v-for="cat in (categoryComparisons?.categories || [])"
v-for="cat in (categorySummary?.categories || [])"
:key="cat.categoryId ?? 'uncategorized'"
class="transition-colors hover:bg-blue-50/50 dark:hover:bg-[hsl(217.2deg_32.6%_17.5%/30%)] dark:bg-[hsl(217.2deg_32.6%_17.5%/50%)]"
>
@@ -274,39 +274,39 @@ const cellRoi = (v: number | null | undefined) =>
{{ cellMoney(cat.profitAfterTax) }}
</td>
</tr>
<tr v-if="!categoryComparisons?.categories?.length">
<tr v-if="!categorySummary?.categories?.length">
<td :colspan="categoryExportMode ? 18 : 17" class="p-8 text-center text-gray-400">
暂无数据
</td>
</tr>
</tbody>
<!-- 合计行 -->
<tfoot v-if="categoryComparisons?.total" class="bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)]">
<tfoot v-if="categorySummary?.total" class="bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)]">
<tr class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
<td class="p-6 text-base">合计</td>
<!-- 规模 -->
<td class="p-6">{{ cellMoney(categoryComparisons?.total?.salesAmount) }}</td>
<td class="p-6">{{ formatIntCell(categoryComparisons?.total?.orderCount) }}</td>
<td class="p-6">{{ cellMoney(categorySummary?.total?.salesAmount) }}</td>
<td class="p-6">{{ formatIntCell(categorySummary?.total?.orderCount) }}</td>
<td class="p-6">
{{ cellMoney(categoryComparisons?.total?.averageOrderValue) }}
{{ cellMoney(categorySummary?.total?.averageOrderValue) }}
</td>
<!-- 成本 -->
<td class="p-6">{{ cellMoney(categoryComparisons?.total?.productCost) }}</td>
<td class="p-6">{{ cellMoney(categoryComparisons?.total?.shippingCost) }}</td>
<td class="p-6">{{ cellMoney(categoryComparisons?.total?.otherCost) }}</td>
<td class="p-6 font-bold text-orange-800 dark:text-orange-300">{{ cellMoney(categoryComparisons?.total?.totalCost) }}</td>
<td class="p-6 text-rose-600 dark:text-rose-400">{{ cellMoney(categoryComparisons?.total?.refundAmount) }}</td>
<td class="p-6">{{ cellMoney(categoryComparisons?.total?.totalPromotionFee) }}</td>
<td class="p-6 text-orange-600 dark:text-orange-400">{{ cellMoney(categoryComparisons?.total?.brushFee) }}</td>
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ categoryComparisons?.total?.feeRatio !== undefined ? formatFeeRatioPercent(categoryComparisons?.total?.feeRatio) : '-' }}</td>
<td class="p-6">{{ cellMoney(categorySummary?.total?.productCost) }}</td>
<td class="p-6">{{ cellMoney(categorySummary?.total?.shippingCost) }}</td>
<td class="p-6">{{ cellMoney(categorySummary?.total?.otherCost) }}</td>
<td class="p-6 font-bold text-orange-800 dark:text-orange-300">{{ cellMoney(categorySummary?.total?.totalCost) }}</td>
<td class="p-6 text-rose-600 dark:text-rose-400">{{ cellMoney(categorySummary?.total?.refundAmount) }}</td>
<td class="p-6">{{ cellMoney(categorySummary?.total?.totalPromotionFee) }}</td>
<td class="p-6 text-orange-600 dark:text-orange-400">{{ cellMoney(categorySummary?.total?.brushFee) }}</td>
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ categorySummary?.total?.feeRatio !== undefined ? formatFeeRatioPercent(categorySummary?.total?.feeRatio) : '-' }}</td>
<!-- 盈利 -->
<td class="p-6">{{ cellMoney(categoryComparisons?.total?.totalProfitBeforeTax) }}</td>
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ cellMoney(categoryComparisons?.total?.salesTaxAmount) }}</td>
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(categoryComparisons?.total?.roi) }}</td>
<td class="p-6">{{ cellMoney(categorySummary?.total?.totalProfitBeforeTax) }}</td>
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ cellMoney(categorySummary?.total?.salesTaxAmount) }}</td>
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(categorySummary?.total?.roi) }}</td>
<td
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
:class="(categoryComparisons?.total?.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-700 dark:text-emerald-300'"
>{{ cellMoney(categoryComparisons?.total?.profitAfterTax) }}</td>
:class="(categorySummary?.total?.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-700 dark:text-emerald-300'"
>{{ cellMoney(categorySummary?.total?.profitAfterTax) }}</td>
</tr>
</tfoot>
</table>
@@ -16,10 +16,10 @@ interface Props {
platformSummary?: CompanyOverviewVO.PlatformOverview;
platformExportMode: boolean;
selectedExportPlatformIds: number[];
shopComparisons?: CompanyOverviewVO.ShopOverview;
shopSummary?: CompanyOverviewVO.ShopOverview;
shopExportMode: boolean;
selectedExportShopIds: number[];
categoryComparisons?: CompanyOverviewVO.CategoryOverview;
categorySummary?: CompanyOverviewVO.CategoryOverview;
categoryExportMode: boolean;
selectedExportCategoryIds: number[];
}
@@ -83,7 +83,7 @@ const modeOptions = [
<ShopComparisonTable
v-if="activeMode === 'shop'"
:shop-comparisons="props.shopComparisons"
:shop-summary="props.shopSummary"
:tax-rate="props.taxRate"
:shop-export-mode="props.shopExportMode"
:selected-export-shop-ids="props.selectedExportShopIds"
@@ -97,7 +97,7 @@ const modeOptions = [
<CategoryComparisonTable
v-if="activeMode === 'category'"
:category-comparisons="props.categoryComparisons"
:category-summary="props.categorySummary"
:tax-rate="props.taxRate"
:category-export-mode="props.categoryExportMode"
:selected-export-category-ids="props.selectedExportCategoryIds"
@@ -11,7 +11,7 @@ defineOptions({ name: 'ShopCharts' });
interface Props {
shopSalesRatios?: CompanyOverviewVO.ShopSalesRatio[];
shopComparisons?: CompanyOverviewVO.ShopOverview;
shopSummary?: CompanyOverviewVO.ShopOverview;
salesAmountTrend?: CompanyOverviewVO.TrendData;
orderCountTrend?: CompanyOverviewVO.TrendData;
}
@@ -15,7 +15,7 @@ import {
defineOptions({ name: 'ShopComparisonTable' });
interface Props {
shopComparisons?: CompanyOverviewVO.ShopOverview;
shopSummary?: CompanyOverviewVO.ShopOverview;
taxRate: number;
shopExportMode: boolean;
selectedExportShopIds: number[];
@@ -32,7 +32,7 @@ const props = defineProps<Props>();
const emit = defineEmits<Emits>();
const allShopsSelected = computed(() => {
const total = props.shopComparisons?.shops?.length || 0;
const total = props.shopSummary?.shops?.length || 0;
return total > 0 && props.selectedExportShopIds.length === total;
});
const someShopsSelected = computed(() => {
@@ -122,7 +122,7 @@ const cellRoi = (v: number | null | undefined) =>
if ((e.target as HTMLInputElement).checked) {
emit(
'update:selectedExportShopIds',
shopComparisons?.shops?.map((s) => s.shopId) || [],
shopSummary?.shops?.map((s) => s.shopId) || [],
);
} else {
emit('update:selectedExportShopIds', []);
@@ -247,7 +247,7 @@ const cellRoi = (v: number | null | undefined) =>
</thead>
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
<tr
v-for="shop in (shopComparisons?.shops || [])"
v-for="shop in (shopSummary?.shops || [])"
:key="shop.shopId"
class="transition-colors hover:bg-blue-50/50 dark:hover:bg-[hsl(217.2deg_32.6%_17.5%/30%)] dark:bg-[hsl(217.2deg_32.6%_17.5%/50%)]"
>
@@ -355,56 +355,56 @@ const cellRoi = (v: number | null | undefined) =>
{{ cellMoney(shop.profitAfterTax) }}
</td>
</tr>
<tr v-if="!shopComparisons?.shops?.length">
<tr v-if="!shopSummary?.shops?.length">
<td :colspan="shopExportMode ? 22 : 21" class="p-8 text-center text-gray-400">
暂无数据
</td>
</tr>
</tbody>
<!-- 合计行 -->
<tfoot v-if="shopComparisons?.total" class="bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)]">
<tfoot v-if="shopSummary?.total" class="bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)]">
<tr class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
<td class="p-6 text-base" :class="shopExportMode ? 'border-l-0' : ''">合计</td>
<!-- 目标 -->
<td class="p-6">{{ formatIntCell(shopComparisons?.total?.targetOrderCount) }}</td>
<td class="p-6">{{ formatIntCell(shopSummary?.total?.targetOrderCount) }}</td>
<td class="p-6 text-blue-600 dark:text-blue-400">
{{
shopComparisons?.total?.orderCountAchievementRate !== undefined
? formatPercentPlain(shopComparisons?.total?.orderCountAchievementRate)
shopSummary?.total?.orderCountAchievementRate !== undefined
? formatPercentPlain(shopSummary?.total?.orderCountAchievementRate)
: '-'
}}
</td>
<td class="p-6">{{ cellMoney(shopComparisons?.total?.targetAmount) }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.targetAmount) }}</td>
<td class="p-6 text-blue-600 dark:text-blue-400">
{{
shopComparisons?.total?.salesAmountAchievementRate !== undefined
? formatPercentPlain(shopComparisons?.total?.salesAmountAchievementRate)
shopSummary?.total?.salesAmountAchievementRate !== undefined
? formatPercentPlain(shopSummary?.total?.salesAmountAchievementRate)
: '-'
}}
</td>
<!-- 规模 -->
<td class="p-6">{{ cellMoney(shopComparisons?.total?.salesAmount) }}</td>
<td class="p-6">{{ formatIntCell(shopComparisons?.total?.orderCount) }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.salesAmount) }}</td>
<td class="p-6">{{ formatIntCell(shopSummary?.total?.orderCount) }}</td>
<td class="p-6">
{{ cellMoney(shopComparisons?.total?.averageOrderValue) }}
{{ cellMoney(shopSummary?.total?.averageOrderValue) }}
</td>
<!-- 成本 -->
<td class="p-6">{{ cellMoney(shopComparisons?.total?.productCost) }}</td>
<td class="p-6">{{ cellMoney(shopComparisons?.total?.shippingCost) }}</td>
<td class="p-6">{{ cellMoney(shopComparisons?.total?.otherCost) }}</td>
<td class="p-6 font-bold text-orange-800 dark:text-orange-300">{{ cellMoney(shopComparisons?.total?.totalCost) }}</td>
<td class="p-6 text-rose-600 dark:text-rose-400">{{ cellMoney(shopComparisons?.total?.refundAmount) }}</td>
<td class="p-6">{{ cellMoney(shopComparisons?.total?.totalPromotionFee) }}</td>
<td class="p-6 text-orange-600 dark:text-orange-400">{{ cellMoney(shopComparisons?.total?.brushFee) }}</td>
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ shopComparisons?.total?.feeRatio !== undefined ? formatFeeRatioPercent(shopComparisons?.total?.feeRatio) : '-' }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.productCost) }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.shippingCost) }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.otherCost) }}</td>
<td class="p-6 font-bold text-orange-800 dark:text-orange-300">{{ cellMoney(shopSummary?.total?.totalCost) }}</td>
<td class="p-6 text-rose-600 dark:text-rose-400">{{ cellMoney(shopSummary?.total?.refundAmount) }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.totalPromotionFee) }}</td>
<td class="p-6 text-orange-600 dark:text-orange-400">{{ cellMoney(shopSummary?.total?.brushFee) }}</td>
<td class="p-6 text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ shopSummary?.total?.feeRatio !== undefined ? formatFeeRatioPercent(shopSummary?.total?.feeRatio) : '-' }}</td>
<!-- 盈利 -->
<td class="p-6">{{ cellMoney(shopComparisons?.total?.totalProfitBeforeTax) }}</td>
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ cellMoney(shopComparisons?.total?.salesTaxAmount) }}</td>
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(shopComparisons?.total?.roi) }}</td>
<td class="p-6">{{ cellMoney(shopSummary?.total?.totalProfitBeforeTax) }}</td>
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ cellMoney(shopSummary?.total?.salesTaxAmount) }}</td>
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ cellRoi(shopSummary?.total?.roi) }}</td>
<td
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
:class="(shopComparisons?.total?.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-700 dark:text-emerald-300'"
>{{ cellMoney(shopComparisons?.total?.profitAfterTax) }}</td>
:class="(shopSummary?.total?.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-700 dark:text-emerald-300'"
>{{ cellMoney(shopSummary?.total?.profitAfterTax) }}</td>
</tr>
</tfoot>
</table>
@@ -325,9 +325,9 @@ const handleExportCompanyOverview = async () => {
exportLoading.value = true;
const [startDate, endDate] = dateRange.value;
let dataToExport: CompanyOverviewVO.ShopComparison[] = [];
if (overviewData.value?.shopComparisons) {
const shops = overviewData.value.shopComparisons.shops;
let dataToExport: CompanyOverviewVO.ShopSummary[] = [];
if (overviewData.value?.shopSummary) {
const shops = overviewData.value.shopSummary.shops;
dataToExport =
selectedExportShopIds.value.length > 0
? shops.filter((s) =>
@@ -554,7 +554,7 @@ const navigateToShopOverview = (shopId: number) => {
<ShopCharts
ref="shopChartsRef"
:shop-sales-ratios="overviewData?.shopSalesRatios"
:shop-comparisons="overviewData?.shopComparisons"
:shop-summary="overviewData?.shopSummary"
:sales-amount-trend="overviewData?.salesAmountTrend"
:order-count-trend="overviewData?.orderCountTrend"
/>
@@ -565,10 +565,10 @@ const navigateToShopOverview = (shopId: number) => {
:platform-summary="overviewData?.platformSummary"
:platform-export-mode="platformExportMode"
:selected-export-platform-ids="selectedExportPlatformIds"
:shop-comparisons="overviewData?.shopComparisons"
:shop-summary="overviewData?.shopSummary"
:shop-export-mode="shopExportMode"
:selected-export-shop-ids="selectedExportShopIds"
:category-comparisons="overviewData?.categoryComparisons"
:category-summary="overviewData?.categorySummary"
:category-export-mode="categoryExportMode"
:selected-export-category-ids="selectedExportCategoryIds"
@update:selected-export-platform-ids="(ids) => (selectedExportPlatformIds = ids)"
@@ -252,7 +252,7 @@ const handleCategorySelectAllChange = (event: Event) => {
const target = event.target as HTMLInputElement | null;
if (!target) return;
selectedExportCategoryIds.value = target.checked
? (overviewData.value?.categoryOverview?.categories?.map((c: ShopVO.CategoryComparison) => c.categoryId) ?? [])
? (overviewData.value?.categoryOverview?.categories?.map((c: ShopVO.CategorySummary) => c.categoryId) ?? [])
: [];
};