fix(miniprogram): retry invoice picker load after empty failure.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-09-16 21:20:44 +08:00
1 parent ffec3ecd94
commit 0c269b6e73
1 file changed
+5 -17
+5 -17
View File
@@ -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
})