add store

This commit is contained in:
Timi
2026-08-07 11:32:48 +08:00
parent 9df6dfaf59
commit fab3cd8891
21 changed files with 1355 additions and 31 deletions
+18 -10
View File
@@ -1,10 +1,11 @@
import { axios, type Page, type PageResult } from "timi-web";
import type { Customer, CustomerDailyStatView, CustomerGenderStatView, CustomerTrendStatReq } from "@/types/Customer";
import { getCurrentStoreId, withCurrentStoreId, withCurrentStorePage } from "@/utils/store";
const BASE_URI = "/gao/customer";
async function list(page: Page<Customer>): Promise<PageResult<Customer>> {
return await axios.post(`${BASE_URI}/list`, page);
return await axios.post(`${BASE_URI}/list`, withCurrentStorePage(page));
}
async function detail(id: string): Promise<Customer> {
@@ -14,11 +15,11 @@ async function detail(id: string): Promise<Customer> {
}
async function create(customer: Customer): Promise<string> {
return await axios.post(`${BASE_URI}/create`, customer);
return await axios.post(`${BASE_URI}/create`, withCurrentStoreId(customer));
}
async function update(page: Customer): Promise<void> {
return await axios.post(`${BASE_URI}/update`, page);
return await axios.post(`${BASE_URI}/update`, withCurrentStoreId(page));
}
async function remove(id: string): Promise<void> {
@@ -35,18 +36,24 @@ async function findById(id: string): Promise<Customer | undefined> {
async function findByCode(code: string): Promise<Customer | undefined> {
return await axios.post(`${BASE_URI}/find/code`, null, {
params: { code }
params: {
storeId: getCurrentStoreId(),
code
}
});
}
async function findByName(name: string): Promise<Customer | undefined> {
return await axios.post(`${BASE_URI}/find/name`, null, {
params: { name }
})
params: {
storeId: getCurrentStoreId(),
name
}
});
}
async function exportXSSF(page: Page<Customer>): Promise<Blob> {
return await axios.post(`${BASE_URI}/export`, page, {
return await axios.post(`${BASE_URI}/export`, withCurrentStorePage(page), {
responseType: "blob"
});
}
@@ -73,11 +80,13 @@ async function deleteInvite(customerId: string): Promise<void> {
}
async function dailyStat(req: CustomerTrendStatReq): Promise<CustomerDailyStatView[]> {
return await axios.post(`${BASE_URI}/state/daily`, req);
return await axios.post(`${BASE_URI}/state/daily`, withCurrentStoreId(req));
}
async function genderStat(): Promise<CustomerGenderStatView[]> {
return await axios.post(`${BASE_URI}/state/gender`);
return await axios.post(`${BASE_URI}/state/gender`, undefined, {
params: { storeId: getCurrentStoreId() }
});
}
export default {
@@ -96,4 +105,3 @@ export default {
dailyStat,
genderStat
};
+7 -4
View File
@@ -1,14 +1,17 @@
import { axios, type Page, type PageResult } from "timi-web";
import type { EventItem } from "@/types/EventItem";
import { getCurrentStoreId, withCurrentStoreId, withCurrentStorePage } from "@/utils/store";
const BASE_URI = "/gao/event";
async function list(req: Page<EventItem>): Promise<PageResult<EventItem>> {
return await axios.post(`${BASE_URI}/list`, req);
return await axios.post(`${BASE_URI}/list`, withCurrentStorePage(req));
}
async function listValid(): Promise<EventItem[]> {
return await axios.post(`${BASE_URI}/list/valid`);
return await axios.post(`${BASE_URI}/list/valid`, undefined, {
params: { storeId: getCurrentStoreId() }
});
}
async function detail(id: string): Promise<EventItem> {
@@ -18,11 +21,11 @@ async function detail(id: string): Promise<EventItem> {
}
async function create(event: EventItem): Promise<void> {
return await axios.post(`${BASE_URI}/create`, event);
return await axios.post(`${BASE_URI}/create`, withCurrentStoreId(event));
}
async function update(event: EventItem): Promise<void> {
return await axios.post(`${BASE_URI}/update`, event);
return await axios.post(`${BASE_URI}/update`, withCurrentStoreId(event));
}
async function sort(idList: string[]): Promise<void> {
+8 -8
View File
@@ -1,11 +1,12 @@
import { axios, type PageResult } from "timi-web";
import type { CustomerEventRankView, EventRecord, EventRecordPage, EventRecordRankPage } from "@/types/EventRecord";
import type { Customer } from "@/types/Customer.ts";
import { withCurrentStoreId } from "@/utils/store";
const BASE_URI = "/gao/event/record";
async function list(page: EventRecordPage): Promise<PageResult<EventRecord>> {
return await axios.post(`${BASE_URI}/list`, page);
return await axios.post(`${BASE_URI}/list`, withCurrentStoreId(page));
}
async function detail(id: string): Promise<EventRecord> {
@@ -15,19 +16,19 @@ async function detail(id: string): Promise<EventRecord> {
}
async function create(record: EventRecord): Promise<void> {
await axios.post(`${BASE_URI}/create`, record);
await axios.post(`${BASE_URI}/create`, withCurrentStoreId(record));
}
async function createBatch(recordList: EventRecord[]): Promise<void> {
await axios.post(`${BASE_URI}/create/batch`, recordList);
await axios.post(`${BASE_URI}/create/batch`, recordList.map(record => withCurrentStoreId(record)));
}
async function createWithCustomer(customer: Customer): Promise<void> {
await axios.post(`${BASE_URI}/create/customer`, customer);
await axios.post(`${BASE_URI}/create/customer`, withCurrentStoreId(customer));
}
async function update(record: EventRecord): Promise<void> {
await axios.post(`${BASE_URI}/update`, record);
await axios.post(`${BASE_URI}/update`, withCurrentStoreId(record));
}
async function remove(id: string): Promise<void> {
@@ -37,11 +38,11 @@ async function remove(id: string): Promise<void> {
}
async function eventRank(page: EventRecordRankPage): Promise<CustomerEventRankView> {
return await axios.post(`${BASE_URI}/rank`, page);
return await axios.post(`${BASE_URI}/rank`, withCurrentStoreId(page));
}
async function exportXSSF(page: EventRecordPage): Promise<Blob> {
return await axios.post(`${BASE_URI}/export`, page, {
return await axios.post(`${BASE_URI}/export`, withCurrentStoreId(page), {
responseType: "blob"
});
}
@@ -57,4 +58,3 @@ export default {
remove,
eventRank
};
+4 -3
View File
@@ -1,10 +1,11 @@
import { axios, type Page, type PageResult, type Role } from "timi-web";
import type { ManagedUser } from "@/types/ManagedUser";
import { withCurrentStoreId, withCurrentStorePage } from "@/utils/store";
const BASE_URI = "/gao/user";
async function list(page: Page<ManagedUser>): Promise<PageResult<ManagedUser>> {
return await axios.post(`${BASE_URI}/list`, page);
return await axios.post(`${BASE_URI}/list`, withCurrentStorePage(page));
}
async function detail(id: string): Promise<ManagedUser> {
@@ -14,11 +15,11 @@ async function detail(id: string): Promise<ManagedUser> {
}
async function create(user: ManagedUser): Promise<ManagedUser> {
return await axios.post(`${BASE_URI}/create`, user);
return await axios.post(`${BASE_URI}/create`, withCurrentStoreId(user));
}
async function update(user: ManagedUser): Promise<ManagedUser> {
return await axios.post(`${BASE_URI}/update`, user);
return await axios.post(`${BASE_URI}/update`, withCurrentStoreId(user));
}
async function remove(id: string): Promise<void> {
+85
View File
@@ -0,0 +1,85 @@
import { axios, type Page, type PageResult } from "timi-web";
import type { Store, StoreBusinessDay } from "@/types/Store";
const STORE_BASE_URI = "/gao/store";
const BUSINESS_DAY_BASE_URI = "/gao/store/business/day";
async function list(page: Page<Store>): Promise<PageResult<Store>> {
return await axios.post(`${STORE_BASE_URI}/list`, page);
}
async function detail(id: string): Promise<Store> {
return await axios.post(`${STORE_BASE_URI}/detail`, undefined, {
params: { id }
});
}
async function create(store: Store): Promise<string> {
return await axios.post(`${STORE_BASE_URI}/create`, store);
}
async function update(store: Store): Promise<void> {
await axios.post(`${STORE_BASE_URI}/update`, store);
}
async function remove(id: string): Promise<void> {
await axios.post(`${STORE_BASE_URI}/delete`, undefined, {
params: { id }
});
}
async function exportXSSF(page: Page<Store>): Promise<Blob> {
return await axios.post(`${STORE_BASE_URI}/export`, page, {
responseType: "blob"
});
}
async function businessDayList(page: Page<StoreBusinessDay>): Promise<PageResult<StoreBusinessDay>> {
return await axios.post(`${BUSINESS_DAY_BASE_URI}/list`, page);
}
async function businessDayCalendar(storeId: string, beginDateValue: number, endDateValue: number): Promise<StoreBusinessDay[]> {
return await axios.post(`${BUSINESS_DAY_BASE_URI}/calendar`, undefined, {
params: {
storeId,
beginDateValue,
endDateValue
}
});
}
async function businessDayDetail(id: string): Promise<StoreBusinessDay> {
return await axios.post(`${BUSINESS_DAY_BASE_URI}/detail`, undefined, {
params: { id }
});
}
async function createBusinessDay(day: StoreBusinessDay): Promise<string> {
return await axios.post(`${BUSINESS_DAY_BASE_URI}/create`, day);
}
async function updateBusinessDay(day: StoreBusinessDay): Promise<void> {
await axios.post(`${BUSINESS_DAY_BASE_URI}/update`, day);
}
async function removeBusinessDay(id: string): Promise<void> {
await axios.post(`${BUSINESS_DAY_BASE_URI}/delete`, undefined, {
params: { id }
});
}
export default {
list,
detail,
create,
update,
remove,
exportXSSF,
businessDayList,
businessDayCalendar,
businessDayDetail,
createBusinessDay,
updateBusinessDay,
removeBusinessDay
};