mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:59:19 +08:00
fix(shop-overview): 表头固定+深色模式边框+空状态colspan修复
- 表头tbody拆分为两个独立table,thead固定不滚动,tbody独立滚动 - 表头所有border-slate-200替换为dark:深色边框色 - 商品详情单元格加明确深色背景 - 空状态colspan从13改为15
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
<script lang="ts" setup>
|
||||
import type { EchartsUIType } from '@vben/plugins/echarts';
|
||||
|
||||
import type {
|
||||
CompanyOverviewDTO,
|
||||
@@ -7,7 +6,6 @@ import type {
|
||||
} from '#/api/ecommerce/company-overview';
|
||||
|
||||
import {
|
||||
computed,
|
||||
onActivated,
|
||||
onMounted,
|
||||
onUnmounted,
|
||||
@@ -18,7 +16,7 @@ import { useRoute, useRouter } from 'vue-router';
|
||||
|
||||
import { Page } from '@vben/common-ui';
|
||||
|
||||
import { Button, DatePicker, InputNumber, message, Spin } from 'ant-design-vue';
|
||||
import { Button, DatePicker, InputNumber, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getCompanyOverviewApi } from '#/api/ecommerce/company-overview';
|
||||
@@ -46,15 +44,6 @@ const shopCount = ref(0);
|
||||
const shopExportMode = ref(false);
|
||||
const selectedExportShopIds = ref<number[]>([]);
|
||||
|
||||
// 全选状态计算
|
||||
const allShopsSelected = computed(() => {
|
||||
const total = overviewData.value?.shopComparisons?.length || 0;
|
||||
return total > 0 && selectedExportShopIds.value.length === total;
|
||||
});
|
||||
const someShopsSelected = computed(() => {
|
||||
return selectedExportShopIds.value.length > 0;
|
||||
});
|
||||
|
||||
// 日期范围
|
||||
const dateRange = ref<[dayjs.Dayjs, dayjs.Dayjs]>([
|
||||
dayjs().subtract(30, 'day'),
|
||||
@@ -397,15 +386,6 @@ const toggleShopExportMode = (enabled: boolean) => {
|
||||
}
|
||||
};
|
||||
|
||||
// 导出当前选中店铺(不关闭模式)
|
||||
const handleExportSelectedShops = async () => {
|
||||
if (selectedExportShopIds.value.length === 0) {
|
||||
message.warning('请先选择要导出的店铺');
|
||||
return;
|
||||
}
|
||||
await handleExportCompanyOverview();
|
||||
};
|
||||
|
||||
// 跳转到店铺详情页
|
||||
const navigateToShopOverview = (shopId: number) => {
|
||||
router.push({
|
||||
|
||||
@@ -1134,64 +1134,66 @@ onActivated(async () => {
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
<div class="table-container overflow-x-auto">
|
||||
<!-- 表头(固定不滚动) -->
|
||||
<table class="w-full whitespace-nowrap text-left text-sm shop-overview-thead">
|
||||
<thead
|
||||
class="bg-slate-50 text-xs font-black uppercase tracking-tight text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
class="sticky-col z-10 border-b px-6 py-6 text-base font-black text-slate-900 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/80%)] dark:text-[hsl(0deg_0%_95%)]"
|
||||
style="left: 0"
|
||||
>
|
||||
商品详情
|
||||
</th>
|
||||
<th
|
||||
colspan="3"
|
||||
class="border-b border-l border-slate-200 dark:border-b dark:border-l dark:border-[hsl(240deg_3.7%_22%)] bg-slate-100/50 dark:bg-[hsl(240deg_3.7%_22%/50)] px-3 py-3 text-center"
|
||||
>
|
||||
商品规模 (Scale)
|
||||
</th>
|
||||
<th
|
||||
colspan="6"
|
||||
class="border-b border-l border-slate-200 dark:border-b dark:border-l dark:border-[hsl(240deg_3.7%_22%)] bg-orange-50/50 dark:bg-[hsl(24deg_9.8%_15%/50)] px-3 py-3 text-center italic text-orange-700 dark:text-orange-400"
|
||||
>
|
||||
费用成本 (Costs)
|
||||
</th>
|
||||
<th
|
||||
colspan="5"
|
||||
class="border-b border-l border-slate-200 dark:border-b dark:border-l dark:border-[hsl(240deg_3.7%_22%)] bg-emerald-50/50 dark:bg-[hsl(142deg_71.8%_29%/20%)] px-3 py-3 text-center italic text-emerald-700"
|
||||
>
|
||||
单品损益 (Profitability)
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
|
||||
<th class="border-b px-6 py-4 dark:bg-[hsl(240deg_3.7%_15.9%/80%)]" style="left: 0; position: sticky; z-index: 10;">销售额</th>
|
||||
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">单量</th>
|
||||
<th class="border-b px-6 py-4">客单价</th>
|
||||
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">商品成本</th>
|
||||
<th class="border-b px-6 py-4">运费</th>
|
||||
<th class="border-b px-6 py-4">其他成本</th>
|
||||
<th class="border-b px-6 py-4 text-rose-600">退款金额</th>
|
||||
<th class="border-b px-6 py-4">推广费</th>
|
||||
<th class="border-b px-6 py-4">刷单费用</th>
|
||||
<th class="border-b border-l dark:border-l dark:border-[hsl(240deg_3.7%_22%)] px-6 py-4">费比 %</th>
|
||||
<th class="border-b px-6 py-4 text-indigo-700 dark:text-indigo-400">单品 ROI</th>
|
||||
<th class="border-b px-6 py-4">税前盈亏</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
|
||||
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||
</th>
|
||||
<th class="border-b bg-emerald-600 px-6 py-4 font-black text-white">
|
||||
税后净利
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
<!-- 表体(独立滚动) -->
|
||||
<div
|
||||
class="table-container overflow-x-auto"
|
||||
style="max-height: 420px; overflow-y: auto;"
|
||||
>
|
||||
<table class="w-full whitespace-nowrap text-left text-sm">
|
||||
<!-- 分类复合表头 -->
|
||||
<thead
|
||||
class="bg-slate-50 text-xs font-black uppercase tracking-tight text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
<tr>
|
||||
<th
|
||||
rowspan="2"
|
||||
class="sticky-col border-b px-6 py-6 text-base font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]"
|
||||
>
|
||||
商品详情
|
||||
</th>
|
||||
<th
|
||||
colspan="3"
|
||||
class="border-b border-l border-slate-200 bg-slate-100/50 dark:bg-[hsl(240deg_3.7%_22%/50)] px-3 py-3 text-center"
|
||||
>
|
||||
商品规模 (Scale)
|
||||
</th>
|
||||
<th
|
||||
colspan="4"
|
||||
class="border-b border-l border-slate-200 bg-orange-50/50 dark:bg-[hsl(24deg_9.8%_15%/50)] px-3 py-3 text-center italic text-orange-700 dark:text-orange-400"
|
||||
>
|
||||
费用成本 (Costs)
|
||||
</th>
|
||||
<th
|
||||
colspan="5"
|
||||
class="border-b border-l border-slate-200 bg-emerald-50/50 dark:bg-[hsl(142deg_71.8%_29%/20%)] px-3 py-3 text-center italic text-emerald-700"
|
||||
>
|
||||
单品损益 (Profitability)
|
||||
</th>
|
||||
</tr>
|
||||
<tr class="bg-slate-50/80 dark:bg-[hsl(240deg_3.7%_15.9%/80)] text-sm">
|
||||
<!-- 规模 -->
|
||||
<th class="border-b border-l px-6 py-4">销售额</th>
|
||||
<th class="border-b px-6 py-4">单量</th>
|
||||
<th class="border-b px-6 py-4">客单价</th>
|
||||
<!-- 成本 -->
|
||||
<th class="border-b border-l px-6 py-4">商品成本</th>
|
||||
<th class="border-b px-6 py-4">运费</th>
|
||||
<th class="border-b px-6 py-4">其他成本</th>
|
||||
<th class="border-b px-6 py-4 text-rose-600">退款金额</th>
|
||||
<th class="border-b px-6 py-4">推广费</th>
|
||||
<th class="border-b px-6 py-4">刷单费用</th>
|
||||
<!-- 损益 -->
|
||||
<th class="border-b border-l px-6 py-4">费比 %</th>
|
||||
<th class="border-b px-6 py-4 text-indigo-700 dark:text-indigo-400">单品 ROI</th>
|
||||
<th class="border-b px-6 py-4">税前盈亏</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500 dark:text-rose-400">
|
||||
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||
</th>
|
||||
<th
|
||||
class="border-b bg-emerald-600 px-6 py-4 font-black text-white"
|
||||
>
|
||||
税后净利
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-slate-100">
|
||||
<tr
|
||||
v-for="product in overviewData?.productComparisons"
|
||||
@@ -1200,6 +1202,7 @@ onActivated(async () => {
|
||||
>
|
||||
<td
|
||||
class="sticky-col border-r-2 border-slate-100 dark:border-[hsl(240deg_3.7%_22%)] bg-white dark:bg-[hsl(222.34deg_10.43%_12.27%)] px-6 py-6 font-bold text-slate-900 dark:text-[hsl(0deg_0%_95%)] cursor-pointer hover:text-blue-600 dark:text-blue-400 hover:underline"
|
||||
style="left: 0; position: sticky; z-index: 10;"
|
||||
@click="router.push(`/ecom/product/details/${product.productId}`)"
|
||||
>
|
||||
<div>{{ product.productName }}</div>
|
||||
@@ -1306,7 +1309,7 @@ onActivated(async () => {
|
||||
</td>
|
||||
</tr>
|
||||
<tr v-if="!overviewData?.productComparisons?.length">
|
||||
<td colspan="13" class="p-8 text-center text-gray-400">
|
||||
<td colspan="15" class="p-8 text-center text-gray-400">
|
||||
暂无数据
|
||||
</td>
|
||||
</tr>
|
||||
@@ -1393,10 +1396,14 @@ onActivated(async () => {
|
||||
</style>
|
||||
|
||||
<style>
|
||||
html.dark .table-container table thead th {
|
||||
html.dark .shop-overview-thead table thead th {
|
||||
background-color: hsl(240deg 3.7% 15.9% / 80%) !important;
|
||||
}
|
||||
|
||||
html.dark .shop-overview-thead table thead th {
|
||||
border-color: hsl(240deg 3.7% 22%) !important;
|
||||
}
|
||||
|
||||
html.dark .table-container table tbody tr:hover td {
|
||||
background-color: hsl(217.2deg 32.6% 17.5% / 30%) !important;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user