订单列表重新计费优化

This commit is contained in:
wuweihua
2026-10-21 10:13:01 +08:00
parent be3856a59c
commit d7f7ebd981
9 changed files with 659 additions and 41 deletions
+44
View File
@@ -85,6 +85,50 @@ export function listOrderBillsByProduct(data) {
})
}
/** Order-list local rebill (prc_order_bill only, no Oracle). Returns { taskId }. */
export function submitLocalRebill(data) {
return request({
url: '/price/billing/orderBill/rebill',
method: 'post',
data,
timeout: 120000
})
}
export function getLocalRebillTask(taskId) {
return request({
url: '/price/billing/orderBill/rebill/task/' + taskId,
method: 'get'
})
}
/**
* Async local rebill; poll until done.
* @param {object} data LocalRebillRequest
* @param {(task: object) => void} [onProgress]
*/
export async function localRebillAsync(data, onProgress) {
const submitRes = await submitLocalRebill(data)
const d = submitRes && submitRes.data
const taskId = d && (d.taskId || d)
if (!taskId) throw new Error('missing local rebill taskId')
const started = Date.now()
const maxMs = 30 * 60 * 1000
while (Date.now() - started < maxMs) {
const res = await getLocalRebillTask(String(taskId))
const task = res.data || {}
if (typeof onProgress === 'function') onProgress(task)
if (task.status === 'SUCCESS') return { task }
if (task.status === 'FAIL') {
const err = new Error(task.error || task.message || 'local rebill failed')
err.task = task
throw err
}
await new Promise(resolve => setTimeout(resolve, 800))
}
throw new Error('local rebill timeout')
}
/** Receivable bill detail */
export function getBill(billId) {
return request({