add customer age chart

This commit is contained in:
Timi
2026-09-11 18:47:14 +08:00
parent 3544ac559b
commit d036d756f4
7 changed files with 198 additions and 15 deletions
+9 -1
View File
@@ -1,7 +1,7 @@
import { axios } from "timi-web-api";
import EventAPI from "@/api/EventAPI";
import StoreAPI from "@/api/StoreAPI";
import type { CustomerDailyStatView, CustomerGenderStatView } from "@/types/Customer";
import type { CustomerAgeStatView, CustomerDailyStatView, CustomerGenderStatView } from "@/types/Customer";
import type { EventItem } from "@/types/EventItem";
import type { StoreBusinessDay, StoreChartReq, StoreEventRecordCalendarView, StoreEventRecordDailyStatView, StoreEventRecordNumberValueDailyStatView } from "@/types/Store";
import { getStoreChartCache } from "@/utils/storeChartCache";
@@ -21,6 +21,13 @@ async function customerGenderStat(): Promise<CustomerGenderStatView[]> {
}));
}
async function customerAgeStat(): Promise<CustomerAgeStatView[]> {
const storeId = getCurrentStoreId();
return await getStoreChartCache(`customer-age:${storeId}`, async () => await axios.post(`${BASE_URI}/customer/age`, undefined, {
params: { storeId }
}));
}
async function eventRecordDailyStat(req: StoreChartReq): Promise<StoreEventRecordDailyStatView[]> {
const request = withCurrentStoreId(req);
return await getStoreChartCache(`event-record-daily:${JSON.stringify(request)}`, async () => await axios.post(`${BASE_URI}/event/record/daily`, request));
@@ -48,6 +55,7 @@ async function businessDayCalendar(storeId: string, beginDateValue: number, endD
export default {
customerDailyStat,
customerGenderStat,
customerAgeStat,
eventRecordDailyStat,
eventRecordNumberValueDailyStat,
eventRecordCalendar,