- 在组件类型中新增 'ApiCascader' 以支持更多业务需求 - 在商品统计概览中为多个统计项添加 tooltip,提供更清晰的数据解释 - 优化交易统计页面,重构数据加载逻辑,提升用户体验
76 lines
1.9 KiB
Vue
76 lines
1.9 KiB
Vue
<script lang="ts" setup>
|
|
import type { AnalysisOverviewItem } from '@vben/common-ui';
|
|
|
|
import type { MallDataComparisonResp } from '#/api/mall/statistics/common';
|
|
import type { MallTradeStatisticsApi } from '#/api/mall/statistics/trade';
|
|
|
|
import { onMounted, ref } from 'vue';
|
|
|
|
import { AnalysisOverview, DocAlert, Page } from '@vben/common-ui';
|
|
import {
|
|
SvgBellIcon,
|
|
SvgCakeIcon,
|
|
SvgDownloadIcon,
|
|
SvgEyeIcon,
|
|
} from '@vben/icons';
|
|
|
|
import * as TradeStatisticsApi from '#/api/mall/statistics/trade';
|
|
|
|
const overviewItems = ref<AnalysisOverviewItem[]>();
|
|
const summary =
|
|
ref<MallDataComparisonResp<MallTradeStatisticsApi.TradeSummary>>();
|
|
const loadOverview = () => {
|
|
overviewItems.value = [
|
|
{
|
|
icon: SvgEyeIcon,
|
|
title: '昨日订单数量',
|
|
value: summary.value?.value?.yesterdayOrderCount || 0,
|
|
tooltip: '昨日订单数量',
|
|
},
|
|
{
|
|
icon: SvgCakeIcon,
|
|
title: '本月订单数量',
|
|
value: summary.value?.value?.monthOrderCount || 0,
|
|
tooltip: '本月订单数量',
|
|
},
|
|
{
|
|
icon: SvgDownloadIcon,
|
|
title: '昨日支付金额',
|
|
value: summary.value?.value?.yesterdayPayPrice || 0,
|
|
tooltip: '昨日支付金额',
|
|
},
|
|
{
|
|
icon: SvgBellIcon,
|
|
title: '本月支付金额',
|
|
value: summary.value?.value?.monthPayPrice || 0,
|
|
tooltip: '本月支付金额',
|
|
},
|
|
];
|
|
};
|
|
|
|
/** 查询交易统计 */
|
|
const getTradeStatisticsSummary = async () => {
|
|
summary.value = await TradeStatisticsApi.getTradeStatisticsSummary();
|
|
};
|
|
|
|
/** 初始化 */
|
|
onMounted(async () => {
|
|
await getTradeStatisticsSummary();
|
|
loadOverview();
|
|
});
|
|
</script>
|
|
|
|
<template>
|
|
<Page>
|
|
<DocAlert
|
|
title="【统计】会员、商品、交易统计"
|
|
url="https://doc.iocoder.cn/mall/statistics/"
|
|
/>
|
|
<!-- 统计值 -->
|
|
<AnalysisOverview
|
|
v-model:model-value="overviewItems"
|
|
class="mt-5 md:mr-4 md:mt-0 md:w-full"
|
|
/>
|
|
</Page>
|
|
</template>
|