mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:19: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>
|
||||
|
||||
+102
-121
@@ -1,12 +1,20 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
|
||||
import { Button, DatePicker, InputNumber, Select, Spin } from 'ant-design-vue';
|
||||
import { DatePicker, InputNumber, Select, Spin } from 'ant-design-vue';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { normalizeOverviewRangePickerChange } from '#/utils/overview-date-range';
|
||||
|
||||
import {
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState,
|
||||
overviewToolbarLabelClass,
|
||||
overviewToolbarPanelClass,
|
||||
overviewToolbarShellClass,
|
||||
} from '../../../styles/overview-toolbar-classes';
|
||||
|
||||
interface SelectOption {
|
||||
label: string;
|
||||
value: string;
|
||||
@@ -84,7 +92,7 @@ const formatTaxRate = (value: null | number | string | undefined) => {
|
||||
if (value === null || value === undefined || value === '') return '';
|
||||
const num = Number(value);
|
||||
if (!Number.isFinite(num)) return '';
|
||||
return `${num * 100}%`;
|
||||
return `${Math.round(num * 100 * 1e10) / 1e10}%`;
|
||||
};
|
||||
|
||||
const parseTaxRate = (value: string | undefined) => {
|
||||
@@ -163,39 +171,43 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center">
|
||||
<!-- 税率输入 -->
|
||||
<div
|
||||
class="flex min-h-[44px] w-full items-center gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 px-3 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto"
|
||||
>
|
||||
<span class="text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">税率</span>
|
||||
<InputNumber
|
||||
:value="props.modelValue.taxRate"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
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"
|
||||
@change="handleTaxRateChange"
|
||||
/>
|
||||
<div
|
||||
class="overview-header-extra flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<div :class="overviewToolbarShellClass">
|
||||
<div :class="[overviewToolbarPanelClass, 'flex items-center gap-2 px-2 py-1']">
|
||||
<span class="shrink-0" :class="overviewToolbarLabelClass">税率</span>
|
||||
<InputNumber
|
||||
:value="props.modelValue.taxRate"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
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"
|
||||
@change="handleTaxRateChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 店铺 + 商品(布局/配色与工作台平台+店铺筛选一致) -->
|
||||
<div
|
||||
class="overview-filter-select-group 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="[
|
||||
overviewToolbarShellClass,
|
||||
'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="[
|
||||
overviewToolbarPanelClass,
|
||||
'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%)]"
|
||||
>
|
||||
<span class="w-9 shrink-0 text-right" :class="overviewToolbarLabelClass">
|
||||
店铺
|
||||
</span>
|
||||
<Select
|
||||
@@ -212,29 +224,31 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
@change="handleShopSelectChange"
|
||||
@search="(kw: string) => emit('shop-search', kw)"
|
||||
@popup-scroll="(e: Event) => emit('shop-popup-scroll', e)"
|
||||
@dropdown-visible-change="(open: boolean) => emit('shop-dropdown-visible-change', open)"
|
||||
@dropdown-visible-change="
|
||||
(open: boolean) => emit('shop-dropdown-visible-change', open)
|
||||
"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="props.shopListLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无店铺
|
||||
<div class="mt-1 text-xs text-slate-600">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-600">暂无店铺</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
<div
|
||||
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%)]"
|
||||
>
|
||||
<span class="w-9 shrink-0 text-right" :class="overviewToolbarLabelClass">
|
||||
商品
|
||||
</span>
|
||||
<Select
|
||||
:value="props.productId != null && props.productId > 0 ? String(props.productId) : undefined"
|
||||
:value="
|
||||
props.productId != null && props.productId > 0
|
||||
? String(props.productId)
|
||||
: undefined
|
||||
"
|
||||
size="small"
|
||||
show-search
|
||||
:filter-option="false"
|
||||
@@ -246,104 +260,91 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
@change="handleProductSelectChange"
|
||||
@search="(kw: string) => emit('product-search', kw)"
|
||||
@popup-scroll="(e: Event) => emit('product-popup-scroll', e)"
|
||||
@dropdown-visible-change="(open: boolean) => emit('product-dropdown-visible-change', open)"
|
||||
@dropdown-visible-change="
|
||||
(open: boolean) => emit('product-dropdown-visible-change', open)
|
||||
"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="props.productListLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无商品
|
||||
<div class="mt-1 text-xs text-slate-600">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-600">暂无商品</div>
|
||||
</template>
|
||||
</Select>
|
||||
</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 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto sm:flex-row sm:items-center sm:gap-1.5 sm:p-1"
|
||||
>
|
||||
<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%)]">
|
||||
<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="
|
||||
props.modelValue.activeTimeRange === 'today'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
<div :class="overviewToolbarShellClass">
|
||||
<div
|
||||
:class="[overviewToolbarPanelClass, 'flex w-full items-center gap-1 overflow-x-auto p-1']"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === 'yesterday'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === '7days'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === '30days'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === 'thisMonth'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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 dark:text-[hsl(240deg_5%_64.9%)] sm:inline">自定义日期</span>
|
||||
<span
|
||||
class="hidden whitespace-nowrap sm:inline"
|
||||
:class="overviewToolbarLabelClass"
|
||||
>
|
||||
自定义日期
|
||||
</span>
|
||||
<DatePicker.RangePicker
|
||||
:value="props.modelValue.customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始', '结束']"
|
||||
class="!h-8 !w-full !cursor-pointer !border-none !bg-transparent !text-sm !font-bold dark:!text-[hsl(240deg_5%_64.9%)] sm:!w-[220px]"
|
||||
class="overview-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>
|
||||
@@ -351,25 +352,5 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.tax-rate-input .ant-input-number-input) {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.ant-picker) {
|
||||
border-color: hsl(240deg 3.7% 22%);
|
||||
}
|
||||
:deep(.ant-picker:hover),
|
||||
:deep(.ant-picker-focused) {
|
||||
border-color: hsl(240deg 3.7% 22%);
|
||||
}
|
||||
:deep(.ant-picker-input > input) {
|
||||
color: hsl(240deg 5% 64.9%);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style src="../../../styles/overview-header-select.css"></style>
|
||||
<style src="../../../styles/overview-toolbar.css"></style>
|
||||
<style src="../../../styles/overview-header-select.css"></style>
|
||||
|
||||
@@ -448,9 +448,8 @@ onUnmounted(() => {
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<div class="w-full sm:w-auto">
|
||||
<div class="w-full max-w-full sm:w-auto">
|
||||
<TimeRangeBar
|
||||
class="w-full"
|
||||
:model-value="timeRangeState"
|
||||
:shop-id="contextShopId"
|
||||
:shop-options="shopSelectOptions"
|
||||
@@ -498,7 +497,28 @@ onUnmounted(() => {
|
||||
|
||||
<style scoped>
|
||||
:deep(.product-overview-page-header) {
|
||||
align-items: center;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
:deep(.product-overview-page-header) {
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.product-overview-page-header > div:first-child),
|
||||
:deep(.product-overview-page-header > div:last-child) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
:deep(.product-overview-page-header > div:first-child),
|
||||
:deep(.product-overview-page-header > div:last-child) {
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
/* 表格滚动条优化 */
|
||||
@@ -510,21 +530,6 @@ onUnmounted(() => {
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
:deep(.product-overview-page-header) {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
:deep(.product-overview-page-header > div:first-child) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
:deep(.product-overview-page-header > div:last-child) {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
<style>
|
||||
|
||||
+90
-111
@@ -1,10 +1,18 @@
|
||||
<script lang="ts" setup>
|
||||
import { Button, DatePicker, InputNumber, Select, Spin } from 'ant-design-vue';
|
||||
import { DatePicker, InputNumber, Select, Spin } from 'ant-design-vue';
|
||||
import type { Dayjs } from 'dayjs';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import { normalizeOverviewRangePickerChange } from '#/utils/overview-date-range';
|
||||
|
||||
import {
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState,
|
||||
overviewToolbarLabelClass,
|
||||
overviewToolbarPanelClass,
|
||||
overviewToolbarShellClass,
|
||||
} from '../../../styles/overview-toolbar-classes';
|
||||
|
||||
interface ShopSelectOption {
|
||||
label: string;
|
||||
value: string;
|
||||
@@ -134,36 +142,40 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center">
|
||||
<!-- 税率输入 -->
|
||||
<div
|
||||
class="flex min-h-[44px] w-full items-center gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 px-3 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto"
|
||||
>
|
||||
<span class="text-xs font-bold text-slate-400 dark:text-[hsl(240deg_5%_64.9%)]">税率</span>
|
||||
<InputNumber
|
||||
:value="props.modelValue.taxRate"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
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"
|
||||
@change="handleTaxRateChange"
|
||||
/>
|
||||
<div
|
||||
class="overview-header-extra flex w-full max-w-full flex-col gap-2 sm:w-auto sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<div :class="overviewToolbarShellClass">
|
||||
<div :class="[overviewToolbarPanelClass, 'flex items-center gap-2 px-2 py-1']">
|
||||
<span class="shrink-0" :class="overviewToolbarLabelClass">税率</span>
|
||||
<InputNumber
|
||||
:value="props.modelValue.taxRate"
|
||||
:min="0"
|
||||
:max="1"
|
||||
:step="0.01"
|
||||
:precision="2"
|
||||
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"
|
||||
@change="handleTaxRateChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 店铺选择(布局/配色与工作台一致) -->
|
||||
<div
|
||||
class="overview-filter-select-group 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),28rem)] dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)]"
|
||||
:class="[
|
||||
overviewToolbarShellClass,
|
||||
'min-w-0 sm:max-w-[min(calc(100vw-2.5rem),28rem)]',
|
||||
]"
|
||||
>
|
||||
<div
|
||||
class="flex min-w-0 items-center gap-2 rounded-xl bg-white/30 p-1 px-2 dark:bg-[hsl(240deg_3.7%_22%/30%)] sm:min-w-[16rem]"
|
||||
:class="[
|
||||
overviewToolbarPanelClass,
|
||||
'flex min-w-0 items-center gap-2 p-1 px-2 sm:min-w-[16rem]',
|
||||
]"
|
||||
>
|
||||
<span
|
||||
class="w-9 shrink-0 text-right text-xs font-bold text-slate-500 dark:text-[hsl(240deg_5%_64.9%)]"
|
||||
>
|
||||
<span class="w-9 shrink-0 text-right" :class="overviewToolbarLabelClass">
|
||||
店铺
|
||||
</span>
|
||||
<Select
|
||||
@@ -179,103 +191,90 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
@change="handleShopSelectChange"
|
||||
@search="(kw: string) => emit('shop-search', kw)"
|
||||
@popup-scroll="(e: Event) => emit('shop-popup-scroll', e)"
|
||||
@dropdown-visible-change="(open: boolean) => emit('shop-dropdown-visible-change', open)"
|
||||
@dropdown-visible-change="
|
||||
(open: boolean) => emit('shop-dropdown-visible-change', open)
|
||||
"
|
||||
>
|
||||
<template #notFoundContent>
|
||||
<div v-if="props.shopListLoading" class="py-3 text-center">
|
||||
<Spin size="small" />
|
||||
<div class="mt-1 text-xs text-slate-400">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-400">
|
||||
暂无店铺
|
||||
<div class="mt-1 text-xs text-slate-600">加载中...</div>
|
||||
</div>
|
||||
<div v-else class="py-3 text-center text-xs text-slate-600">暂无店铺</div>
|
||||
</template>
|
||||
</Select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 时间选择器 -->
|
||||
<div
|
||||
class="flex w-full flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 dark:border-[hsl(240deg_3.7%_22%)] dark:bg-[hsl(240deg_3.7%_15.9%/30%)] sm:w-auto sm:flex-row sm:items-center sm:gap-1.5 sm:p-1"
|
||||
>
|
||||
<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%)]">
|
||||
<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="
|
||||
props.modelValue.activeTimeRange === 'today'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
<div :class="overviewToolbarShellClass">
|
||||
<div
|
||||
:class="[overviewToolbarPanelClass, 'flex w-full items-center gap-1 overflow-x-auto p-1']"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === 'yesterday'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === '7days'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === '30days'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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="
|
||||
props.modelValue.activeTimeRange === 'thisMonth'
|
||||
? '!bg-white !text-blue-600 dark:!bg-blue-900/30 dark:!text-blue-400 !shadow-sm dark:!shadow-none'
|
||||
: '!bg-transparent !text-slate-600 dark:!bg-[hsl(222.34deg_10.43%_12.27%/50%)] dark:!text-[hsl(240deg_5%_64.9%)] hover:!bg-[hsl(240deg_3.7%_22%)]'
|
||||
"
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
:class="[
|
||||
overviewTimeRangeBtnClass,
|
||||
overviewTimeRangeBtnState(props.modelValue.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 dark:text-[hsl(240deg_5%_64.9%)] sm:inline">自定义日期</span>
|
||||
<span
|
||||
class="hidden whitespace-nowrap sm:inline"
|
||||
:class="overviewToolbarLabelClass"
|
||||
>
|
||||
自定义日期
|
||||
</span>
|
||||
<DatePicker.RangePicker
|
||||
:value="props.modelValue.customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
class="!h-8 !w-full !cursor-pointer !border-none !bg-transparent !text-sm !font-bold dark:!text-[hsl(240deg_5%_64.9%)] sm:!w-[220px]"
|
||||
:placeholder="['开始', '结束']"
|
||||
class="overview-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>
|
||||
@@ -283,25 +282,5 @@ const handleTaxRateChange = (val: number | string | undefined) => {
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
:deep(.tax-rate-input .ant-input-number-input) {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
|
||||
:deep(.ant-picker) {
|
||||
border-color: hsl(240deg 3.7% 22%);
|
||||
}
|
||||
:deep(.ant-picker:hover),
|
||||
:deep(.ant-picker-focused) {
|
||||
border-color: hsl(240deg 3.7% 22%);
|
||||
}
|
||||
:deep(.ant-picker-input > input) {
|
||||
color: hsl(240deg 5% 64.9%);
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<style src="../../../styles/overview-toolbar.css"></style>
|
||||
<style src="../../../styles/overview-header-select.css"></style>
|
||||
|
||||
@@ -397,9 +397,8 @@ onActivated(async () => {
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<div class="w-full sm:w-auto">
|
||||
<div class="w-full max-w-full sm:w-auto">
|
||||
<TimeRangeBar
|
||||
class="w-full"
|
||||
:model-value="timeRangeState"
|
||||
:shop-id="shopId"
|
||||
:shop-options="shopSelectOptions"
|
||||
@@ -444,22 +443,27 @@ onActivated(async () => {
|
||||
|
||||
<style scoped>
|
||||
:deep(.shop-overview-page-header) {
|
||||
align-items: center;
|
||||
align-items: stretch;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
@media (max-width: 640px) {
|
||||
@media (min-width: 640px) {
|
||||
:deep(.shop-overview-page-header) {
|
||||
flex-direction: column;
|
||||
align-items: stretch;
|
||||
gap: 10px;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
}
|
||||
}
|
||||
|
||||
:deep(.shop-overview-page-header > div:first-child) {
|
||||
width: 100%;
|
||||
}
|
||||
:deep(.shop-overview-page-header > div:first-child),
|
||||
:deep(.shop-overview-page-header > div:last-child) {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@media (min-width: 640px) {
|
||||
:deep(.shop-overview-page-header > div:first-child),
|
||||
:deep(.shop-overview-page-header > div:last-child) {
|
||||
width: 100%;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
/** 概览页顶部工具栏(与工作台 #extra 一致) */
|
||||
export const overviewToolbarShellClass =
|
||||
'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%)]';
|
||||
|
||||
export const overviewToolbarPanelClass =
|
||||
'overview-toolbar-panel rounded-xl bg-white dark:bg-[hsl(222.34deg_10.43%_14%)]';
|
||||
|
||||
export const overviewToolbarLabelClass =
|
||||
'text-xs font-bold text-slate-700 dark:text-slate-300';
|
||||
|
||||
export const overviewTimeRangeBtnClass =
|
||||
'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';
|
||||
|
||||
export function overviewTimeRangeBtnState(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%)]';
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
/* 概览页头部工具栏:税率、日期选择器等(与工作台 workbench-header-extra 一致) */
|
||||
.overview-header-extra .tax-rate-input.ant-input-number {
|
||||
background: transparent !important;
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.overview-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;
|
||||
}
|
||||
|
||||
.overview-header-extra .tax-rate-input:hover .ant-input-number-input {
|
||||
background-color: rgb(241 245 249) !important;
|
||||
}
|
||||
|
||||
.overview-header-extra .overview-header-range-picker .ant-picker-input > input {
|
||||
color: rgb(15 23 42) !important;
|
||||
font-weight: 700;
|
||||
}
|
||||
|
||||
.overview-header-extra .overview-header-range-picker .ant-picker-separator,
|
||||
.overview-header-extra .overview-header-range-picker .ant-picker-suffix {
|
||||
color: rgb(71 85 105);
|
||||
}
|
||||
|
||||
.overview-toolbar-panel .overview-header-select .ant-select-selector {
|
||||
min-height: 2rem !important;
|
||||
padding-inline: 8px 28px !important;
|
||||
background-color: transparent !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
.overview-toolbar-panel .overview-header-select:hover .ant-select-selector {
|
||||
background-color: rgb(241 245 249) !important;
|
||||
}
|
||||
|
||||
html.dark .overview-header-extra .tax-rate-input .ant-input-number-input,
|
||||
html.dark .overview-header-extra .overview-header-range-picker .ant-picker-input > input {
|
||||
color: hsl(0deg 0% 95%) !important;
|
||||
}
|
||||
|
||||
html.dark .overview-header-extra .overview-header-range-picker .ant-picker-separator,
|
||||
html.dark .overview-header-extra .overview-header-range-picker .ant-picker-suffix {
|
||||
color: hsl(240deg 5% 75%);
|
||||
}
|
||||
|
||||
html.dark .overview-header-extra .tax-rate-input:hover .ant-input-number-input {
|
||||
background-color: hsl(240deg 3.7% 22%) !important;
|
||||
}
|
||||
|
||||
html.dark .overview-toolbar-panel .overview-header-select .ant-select-selector {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
html.dark .overview-toolbar-panel .overview-header-select:hover .ant-select-selector {
|
||||
background-color: hsl(240deg 3.7% 22%) !important;
|
||||
}
|
||||
Reference in New Issue
Block a user