diff --git a/src/views/admin/account/cost/myOrder/index.vue b/src/views/admin/account/cost/myOrder/index.vue index d9e34da..c094eeb 100644 --- a/src/views/admin/account/cost/myOrder/index.vue +++ b/src/views/admin/account/cost/myOrder/index.vue @@ -33,8 +33,31 @@ - + +
+ + + 批量去开票 + + + 已选择 {{ selectedRowKeys.length }} 条记录 + + +
+ +
+ + +
+
+ 流水号: + {{ currentInvoiceRecord?.serial_number || '-' }} +
+
+ 交易时间: + {{ currentInvoiceRecord?.created_at ? dayjs(currentInvoiceRecord.created_at).format('YYYY-MM-DD HH:mm') : '-' }} +
+
+ 交易金额: + ¥{{ currentInvoiceRecord?.real_amount || '0.00' }} +
+
+ 确认要为该订单申请发票吗? +
+
+
+ + +
+
+ 已选择 {{ selectedRowKeys.length }} 条记录进行批量开票 +
+
+ 合计金额: + ¥{{ selectedTotalAmount.toFixed(2) }} +
+
+ + + +
+
+ 注意:批量开票将为所有选中的订单统一生成一张发票。 +
+
+
+ \ No newline at end of file + +/** + * 单个去开票 + */ +function handleSingleInvoice(record: any) { + currentInvoiceRecord.value = record + singleInvoiceModalVisible.value = true +} + +/** + * 确认单个开票 + */ +async function handleSingleInvoiceConfirm() { + singleInvoiceLoading.value = true + try { + // 这里调用开票API + // await invoiceApi.createSingleInvoice(currentInvoiceRecord.value.id) + + // 模拟API调用延迟 + await new Promise(resolve => setTimeout(resolve, 1000)) + + message.success('开票申请已提交成功!') + singleInvoiceModalVisible.value = false + + // 刷新列表 + getPageList() + } catch (error) { + message.error('开票申请提交失败,请稍后重试') + } finally { + singleInvoiceLoading.value = false + } +} + +/** + * 批量去开票 + */ +function handleBatchInvoice() { + if (selectedRowKeys.value.length === 0) { + message.warning('请先选择要开票的记录') + return + } + batchInvoiceModalVisible.value = true +} + +/** + * 确认批量开票 + */ +async function handleBatchInvoiceConfirm() { + batchInvoiceLoading.value = true + try { + // 这里调用批量开票API + // await invoiceApi.createBatchInvoice(selectedRowKeys.value) + + // 模拟API调用延迟 + await new Promise(resolve => setTimeout(resolve, 1500)) + + message.success(`批量开票申请已提交成功,共 ${selectedRowKeys.value.length} 条记录`) + batchInvoiceModalVisible.value = false + + // 清空选择 + selectedRowKeys.value = [] + selectedRows.value = [] + + // 刷新列表 + getPageList() + } catch (error) { + message.error('批量开票申请提交失败,请稍后重试') + } finally { + batchInvoiceLoading.value = false + } +} + + + \ No newline at end of file