mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 06:29:20 +08:00
feat: 移除 BI Overview 旧趋势字段,统一使用 dealTrend
This commit is contained in:
@@ -16,8 +16,6 @@ export namespace CompanyOverviewVO {
|
||||
totalTaxAmount?: number;
|
||||
shopSalesRatios?: ShopSalesRatio[];
|
||||
shopEfficiencyQuadrants?: ShopEfficiencyQuadrant[];
|
||||
salesAmountTrend?: TrendData;
|
||||
orderCountTrend?: TrendData;
|
||||
shopSummary?: ShopOverview;
|
||||
categorySummary?: CategoryOverview;
|
||||
platformSummary?: PlatformOverview;
|
||||
@@ -29,17 +27,6 @@ export namespace CompanyOverviewVO {
|
||||
salesAmountAchievementRate?: number;
|
||||
}
|
||||
|
||||
export interface TrendData {
|
||||
total?: number;
|
||||
dailyDataList?: TrendDataItem[];
|
||||
}
|
||||
|
||||
export interface TrendDataItem {
|
||||
/** yyyy-MM-dd */
|
||||
date?: string;
|
||||
value?: number;
|
||||
}
|
||||
|
||||
export interface ShopSalesRatio {
|
||||
shopId?: number;
|
||||
shopName?: string;
|
||||
|
||||
@@ -68,18 +68,6 @@ export namespace CategoryOverviewVO {
|
||||
products: ProductSummary[];
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendDataItem {
|
||||
date: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendData {
|
||||
total: number;
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
export interface Overview {
|
||||
categoryId: number;
|
||||
categoryName: string;
|
||||
@@ -109,10 +97,6 @@ export namespace CategoryOverviewVO {
|
||||
totalProfitBeforeTax?: number;
|
||||
|
||||
productSalesTop10?: ProductSalesRankItem[];
|
||||
/** @deprecated */
|
||||
salesAmountTrend?: TrendData;
|
||||
/** @deprecated */
|
||||
orderCountTrend?: TrendData;
|
||||
productOverview?: ProductOverview;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,18 +96,6 @@ export namespace PlatformOverviewVO {
|
||||
categories: CategorySummary[];
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendDataItem {
|
||||
date: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendData {
|
||||
total: number;
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
export interface Overview {
|
||||
platformCode: string;
|
||||
platformName: string;
|
||||
@@ -137,10 +125,6 @@ export namespace PlatformOverviewVO {
|
||||
totalProfitBeforeTax?: number;
|
||||
|
||||
productSalesTop10?: ProductSalesRankItem[];
|
||||
/** @deprecated */
|
||||
salesAmountTrend?: TrendData;
|
||||
/** @deprecated */
|
||||
orderCountTrend?: TrendData;
|
||||
productOverview?: ProductOverview;
|
||||
categoryOverview?: CategoryOverview;
|
||||
}
|
||||
|
||||
@@ -30,18 +30,6 @@ export namespace ProductOverviewVO {
|
||||
pct?: number;
|
||||
}
|
||||
|
||||
/** @deprecated 旧趋势结构,优先用 dealTrend */
|
||||
export interface TrendDataItem {
|
||||
date: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendData {
|
||||
total: number;
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
export interface SkuSalesRankItem {
|
||||
skuId?: number;
|
||||
skuName?: string;
|
||||
@@ -118,10 +106,6 @@ export namespace ProductOverviewVO {
|
||||
totalROI?: number;
|
||||
|
||||
specSalesTop10?: SkuSalesRankItem[];
|
||||
/** @deprecated */
|
||||
salesAmountTrend?: TrendData;
|
||||
/** @deprecated */
|
||||
orderCountTrend?: TrendData;
|
||||
specSummaries?: SkuSummary;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,10 +201,6 @@ export namespace ShopVO {
|
||||
totalProfitBeforeTax?: number;
|
||||
/** 各商品按单量排序的销量 Top10 */
|
||||
productSalesTop10?: ProductSalesRankItem[];
|
||||
/** @deprecated 使用 dealTrend */
|
||||
salesAmountTrend?: TrendData;
|
||||
/** @deprecated 使用 dealTrend */
|
||||
orderCountTrend?: TrendData;
|
||||
/** 多商品数据横向汇总(含合计行) */
|
||||
productOverview?: ProductOverview;
|
||||
/** 品类多维度数据汇总(含合计行) */
|
||||
@@ -310,22 +306,6 @@ export namespace ShopVO {
|
||||
roi?: number;
|
||||
}
|
||||
|
||||
/** 趋势数据 */
|
||||
export interface TrendData {
|
||||
/** 时间范围的总值 */
|
||||
total: number;
|
||||
/** 每日数据列表 */
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
/** 趋势数据项 */
|
||||
export interface TrendDataItem {
|
||||
/** 日期 */
|
||||
date: string;
|
||||
/** 对应的值 */
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** 商品概览(含合计行和商品列表) */
|
||||
export interface ProductOverview {
|
||||
/** 合计行 */
|
||||
|
||||
@@ -24,18 +24,6 @@ export namespace SkuOverviewVO {
|
||||
refundYuan?: number;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendDataItem {
|
||||
date: string;
|
||||
value: number;
|
||||
}
|
||||
|
||||
/** @deprecated */
|
||||
export interface TrendData {
|
||||
total: number;
|
||||
dailyDataList: TrendDataItem[];
|
||||
}
|
||||
|
||||
export interface Overview {
|
||||
skuId: number;
|
||||
skuName?: string;
|
||||
@@ -61,10 +49,5 @@ export namespace SkuOverviewVO {
|
||||
refundAmount?: number;
|
||||
averageOrderValue?: number;
|
||||
totalProfitBeforeTax?: number;
|
||||
|
||||
/** @deprecated */
|
||||
salesAmountTrend?: TrendData;
|
||||
/** @deprecated */
|
||||
orderCountTrend?: TrendData;
|
||||
}
|
||||
}
|
||||
|
||||
+705
-248
File diff suppressed because it is too large
Load Diff
-176
@@ -1,176 +0,0 @@
|
||||
<script lang="ts" setup>
|
||||
import type { EchartsUIType } from '@vben/plugins/echarts';
|
||||
|
||||
import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { onMounted, onUnmounted, ref, watch } from 'vue';
|
||||
|
||||
interface Props {
|
||||
data: {
|
||||
salesAmountTrend?: {
|
||||
dailyDataList: { date: string; value: number }[];
|
||||
};
|
||||
orderCountTrend?: {
|
||||
dailyDataList: { date: string; value: number }[];
|
||||
};
|
||||
} | null;
|
||||
}
|
||||
|
||||
const props = defineProps<Props>();
|
||||
|
||||
const trendChartRef = ref<EchartsUIType>();
|
||||
const { renderEcharts: renderTrendChart } = useEcharts(trendChartRef);
|
||||
|
||||
const renderChart = () => {
|
||||
if (!trendChartRef.value || !props.data) return;
|
||||
|
||||
const salesTrend = props.data.salesAmountTrend;
|
||||
const orderTrend = props.data.orderCountTrend;
|
||||
|
||||
if (!salesTrend || !orderTrend) return;
|
||||
|
||||
const dates = salesTrend.dailyDataList.map((item) =>
|
||||
dayjs(item.date).format('MM-DD'),
|
||||
);
|
||||
const salesData = salesTrend.dailyDataList.map((item) => item.value);
|
||||
const orderData = orderTrend.dailyDataList.map((item) => item.value);
|
||||
|
||||
const isDark = document.documentElement.classList.contains('dark');
|
||||
renderTrendChart({
|
||||
grid: {
|
||||
left: '3%',
|
||||
right: '3%',
|
||||
bottom: '3%',
|
||||
top: '5%',
|
||||
containLabel: true,
|
||||
},
|
||||
tooltip: {
|
||||
trigger: 'axis',
|
||||
backgroundColor: isDark ? 'hsl(222.34deg 10.43% 12.27%)' : '#fff',
|
||||
textStyle: {
|
||||
color: isDark ? 'hsl(0deg 0% 95%)' : '#000',
|
||||
},
|
||||
},
|
||||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: dates,
|
||||
axisLine: {
|
||||
lineStyle: {
|
||||
color: isDark ? 'hsl(240deg 3.7% 22%)' : '#e2e8f0',
|
||||
},
|
||||
},
|
||||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'value',
|
||||
name: '销售额',
|
||||
nameTextStyle: {
|
||||
color: isDark ? 'hsl(240deg 5% 64.9%)' : undefined,
|
||||
},
|
||||
axisLabel: {
|
||||
color: isDark ? 'hsl(240deg 5% 64.9%)' : undefined,
|
||||
},
|
||||
splitLine: {
|
||||
lineStyle: {
|
||||
type: 'dashed',
|
||||
color: isDark ? 'hsl(240deg 3.7% 22%)' : undefined,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'value',
|
||||
name: '单量',
|
||||
position: 'right',
|
||||
nameTextStyle: {
|
||||
color: isDark ? 'hsl(240deg 5% 64.9%)' : undefined,
|
||||
},
|
||||
axisLabel: {
|
||||
color: isDark ? 'hsl(240deg 5% 64.9%)' : undefined,
|
||||
},
|
||||
splitLine: { show: false },
|
||||
},
|
||||
],
|
||||
series: [
|
||||
{
|
||||
name: '销售额',
|
||||
type: 'line',
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { width: 3, color: '#3b82f6' },
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: 'rgba(59, 130, 246, 0.4)' },
|
||||
{ offset: 1, color: 'rgba(59, 130, 246, 0)' },
|
||||
],
|
||||
},
|
||||
},
|
||||
data: salesData,
|
||||
},
|
||||
{
|
||||
name: '日单量',
|
||||
type: 'line',
|
||||
yAxisIndex: 1,
|
||||
smooth: true,
|
||||
symbol: 'none',
|
||||
lineStyle: { width: 3, color: '#10b981' },
|
||||
areaStyle: {
|
||||
color: {
|
||||
type: 'linear',
|
||||
x: 0,
|
||||
y: 0,
|
||||
x2: 0,
|
||||
y2: 1,
|
||||
colorStops: [
|
||||
{ offset: 0, color: 'rgba(16, 185, 129, 0.2)' },
|
||||
{ offset: 1, color: 'rgba(16, 185, 129, 0)' },
|
||||
],
|
||||
},
|
||||
},
|
||||
data: orderData,
|
||||
},
|
||||
],
|
||||
});
|
||||
};
|
||||
|
||||
watch(
|
||||
() => props.data,
|
||||
() => {
|
||||
if (props.data) {
|
||||
setTimeout(() => renderChart(), 100);
|
||||
}
|
||||
},
|
||||
{ deep: true, immediate: true },
|
||||
);
|
||||
|
||||
onMounted(() => {
|
||||
const darkObserver = new MutationObserver(() => {
|
||||
if (props.data) renderChart();
|
||||
});
|
||||
darkObserver.observe(document.documentElement, {
|
||||
attributes: true,
|
||||
attributeFilter: ['class'],
|
||||
});
|
||||
onUnmounted(() => darkObserver.disconnect());
|
||||
});
|
||||
|
||||
defineExpose({ renderChart });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="rounded-[20px] border border-slate-200/80 dark:border-[hsl(240deg_3.7%_22%)] bg-white/85 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-8 shadow-[0_4px_20px_rgba(0,0,0,0.02)] dark:shadow-none backdrop-blur-[12px] xl:col-span-2">
|
||||
<h3 class="mb-6 text-lg font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
销售额与单量趋势分析
|
||||
</h3>
|
||||
<div class="h-[380px] w-full">
|
||||
<EchartsUI ref="trendChartRef" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user