From 0c269b6e73a9a6c83b0aaf57a7a019a8512f8566 Mon Sep 17 00:00:00 2001 From: wuzilong <704541015@qq.com> Date: Wed, 16 Sep 2026 21:20:44 +0800 Subject: [PATCH] fix(miniprogram): retry invoice picker load after empty failure. Co-authored-by: Cursor --- miniprogram/pages/bx/reimburse/apply.vue | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/miniprogram/pages/bx/reimburse/apply.vue b/miniprogram/pages/bx/reimburse/apply.vue index e53b1a589..0c5cf9e78 100644 --- a/miniprogram/pages/bx/reimburse/apply.vue +++ b/miniprogram/pages/bx/reimburse/apply.vue @@ -535,7 +535,6 @@ async function fetchInvoiceAttachPage(isRefresh) { } } catch (e) { uni.showToast({ title: '发票列表加载失败', icon: 'none' }) - if (isRefresh) invFinished.value = true } finally { invLoading.value = false } @@ -558,7 +557,7 @@ async function onInvoicePickerLoadMore() { async function openInvoicePicker() { pickerDraftKeys.value = selectedInvoicePicks.value.map((p) => p.key) showInvoicePicker.value = true - if (!attachItems.value.length && !invFinished.value) { + if (!attachItems.value.length) { await resetAndLoadInvoices() } } @@ -759,27 +758,16 @@ async function loadEditData(id) { for (const inv of linked) { const invoiceId = String(inv.id || inv.invoiceId || '') if (!invoiceId) continue - let attachmentId = String(inv.attachmentId || inv.attachment_id || '') - let fileName = inv.fileName || inv.file_name || '发票附件' - let fileType = inv.fileType || inv.file_type || '' - const createTime = inv.createTime || inv.create_time || '' - if (!attachmentId) { - const src = attachItems.value.find((w) => String(w.invoiceId) === invoiceId) - if (src) { - attachmentId = src.attachmentId - fileName = src.fileName - fileType = src.fileType - } - } + const attachmentId = String(inv.attachmentId || inv.attachment_id || '') if (!attachmentId) continue picks.push({ key: `${invoiceId}:${attachmentId}`, invoiceId, attachmentId, amount: inv.amount, - createTime, - fileName, - fileType, + createTime: inv.createTime || inv.create_time || '', + fileName: inv.fileName || inv.file_name || '发票附件', + fileType: inv.fileType || inv.file_type || '', previewUrl: '', previewLoading: false })