mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-23 23:59:19 +08:00
fix: 税率输入框移到时间选择器外部,表头税率动态跟随
This commit is contained in:
+2
@@ -3,6 +3,7 @@ package top.xyquan.ecomdmbbackend.modules.ecom.overview.model.dto;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -13,6 +14,7 @@ import java.util.List;
|
||||
* 全店铺概览查询DTO
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "全店铺概览查询DTO")
|
||||
public class CompanyOverviewQueryDTO {
|
||||
|
||||
|
||||
+2
@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -14,6 +15,7 @@ import java.util.List;
|
||||
* 单店铺概览查询DTO
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
@Schema(description = "单店铺概览查询DTO")
|
||||
public class ShopOverviewQueryDTO {
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -62,11 +62,12 @@ const lastRequestKey = ref('');
|
||||
const isSyncingRouteQuery = ref(false);
|
||||
|
||||
// 税率(持久化)
|
||||
const TAX_RATE_KEY = 'shop-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();
|
||||
});
|
||||
|
||||
// 切换时间范围
|
||||
@@ -718,70 +719,10 @@ onActivated(async () => {
|
||||
</template>
|
||||
|
||||
<template #extra>
|
||||
<!-- 时间选择器 -->
|
||||
<div
|
||||
class="flex items-center gap-1.5 rounded-2xl border border-slate-200 bg-slate-200/50 p-1"
|
||||
>
|
||||
<!-- 快速选择按钮组 -->
|
||||
<div class="flex rounded-xl bg-white/40 p-1 shadow-inner">
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === 'today'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('today')"
|
||||
>
|
||||
今日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === 'yesterday'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('yesterday')"
|
||||
>
|
||||
昨日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === '7days'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('7days')"
|
||||
>
|
||||
近7日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === '30days'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('30days')"
|
||||
>
|
||||
近30日
|
||||
</Button>
|
||||
</div>
|
||||
<!-- 分隔线 -->
|
||||
<div class="mx-2 h-6 w-px bg-slate-300"></div>
|
||||
<!-- 税率 + 时间选择器 -->
|
||||
<div class="flex items-center gap-2">
|
||||
<!-- 税率输入 -->
|
||||
<div class="flex items-center gap-1 px-2">
|
||||
<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"
|
||||
@@ -794,20 +735,78 @@ onActivated(async () => {
|
||||
:parser="(val: string) => String(Number(val.replace('%', '')) / 100)"
|
||||
/>
|
||||
</div>
|
||||
<!-- 分隔线 -->
|
||||
<div class="mx-2 h-6 w-px bg-slate-300"></div>
|
||||
<!-- 自定义日期选择器 -->
|
||||
<div class="flex items-center gap-2 px-3">
|
||||
<span class="text-xs font-bold text-slate-400">自定义日期</span>
|
||||
<DatePicker.RangePicker
|
||||
v-model:value="customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
class="!cursor-pointer !border-none !bg-transparent !text-sm !font-bold"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
<!-- 时间选择器 -->
|
||||
<div
|
||||
class="flex items-center gap-1.5 rounded-2xl border border-slate-200 bg-slate-200/50 p-1"
|
||||
>
|
||||
<!-- 快速选择按钮组 -->
|
||||
<div class="flex rounded-xl bg-white/40 p-1 shadow-inner">
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === 'today'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('today')"
|
||||
>
|
||||
今日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === 'yesterday'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('yesterday')"
|
||||
>
|
||||
昨日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === '7days'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('7days')"
|
||||
>
|
||||
近7日
|
||||
</Button>
|
||||
<Button
|
||||
type="text"
|
||||
size="small"
|
||||
class="!h-auto !min-w-0 !rounded-lg !border-none !px-5 !py-2 !text-sm !font-bold !shadow-none !transition-all"
|
||||
:class="
|
||||
activeTimeRange === '30days'
|
||||
? '!bg-white !font-black !text-blue-600 !shadow-sm'
|
||||
: '!bg-transparent !text-slate-500 hover:!text-slate-800'
|
||||
"
|
||||
@click="switchTimeRange('30days')"
|
||||
>
|
||||
近30日
|
||||
</Button>
|
||||
</div>
|
||||
<!-- 日期选择器 -->
|
||||
<div class="flex items-center gap-2">
|
||||
<span class="text-xs font-bold text-slate-400">自定义日期</span>
|
||||
<DatePicker.RangePicker
|
||||
v-model:value="customDateRange"
|
||||
size="small"
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始日期', '结束日期']"
|
||||
class="!cursor-pointer !border-none !bg-transparent !text-sm !font-bold"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -947,7 +946,7 @@ onActivated(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>
|
||||
@@ -1012,7 +1011,7 @@ onActivated(async () => {
|
||||
<!-- 扣除项 -->
|
||||
<div class="mt-4 space-y-3 rounded-2xl bg-slate-50/80 p-4">
|
||||
<div class="flex justify-between text-xs">
|
||||
<span class="text-slate-400">销售额 4% 税额</span>
|
||||
<span class="text-slate-400">销售额 {{ (taxRate * 100).toFixed(0) }}% 税额</span>
|
||||
<span class="font-bold text-rose-500">
|
||||
{{
|
||||
overviewData?.totalTaxAmount
|
||||
@@ -1122,7 +1121,7 @@ onActivated(async () => {
|
||||
<th class="border-b px-6 py-4 text-indigo-700">单品 ROI</th>
|
||||
<th class="border-b px-6 py-4">税前盈亏</th>
|
||||
<th class="border-b px-6 py-4 italic text-rose-500">
|
||||
4%税额
|
||||
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||
</th>
|
||||
<th
|
||||
class="border-b bg-emerald-600 px-6 py-4 font-black text-white"
|
||||
|
||||
Reference in New Issue
Block a user