add customer age chart
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user