mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 05:49:20 +08:00
feat: 公司/店铺概览对比表增加商品成本和其他成本字段
CompanyOverviewVO.ShopComparison: 加 productCost、otherCost 字段 ShopOverviewStatisticsVO.ProductComparison: 加 productCost、otherCost 字段 CompanyOverviewServiceImpl / ShopOverviewStatisticsServiceImpl: 分别计算并赋值 前端 API 类型同步更新 公司概览 + 店铺概览页面表格:成本运费列拆为商品成本/运费/其他成本三列
This commit is contained in:
@@ -59,6 +59,19 @@ watch(taxRate, (val) => {
|
||||
loadOverviewData();
|
||||
});
|
||||
|
||||
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}%`;
|
||||
};
|
||||
|
||||
const parseTaxRate = (value: string | undefined) => {
|
||||
if (!value) return 0;
|
||||
const num = Number(value.replace('%', '').trim());
|
||||
return Number.isFinite(num) ? num / 100 : 0;
|
||||
};
|
||||
|
||||
// 当前选中的时间范围类型
|
||||
const activeTimeRange = ref<
|
||||
'7days' | '30days' | 'custom' | 'today' | 'yesterday'
|
||||
@@ -595,7 +608,10 @@ const handleExportSelectedShops = async () => {
|
||||
<!-- 税率 + 时间选择器 -->
|
||||
<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">
|
||||
<div
|
||||
class="flex h-[42px] items-center gap-2 rounded-2xl border border-slate-200 bg-slate-200/50 px-3"
|
||||
>
|
||||
<span class="text-xs font-bold text-slate-400">税率</span>
|
||||
<InputNumber
|
||||
v-model:value="taxRate"
|
||||
:min="0"
|
||||
@@ -603,9 +619,9 @@ const handleExportSelectedShops = async () => {
|
||||
: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)"
|
||||
class="tax-rate-input !h-8 !w-20 !rounded-lg !border-none !bg-white/30 !text-sm !font-bold"
|
||||
:formatter="formatTaxRate"
|
||||
:parser="parseTaxRate"
|
||||
/>
|
||||
</div>
|
||||
<!-- 时间选择器容器 -->
|
||||
@@ -680,7 +696,7 @@ const handleExportSelectedShops = async () => {
|
||||
format="YYYY-MM-DD"
|
||||
:allow-clear="false"
|
||||
:placeholder="['开始', '结束']"
|
||||
class="!border-none !bg-transparent !text-sm !font-bold"
|
||||
class="!h-8 !border-none !bg-transparent !text-sm !font-bold"
|
||||
@change="handleCustomDateRangeChange"
|
||||
/>
|
||||
</div>
|
||||
@@ -985,7 +1001,9 @@ const handleExportSelectedShops = async () => {
|
||||
<th class="border-b px-6 py-4">单量</th>
|
||||
<th class="border-b px-6 py-4">客单价</th>
|
||||
<!-- 成本 -->
|
||||
<th class="border-b border-l px-6 py-4">成本运费</th>
|
||||
<th class="border-b border-l px-6 py-4">商品成本</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 font-bold text-rose-600">
|
||||
退款金额
|
||||
</th>
|
||||
@@ -1075,11 +1093,21 @@ const handleExportSelectedShops = async () => {
|
||||
}}
|
||||
</td>
|
||||
<!-- 成本 -->
|
||||
<td class="p-6">
|
||||
{{
|
||||
shop.productCost ? formatAmount(shop.productCost) : '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="p-6">
|
||||
{{
|
||||
shop.shippingCost ? formatAmount(shop.shippingCost) : '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="p-6">
|
||||
{{
|
||||
shop.otherCost ? formatAmount(shop.otherCost) : '-'
|
||||
}}
|
||||
</td>
|
||||
<td class="p-6 font-bold text-rose-600">
|
||||
{{
|
||||
shop.refundAmount ? formatAmount(shop.refundAmount) : '-'
|
||||
@@ -1163,4 +1191,11 @@ const handleExportSelectedShops = async () => {
|
||||
left: 0;
|
||||
z-index: 10;
|
||||
}
|
||||
|
||||
:deep(.tax-rate-input .ant-input-number-input) {
|
||||
height: 32px;
|
||||
line-height: 32px;
|
||||
padding-top: 0;
|
||||
padding-bottom: 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user