mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:09: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 io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import jakarta.validation.constraints.NotEmpty;
|
import jakarta.validation.constraints.NotEmpty;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -13,6 +14,7 @@ import java.util.List;
|
|||||||
* 全店铺概览查询DTO
|
* 全店铺概览查询DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@Schema(description = "全店铺概览查询DTO")
|
@Schema(description = "全店铺概览查询DTO")
|
||||||
public class CompanyOverviewQueryDTO {
|
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.NotEmpty;
|
||||||
import jakarta.validation.constraints.NotNull;
|
import jakarta.validation.constraints.NotNull;
|
||||||
import jakarta.validation.constraints.Size;
|
import jakarta.validation.constraints.Size;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -14,6 +15,7 @@ import java.util.List;
|
|||||||
* 单店铺概览查询DTO
|
* 单店铺概览查询DTO
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
|
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||||
@Schema(description = "单店铺概览查询DTO")
|
@Schema(description = "单店铺概览查询DTO")
|
||||||
public class ShopOverviewQueryDTO {
|
public class ShopOverviewQueryDTO {
|
||||||
|
|
||||||
|
|||||||
@@ -50,12 +50,13 @@ const dateRange = ref<[dayjs.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);
|
const taxRate = ref<number>(0.04);
|
||||||
taxRate.value = Number(localStorage.getItem(TAX_RATE_KEY)) || 0.04;
|
taxRate.value = Number(localStorage.getItem(TAX_RATE_KEY)) || 0.04;
|
||||||
watch(taxRate, (val) => {
|
watch(taxRate, (val) => {
|
||||||
localStorage.setItem(TAX_RATE_KEY, String(val));
|
localStorage.setItem(TAX_RATE_KEY, String(val));
|
||||||
|
loadOverviewData();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 当前选中的时间范围类型
|
// 当前选中的时间范围类型
|
||||||
@@ -591,7 +592,23 @@ const handleExportSelectedShops = async () => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #extra>
|
<template #extra>
|
||||||
<!-- 时间选择器 - 响应式适配 -->
|
<!-- 税率 + 时间选择器 -->
|
||||||
|
<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-slate-200/70 px-2 py-1.5">
|
||||||
|
<InputNumber
|
||||||
|
v-model:value="taxRate"
|
||||||
|
:min="0"
|
||||||
|
:max="1"
|
||||||
|
:step="0.01"
|
||||||
|
:precision="2"
|
||||||
|
size="small"
|
||||||
|
class="!w-16 !border-none !bg-transparent !text-sm !font-bold"
|
||||||
|
:formatter="(val: number) => `${Number(val) * 100}%`"
|
||||||
|
:parser="(val: string) => String(Number(val.replace('%', '')) / 100)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<!-- 时间选择器容器 -->
|
||||||
<div
|
<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"
|
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"
|
||||||
>
|
>
|
||||||
@@ -652,27 +669,8 @@ const handleExportSelectedShops = async () => {
|
|||||||
近30日
|
近30日
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
<!-- 分隔线 - 移动端隐藏 -->
|
<!-- 日期选择器 -->
|
||||||
<div class="hidden h-6 w-px bg-slate-300 sm:block"></div>
|
<div class="flex items-center 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>
|
|
||||||
<InputNumber
|
|
||||||
v-model:value="taxRate"
|
|
||||||
:min="0"
|
|
||||||
:max="1"
|
|
||||||
:step="0.01"
|
|
||||||
:precision="2"
|
|
||||||
size="small"
|
|
||||||
class="!w-16 !border-none !bg-transparent !text-sm !font-bold"
|
|
||||||
:formatter="(val: number) => `${Number(val) * 100}%`"
|
|
||||||
: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 class="hidden text-xs font-bold text-slate-400 sm:inline">
|
||||||
自定义日期
|
自定义日期
|
||||||
</span>
|
</span>
|
||||||
@@ -687,6 +685,7 @@ const handleExportSelectedShops = async () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Spin :spinning="loading">
|
<Spin :spinning="loading">
|
||||||
@@ -797,7 +796,7 @@ const handleExportSelectedShops = async () => {
|
|||||||
v-if="overviewData?.totalTaxAmount !== undefined"
|
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"
|
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>
|
<span>{{ formatAmount(overviewData.totalTaxAmount) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -998,7 +997,7 @@ const handleExportSelectedShops = async () => {
|
|||||||
税前盈亏
|
税前盈亏
|
||||||
</th>
|
</th>
|
||||||
<th class="border-b px-6 py-4 italic text-rose-500">
|
<th class="border-b px-6 py-4 italic text-rose-500">
|
||||||
4%税额
|
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||||
</th>
|
</th>
|
||||||
<th class="border-b px-6 py-4 font-black text-indigo-700">
|
<th class="border-b px-6 py-4 font-black text-indigo-700">
|
||||||
ROI
|
ROI
|
||||||
|
|||||||
@@ -62,11 +62,12 @@ const lastRequestKey = ref('');
|
|||||||
const isSyncingRouteQuery = ref(false);
|
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);
|
const taxRate = ref<number>(0.04);
|
||||||
taxRate.value = Number(localStorage.getItem(TAX_RATE_KEY)) || 0.04;
|
taxRate.value = Number(localStorage.getItem(TAX_RATE_KEY)) || 0.04;
|
||||||
watch(taxRate, (val) => {
|
watch(taxRate, (val) => {
|
||||||
localStorage.setItem(TAX_RATE_KEY, String(val));
|
localStorage.setItem(TAX_RATE_KEY, String(val));
|
||||||
|
loadOverviewData();
|
||||||
});
|
});
|
||||||
|
|
||||||
// 切换时间范围
|
// 切换时间范围
|
||||||
@@ -718,6 +719,22 @@ onActivated(async () => {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<template #extra>
|
<template #extra>
|
||||||
|
<!-- 税率 + 时间选择器 -->
|
||||||
|
<div class="flex items-center gap-2">
|
||||||
|
<!-- 税率输入 -->
|
||||||
|
<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"
|
||||||
|
:max="1"
|
||||||
|
:step="0.01"
|
||||||
|
:precision="2"
|
||||||
|
size="small"
|
||||||
|
class="!w-16 !border-none !bg-transparent !text-sm !font-bold"
|
||||||
|
:formatter="(val: number) => `${Number(val) * 100}%`"
|
||||||
|
:parser="(val: string) => String(Number(val.replace('%', '')) / 100)"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
<!-- 时间选择器 -->
|
<!-- 时间选择器 -->
|
||||||
<div
|
<div
|
||||||
class="flex items-center gap-1.5 rounded-2xl border border-slate-200 bg-slate-200/50 p-1"
|
class="flex items-center gap-1.5 rounded-2xl border border-slate-200 bg-slate-200/50 p-1"
|
||||||
@@ -777,27 +794,8 @@ onActivated(async () => {
|
|||||||
近30日
|
近30日
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</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>
|
|
||||||
<InputNumber
|
|
||||||
v-model:value="taxRate"
|
|
||||||
:min="0"
|
|
||||||
:max="1"
|
|
||||||
:step="0.01"
|
|
||||||
:precision="2"
|
|
||||||
size="small"
|
|
||||||
class="!w-16 !border-none !bg-transparent !text-sm !font-bold"
|
|
||||||
:formatter="(val: number) => `${Number(val) * 100}%`"
|
|
||||||
: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>
|
<span class="text-xs font-bold text-slate-400">自定义日期</span>
|
||||||
<DatePicker.RangePicker
|
<DatePicker.RangePicker
|
||||||
v-model:value="customDateRange"
|
v-model:value="customDateRange"
|
||||||
@@ -810,6 +808,7 @@ onActivated(async () => {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<Spin :spinning="loading">
|
<Spin :spinning="loading">
|
||||||
@@ -947,7 +946,7 @@ onActivated(async () => {
|
|||||||
v-if="overviewData?.totalTaxAmount !== undefined"
|
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"
|
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>
|
<span>-{{ formatAmount(overviewData.totalTaxAmount) }}</span>
|
||||||
</div>
|
</div>
|
||||||
</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="mt-4 space-y-3 rounded-2xl bg-slate-50/80 p-4">
|
||||||
<div class="flex justify-between text-xs">
|
<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">
|
<span class="font-bold text-rose-500">
|
||||||
{{
|
{{
|
||||||
overviewData?.totalTaxAmount
|
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 text-indigo-700">单品 ROI</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 italic text-rose-500">
|
<th class="border-b px-6 py-4 italic text-rose-500">
|
||||||
4%税额
|
{{ (taxRate * 100).toFixed(0) }}%税额
|
||||||
</th>
|
</th>
|
||||||
<th
|
<th
|
||||||
class="border-b bg-emerald-600 px-6 py-4 font-black text-white"
|
class="border-b bg-emerald-600 px-6 py-4 font-black text-white"
|
||||||
|
|||||||
Reference in New Issue
Block a user