From e6a899cbf6d9cdf709d0f1deef91ff4d3f36abe8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 10 二月 2026 11:01:14 +0800
Subject: [PATCH] 进销存升级app: 1.添加菜单权限

---
 src/pages/sales/invoiceLedger/detail.vue |   57 ++++++++++++++++++++++++++++++++++++++-------------------
 1 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/src/pages/sales/invoiceLedger/detail.vue b/src/pages/sales/invoiceLedger/detail.vue
index 8848730..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>
@@ -26,24 +29,24 @@
 				</u-form-item>
 			</u-cell-group>
 			
-			<u-cell-group title="闄勪欢鏉愭枡锛堜粎鏀寔 pdf锛�">
-				<u-upload
-					accept=".pdf"
-					multiple
-					:afterRead="afterReadUpload"
-					:beforeRead="beforeReadPdf"
-				>
-					<u-button class="upload-btn" type="primary">
-						涓婁紶鏂囦欢
-					</u-button>
-				</u-upload>
-				<view class="uploaded-list" v-if="fileList.length">
-					<view class="uploaded-item" v-for="(f, idx) in fileList" :key="idx">
-						<text class="file-name">{{ f.name || getFileNameFromUrl(f.url) }}</text>
-						<u-button size="mini" type="error" plain @click="removeUploaded(idx)">绉婚櫎</u-button>
-					</view>
-				</view>
-			</u-cell-group>
+<!--			<u-cell-group title="闄勪欢鏉愭枡锛堜粎鏀寔 pdf锛�">-->
+<!--				<u-upload-->
+<!--					accept=".pdf"-->
+<!--					multiple-->
+<!--					:afterRead="afterReadUpload"-->
+<!--					:beforeRead="beforeReadPdf"-->
+<!--				>-->
+<!--					<u-button class="upload-btn" type="primary">-->
+<!--						涓婁紶鏂囦欢-->
+<!--					</u-button>-->
+<!--				</u-upload>-->
+<!--				<view class="uploaded-list" v-if="fileList.length">-->
+<!--					<view class="uploaded-item" v-for="(f, idx) in fileList" :key="idx">-->
+<!--						<text class="file-name">{{ f.name || getFileNameFromUrl(f.url) }}</text>-->
+<!--						<u-button size="mini" type="error" plain @click="removeUploaded(idx)">绉婚櫎</u-button>-->
+<!--					</view>-->
+<!--				</view>-->
+<!--			</u-cell-group>-->
 			
 			<!-- 鎻愪氦鎸夐挳 -->
 			<view class="footer-btns">
@@ -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