修改附加费

This commit is contained in:
wuweihua
2026-09-22 10:40:13 +08:00
parent 465b3e6b6b
commit c860d1666d
8 changed files with 192 additions and 46 deletions
+35
View File
@@ -197,6 +197,41 @@ export function updateSetDetail(data) {
})
}
/**
* Submit async batch write of detail surcharge snapshots and poll until done.
* @returns {Promise<{ task: object }>}
*/
export async function updateSetDetailSurchargeAsync(details, onProgress) {
const submitRes = await request({
url: '/price/set/detail/surcharge/async',
method: 'post',
data: details || []
})
const taskId = pickSaveTaskId(submitRes)
if (!taskId) {
throw new Error('missing surcharge taskId')
}
const started = Date.now()
const maxMs = 30 * 60 * 1000
while (Date.now() - started < maxMs) {
const res = await getPriceSetSaveTask(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 || 'surcharge save failed')
err.task = task
throw err
}
await new Promise(resolve => setTimeout(resolve, 800))
}
throw new Error('surcharge save timeout')
}
export function delSetDetail(psdIds) {
return request({
url: '/price/set/detail/' + psdIds,