add point account list

This commit is contained in:
Timi
2026-08-22 16:42:32 +08:00
parent e237b71f13
commit 1a333508cd
12 changed files with 523 additions and 342 deletions
+30 -5
View File
@@ -1,6 +1,7 @@
import { axios, type Page, type PageResult } from "timi-web";
import type {
PointAccount,
PointAccountPage,
PointAdjustRequest,
PointLedger,
PointLedgerPage,
@@ -15,9 +16,21 @@ type ListOptions = {
storeId?: string;
};
/** 分页查询积分账户。账户列表由后端关联返回客户资料。 */
async function list(page: PointAccountPage, options?: ListOptions): Promise<PageResult<PointAccount>> {
if (options?.allStores) {
return await axios.post(`${BASE_URI}/account/list`, page);
}
return await axios.post(`${BASE_URI}/account/list`, {
...page,
storeId: options?.storeId || getCurrentStoreId()
});
}
/** 查询指定客户的积分账户。账户不存在表示客户尚未产生过积分流水。 */
async function accountDetail(customerId: string, storeId?: string): Promise<PointAccount> {
return await axios.post(`${BASE_URI}/account/detail`, undefined, {
async function detailByCustomerId(customerId: string, storeId?: string): Promise<PointAccount> {
return await axios.post(`${BASE_URI}/account/detail/customer`, undefined, {
params: {
customerId,
storeId: storeId || getCurrentStoreId() || undefined
@@ -25,8 +38,18 @@ async function accountDetail(customerId: string, storeId?: string): Promise<Poin
});
}
/** 按账户 ID 查询积分账户详情。 */
async function detail(accountId: string, storeId?: string): Promise<PointAccount> {
return await axios.post(`${BASE_URI}/account/detail`, undefined, {
params: {
id: accountId,
storeId: storeId || getCurrentStoreId() || undefined
}
});
}
/** 分页查询积分流水。全局管理员不传门店时允许查询全部门店。 */
async function ledgerList(page: PointLedgerPage, options?: ListOptions): Promise<PageResult<PointLedger>> {
async function listLedger(page: PointLedgerPage, options?: ListOptions): Promise<PageResult<PointLedger>> {
if (options?.allStores) {
return await axios.post(`${BASE_URI}/ledger/list`, page);
}
@@ -89,8 +112,10 @@ async function ruleRemove(id: string): Promise<void> {
}
export default {
accountDetail,
ledgerList,
list,
detailByCustomerId,
detail,
listLedger,
adjust,
ruleList,
ruleDetail,