src/pages/sales/invoiceLedger/detail.vue
@@ -18,6 +18,9 @@
            <u-form-item label="发票金额(元)" prop="invoiceTotal" required border-bottom>
               <u-input v-model="form.invoiceTotal" type="number" placeholder="请输入" />
            </u-form-item>
            <view class="tip-text" v-if="Number(maxInvoiceAmount) > 0">
               可开票最大金额:{{ formatAmount(maxInvoiceAmount) }} 元
            </view>
            <u-form-item label="开票人" border-bottom>
               <u-input v-model="form.invoicePerson" readonly />
            </u-form-item>
@@ -110,6 +113,7 @@
})
const fileList = ref([])
const currentId = ref('')
const maxInvoiceAmount = ref(0)
// 日期选择
const showInvoiceDatePicker = ref(false)
@@ -245,6 +249,10 @@
      const res = await invoiceLedgerProductInfo({ id })
      const data = res?.data || res
      form.value = { ...data }
    // 计算发票金额最大值:noInvoiceAmount + invoiceAmount
    const noInvoiceAmount = parseFloat(data?.noInvoiceAmount || 0)
    const invoiceAmount = parseFloat(data?.invoiceAmount || 0)
    maxInvoiceAmount.value = (Number.isNaN(noInvoiceAmount) ? 0 : noInvoiceAmount) + (Number.isNaN(invoiceAmount) ? 0 : invoiceAmount)
      fileList.value = data?.fileList || []
      if (!form.value.invoicePerson) {
         form.value.invoicePerson = userStore.nickName
@@ -264,6 +272,17 @@
      if (!form.value.invoiceNo) { showToast('请输入发票号'); return }
      if (!form.value.invoiceTotal) { showToast('请输入发票金额'); return }
      if (!form.value.invoiceDate) { showToast('请选择开票日期'); return }
    // 校验:发票金额不能超过最大值
    const invoiceTotal = parseFloat(form.value.invoiceTotal || 0)
    if (Number.isNaN(invoiceTotal) || invoiceTotal <= 0) {
      showToast('请输入有效的发票金额')
      return
    }
    if (maxInvoiceAmount.value > 0 && invoiceTotal - maxInvoiceAmount.value > 1e-6) {
      showToast(`发票金额不能超过最大值:${formatAmount(maxInvoiceAmount.value)}`)
      return
    }
      showLoadingToast('提交中...')
      form.value.fileList = fileList.value
      await invoiceLedgerSaveOrUpdate(form.value)
@@ -342,7 +361,7 @@
.uploaded-list { padding: 8px 16px 0 16px; }
.uploaded-item { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.file-name { font-size: 12px; color: #333; margin-right: 8px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-text { padding: 4px 16px 0 16px; font-size: 12px; color: #888; }
.tip-text { padding: 4px 0; font-size: 12px; color: #888; }
.footer-btns {
   position: fixed;
   left: 0;