mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:49:20 +08:00
fix: 税率输入框移到时间选择器外部,表头税率动态跟随
This commit is contained in:
@@ -50,12 +50,13 @@ const dateRange = ref<[dayjs.Dayjs, dayjs.Dayjs]>([
|
||||
dayjs(),
|
||||
]);
|
||||
|
||||
// 税率(持久化)
|
||||
const TAX_RATE_KEY = 'company-overview-tax-rate';
|
||||
// 税率(公司/店铺概览共用持久化)
|
||||
const TAX_RATE_KEY = 'overview-tax-rate';
|
||||
const taxRate = ref<number>(0.04);
|
||||
taxRate.value = Number(localStorage.getItem(TAX_RATE_KEY)) || 0.04;
|
||||
watch(taxRate, (val) => {
|
||||
localStorage.setItem(TAX_RATE_KEY, String(val));
|
||||
loadOverviewData();
|
||||
});
|
||||
|
||||
// 当前选中的时间范围类型
|
||||
@@ -591,72 +592,10 @@ const handleExportSelectedShops = async () => {
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<!-- 时间选择器 - 响应式适配 -->
|
||||
<div
|
||||
class="flex flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<!-- 快速选择按钮组 -->
|
||||
<div
|
||||
class="flex items-center gap-1 overflow-x-auto rounded-xl bg-white/30 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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@click="switchTimeRange('30days')"
|
||||
>
|
||||
近30日
|
||||
</Button>
|
||||
</div>
|
||||
<!-- 分隔线 - 移动端隐藏 -->
|
||||
<div class="hidden h-6 w-px bg-slate-300 sm:block"></div>
|
||||
<!-- 税率 + 时间选择器 -->
|
||||
<div class="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-2">
|
||||
<!-- 税率输入 -->
|
||||
<div class="flex items-center gap-1 rounded-xl bg-white/30 px-2 py-1.5">
|
||||
<span class="text-xs font-bold text-slate-400">税率</span>
|
||||
<div class="flex items-center gap-1 rounded-xl bg-slate-200/70 px-2 py-1.5">
|
||||
<InputNumber
|
||||
v-model:value="taxRate"
|
||||
:min="0"
|
||||
@@ -669,22 +608,82 @@ const handleExportSelectedShops = async () => {
|
||||
:parser="(val: string) => String(Number(val.replace('%', '')) / 100)"
|
||||
/>
|
||||
</div>
|
||||
<!-- 分隔线 - 移动端隐藏 -->
|
||||
<div class="hidden h-6 w-px bg-slate-300 sm:block"></div>
|
||||
<!-- 自定义日期选择器 -->
|
||||
<div class="flex items-center gap-2 rounded-xl bg-white/30 px-3 py-1.5">
|
||||
<span class="hidden text-xs font-bold text-slate-400 sm:inline">
|
||||
自定义日期
|
||||
</span>
|
||||
<DatePicker.RangePicker
|
||||
v-model:value="customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始', '结束']"
|
||||
class="!border-none !bg-transparent !text-sm !font-bold"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
<!-- 时间选择器容器 -->
|
||||
<div
|
||||
class="flex flex-col gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 p-1.5 sm:flex-row sm:items-center sm:gap-2"
|
||||
>
|
||||
<!-- 快速选择按钮组 -->
|
||||
<div
|
||||
class="flex items-center gap-1 overflow-x-auto rounded-xl bg-white/30 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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@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'
|
||||
: '!bg-transparent !text-slate-600 hover:!bg-white/50'
|
||||
"
|
||||
@click="switchTimeRange('30days')"
|
||||
>
|
||||
近30日
|
||||
</Button>
|
||||
</div>
|
||||
<!-- 日期选择器 -->
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="hidden text-xs font-bold text-slate-400 sm:inline">
|
||||
自定义日期
|
||||
</span>
|
||||
<DatePicker.RangePicker
|
||||
v-model:value="customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始', '结束']"
|
||||
class="!border-none !bg-transparent !text-sm !font-bold"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -797,7 +796,7 @@ const handleExportSelectedShops = async () => {
|
||||
v-if="overviewData?.totalTaxAmount !== undefined"
|
||||
class="mt-6 flex justify-between border-t border-slate-100 pt-4 text-[11px] font-bold text-slate-400"
|
||||
>
|
||||
<span>已扣除预扣税额 (4%)</span>
|
||||
<span>已扣除预扣税额 ({{ (taxRate * 100).toFixed(0) }}%)</span>
|
||||
<span>{{ formatAmount(overviewData.totalTaxAmount) }}</span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -998,7 +997,7 @@ const handleExportSelectedShops = async () => {
|
||||
税前盈亏
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500">
|
||||
4%税额
|
||||
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||
</th>
|
||||
<th class="border-b px-6 py-4 font-black text-indigo-700">
|
||||
ROI
|
||||
|
||||
Reference in New Issue
Block a user