From 5eadfbb64d2f288b92ec1f22cfef6f096b4b9a9e Mon Sep 17 00:00:00 2001
From: spring <2396852758@qq.com>
Date: 星期五, 06 二月 2026 14:24:11 +0800
Subject: [PATCH] Merge branch 'dev_new' of http://114.132.189.42:9002/r/product-inventory-APP-before into dev_new

---
 src/pages/sales/invoiceLedger/detail.vue |   21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diff --git a/src/pages/sales/invoiceLedger/detail.vue b/src/pages/sales/invoiceLedger/detail.vue
index 93e622a..2abb7d7 100644
--- a/src/pages/sales/invoiceLedger/detail.vue
+++ b/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;

--
Gitblit v1.9.3