feat(M08-D): 补后台订单运营

This commit is contained in:
Codex
2026-08-10 11:52:25 +08:00
parent 3502f5b5f7
commit 20a292e4ce
10 changed files with 619 additions and 37 deletions
+62
View File
@@ -7,9 +7,13 @@ import type {
CleaningTaskMember,
BusinessStatistics,
ManagedRoom,
ManagedOrder,
ManagedStore,
ManagedUser,
PageResult,
OrderAction,
OrderHistoryItem,
OrderStatus,
PayoutStateFilter,
StaffRole,
SettlementStatus,
@@ -108,6 +112,64 @@ export function addManagedRoomDisabledPeriod(
});
}
export function listManagedOrders(
session: ApiSession,
input: { page: number; pageSize: number; status?: OrderStatus; storeId?: string }
) {
const params = new URLSearchParams({ page: String(input.page), pageSize: String(input.pageSize) });
if (input.status) params.set('status', input.status);
if (input.storeId) params.set('storeId', input.storeId);
return request<PageResult<ManagedOrder>>(session, `/orders?${params}`);
}
export function getManagedOrder(session: ApiSession, orderId: string) {
return request<ManagedOrder>(session, `/orders/${orderId}`);
}
export function listManagedOrderHistory(session: ApiSession, orderId: string) {
return request<OrderHistoryItem[]>(session, `/orders/${orderId}/history`);
}
export function executeManagedOrderAction(
session: ApiSession, orderId: string, action: OrderAction, reason: string
) {
return request<{ orderId: string; status: OrderStatus }>(session, `/orders/${orderId}/actions`, {
method: 'POST', body: JSON.stringify({ action, reason })
});
}
export function addManagedOrderNote(session: ApiSession, orderId: string, note: string) {
return request<{ orderId: string }>(session, `/orders/${orderId}/note`, {
method: 'POST', body: JSON.stringify({ note })
});
}
export function adjustManagedOrderTime(
session: ApiSession, orderId: string,
input: { startAt?: string; endAt?: string; reason: string }
) {
return request<{ orderId: string }>(session, `/orders/${orderId}/adjust-time`, {
method: 'POST', body: JSON.stringify(input)
});
}
export function renewManagedOrder(
session: ApiSession, orderId: string,
input: { endAt: string; pricingPolicy: 'CURRENT' | 'LOCKED'; reason: string }
) {
return request<{ orderId: string }>(session, `/orders/${orderId}/renew`, {
method: 'POST', body: JSON.stringify(input)
});
}
export function changeManagedOrderRoom(
session: ApiSession, orderId: string, input: { roomId: string; reason: string }
) {
return request<{ orderId: string }>(session, `/orders/${orderId}/change-room`, {
method: 'POST', body: JSON.stringify(input)
});
}
export function getBusinessStatistics(
session: ApiSession,
input: { storeId: string; from: string; to: string }