mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:09:19 +08:00
style(工作台/概览): 统一顶栏工具栏样式,经营概览 KPI 改为五列简约布局
This commit is contained in:
@@ -5,7 +5,7 @@ import { useRouter } from 'vue-router';
|
||||
import { Page } from '@vben/common-ui';
|
||||
import { createIconifyIcon } from '@vben/icons';
|
||||
|
||||
import { Button, DatePicker, InputNumber, message, Select, Spin, Tabs } from 'ant-design-vue';
|
||||
import { DatePicker, InputNumber, message, Select, Spin, Tabs } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { getPlatformPageApi } from '#/api/ecommerce/platform/apis';
|
||||
@@ -65,6 +65,25 @@ const customDateRange = ref<[dayjs.Dayjs, dayjs.Dayjs] | undefined>([
|
||||
dateRange.value[1],
|
||||
]);
|
||||
|
||||
/** 与日期区一致:灰底外框 + 白底内面板 */
|
||||
const toolbarShellClass =
|
||||
'flex w-full flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:w-auto sm:flex-row sm:items-center sm:gap-2 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]';
|
||||
|
||||
const toolbarPanelClass =
|
||||
'workbench-toolbar-panel rounded-xl bg-white dark:bg-[hsl(222.34deg_10.43%_14%)]';
|
||||
|
||||
const toolbarActionClass =
|
||||
'inline-flex min-w-0 shrink-0 cursor-pointer items-center justify-center gap-1.5 rounded-xl border-0 bg-transparent px-3 py-2 text-sm font-bold text-slate-800 transition-colors hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-[hsl(240deg_3.7%_22%)]';
|
||||
|
||||
const timeRangeBtnClass =
|
||||
'inline-flex min-w-0 cursor-pointer items-center justify-center rounded-xl border-0 px-3 py-2 text-sm font-bold transition-colors sm:px-5';
|
||||
|
||||
function timeRangeBtnState(active: boolean) {
|
||||
return active
|
||||
? 'bg-slate-100 text-blue-600 shadow-sm dark:bg-blue-900/30 dark:text-blue-400'
|
||||
: 'bg-transparent text-slate-800 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-[hsl(240deg_3.7%_22%)]';
|
||||
}
|
||||
|
||||
const switchTimeRange = (
|
||||
type: '7days' | '30days' | 'custom' | 'thisMonth' | 'today' | 'yesterday',
|
||||
) => {
|
||||
@@ -509,56 +528,66 @@ onUnmounted(() => {
|
||||
|
||||
<template #extra>
|
||||
<div
|
||||
class="flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-2"
|
||||
class="workbench-header-extra flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<Button
|
||||
type="default"
|
||||
size="small"
|
||||
class="!inline-flex !h-9 shrink-0 !items-center !rounded-xl !border-slate-200 !px-4 !text-sm !font-bold !shadow-sm dark:!border-[hsl(240deg_3.7%_22%)]"
|
||||
@click="goToImportOrder"
|
||||
>
|
||||
<ImportOrderIcon class="mr-1.5 h-4 w-4 shrink-0" />
|
||||
导入订单
|
||||
</Button>
|
||||
<Button
|
||||
type="default"
|
||||
size="small"
|
||||
class="!inline-flex !h-9 shrink-0 !items-center !rounded-xl !border-slate-200 !px-4 !text-sm !font-bold !shadow-sm dark:!border-[hsl(240deg_3.7%_22%)]"
|
||||
@click="goToImportPromotionFee"
|
||||
>
|
||||
<PromotionFeeIcon class="mr-1.5 h-4 w-4 shrink-0" />
|
||||
导入推广费
|
||||
</Button>
|
||||
<div
|
||||
class="flex min-h-[44px] w-full items-center gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 px-3 sm:w-auto dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
>
|
||||
<span
|
||||
class="text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
<div :class="toolbarShellClass">
|
||||
<div
|
||||
:class="[toolbarPanelClass, 'flex items-center gap-0.5 overflow-x-auto p-1']"
|
||||
>
|
||||
税率
|
||||
</span>
|
||||
<InputNumber
|
||||
v-model:value="taxRate"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
size="small"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 !text-center !text-sm !font-bold dark:!bg-[hsl(240deg_3.7%_22%/30%)]"
|
||||
:formatter="formatTaxRate"
|
||||
:parser="parseTaxRate"
|
||||
/>
|
||||
<button
|
||||
type="button"
|
||||
:class="toolbarActionClass"
|
||||
@click="goToImportOrder"
|
||||
>
|
||||
<ImportOrderIcon class="h-4 w-4 shrink-0" />
|
||||
导入订单
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="toolbarActionClass"
|
||||
@click="goToImportPromotionFee"
|
||||
>
|
||||
<PromotionFeeIcon class="h-4 w-4 shrink-0" />
|
||||
导入推广费
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div :class="toolbarShellClass">
|
||||
<div
|
||||
:class="[toolbarPanelClass, 'flex items-center gap-2 px-2 py-1']"
|
||||
>
|
||||
<span class="shrink-0 text-xs font-bold text-slate-700 dark:text-slate-300">
|
||||
税率
|
||||
</span>
|
||||
<InputNumber
|
||||
v-model:value="taxRate"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
size="small"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-transparent !text-center !text-sm !font-bold !text-slate-800 !shadow-none dark:!text-slate-100"
|
||||
:formatter="formatTaxRate"
|
||||
:parser="parseTaxRate"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="workbench-filter-platform-shop w-full min-w-0 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:w-auto sm:max-w-[min(calc(100vw-2.5rem),56rem)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
:class="[
|
||||
toolbarShellClass,
|
||||
'workbench-filter-platform-shop min-w-0 sm:max-w-[min(calc(100vw-2.5rem),56rem)]',
|
||||
]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 flex-col gap-2 rounded-xl bg-white/30 p-1 sm:flex-row sm:items-center sm:gap-0 sm:divide-x sm:divide-slate-300/50 dark:bg-[hsl(240deg_3.7%_22%/30%)] dark:sm:divide-[hsl(240deg_3.7%_35%)]"
|
||||
:class="[
|
||||
toolbarPanelClass,
|
||||
'flex min-w-0 flex-col gap-2 p-1 sm:flex-row sm:items-center sm:gap-0 sm:divide-x sm:divide-slate-200 dark:sm:divide-[hsl(240deg_3.7%_28%)]',
|
||||
]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 items-center gap-2 px-2 py-0.5 sm:w-[11.5rem] sm:flex-none sm:shrink-0 sm:py-0"
|
||||
>
|
||||
<span
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-700 dark:text-slate-300"
|
||||
>
|
||||
平台
|
||||
</span>
|
||||
@@ -579,9 +608,9 @@ onUnmounted(() => {
|
||||
<template #notFoundContent>
|
||||
<div v-if="platformLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
<div class="mt-1 text-xs text-slate-600">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
<div v-else class="py-3 text-center text-xs text-slate-600">
|
||||
暂无平台
|
||||
</div>
|
||||
</template>
|
||||
@@ -591,7 +620,7 @@ onUnmounted(() => {
|
||||
class="flex min-w-0 flex-1 items-center gap-2 border-t border-slate-200/80 px-2 pt-2 sm:min-w-[16rem] sm:border-t-0 sm:py-0 sm:pt-0 dark:border-[hsl(240deg_3.7%_22%)]"
|
||||
>
|
||||
<span
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-700 dark:text-slate-300"
|
||||
>
|
||||
店铺
|
||||
</span>
|
||||
@@ -613,9 +642,9 @@ onUnmounted(() => {
|
||||
<template #notFoundContent>
|
||||
<div v-if="shopLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
<div class="mt-1 text-xs text-slate-600">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
<div v-else class="py-3 text-center text-xs text-slate-600">
|
||||
暂无店铺
|
||||
</div>
|
||||
</template>
|
||||
@@ -623,83 +652,51 @@ onUnmounted(() => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
class="flex w-full flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:w-auto sm:flex-row sm:items-center sm:gap-2 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
>
|
||||
<div :class="toolbarShellClass">
|
||||
<div
|
||||
class="flex w-full items-center gap-1 overflow-x-auto rounded-xl bg-white/30 p-1 dark:bg-[hsl(240deg_3.7%_22%/30%)]"
|
||||
:class="[toolbarPanelClass, 'flex w-full items-center gap-1 overflow-x-auto p-1']"
|
||||
>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none !transition-colors sm:!px-5"
|
||||
:class="
|
||||
activeTimeRange === 'today'
|
||||
? '!bg-white !text-blue-600 !shadow-sm dark:!bg-blue-900/30 dark:!text-blue-400 dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)]'
|
||||
"
|
||||
<button
|
||||
type="button"
|
||||
:class="[timeRangeBtnClass, timeRangeBtnState(activeTimeRange === 'today')]"
|
||||
@click="switchTimeRange('today')"
|
||||
>
|
||||
今日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none !transition-colors sm:!px-5"
|
||||
:class="
|
||||
activeTimeRange === 'yesterday'
|
||||
? '!bg-white !text-blue-600 !shadow-sm dark:!bg-blue-900/30 dark:!text-blue-400 dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[timeRangeBtnClass, timeRangeBtnState(activeTimeRange === 'yesterday')]"
|
||||
@click="switchTimeRange('yesterday')"
|
||||
>
|
||||
昨日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none !transition-colors sm:!px-5"
|
||||
:class="
|
||||
activeTimeRange === '7days'
|
||||
? '!bg-white !text-blue-600 !shadow-sm dark:!bg-blue-900/30 dark:!text-blue-400 dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[timeRangeBtnClass, timeRangeBtnState(activeTimeRange === '7days')]"
|
||||
@click="switchTimeRange('7days')"
|
||||
>
|
||||
近7日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none !transition-colors sm:!px-5"
|
||||
:class="
|
||||
activeTimeRange === '30days'
|
||||
? '!bg-white !text-blue-600 !shadow-sm dark:!bg-blue-900/30 dark:!text-blue-400 dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[timeRangeBtnClass, timeRangeBtnState(activeTimeRange === '30days')]"
|
||||
@click="switchTimeRange('30days')"
|
||||
>
|
||||
近30日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-xl !border-none !px-3 !py-2 !text-sm !font-bold !shadow-none !transition-colors sm:!px-5"
|
||||
:class="
|
||||
activeTimeRange === 'thisMonth'
|
||||
? '!bg-white !text-blue-600 !shadow-sm dark:!bg-blue-900/30 dark:!text-blue-400 dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-[hsl(240deg_3.7%_22%)] dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[timeRangeBtnClass, timeRangeBtnState(activeTimeRange === 'thisMonth')]"
|
||||
@click="switchTimeRange('thisMonth')"
|
||||
>
|
||||
本月
|
||||
</Button>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="flex w-full items-center justify-between gap-2 sm:w-auto sm:justify-start"
|
||||
>
|
||||
<span
|
||||
class="hidden whitespace-nowrap text-xs font-bold text-slate-400 sm:inline dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
class="hidden whitespace-nowrap text-xs font-bold text-slate-700 sm:inline dark:text-slate-300"
|
||||
>
|
||||
自定义日期
|
||||
</span>
|
||||
@@ -709,7 +706,7 @@ onUnmounted(() => {
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始', '结束']"
|
||||
class="!h-8 !w-full !border-none !bg-transparent !text-sm !font-bold sm:!w-[220px] dark:!text-[hsl(240deg_5%_64.9%)]"
|
||||
class="workbench-header-range-picker !h-8 !w-full !border-none !bg-transparent !text-sm !font-bold !text-slate-800 sm:!w-[220px] dark:!text-slate-200"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
</div>
|
||||
@@ -811,17 +808,22 @@ onUnmounted(() => {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-select .ant-select-selector) {
|
||||
:deep(.workbench-toolbar-panel .workbench-header-select .ant-select-selector) {
|
||||
border-radius: 0.75rem !important;
|
||||
border: none !important;
|
||||
font-weight: 700;
|
||||
font-size: 0.875rem !important;
|
||||
line-height: 1.25rem !important;
|
||||
min-height: 2.125rem !important;
|
||||
min-height: 2rem !important;
|
||||
display: flex !important;
|
||||
align-items: center !important;
|
||||
padding-inline: 10px 28px !important;
|
||||
background-color: rgb(255 255 255 / 0.92) !important;
|
||||
padding-inline: 8px 28px !important;
|
||||
background-color: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-toolbar-panel .workbench-header-select:hover .ant-select-selector) {
|
||||
background-color: rgb(241 245 249) !important;
|
||||
}
|
||||
|
||||
:deep(
|
||||
@@ -909,11 +911,33 @@ onUnmounted(() => {
|
||||
align-self: center !important;
|
||||
}
|
||||
|
||||
:deep(.tax-rate-input .ant-input-number-input) {
|
||||
:deep(.workbench-header-extra .tax-rate-input.ant-input-number) {
|
||||
background: transparent !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-extra .tax-rate-input .ant-input-number-input) {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
color: rgb(15 23 42);
|
||||
background: transparent !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-extra .tax-rate-input:hover .ant-input-number-input) {
|
||||
background-color: rgb(241 245 249) !important;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-extra .workbench-header-range-picker .ant-picker-input > input) {
|
||||
color: rgb(15 23 42) !important;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
:deep(.workbench-header-extra .workbench-header-range-picker .ant-picker-separator),
|
||||
:deep(.workbench-header-extra .workbench-header-range-picker .ant-picker-suffix) {
|
||||
color: rgb(71 85 105);
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -923,8 +947,12 @@ html.dark .workbench-tabs.ant-tabs .ant-tabs-nav {
|
||||
border-bottom-color: hsl(240deg 3.7% 22%);
|
||||
}
|
||||
|
||||
html.dark .workbench-header-select .ant-select-selector {
|
||||
background-color: hsl(240deg 3.7% 18%) !important;
|
||||
html.dark .workbench-toolbar-panel .workbench-header-select .ant-select-selector {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
html.dark .workbench-toolbar-panel .workbench-header-select:hover .ant-select-selector {
|
||||
background-color: hsl(240deg 3.7% 22%) !important;
|
||||
}
|
||||
|
||||
html.dark .workbench-header-select.ant-select-single .ant-select-selector .ant-select-selection-item,
|
||||
@@ -932,4 +960,14 @@ html.dark .workbench-header-select.ant-select-single .ant-select-selector .ant-s
|
||||
html.dark .workbench-header-select .ant-select-selection-search-input {
|
||||
color: hsl(0deg 0% 95%) !important;
|
||||
}
|
||||
|
||||
html.dark .workbench-header-extra .tax-rate-input .ant-input-number-input,
|
||||
html.dark .workbench-header-extra .workbench-header-range-picker .ant-picker-input > input {
|
||||
color: hsl(0deg 0% 95%) !important;
|
||||
}
|
||||
|
||||
html.dark .workbench-header-extra .workbench-header-range-picker .ant-picker-separator,
|
||||
html.dark .workbench-header-extra .workbench-header-range-picker .ant-picker-suffix {
|
||||
color: hsl(240deg 5% 75%);
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user