diff --git a/src/api/StoreChartAPI.ts b/src/api/StoreChartAPI.ts index 4d543e8..58941a9 100644 --- a/src/api/StoreChartAPI.ts +++ b/src/api/StoreChartAPI.ts @@ -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 { })); } +async function customerAgeStat(): Promise { + 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 { 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, diff --git a/src/pages/store/StoreDataCharts.vue b/src/pages/store/StoreDataCharts.vue index c5c1721..1c12a33 100644 --- a/src/pages/store/StoreDataCharts.vue +++ b/src/pages/store/StoreDataCharts.vue @@ -1,19 +1,32 @@ + + diff --git a/src/pages/store/component/StoreCustomerDiseaseWordCloudChart.vue b/src/pages/store/component/StoreCustomerDiseaseWordCloudChart.vue index c6b40a3..9deeb4c 100644 --- a/src/pages/store/component/StoreCustomerDiseaseWordCloudChart.vue +++ b/src/pages/store/component/StoreCustomerDiseaseWordCloudChart.vue @@ -1,6 +1,6 @@