fix(frontend): 调整全店概览及店铺概览中成本字段的展示逻辑

- 修正全店概览/店铺概览各表格组件的成本字段渲染逻辑
- 同步注释更新
This commit is contained in:
小蟑螂
2026-05-06 01:41:44 +08:00
parent 157c5ae3c4
commit 5445dc5a22
6 changed files with 66 additions and 59 deletions
@@ -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>
@@ -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>
@@ -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>