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
};