Files
web_escort_admin/src/api/escort.ts
T

71 lines
2.0 KiB
TypeScript

import type { EscortListResult, EscortRecord, PaymentStatusResult } from '~/types/api'
import { request } from '~/utils/request'
export type EscortListQuery = {
page?: number
pageSize?: number
status?: string
cancelStatus?: string
paymentStatus?: string
payChannel?: string
startDate?: string
endDate?: string
appointmentDate?: string
keyword?: string
userId?: string
healthProfileId?: string
includeCancelled?: string
}
export const escortApi = {
list: (query: EscortListQuery) =>
request<EscortListResult>('/health/escort-record', { query }),
detail: (id: string) =>
request<{ record: EscortRecord }>(`/health/escort-record/${id}`),
update: (id: string, body: Record<string, unknown>) =>
request<{ record: EscortRecord }>(`/health/escort-record/${id}`, {
method: 'PUT',
body,
}),
assign: (id: string, employeeId: string) =>
request<{ record: EscortRecord }>(`/health/escort-record/${id}/assign`, {
method: 'POST',
body: { employeeId },
}),
updateStatus: (id: string, status: string, reason?: string) =>
request<{ record: EscortRecord; deleted?: boolean }>(`/health/escort-record/${id}/status`, {
method: 'PATCH',
body: { status, reason },
}),
remove: (id: string) =>
request<{ record: EscortRecord }>(`/health/escort-record/${id}`, {
method: 'DELETE',
}),
payStatus: (id: string) =>
request<PaymentStatusResult>(`/health/escort-record/${id}/pay/status`),
refundQuery: (id: string) =>
request<{ refund: Record<string, unknown>; paymentStatus: string }>(
`/health/escort-record/${id}/refund/query`,
{ method: 'POST' }
),
refundManual: (id: string, refundNo?: string) =>
request<{ record: EscortRecord }>(`/health/escort-record/${id}/refund/manual`, {
method: 'POST',
body: { refundNo: refundNo || '' },
}),
refundRetry: (id: string) =>
request<{ refund: Record<string, unknown> | null; paymentStatus: string }>(
`/health/escort-record/${id}/refund/retry`,
{ method: 'POST' }
),
}