sql数据流,amdin业务逻辑接入
This commit is contained in:
78
services/orderService.uts
Normal file
78
services/orderService.uts
Normal file
@@ -0,0 +1,78 @@
|
||||
import { rpcOrNull, rpcOrEmptyArray } from '@/services/analytics/rpc.uts'
|
||||
|
||||
export async function fetchRefundOrderPage(
|
||||
page: number,
|
||||
pageSize: number,
|
||||
status: number | null = null,
|
||||
search: string | null = null
|
||||
): Promise<{ total: number; items: Array<any> }> {
|
||||
const res = await rpcOrNull('rpc_admin_refund_order_list', {
|
||||
p_page: page,
|
||||
p_page_size: pageSize,
|
||||
p_refund_status: status,
|
||||
p_search: search
|
||||
} as any)
|
||||
|
||||
if (res == null) return { total: 0, items: [] as Array<any> }
|
||||
|
||||
const anyTotal = (res as any).total
|
||||
const anyItems = (res as any).items
|
||||
|
||||
const total = typeof anyTotal === 'number' ? anyTotal : parseInt(String(anyTotal ?? '0'))
|
||||
const items = Array.isArray(anyItems) ? (anyItems as Array<any>) : ([] as Array<any>)
|
||||
|
||||
return { total, items }
|
||||
}
|
||||
|
||||
export async function fetchCashierOrderPage(
|
||||
page: number,
|
||||
pageSize: number,
|
||||
orderNo: string | null = null,
|
||||
username: string | null = null
|
||||
): Promise<{ total: number; items: Array<any> }> {
|
||||
const res = await rpcOrNull('rpc_admin_cashier_order_list', {
|
||||
p_page: page,
|
||||
p_page_size: pageSize,
|
||||
p_search_order_no: orderNo,
|
||||
p_search_username: username
|
||||
} as any)
|
||||
|
||||
if (res == null) return { total: 0, items: [] as Array<any> }
|
||||
|
||||
const anyTotal = (res as any).total
|
||||
const anyItems = (res as any).items
|
||||
|
||||
const total = typeof anyTotal === 'number' ? anyTotal : parseInt(String(anyTotal ?? '0'))
|
||||
const items = Array.isArray(anyItems) ? (anyItems as Array<any>) : ([] as Array<any>)
|
||||
|
||||
return { total, items }
|
||||
}
|
||||
|
||||
export async function fetchWriteOffRecordPage(
|
||||
page: number,
|
||||
pageSize: number,
|
||||
search: string | null = null
|
||||
): Promise<{ total: number; items: Array<any> }> {
|
||||
const res = await rpcOrNull('rpc_admin_write_off_record_list', {
|
||||
p_page: page,
|
||||
p_page_size: pageSize,
|
||||
p_search: search
|
||||
} as any)
|
||||
|
||||
if (res == null) return { total: 0, items: [] as Array<any> }
|
||||
|
||||
const anyTotal = (res as any).total
|
||||
const anyItems = (res as any).items
|
||||
|
||||
const total = typeof anyTotal === 'number' ? anyTotal : parseInt(String(anyTotal ?? '0'))
|
||||
const items = Array.isArray(anyItems) ? (anyItems as Array<any>) : ([] as Array<any>)
|
||||
|
||||
return { total, items }
|
||||
}
|
||||
|
||||
export async function fetchOrderSourceStats(startTime: string, endTime: string): Promise<Array<any>> {
|
||||
return (await rpcOrEmptyArray('rpc_admin_order_source_stats', {
|
||||
p_start_time: startTime,
|
||||
p_end_time: endTime
|
||||
} as any)) as any
|
||||
}
|
||||
Reference in New Issue
Block a user