diff --git a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue index 9841e96b..cca94a6c 100644 --- a/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue +++ b/ecom-dmb-frontend/apps/web-antd/src/views/ecommerce/shop/overview/index.vue @@ -7,7 +7,14 @@ import type { OrderStatusVO } from '#/api/ecommerce/order-status/types'; import type { ShopDTO, ShopVO } from '#/api/ecommerce/shop/types'; import type { PageQueryDTO } from '#/types/common'; -import { computed, onActivated, onMounted, ref, watch } from 'vue'; +import { + computed, + onActivated, + onMounted, + onUnmounted, + ref, + watch, +} from 'vue'; import { useRoute, useRouter } from 'vue-router'; import { Page } from '@vben/common-ui'; @@ -321,6 +328,7 @@ const renderTrendChartData = () => { 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%', @@ -331,25 +339,48 @@ const renderTrendChartData = () => { }, tooltip: { trigger: 'axis', - backgroundColor: '#fff', - textStyle: { color: '#000' }, + 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: '#e2e8f0' } }, + axisLine: { + lineStyle: { + color: isDark ? 'hsl(240deg 3.7% 22%)' : '#e2e8f0', + }, + }, }, yAxis: [ { type: 'value', name: '销售额', - splitLine: { lineStyle: { type: 'dashed' } }, + 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 }, }, ], @@ -712,6 +743,18 @@ onMounted(async () => { await refreshOverviewByCurrentParams(true); await fetchOrderStatusOptions(); refreshOrderGrid(); + + // 监听深色模式切换,重新渲染图表 + const darkObserver = new MutationObserver(() => { + if (overviewData.value) { + renderTrendChartData(); + } + }); + darkObserver.observe(document.documentElement, { + attributes: true, + attributeFilter: ['class'], + }); + onUnmounted(() => darkObserver.disconnect()); }); onActivated(async () => { @@ -724,10 +767,10 @@ onActivated(async () => { @@ -737,9 +780,9 @@ onActivated(async () => {
- 税率 + 税率 { :step="0.01" :precision="2" size="small" - class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 !text-sm !font-bold" + class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 dark:!bg-[hsl(240deg_3.7%_22%/30%)] dark:bg-[hsl(222.34deg_10.43%_12.27%)] !text-sm !font-bold" :formatter="formatTaxRate" :parser="parseTaxRate" />
-
+
- 自定义日期 + 自定义日期 {
店铺销售总额 增长率 {{ formatPercent(overviewData.monthOverMonthGrowth) }}
-
+
{{ overviewData?.totalSalesAmount ? formatAmount(overviewData.totalSalesAmount) @@ -858,10 +901,10 @@ onActivated(async () => {
- 销售额目标达成 - + 销售额目标达成 + {{ formatPercentPlain(overviewData.salesAmountAchievementRate) }} @@ -871,25 +914,25 @@ onActivated(async () => {
订单总量与达成
-
+
{{ overviewData?.totalOrderCount?.toLocaleString('zh-CN') || '-' }} - 单 + 单
目标: @@ -920,23 +963,23 @@ onActivated(async () => {
投资回报率 (ROI)
-
+
{{ overviewData?.totalROI?.toFixed(2) || '-' }}
- 平均费比 - + 平均费比 + {{ formatPercentPlain(overviewData.averageFeeRatio) }}
@@ -945,14 +988,14 @@ onActivated(async () => {
店铺总净利润 (税后)
-
+
{{ overviewData?.totalNetProfitAfterTax ? formatAmount(overviewData.totalNetProfitAfterTax) @@ -961,7 +1004,7 @@ onActivated(async () => {
已扣除 {{ (taxRate * 100).toFixed(0) }}% 税额 -{{ formatAmount(overviewData.totalTaxAmount) }} @@ -973,9 +1016,9 @@ onActivated(async () => {
-

+

销售额与单量趋势分析

@@ -985,15 +1028,15 @@ onActivated(async () => {
-

+

财务损益全维度 (P&L)

-
- 推广费总支出 - +
+ 推广费总支出 + {{ overviewData?.totalPromotionFee ? `-${formatAmount(overviewData.totalPromotionFee)}` @@ -1001,9 +1044,9 @@ onActivated(async () => { }}
-
- 客单价 (AOV) - +
+ 客单价 (AOV) + {{ overviewData?.totalSalesAmount && overviewData?.totalOrderCount @@ -1015,9 +1058,9 @@ onActivated(async () => { }}
-
- 总税后盈亏 (Profit) - +
+ 总税后盈亏 (Profit) + {{ overviewData?.totalProfitAfterTax ? formatAmount(overviewData.totalProfitAfterTax) @@ -1026,10 +1069,10 @@ onActivated(async () => {
-
+
- 销售额 {{ (taxRate * 100).toFixed(0) }}% 税额 - + 销售额 {{ (taxRate * 100).toFixed(0) }}% 税额 + {{ overviewData?.totalTaxAmount ? formatAmount(overviewData.totalTaxAmount) @@ -1038,15 +1081,15 @@ onActivated(async () => {
- 较上月同期增长 - + 较上月同期增长 + {{ formatPercent(overviewData?.monthOverMonthGrowth) }}

@@ -1068,22 +1111,22 @@ onActivated(async () => {

-

+

核心商品多维度损益对比表

-

+

横向对比各商品规模、成本及 ROI 效率