资金申请增加渠道筛选合计与审核留痕
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import {
|
||||
summarizeWorkerFinanceRequests,
|
||||
addWorkerWalletCredit,
|
||||
getWorkerFinanceRequestById,
|
||||
listWorkerFinanceRequests,
|
||||
@@ -169,25 +170,39 @@ export async function listAdminWorkerFinanceRequests(query: JsonObject = {}) {
|
||||
const keyword = String(query.keyword || '').trim()
|
||||
const createdFrom = normalizeDateString(query.createdFrom)
|
||||
const createdTo = normalizeDateString(query.createdTo)
|
||||
const { items, total } = await listWorkerFinanceRequests({
|
||||
page,
|
||||
pageSize,
|
||||
const accountChannel = ['alipay', 'wechat'].includes(String(query.accountChannel || ''))
|
||||
? String(query.accountChannel)
|
||||
: ''
|
||||
const listFilters = {
|
||||
requestId,
|
||||
status,
|
||||
requestType,
|
||||
keyword,
|
||||
...(createdFrom ? { createdFrom } : {}),
|
||||
...(createdTo ? { createdTo } : {}),
|
||||
})
|
||||
...(accountChannel ? { accountChannel } : {}),
|
||||
}
|
||||
const [listResult, channels] = await Promise.all([
|
||||
listWorkerFinanceRequests({ page, pageSize, ...listFilters }),
|
||||
summarizeWorkerFinanceRequests(listFilters),
|
||||
])
|
||||
const { items, total } = listResult
|
||||
const summary = {
|
||||
channels,
|
||||
totalCount: channels.reduce((sum, item) => sum + item.count, 0),
|
||||
totalAmount: channels.reduce((sum, item) => sum + item.amount, 0),
|
||||
}
|
||||
return {
|
||||
items: items.map(mapFinanceRequest),
|
||||
pagination: { page, pageSize, total },
|
||||
summary,
|
||||
}
|
||||
}
|
||||
|
||||
export async function reviewAdminWorkerFinanceRequest(
|
||||
requestId: number | string,
|
||||
payload: JsonObject = {},
|
||||
reviewedBy = '',
|
||||
) {
|
||||
const current = await getWorkerFinanceRequestById(requestId)
|
||||
if (!current) {
|
||||
@@ -204,6 +219,7 @@ export async function reviewAdminWorkerFinanceRequest(
|
||||
status,
|
||||
reviewedNote,
|
||||
now: nowIso(),
|
||||
reviewedBy: String(reviewedBy || '').trim(),
|
||||
})
|
||||
|
||||
if (reviewed.failureReason === 'request_not_pending') {
|
||||
|
||||
Reference in New Issue
Block a user