feat:【代码优化】减少部分模块的 import * 的 API
This commit is contained in:
@@ -21,8 +21,13 @@ import {
|
||||
import { Button, Card, Col, Row, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import * as TradeStatisticsApi from '#/api/mall/statistics/trade';
|
||||
import {
|
||||
exportTradeStatisticsExcel,
|
||||
getTradeStatisticsAnalyse,
|
||||
getTradeStatisticsList,
|
||||
} from '#/api/mall/statistics/trade';
|
||||
import ShortcutDateRangePicker from '#/components/shortcut-date-range-picker/shortcut-date-range-picker.vue';
|
||||
import { $t } from '#/locales';
|
||||
|
||||
import { getTradeTrendChartOptions } from './trend-chart-options';
|
||||
|
||||
@@ -51,7 +56,7 @@ const calculateRelativeRate = (value?: number, reference?: number): string => {
|
||||
/** 处理日期范围变化 */
|
||||
const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => {
|
||||
if (times?.length !== 2) {
|
||||
getTradeTrendData();
|
||||
loadTradeTrendData();
|
||||
return;
|
||||
}
|
||||
// 处理时间: 开始与截止在同一天的, 折线图出不来, 需要延长一天
|
||||
@@ -65,29 +70,32 @@ const handleDateRangeChange = (times?: [Dayjs, Dayjs]) => {
|
||||
];
|
||||
|
||||
// 查询数据
|
||||
getTradeTrendData();
|
||||
loadTradeTrendData();
|
||||
};
|
||||
|
||||
/** 处理交易状况查询 */
|
||||
async function getTradeTrendData() {
|
||||
async function loadTradeTrendData() {
|
||||
trendLoading.value = true;
|
||||
try {
|
||||
await Promise.all([getTradeStatisticsAnalyse(), getTradeStatisticsList()]);
|
||||
await Promise.all([
|
||||
loadTradeStatisticsAnalyse(),
|
||||
loadTradeStatisticsList(),
|
||||
]);
|
||||
} finally {
|
||||
trendLoading.value = false;
|
||||
}
|
||||
}
|
||||
|
||||
/** 查询交易状况数据统计 */
|
||||
async function getTradeStatisticsAnalyse() {
|
||||
trendSummary.value = await TradeStatisticsApi.getTradeStatisticsAnalyse({
|
||||
async function loadTradeStatisticsAnalyse() {
|
||||
trendSummary.value = await getTradeStatisticsAnalyse({
|
||||
times: searchTimes.value.length > 0 ? searchTimes.value : undefined,
|
||||
});
|
||||
}
|
||||
|
||||
/** 查询交易状况数据列表 */
|
||||
async function getTradeStatisticsList() {
|
||||
const list = await TradeStatisticsApi.getTradeStatisticsList({
|
||||
async function loadTradeStatisticsList() {
|
||||
const list = await getTradeStatisticsList({
|
||||
times: searchTimes.value.length > 0 ? searchTimes.value : undefined,
|
||||
});
|
||||
|
||||
@@ -104,7 +112,7 @@ async function handleExport() {
|
||||
});
|
||||
// 发起导出
|
||||
exportLoading.value = true;
|
||||
const data = await TradeStatisticsApi.exportTradeStatisticsExcel({
|
||||
const data = await exportTradeStatisticsExcel({
|
||||
times: searchTimes.value.length > 0 ? searchTimes.value : undefined,
|
||||
});
|
||||
// 处理下载
|
||||
|
||||
Reference in New Issue
Block a user