feat:【代码优化】减少部分模块的 import * 的 API
This commit is contained in:
@@ -10,7 +10,7 @@ import { EchartsUI, useEcharts } from '@vben/plugins/echarts';
|
||||
import { Card, Radio, RadioGroup, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import * as MemberStatisticsApi from '#/api/mall/statistics/member';
|
||||
import { getMemberRegisterCountList } from '#/api/mall/statistics/member';
|
||||
|
||||
import {
|
||||
getMemberStatisticsChartOptions,
|
||||
@@ -71,13 +71,13 @@ async function handleTimeRangeTypeChange() {
|
||||
}
|
||||
}
|
||||
// 发送时间范围选中事件
|
||||
await getMemberRegisterCountList(beginTime, endTime);
|
||||
await loadMemberRegisterCountList(beginTime, endTime);
|
||||
}
|
||||
|
||||
async function getMemberRegisterCountList(beginTime: Dayjs, endTime: Dayjs) {
|
||||
async function loadMemberRegisterCountList(beginTime: Dayjs, endTime: Dayjs) {
|
||||
loading.value = true;
|
||||
try {
|
||||
const list = await MemberStatisticsApi.getMemberRegisterCountList(
|
||||
const list = await getMemberRegisterCountList(
|
||||
beginTime.toDate(),
|
||||
endTime.toDate(),
|
||||
);
|
||||
|
||||
@@ -6,9 +6,9 @@ import { CountTo } from '@vben/common-ui';
|
||||
|
||||
import { Card } from 'ant-design-vue';
|
||||
|
||||
import * as ProductSpuApi from '#/api/mall/product/spu';
|
||||
import * as PayStatisticsApi from '#/api/mall/statistics/pay';
|
||||
import * as TradeStatisticsApi from '#/api/mall/statistics/trade';
|
||||
import { getTabsCount } from '#/api/mall/product/spu';
|
||||
import { getWalletRechargePrice } from '#/api/mall/statistics/pay';
|
||||
import { getOrderCount } from '#/api/mall/statistics/trade';
|
||||
|
||||
/** 运营数据卡片 */
|
||||
defineOptions({ name: 'OperationDataCard' });
|
||||
@@ -51,8 +51,8 @@ const data = reactive({
|
||||
});
|
||||
|
||||
/** 查询订单数据 */
|
||||
async function getOrderData() {
|
||||
const orderCount = await TradeStatisticsApi.getOrderCount();
|
||||
async function loadOrderData() {
|
||||
const orderCount = await getOrderCount();
|
||||
if (orderCount.undelivered) {
|
||||
data.orderUndelivered.value = orderCount.undelivered;
|
||||
}
|
||||
@@ -68,16 +68,16 @@ async function getOrderData() {
|
||||
}
|
||||
|
||||
/** 查询商品数据 */
|
||||
async function getProductData() {
|
||||
const productCount = await ProductSpuApi.getTabsCount();
|
||||
async function loadProductData() {
|
||||
const productCount = await getTabsCount();
|
||||
data.productForSale.value = productCount['0'] || 0;
|
||||
data.productInWarehouse.value = productCount['1'] || 0;
|
||||
data.productAlertStock.value = productCount['3'] || 0;
|
||||
}
|
||||
|
||||
/** 查询钱包充值数据 */
|
||||
async function getWalletRechargeData() {
|
||||
const paySummary = await PayStatisticsApi.getWalletRechargePrice();
|
||||
async function loadWalletRechargeData() {
|
||||
const paySummary = await getWalletRechargePrice();
|
||||
data.rechargePrice.value = paySummary.rechargePrice;
|
||||
}
|
||||
|
||||
@@ -88,16 +88,16 @@ function handleClick(routerName: string) {
|
||||
|
||||
/** 激活时 */
|
||||
onActivated(() => {
|
||||
getOrderData();
|
||||
getProductData();
|
||||
getWalletRechargeData();
|
||||
loadOrderData();
|
||||
loadProductData();
|
||||
loadWalletRechargeData();
|
||||
});
|
||||
|
||||
/** 初始化 */
|
||||
onMounted(() => {
|
||||
getOrderData();
|
||||
getProductData();
|
||||
getWalletRechargeData();
|
||||
loadOrderData();
|
||||
loadProductData();
|
||||
loadWalletRechargeData();
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import { fenToYuan } from '@vben/utils';
|
||||
import { Card, Radio, RadioGroup, Spin } from 'ant-design-vue';
|
||||
import dayjs from 'dayjs';
|
||||
|
||||
import * as TradeStatisticsApi from '#/api/mall/statistics/trade';
|
||||
import { getOrderCountTrendComparison } from '#/api/mall/statistics/trade';
|
||||
|
||||
import {
|
||||
getTradeTrendChartOptions,
|
||||
@@ -76,15 +76,15 @@ async function handleTimeRangeTypeChange() {
|
||||
}
|
||||
}
|
||||
// 发送时间范围选中事件
|
||||
await getOrderCountTrendComparison(beginTime, endTime);
|
||||
await loadOrderCountTrendComparison(beginTime, endTime);
|
||||
}
|
||||
|
||||
/** 查询订单数量趋势对照数据 */
|
||||
async function getOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) {
|
||||
async function loadOrderCountTrendComparison(beginTime: Dayjs, endTime: Dayjs) {
|
||||
loading.value = true;
|
||||
try {
|
||||
// 1. 查询数据
|
||||
const list = await TradeStatisticsApi.getOrderCountTrendComparison(
|
||||
const list = await getOrderCountTrendComparison(
|
||||
timeRangeType.value,
|
||||
beginTime.toDate(),
|
||||
endTime.toDate(),
|
||||
|
||||
Reference in New Issue
Block a user