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 |  157 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 124 insertions(+), 33 deletions(-)

diff --git a/src/pages/sales/invoiceLedger/detail.vue b/src/pages/sales/invoiceLedger/detail.vue
index 84a888a..2abb7d7 100644
--- a/src/pages/sales/invoiceLedger/detail.vue
+++ b/src/pages/sales/invoiceLedger/detail.vue
@@ -1,5 +1,5 @@
 <template>
-	<view class="invoice-detail">
+	<view class="account-view">
 		<!-- 浣跨敤閫氱敤椤甸潰澶撮儴缁勪欢 -->
 		<PageHeader title="鍙戠エ璇︽儏" @back="goBack" />
 		
@@ -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,25 +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-icon name="plus" size="14" />
-						涓婁紶鏂囦欢
-					</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">
@@ -87,6 +89,7 @@
 
 import { ref, onMounted } from 'vue'
 import dayjs from 'dayjs'
+import { formatDateToYMD } from '@/utils/ruoyi'
 import useUserStore from '@/store/modules/user'
 import { getToken } from '@/utils/auth'
 import { invoiceLedgerProductInfo, invoiceLedgerSaveOrUpdate } from '@/api/salesManagement/invoiceLedger.js'
@@ -110,6 +113,7 @@
 })
 const fileList = ref([])
 const currentId = ref('')
+const maxInvoiceAmount = ref(0)
 
 // 鏃ユ湡閫夋嫨
 const showInvoiceDatePicker = ref(false)
@@ -127,10 +131,11 @@
 	return num.toFixed(2)
 }
 
-const onInvoiceDateConfirm = ({ selectedValues }) => {
-	form.value.invoiceDate = selectedValues.join('-')
-	currentInvoiceDate.value = selectedValues
-	showInvoiceDatePicker.value = false
+// 鏃ユ湡纭浜嬩欢
+const onInvoiceDateConfirm = (e) => {
+	form.value.invoiceDate = formatDateToYMD(e.value)
+	currentInvoiceDate.value = formatDateToYMD(e.value)
+	showInvoiceDatePicker.value = false;
 }
 
 // 涓婁紶鍓嶆牎楠岋紙鍏煎 Vant Uploader 鐨� file/fileList 缁撴瀯锛�
@@ -155,7 +160,7 @@
 
 const uploadSingleFile = async (fileObj) => {
 	return new Promise((resolve, reject) => {
-		showLoadingToast({ message: '姝e湪涓婁紶...' })
+		showLoadingToast('姝e湪涓婁紶...')
 		const baseUrl = config.baseUrl + '/invoiceLedger/uploadFile'
 
 		const filePath = fileObj?.url || fileObj?.tempFilePath || fileObj?.file?.path
@@ -240,10 +245,14 @@
 
 const loadDetail = async (id) => {
 	try {
-		showLoadingToast({ message: '鍔犺浇涓�...' })
+		showLoadingToast('鍔犺浇涓�...')
 		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
@@ -263,7 +272,18 @@
 		if (!form.value.invoiceNo) { showToast('璇疯緭鍏ュ彂绁ㄥ彿'); return }
 		if (!form.value.invoiceTotal) { showToast('璇疯緭鍏ュ彂绁ㄩ噾棰�'); return }
 		if (!form.value.invoiceDate) { showToast('璇烽�夋嫨寮�绁ㄦ棩鏈�'); return }
-		showLoadingToast({ message: '鎻愪氦涓�...' })
+
+    // 鏍¢獙锛氬彂绁ㄩ噾棰濅笉鑳借秴杩囨渶澶у��
+    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)
 		closeToast()
@@ -290,17 +310,88 @@
 </script>
 
 <style scoped lang="scss">
-.account-detail {
+@import '@/static/scss/form-common.scss';
+.account-view {
 	min-height: 100vh;
 	background: #f8f9fa;
-	padding-bottom: 5rem;
 }
+
+.info-section {
+	background: #fff;
+	margin-bottom: 16px;
+}
+
+.info-grid {
+	display: flex;
+	flex-wrap: wrap;
+	padding: 16px;
+}
+
+.info-item {
+	display: flex;
+	width: 100%;
+	margin-bottom: 12px;
+
+	&:last-child {
+		margin-bottom: 0;
+	}
+
+	.info-label {
+		font-size: 14px;
+		color: #999;
+		min-width: 100px;
+	}
+
+	.info-value {
+		font-size: 14px;
+		color: #333;
+		flex: 1;
+	}
+
+	.info-value.highlight {
+		color: #2979ff;
+		font-weight: 500;
+	}
+
+	.info-value.medium {
+		font-size: 16px;
+	}
+}
+
 .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; }
-.footer-btns { position: fixed; left: 0; right: 0; bottom: 0; background: #fff; display: flex; justify-content: space-around; align-items: center; padding: 0.75rem 0; box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05); z-index: 1000; }
-.cancel-btn { font-weight: 400; font-size: 1rem; color: #FFFFFF; width: 6.375rem; background: #C7C9CC; box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; }
-.save-btn { font-weight: 400; font-size: 1rem; color: #FFFFFF; width: 14rem; background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%); box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2); border-radius: 2.5rem 2.5rem 2.5rem 2.5rem; }
+.tip-text { padding: 4px 0; font-size: 12px; color: #888; }
+.footer-btns {
+	position: fixed;
+	left: 0;
+	right: 0;
+	bottom: 0;
+	background: #fff;
+	display: flex;
+	justify-content: space-around;
+	align-items: center;
+	padding: 0.75rem 0;
+	box-shadow: 0 -0.125rem 0.5rem rgba(0,0,0,0.05);
+	z-index: 1000;
+}
+.cancel-btn {
+	font-weight: 400;
+	font-size: 1rem;
+	color: #FFFFFF;
+	width: 6.375rem;
+	background: #C7C9CC;
+	box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
+	border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+}
+.save-btn {
+	font-weight: 400;
+	font-size: 1rem;
+	color: #FFFFFF;
+	width: 14rem;
+	background: linear-gradient( 140deg, #00BAFF 0%, #006CFB 100%);
+	box-shadow: 0 0.25rem 0.625rem 0 rgba(3,88,185,0.2);
+	border-radius: 2.5rem 2.5rem 2.5rem 2.5rem;
+}
 </style>
 

--
Gitblit v1.9.3