mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-24 01:59:20 +08:00
fix(frontend): 调整全店概览及店铺概览中成本字段的展示逻辑
- 修正全店概览/店铺概览各表格组件的成本字段渲染逻辑 - 同步注释更新
This commit is contained in:
+4
-1
@@ -268,7 +268,10 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
<td class="p-6">{{ categoryComparisons?.total?.totalProfitBeforeTax ? formatAmount(categoryComparisons?.total?.totalProfitBeforeTax) : '-' }}</td>
|
||||
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ categoryComparisons?.total?.salesTaxAmount ? formatAmount(categoryComparisons?.total?.salesTaxAmount) : '-' }}</td>
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ categoryComparisons?.total?.roi?.toFixed(2) || '-' }}</td>
|
||||
<td class="bg-emerald-100 dark:bg-emerald-900/30 p-6 text-base text-emerald-600">{{ categoryComparisons?.total?.profitAfterTax ? formatAmount(categoryComparisons?.total?.profitAfterTax) : '-' }}</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'"
|
||||
>{{ categoryComparisons?.total?.profitAfterTax ? formatAmount(categoryComparisons?.total?.profitAfterTax) : '-' }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
+3
-2
@@ -330,8 +330,9 @@ const sortedData = computed(() => {
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">
|
||||
{{ totalData.roi !== undefined ? totalData.roi.toFixed(2) : '-' }}
|
||||
</td>
|
||||
<td class="bg-emerald-100 dark:bg-emerald-900/30 p-6 text-base"
|
||||
:class="(totalData.profitAfterTax ?? 0) >= 0 ? 'text-emerald-600' : 'text-rose-600'"
|
||||
<td
|
||||
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
|
||||
:class="(totalData.profitAfterTax ?? 0) >= 0 ? 'text-emerald-700 dark:text-emerald-300' : 'text-rose-600 dark:text-rose-400'"
|
||||
>
|
||||
{{ totalData.profitAfterTax ? formatAmount(totalData.profitAfterTax) : '-' }}
|
||||
</td>
|
||||
|
||||
+4
-1
@@ -366,7 +366,10 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
<td class="p-6">{{ shopComparisons?.total?.totalProfitBeforeTax ? formatAmount(shopComparisons?.total?.totalProfitBeforeTax) : '-' }}</td>
|
||||
<td class="p-6 italic text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]">{{ shopComparisons?.total?.salesTaxAmount ? formatAmount(shopComparisons?.total?.salesTaxAmount) : '-' }}</td>
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ shopComparisons?.total?.roi !== undefined ? shopComparisons?.total?.roi.toFixed(2) : '-' }}</td>
|
||||
<td class="bg-emerald-100 dark:bg-emerald-900/30 p-6 text-base text-emerald-600">{{ shopComparisons?.total?.profitAfterTax ? formatAmount(shopComparisons?.total?.profitAfterTax) : '-' }}</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'"
|
||||
>{{ shopComparisons?.total?.profitAfterTax ? formatAmount(shopComparisons?.total?.profitAfterTax) : '-' }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
+49
-52
@@ -1,8 +1,6 @@
|
||||
<script lang="ts" setup>
|
||||
import type { ShopVO } from '#/api/ecommerce/shop/types';
|
||||
|
||||
import { Button } from 'ant-design-vue';
|
||||
|
||||
interface Props {
|
||||
data: ShopVO.OverviewStatistics | null;
|
||||
taxRate: number;
|
||||
@@ -33,7 +31,7 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
class="overflow-hidden 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%)] shadow-[0_4px_20px_rgba(0,0,0,0.02)] dark:shadow-none backdrop-blur-[12px]"
|
||||
>
|
||||
<div
|
||||
class="flex items-center justify-between border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] bg-white/40 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-8"
|
||||
class="flex flex-col items-start justify-between gap-4 border-b border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] bg-white/40 dark:bg-[hsl(222.34deg_10.43%_12.27%)] p-8 md:flex-row md:items-center"
|
||||
>
|
||||
<div>
|
||||
<h3 class="text-xl font-black text-slate-800 dark:text-[hsl(0deg_0%_95%)]">
|
||||
@@ -43,62 +41,48 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
当前时间范围内的品类经营数据汇总,支持按品类导出
|
||||
</p>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex items-center gap-3">
|
||||
<template v-if="props.categoryExportMode">
|
||||
<Button
|
||||
class="!rounded-2xl !border !border-slate-300 !bg-white !px-4 !py-2 !text-sm !font-bold !text-slate-700 dark:!border-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(240deg_3.7%_15.9%)] dark:!text-[hsl(240deg_5%_64.9%)]"
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl border border-slate-300 bg-white px-4 py-2 text-sm font-bold text-slate-700 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
:disabled="props.categoryExportLoading"
|
||||
@click="emit('export-toggle', false)"
|
||||
>
|
||||
取消选择
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
class="!h-auto !rounded-2xl !border-none !bg-blue-600 !px-8 !py-3 !text-sm !font-bold !text-white !shadow-xl !shadow-slate-200 dark:!shadow-none !transition-all hover:!scale-105 active:!scale-95"
|
||||
:loading="props.categoryExportLoading"
|
||||
:disabled="props.selectedExportCategoryIds.length === 0"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl bg-blue-600 px-8 py-3 text-sm font-bold text-white shadow-xl shadow-slate-200 transition-all hover:scale-105 active:scale-95 disabled:pointer-events-none disabled:opacity-60 dark:shadow-none"
|
||||
:disabled="props.categoryExportLoading || props.selectedExportCategoryIds.length === 0"
|
||||
@click="emit('export-all')"
|
||||
>
|
||||
导出选中 ({{ props.selectedExportCategoryIds.length }})
|
||||
</Button>
|
||||
导出已选品类 ({{ props.selectedExportCategoryIds.length }})
|
||||
</button>
|
||||
</template>
|
||||
<template v-else>
|
||||
<Button
|
||||
class="!rounded-2xl !border !border-slate-300 !bg-white !px-4 !py-2 !text-sm !font-bold !text-slate-700 dark:!border-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(240deg_3.7%_15.9%)] dark:!text-[hsl(240deg_5%_64.9%)]"
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl border border-slate-300 bg-white px-4 py-2 text-sm font-bold text-slate-700 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%)] dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
:disabled="props.categoryExportLoading"
|
||||
@click="emit('export-toggle', true)"
|
||||
>
|
||||
指定品类导出
|
||||
</Button>
|
||||
<Button
|
||||
type="primary"
|
||||
class="!h-auto !rounded-2xl !border-none !bg-slate-900 !px-8 !py-3 !text-sm !font-black !shadow-xl !shadow-slate-200 dark:!shadow-none !transition-all hover:!scale-105 active:!scale-95"
|
||||
:loading="props.categoryExportLoading"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="rounded-2xl bg-slate-900 px-8 py-3 text-sm font-bold text-white shadow-xl shadow-slate-200 transition-all hover:scale-105 active:scale-95 disabled:pointer-events-none disabled:opacity-60 dark:shadow-none"
|
||||
:disabled="props.categoryExportLoading"
|
||||
@click="emit('export-all')"
|
||||
>
|
||||
导出全部
|
||||
</Button>
|
||||
</button>
|
||||
</template>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="max-h-[580px] overflow-auto">
|
||||
<div class="table-container max-h-[580px] overflow-x-auto overflow-y-auto">
|
||||
<table class="w-full whitespace-nowrap text-left text-sm shop-overview-thead">
|
||||
<colgroup>
|
||||
<col style="width: 60px; min-width: 60px;" />
|
||||
<col style="width: 160px; min-width: 160px;" />
|
||||
<col style="width: 130px; min-width: 130px;" />
|
||||
<col style="width: 100px; min-width: 100px;" />
|
||||
<col style="width: 110px; min-width: 110px;" />
|
||||
<col style="width: 120px; min-width: 120px;" />
|
||||
<col style="width: 100px; min-width: 100px;" />
|
||||
<col style="width: 100px; min-width: 100px;" />
|
||||
<col style="width: 110px; min-width: 110px;" />
|
||||
<col style="width: 110px; min-width: 110px;" />
|
||||
<col style="width: 110px; min-width: 110px;" />
|
||||
<col style="width: 120px; min-width: 120px;" />
|
||||
<col style="width: 130px; min-width: 130px;" />
|
||||
<col style="width: 120px; min-width: 120px;" />
|
||||
<col style="width: 140px; min-width: 140px;" />
|
||||
</colgroup>
|
||||
<thead
|
||||
class="bg-slate-50 text-xs font-black uppercase tracking-tight text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
style="position: sticky; top: 0; z-index: 20;"
|
||||
@@ -145,11 +129,19 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
<th class="border-b px-6 py-4 font-bold text-rose-600 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-rose-400">退款金额</th>
|
||||
<th class="border-b px-6 py-4 dark:bg-[hsl(24deg_9.8%_15%/50%)]">推广费</th>
|
||||
<th class="border-b px-6 py-4 text-orange-600 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-orange-400">刷单费用</th>
|
||||
<th class="border-b border-l dark:border-l-[hsl(240deg_3.7%_22%)] px-6 py-4 text-slate-400 dark:bg-[hsl(24deg_9.8%_15%/50%)] dark:text-[hsl(240deg_5%_64.9%)]">费比 %</th>
|
||||
<th class="border-b px-6 py-4 font-bold dark:bg-[hsl(142deg_71.8%_29%/20%)]">税前盈亏</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500 dark:bg-[hsl(142deg_71.8%_29%/20%)] dark:text-rose-400">{{ (props.taxRate * 100).toFixed(0) }}%税额</th>
|
||||
<th class="border-b px-6 py-4 font-black text-indigo-700 dark:bg-[hsl(142deg_71.8%_29%/20%)] dark:text-indigo-400">ROI</th>
|
||||
<th class="border-b bg-emerald-600 dark:bg-emerald-600 px-6 py-4 font-black text-white">税后盈亏</th>
|
||||
<th class="border-b px-6 py-4 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">费比 %</th>
|
||||
<th class="border-b border-l px-6 py-4 font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||
税前盈亏
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
|
||||
{{ (props.taxRate * 100).toFixed(0) }}%税额
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-black text-indigo-700 dark:text-indigo-400">
|
||||
ROI
|
||||
</th>
|
||||
<th class="border-b bg-emerald-600 px-6 py-4 font-black text-white dark:bg-emerald-600">
|
||||
税后盈亏
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
@@ -185,19 +177,21 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
<td class="border-l dark:border-l-[hsl(240deg_3.7%_22%)] p-6 font-bold text-rose-600 dark:text-rose-400">{{ cat.refundAmount ? formatAmount(cat.refundAmount) : '-' }}</td>
|
||||
<td class="p-6 text-amber-600 dark:text-amber-400">{{ cat.totalPromotionFee ? formatAmount(cat.totalPromotionFee) : '-' }}</td>
|
||||
<td class="p-6 text-orange-600 dark:text-orange-400">{{ cat.brushFee ? formatAmount(cat.brushFee) : '-' }}</td>
|
||||
<td class="border-l dark:border-l-[hsl(240deg_3.7%_22%)] p-6 text-slate-400">{{ cat.feeRatio !== undefined ? formatPercentPlain(cat.feeRatio) : '-' }}</td>
|
||||
<td class="p-6 font-bold">{{ cat.totalProfitBeforeTax ? formatAmount(cat.totalProfitBeforeTax) : '-' }}</td>
|
||||
<td class="p-6 italic text-rose-500 dark:text-rose-400">{{ cat.salesTaxAmount ? formatAmount(cat.salesTaxAmount) : '-' }}</td>
|
||||
<td class="p-6 text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">{{ cat.feeRatio !== undefined ? formatPercentPlain(cat.feeRatio) : '-' }}</td>
|
||||
<td class="border-l border-slate-100 p-6 font-bold dark:border-l-[hsl(240deg_3.7%_22%)]">
|
||||
{{ cat.totalProfitBeforeTax ? formatAmount(cat.totalProfitBeforeTax) : '-' }}
|
||||
</td>
|
||||
<td class="p-6 italic text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">{{ cat.salesTaxAmount ? formatAmount(cat.salesTaxAmount) : '-' }}</td>
|
||||
<td class="p-6 font-black text-indigo-700 dark:text-indigo-400">{{ cat.roi?.toFixed(2) || '-' }}</td>
|
||||
<td
|
||||
class="border-l bg-emerald-50/30 p-6 text-base font-black dark:bg-[hsl(142deg_71.8%_29%/20%)]"
|
||||
:class="(cat.profitAfterTax ?? 0) < 0 ? 'text-rose-500 dark:text-rose-400' : 'text-emerald-600 dark:text-emerald-400'"
|
||||
class="bg-emerald-50 p-6 text-base font-black dark:bg-emerald-950"
|
||||
:class="(cat.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-600 dark:text-emerald-300'"
|
||||
>
|
||||
{{ cat.profitAfterTax ? formatAmount(cat.profitAfterTax) : '-' }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!props.data?.categoryOverview?.categories?.length">
|
||||
<td :colspan="props.categoryExportMode ? 17 : 16" class="p-8 text-center text-gray-400">
|
||||
<td :colspan="props.categoryExportMode ? 18 : 17" class="p-8 text-center text-gray-400">
|
||||
暂无数据
|
||||
</td>
|
||||
</tr>
|
||||
@@ -220,7 +214,10 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
<td class="p-6">{{ props.data.categoryOverview.total.totalProfitBeforeTax ? formatAmount(props.data.categoryOverview.total.totalProfitBeforeTax) : '-' }}</td>
|
||||
<td class="p-6 italic text-slate-400">{{ props.data.categoryOverview.total.salesTaxAmount ? formatAmount(props.data.categoryOverview.total.salesTaxAmount) : '-' }}</td>
|
||||
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ props.data.categoryOverview.total.roi !== undefined ? props.data.categoryOverview.total.roi.toFixed(2) : '-' }}</td>
|
||||
<td class="bg-emerald-50/30 dark:bg-[hsl(142deg_71.8%_29%/20%)] p-6 text-base">{{ props.data.categoryOverview.total.profitAfterTax ? formatAmount(props.data.categoryOverview.total.profitAfterTax) : '-' }}</td>
|
||||
<td
|
||||
class="bg-emerald-100 p-6 text-base dark:bg-emerald-950"
|
||||
:class="(props.data.categoryOverview.total.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-800 dark:text-emerald-300'"
|
||||
>{{ props.data.categoryOverview.total.profitAfterTax ? formatAmount(props.data.categoryOverview.total.profitAfterTax) : '-' }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
+5
-2
@@ -47,7 +47,7 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
:loading="exportLoading"
|
||||
@click="emit('export')"
|
||||
>
|
||||
导出店铺概览
|
||||
导出汇总数据
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -202,7 +202,10 @@ const formatPercentPlain = (value: number | undefined) => {
|
||||
<td class="sticky bottom-0 bg-slate-100 text-indigo-700 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-indigo-400 px-6 py-4">{{ data.productOverview.total.roi !== undefined ? data.productOverview.total.roi.toFixed(2) : '-' }}</td>
|
||||
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.totalProfitBeforeTax ? formatAmount(data.productOverview.total.totalProfitBeforeTax) : '-' }}</td>
|
||||
<td class="sticky bottom-0 bg-slate-100 italic text-slate-400 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-[hsl(240deg_5%_64.9%)] px-6 py-4">{{ data.productOverview.total.salesTaxAmount ? formatAmount(data.productOverview.total.salesTaxAmount) : '-' }}</td>
|
||||
<td class="sticky bottom-0 bg-emerald-50/30 dark:bg-[hsl(142deg_71.8%_29%/20%)] px-6 py-4 text-base">{{ data.productOverview.total.profitAfterTax ? formatAmount(data.productOverview.total.profitAfterTax) : '-' }}</td>
|
||||
<td
|
||||
class="sticky bottom-0 bg-emerald-100 px-6 py-4 text-base dark:bg-emerald-950"
|
||||
:class="(data.productOverview.total.profitAfterTax ?? 0) < 0 ? 'text-rose-600 dark:text-rose-400' : 'text-emerald-800 dark:text-emerald-300'"
|
||||
>{{ data.productOverview.total.profitAfterTax ? formatAmount(data.productOverview.total.profitAfterTax) : '-' }}</td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
||||
@@ -211,7 +211,7 @@ const loadOverviewData = async () => {
|
||||
}
|
||||
};
|
||||
|
||||
// 导出店铺概览
|
||||
// 导出汇总数据
|
||||
const handleExportShopOverview = async () => {
|
||||
if (!shopId.value) return;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user