Files
gao-customer-h5/src/api/StoreChartAPI.ts
T
2026-08-18 17:26:33 +08:00

37 lines
1.5 KiB
TypeScript

import { axios } from "timi-web";
import type { CustomerDailyStatView, CustomerGenderStatView } from "@/types/Customer";
import type { StoreChartReq, StoreEventRecordCalendarView, StoreEventRecordDailyStatView, StoreEventRecordNumberValueDailyStatView } from "@/types/Store";
import { getCurrentStoreId, withCurrentStoreId } from "@/utils/store";
const BASE_URI = "/gao/store/chart";
async function customerDailyStat(req: StoreChartReq): Promise<CustomerDailyStatView[]> {
return await axios.post(`${BASE_URI}/customer/daily`, withCurrentStoreId(req));
}
async function customerGenderStat(): Promise<CustomerGenderStatView[]> {
return await axios.post(`${BASE_URI}/customer/gender`, undefined, {
params: { storeId: getCurrentStoreId() }
});
}
async function eventRecordDailyStat(req: StoreChartReq): Promise<StoreEventRecordDailyStatView[]> {
return await axios.post(`${BASE_URI}/event/record/daily`, withCurrentStoreId(req));
}
async function eventRecordNumberValueDailyStat(req: StoreChartReq): Promise<StoreEventRecordNumberValueDailyStatView[]> {
return await axios.post(`${BASE_URI}/event/record/number-value/daily`, withCurrentStoreId(req));
}
async function eventRecordCalendar(req: StoreChartReq): Promise<StoreEventRecordCalendarView[]> {
return await axios.post(`${BASE_URI}/event/record/calendar`, withCurrentStoreId(req));
}
export default {
customerDailyStat,
customerGenderStat,
eventRecordDailyStat,
eventRecordNumberValueDailyStat,
eventRecordCalendar
};