mirror of
https://gitee.com/qqtt-ah/ecom-dmb.git
synced 2026-11-25 02:29:19 +08:00
refactor(ecom-dmb): 店铺概览商品/品类对比表改为对象结构含合计行
This commit is contained in:
+28
-4
@@ -136,16 +136,40 @@ public class ShopOverviewStatisticsVO {
|
|||||||
private TrendData orderCountTrend;
|
private TrendData orderCountTrend;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 多商品数据横向对比
|
* 多商品数据横向对比(含合计行)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "多商品数据横向对比")
|
@Schema(description = "多商品数据横向对比")
|
||||||
private List<ProductComparison> productComparisons;
|
private ProductOverview productOverview;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 品类多维度数据对比
|
* 品类多维度数据对比(含合计行)
|
||||||
*/
|
*/
|
||||||
@Schema(description = "品类多维度数据对比")
|
@Schema(description = "品类多维度数据对比")
|
||||||
private List<CategoryComparison> categoryComparisons;
|
private CategoryOverview categoryOverview;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 商品概览(含合计行和商品列表)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "商品概览")
|
||||||
|
public static class ProductOverview {
|
||||||
|
@Schema(description = "合计行")
|
||||||
|
private ProductComparison total;
|
||||||
|
@Schema(description = "各商品对比列表")
|
||||||
|
private List<ProductComparison> products;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 品类概览(含合计行和品类列表)
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@Schema(description = "品类概览")
|
||||||
|
public static class CategoryOverview {
|
||||||
|
@Schema(description = "合计行")
|
||||||
|
private CategoryComparison total;
|
||||||
|
@Schema(description = "各品类对比列表")
|
||||||
|
private List<CategoryComparison> categories;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 商品对比数据
|
* 商品对比数据
|
||||||
|
|||||||
+2
-2
@@ -203,9 +203,9 @@ public class ExportServiceImpl implements ExportService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (("product".equals(exportType) || "all".equals(exportType))
|
if (("product".equals(exportType) || "all".equals(exportType))
|
||||||
&& vo.getProductComparisons() != null && !vo.getProductComparisons().isEmpty()) {
|
&& vo.getProductOverview() != null && vo.getProductOverview().getProducts() != null && !vo.getProductOverview().getProducts().isEmpty()) {
|
||||||
Sheet productSheet = workbook.createSheet("商品明细");
|
Sheet productSheet = workbook.createSheet("商品明细");
|
||||||
createProductDetailSheetFromVO(productSheet, dateRangeLabel, vo.getProductComparisons(), taxRate);
|
createProductDetailSheetFromVO(productSheet, dateRangeLabel, vo.getProductOverview().getProducts(), taxRate);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (("trend".equals(exportType) || "all".equals(exportType))
|
if (("trend".equals(exportType) || "all".equals(exportType))
|
||||||
|
|||||||
+140
-8
@@ -241,14 +241,14 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
|||||||
overviewVO.setOrderCountTrend(orderCountTrend);
|
overviewVO.setOrderCountTrend(orderCountTrend);
|
||||||
|
|
||||||
// 10. 多商品数据横向对比
|
// 10. 多商品数据横向对比
|
||||||
List<ShopOverviewStatisticsVO.ProductComparison> productComparisons = calculateProductComparisons(
|
ShopOverviewStatisticsVO.ProductOverview productOverview = calculateProductComparisons(
|
||||||
orders, promotionFees, brushOrders, refundStatusId);
|
orders, promotionFees, brushOrders, refundStatusId);
|
||||||
overviewVO.setProductComparisons(productComparisons);
|
overviewVO.setProductOverview(productOverview);
|
||||||
|
|
||||||
// 11. 品类多维度数据对比
|
// 11. 品类多维度数据对比
|
||||||
List<ShopOverviewStatisticsVO.CategoryComparison> categoryComparisons = calculateCategoryComparisons(
|
ShopOverviewStatisticsVO.CategoryOverview categoryOverview = calculateCategoryComparisons(
|
||||||
orders, promotionFees, brushOrders, refundStatusId);
|
orders, promotionFees, brushOrders, refundStatusId);
|
||||||
overviewVO.setCategoryComparisons(categoryComparisons);
|
overviewVO.setCategoryOverview(categoryOverview);
|
||||||
|
|
||||||
return overviewVO;
|
return overviewVO;
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
|||||||
/**
|
/**
|
||||||
* 计算多商品数据横向对比
|
* 计算多商品数据横向对比
|
||||||
*/
|
*/
|
||||||
private List<ShopOverviewStatisticsVO.ProductComparison> calculateProductComparisons(
|
private ShopOverviewStatisticsVO.ProductOverview calculateProductComparisons(
|
||||||
List<OrderPO> orders, List<PromotionFeePO> promotionFees,
|
List<OrderPO> orders, List<PromotionFeePO> promotionFees,
|
||||||
List<BrushOrderPO> brushOrders, Long refundStatusId) {
|
List<BrushOrderPO> brushOrders, Long refundStatusId) {
|
||||||
List<ShopOverviewStatisticsVO.ProductComparison> comparisons = new ArrayList<>();
|
List<ShopOverviewStatisticsVO.ProductComparison> comparisons = new ArrayList<>();
|
||||||
@@ -492,7 +492,73 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
|||||||
|
|
||||||
// 按销售额降序排序
|
// 按销售额降序排序
|
||||||
comparisons.sort(Comparator.comparing(ShopOverviewStatisticsVO.ProductComparison::getSalesAmount).reversed());
|
comparisons.sort(Comparator.comparing(ShopOverviewStatisticsVO.ProductComparison::getSalesAmount).reversed());
|
||||||
return comparisons;
|
|
||||||
|
// 计算合计行
|
||||||
|
ShopOverviewStatisticsVO.ProductComparison total = computeProductTotal(comparisons);
|
||||||
|
|
||||||
|
// 封装为 ProductOverview
|
||||||
|
ShopOverviewStatisticsVO.ProductOverview overview = new ShopOverviewStatisticsVO.ProductOverview();
|
||||||
|
overview.setTotal(total);
|
||||||
|
overview.setProducts(comparisons);
|
||||||
|
return overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算商品对比的合计行
|
||||||
|
*/
|
||||||
|
private ShopOverviewStatisticsVO.ProductComparison computeProductTotal(List<ShopOverviewStatisticsVO.ProductComparison> products) {
|
||||||
|
BigDecimal totalSales = BigDecimal.ZERO;
|
||||||
|
int totalOrders = 0;
|
||||||
|
BigDecimal totalProductCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalShippingCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalOtherCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalRefund = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalPromoFee = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalBrushFee = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for (ShopOverviewStatisticsVO.ProductComparison p : products) {
|
||||||
|
totalSales = totalSales.add(p.getSalesAmount() != null ? p.getSalesAmount() : BigDecimal.ZERO);
|
||||||
|
totalOrders += p.getOrderCount() != null ? p.getOrderCount() : 0;
|
||||||
|
totalProductCost = totalProductCost.add(p.getProductCost() != null ? p.getProductCost() : BigDecimal.ZERO);
|
||||||
|
totalShippingCost = totalShippingCost.add(p.getShippingCost() != null ? p.getShippingCost() : BigDecimal.ZERO);
|
||||||
|
totalOtherCost = totalOtherCost.add(p.getOtherCost() != null ? p.getOtherCost() : BigDecimal.ZERO);
|
||||||
|
totalRefund = totalRefund.add(p.getRefundAmount() != null ? p.getRefundAmount() : BigDecimal.ZERO);
|
||||||
|
totalPromoFee = totalPromoFee.add(p.getTotalPromotionFee() != null ? p.getTotalPromotionFee() : BigDecimal.ZERO);
|
||||||
|
totalBrushFee = totalBrushFee.add(p.getBrushFee() != null ? p.getBrushFee() : BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal avgOrderValue = totalOrders > 0
|
||||||
|
? totalSales.divide(new BigDecimal(totalOrders), 2, RoundingMode.HALF_UP)
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal totalCost = totalProductCost.add(totalShippingCost).add(totalOtherCost);
|
||||||
|
BigDecimal profitBeforeTax = totalSales.subtract(totalCost).subtract(totalRefund);
|
||||||
|
BigDecimal salesTax = totalSales.multiply(new BigDecimal("0.04"));
|
||||||
|
BigDecimal profitAfterTax = profitBeforeTax.subtract(salesTax);
|
||||||
|
BigDecimal roi = totalPromoFee.compareTo(BigDecimal.ZERO) > 0
|
||||||
|
? totalSales.subtract(totalRefund).divide(totalPromoFee, 4, RoundingMode.HALF_UP)
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal feeRatio = totalSales.compareTo(BigDecimal.ZERO) > 0
|
||||||
|
? totalPromoFee.add(totalBrushFee).divide(totalSales, 4, RoundingMode.HALF_UP)
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
|
||||||
|
ShopOverviewStatisticsVO.ProductComparison total = new ShopOverviewStatisticsVO.ProductComparison();
|
||||||
|
total.setProductId(0L);
|
||||||
|
total.setProductName("合计");
|
||||||
|
total.setSalesAmount(totalSales);
|
||||||
|
total.setOrderCount(totalOrders);
|
||||||
|
total.setAverageOrderValue(avgOrderValue);
|
||||||
|
total.setProductCost(totalProductCost);
|
||||||
|
total.setShippingCost(totalShippingCost);
|
||||||
|
total.setOtherCost(totalOtherCost);
|
||||||
|
total.setRefundAmount(totalRefund);
|
||||||
|
total.setTotalPromotionFee(totalPromoFee);
|
||||||
|
total.setBrushFee(totalBrushFee);
|
||||||
|
total.setFeeRatio(feeRatio);
|
||||||
|
total.setTotalProfitBeforeTax(profitBeforeTax);
|
||||||
|
total.setSalesTaxAmount(salesTax);
|
||||||
|
total.setRoi(roi);
|
||||||
|
total.setProfitAfterTax(profitAfterTax);
|
||||||
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -619,7 +685,7 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
|||||||
/**
|
/**
|
||||||
* 计算品类多维度数据对比
|
* 计算品类多维度数据对比
|
||||||
*/
|
*/
|
||||||
private List<ShopOverviewStatisticsVO.CategoryComparison> calculateCategoryComparisons(
|
private ShopOverviewStatisticsVO.CategoryOverview calculateCategoryComparisons(
|
||||||
List<OrderPO> orders, List<PromotionFeePO> promotionFees,
|
List<OrderPO> orders, List<PromotionFeePO> promotionFees,
|
||||||
List<BrushOrderPO> brushOrders, Long refundStatusId) {
|
List<BrushOrderPO> brushOrders, Long refundStatusId) {
|
||||||
|
|
||||||
@@ -752,7 +818,73 @@ public class ShopOverviewStatisticsServiceImpl implements ShopOverviewStatistics
|
|||||||
}
|
}
|
||||||
|
|
||||||
results.sort(Comparator.comparing(ShopOverviewStatisticsVO.CategoryComparison::getSalesAmount).reversed());
|
results.sort(Comparator.comparing(ShopOverviewStatisticsVO.CategoryComparison::getSalesAmount).reversed());
|
||||||
return results;
|
|
||||||
|
// 计算合计行
|
||||||
|
ShopOverviewStatisticsVO.CategoryComparison total = computeCategoryTotalForShop(results);
|
||||||
|
|
||||||
|
// 封装为 CategoryOverview
|
||||||
|
ShopOverviewStatisticsVO.CategoryOverview overview = new ShopOverviewStatisticsVO.CategoryOverview();
|
||||||
|
overview.setTotal(total);
|
||||||
|
overview.setCategories(results);
|
||||||
|
return overview;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 计算店铺视角品类对比的合计行
|
||||||
|
*/
|
||||||
|
private ShopOverviewStatisticsVO.CategoryComparison computeCategoryTotalForShop(List<ShopOverviewStatisticsVO.CategoryComparison> categories) {
|
||||||
|
BigDecimal totalSales = BigDecimal.ZERO;
|
||||||
|
int totalOrders = 0;
|
||||||
|
BigDecimal totalProductCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalShippingCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalOtherCost = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalRefund = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalPromoFee = BigDecimal.ZERO;
|
||||||
|
BigDecimal totalBrushFee = BigDecimal.ZERO;
|
||||||
|
|
||||||
|
for (ShopOverviewStatisticsVO.CategoryComparison c : categories) {
|
||||||
|
totalSales = totalSales.add(c.getSalesAmount() != null ? c.getSalesAmount() : BigDecimal.ZERO);
|
||||||
|
totalOrders += c.getOrderCount() != null ? c.getOrderCount() : 0;
|
||||||
|
totalProductCost = totalProductCost.add(c.getProductCost() != null ? c.getProductCost() : BigDecimal.ZERO);
|
||||||
|
totalShippingCost = totalShippingCost.add(c.getShippingCost() != null ? c.getShippingCost() : BigDecimal.ZERO);
|
||||||
|
totalOtherCost = totalOtherCost.add(c.getOtherCost() != null ? c.getOtherCost() : BigDecimal.ZERO);
|
||||||
|
totalRefund = totalRefund.add(c.getRefundAmount() != null ? c.getRefundAmount() : BigDecimal.ZERO);
|
||||||
|
totalPromoFee = totalPromoFee.add(c.getTotalPromotionFee() != null ? c.getTotalPromotionFee() : BigDecimal.ZERO);
|
||||||
|
totalBrushFee = totalBrushFee.add(c.getBrushFee() != null ? c.getBrushFee() : BigDecimal.ZERO);
|
||||||
|
}
|
||||||
|
|
||||||
|
BigDecimal avgOrderValue = totalOrders > 0
|
||||||
|
? totalSales.divide(new BigDecimal(totalOrders), 2, RoundingMode.HALF_UP)
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal totalCost = totalProductCost.add(totalShippingCost).add(totalOtherCost);
|
||||||
|
BigDecimal profitBeforeTax = totalSales.subtract(totalCost).subtract(totalRefund);
|
||||||
|
BigDecimal salesTax = totalSales.multiply(new BigDecimal("0.04"));
|
||||||
|
BigDecimal profitAfterTax = profitBeforeTax.subtract(salesTax);
|
||||||
|
BigDecimal roi = totalPromoFee.compareTo(BigDecimal.ZERO) > 0
|
||||||
|
? totalSales.subtract(totalRefund).divide(totalPromoFee, 4, RoundingMode.HALF_UP)
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
BigDecimal feeRatio = totalSales.compareTo(BigDecimal.ZERO) > 0
|
||||||
|
? totalPromoFee.add(totalBrushFee).divide(totalSales, 4, RoundingMode.HALF_UP)
|
||||||
|
: BigDecimal.ZERO;
|
||||||
|
|
||||||
|
ShopOverviewStatisticsVO.CategoryComparison total = new ShopOverviewStatisticsVO.CategoryComparison();
|
||||||
|
total.setCategoryId(0L);
|
||||||
|
total.setCategoryName("合计");
|
||||||
|
total.setSalesAmount(totalSales);
|
||||||
|
total.setOrderCount(totalOrders);
|
||||||
|
total.setAverageOrderValue(avgOrderValue);
|
||||||
|
total.setProductCost(totalProductCost);
|
||||||
|
total.setShippingCost(totalShippingCost);
|
||||||
|
total.setOtherCost(totalOtherCost);
|
||||||
|
total.setRefundAmount(totalRefund);
|
||||||
|
total.setTotalPromotionFee(totalPromoFee);
|
||||||
|
total.setBrushFee(totalBrushFee);
|
||||||
|
total.setFeeRatio(feeRatio);
|
||||||
|
total.setTotalProfitBeforeTax(profitBeforeTax);
|
||||||
|
total.setSalesTaxAmount(salesTax);
|
||||||
|
total.setRoi(roi);
|
||||||
|
total.setProfitAfterTax(profitAfterTax);
|
||||||
|
return total;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,10 +149,10 @@ export namespace ShopVO {
|
|||||||
salesAmountTrend?: TrendData;
|
salesAmountTrend?: TrendData;
|
||||||
/** 单量趋势分析 */
|
/** 单量趋势分析 */
|
||||||
orderCountTrend?: TrendData;
|
orderCountTrend?: TrendData;
|
||||||
/** 多商品数据横向对比 */
|
/** 多商品数据横向对比(含合计行) */
|
||||||
productComparisons?: ProductComparison[];
|
productOverview?: ProductOverview;
|
||||||
/** 品类多维度数据对比 */
|
/** 品类多维度数据对比(含合计行) */
|
||||||
categoryComparisons?: CategoryComparison[];
|
categoryOverview?: CategoryOverview;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 商品对比数据 */
|
/** 商品对比数据 */
|
||||||
@@ -244,4 +244,20 @@ export namespace ShopVO {
|
|||||||
/** 对应的值 */
|
/** 对应的值 */
|
||||||
value: number;
|
value: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 商品概览(含合计行和商品列表) */
|
||||||
|
export interface ProductOverview {
|
||||||
|
/** 合计行 */
|
||||||
|
total: ProductComparison;
|
||||||
|
/** 各商品对比列表 */
|
||||||
|
products: ProductComparison[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 品类概览(含合计行和品类列表) */
|
||||||
|
export interface CategoryOverview {
|
||||||
|
/** 合计行 */
|
||||||
|
total: CategoryComparison;
|
||||||
|
/** 各品类对比列表 */
|
||||||
|
categories: CategoryComparison[];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+25
-5
@@ -80,7 +80,7 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="max-h-[420px] overflow-auto">
|
<div class="max-h-[580px] overflow-auto">
|
||||||
<table class="w-full whitespace-nowrap text-left text-sm shop-overview-thead">
|
<table class="w-full whitespace-nowrap text-left text-sm shop-overview-thead">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 60px; min-width: 60px;" />
|
<col style="width: 60px; min-width: 60px;" />
|
||||||
@@ -111,8 +111,8 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
type="checkbox"
|
type="checkbox"
|
||||||
:checked="Boolean(props.data?.categoryComparisons?.length) && props.selectedExportCategoryIds.length === (props.data?.categoryComparisons?.length ?? 0)"
|
:checked="Boolean(props.data?.categoryOverview?.categories?.length) && props.selectedExportCategoryIds.length === (props.data?.categoryOverview?.categories?.length ?? 0)"
|
||||||
:indeterminate="props.selectedExportCategoryIds.length > 0 && props.selectedExportCategoryIds.length < (props.data?.categoryComparisons?.length ?? 0)"
|
:indeterminate="props.selectedExportCategoryIds.length > 0 && props.selectedExportCategoryIds.length < (props.data?.categoryOverview?.categories?.length ?? 0)"
|
||||||
class="h-4 w-4 cursor-pointer accent-blue-600"
|
class="h-4 w-4 cursor-pointer accent-blue-600"
|
||||||
@change="emit('category-select-all', $event)"
|
@change="emit('category-select-all', $event)"
|
||||||
/>
|
/>
|
||||||
@@ -154,7 +154,7 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
|
|
||||||
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
|
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
|
||||||
<tr
|
<tr
|
||||||
v-for="cat in props.data?.categoryComparisons"
|
v-for="cat in (props.data?.categoryOverview?.categories || [])"
|
||||||
:key="cat.categoryId ?? 'uncategorized'"
|
:key="cat.categoryId ?? 'uncategorized'"
|
||||||
class="transition-colors hover:bg-blue-50/50 dark:hover:bg-[hsl(217.2deg_32.6%_17.5%/30%)]"
|
class="transition-colors hover:bg-blue-50/50 dark:hover:bg-[hsl(217.2deg_32.6%_17.5%/30%)]"
|
||||||
>
|
>
|
||||||
@@ -194,12 +194,32 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
{{ cat.profitAfterTax ? formatAmount(cat.profitAfterTax) : '-' }}
|
{{ cat.profitAfterTax ? formatAmount(cat.profitAfterTax) : '-' }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="!props.data?.categoryComparisons?.length">
|
<tr v-if="!props.data?.categoryOverview?.categories?.length">
|
||||||
<td :colspan="props.categoryExportMode ? 16 : 15" class="p-8 text-center text-gray-400">
|
<td :colspan="props.categoryExportMode ? 16 : 15" class="p-8 text-center text-gray-400">
|
||||||
暂无数据
|
暂无数据
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot v-if="props.data?.categoryOverview?.total" class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)]">
|
||||||
|
<tr class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||||
|
<td v-if="props.categoryExportMode" class="sticky-col border-r border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] p-6 text-center" style="left: 40px; position: sticky; z-index: 10;"></td>
|
||||||
|
<td class="sticky-col border-r-2 border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4 text-base font-black" style="left: 0; position: sticky; z-index: 10;">合计</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.salesAmount ? formatAmount(props.data.categoryOverview.total.salesAmount) : '-' }}</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.orderCount ? props.data.categoryOverview.total.orderCount.toLocaleString() : '-' }}</td>
|
||||||
|
<td class="p-6">-</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.productCost ? formatAmount(props.data.categoryOverview.total.productCost) : '-' }}</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.shippingCost ? formatAmount(props.data.categoryOverview.total.shippingCost) : '-' }}</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.otherCost ? formatAmount(props.data.categoryOverview.total.otherCost) : '-' }}</td>
|
||||||
|
<td class="p-6 text-rose-600 dark:text-rose-400">{{ props.data.categoryOverview.total.refundAmount ? formatAmount(props.data.categoryOverview.total.refundAmount) : '-' }}</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.totalPromotionFee ? formatAmount(props.data.categoryOverview.total.totalPromotionFee) : '-' }}</td>
|
||||||
|
<td class="p-6 text-orange-600 dark:text-orange-400">{{ props.data.categoryOverview.total.brushFee ? formatAmount(props.data.categoryOverview.total.brushFee) : '-' }}</td>
|
||||||
|
<td class="p-6 text-slate-400">{{ props.data.categoryOverview.total.feeRatio !== undefined ? formatPercentPlain(props.data.categoryOverview.total.feeRatio) : '-' }}</td>
|
||||||
|
<td class="p-6">{{ props.data.categoryOverview.total.totalProfitBeforeTax ? formatAmount(props.data.categoryOverview.total.totalProfitBeforeTax) : '-' }}</td>
|
||||||
|
<td class="p-6 italic text-slate-400">{{ props.data.categoryOverview.total.salesTaxAmount ? formatAmount(props.data.categoryOverview.total.salesTaxAmount) : '-' }}</td>
|
||||||
|
<td class="p-6 text-indigo-700 dark:text-indigo-400">{{ props.data.categoryOverview.total.roi !== undefined ? props.data.categoryOverview.total.roi.toFixed(2) : '-' }}</td>
|
||||||
|
<td class="bg-emerald-50/30 dark:bg-[hsl(142deg_71.8%_29%/20%)] p-6 text-base">{{ props.data.categoryOverview.total.profitAfterTax ? formatAmount(props.data.categoryOverview.total.profitAfterTax) : '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
+22
-3
@@ -51,7 +51,7 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="max-h-[420px] overflow-auto">
|
<div class="max-h-[580px] overflow-auto">
|
||||||
<table class="w-full whitespace-nowrap text-left text-sm shop-overview-thead">
|
<table class="w-full whitespace-nowrap text-left text-sm shop-overview-thead">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col style="width: 220px; min-width: 220px;" />
|
<col style="width: 220px; min-width: 220px;" />
|
||||||
@@ -125,7 +125,7 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
|
|
||||||
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
|
<tbody class="divide-y divide-slate-100 dark:divide-[hsl(240deg_3.7%_22%)]">
|
||||||
<tr
|
<tr
|
||||||
v-for="product in data?.productComparisons"
|
v-for="product in (data?.productOverview?.products || [])"
|
||||||
:key="product.productId"
|
:key="product.productId"
|
||||||
class="transition-colors hover:bg-blue-50/30"
|
class="transition-colors hover:bg-blue-50/30"
|
||||||
>
|
>
|
||||||
@@ -174,12 +174,31 @@ const formatPercentPlain = (value: number | undefined) => {
|
|||||||
{{ product.profitAfterTax ? formatAmount(product.profitAfterTax) : '-' }}
|
{{ product.profitAfterTax ? formatAmount(product.profitAfterTax) : '-' }}
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr v-if="!data?.productComparisons?.length">
|
<tr v-if="!data?.productOverview?.products?.length">
|
||||||
<td colspan="15" class="p-8 text-center text-gray-400">
|
<td colspan="15" class="p-8 text-center text-gray-400">
|
||||||
暂无数据
|
暂无数据
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot v-if="data?.productOverview?.total">
|
||||||
|
<tr class="font-black text-slate-900 dark:text-[hsl(0deg_0%_95%)]">
|
||||||
|
<td class="sticky-col sticky bottom-0 border-r-2 border-slate-200 dark:border-[hsl(240deg_3.7%_22%)] bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4 text-base font-black" style="left: 0; z-index: 30;">合计</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.salesAmount ? formatAmount(data.productOverview.total.salesAmount) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.orderCount ? data.productOverview.total.orderCount.toLocaleString() : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">-</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.productCost ? formatAmount(data.productOverview.total.productCost) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.shippingCost ? formatAmount(data.productOverview.total.shippingCost) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.otherCost ? formatAmount(data.productOverview.total.otherCost) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 text-rose-500 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-rose-400 px-6 py-4">{{ data.productOverview.total.refundAmount ? formatAmount(data.productOverview.total.refundAmount) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.totalPromotionFee ? formatAmount(data.productOverview.total.totalPromotionFee) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 text-amber-500 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-amber-400 px-6 py-4">{{ data.productOverview.total.brushFee ? formatAmount(data.productOverview.total.brushFee) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 text-slate-400 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-[hsl(240deg_5%_64.9%)] px-6 py-4">{{ data.productOverview.total.feeRatio !== undefined ? formatPercentPlain(data.productOverview.total.feeRatio) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 text-indigo-700 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-indigo-400 px-6 py-4">{{ data.productOverview.total.roi !== undefined ? data.productOverview.total.roi.toFixed(2) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 dark:bg-[hsl(240deg_3.7%_22%)] px-6 py-4">{{ data.productOverview.total.totalProfitBeforeTax ? formatAmount(data.productOverview.total.totalProfitBeforeTax) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-slate-100 italic text-slate-400 dark:bg-[hsl(240deg_3.7%_22%)] dark:text-[hsl(240deg_5%_64.9%)] px-6 py-4">{{ data.productOverview.total.salesTaxAmount ? formatAmount(data.productOverview.total.salesTaxAmount) : '-' }}</td>
|
||||||
|
<td class="sticky bottom-0 bg-emerald-50/30 dark:bg-[hsl(142deg_71.8%_29%/20%)] px-6 py-4 text-base">{{ data.productOverview.total.profitAfterTax ? formatAmount(data.productOverview.total.profitAfterTax) : '-' }}</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user