From 3db4630f6bf34bc8857600ca6a0078eb43a21d1e Mon Sep 17 00:00:00 2001
From: ZN <zhang_12370@163.com>
Date: 星期二, 24 三月 2026 17:58:31 +0800
Subject: [PATCH] feat: 移除冗余字段并优化发货逻辑

---
 src/views/salesManagement/salesLedger/index.vue |  353 ++++++++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 255 insertions(+), 98 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 9d50d15..968ed7a 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -10,10 +10,6 @@
           <el-input v-model="searchForm.salesContractNo" placeholder="璇疯緭鍏�" clearable prefix-icon="Search"
             @change="handleQuery" />
         </el-form-item>
-        <el-form-item label="椤圭洰鍚嶇О锛�">
-          <el-input v-model="searchForm.projectName" placeholder="璇疯緭鍏�" clearable prefix-icon="Search"
-            @change="handleQuery" />
-        </el-form-item>
         <el-form-item label="褰曞叆鏃ユ湡锛�">
           <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange"
             placeholder="璇烽�夋嫨" clearable @change="changeDaterange" />
@@ -64,28 +60,8 @@
 									</el-tag>
 								</template>
 							</el-table-column>
-							<el-table-column label="蹇�掑叕鍙�" prop="expressCompany" show-overflow-tooltip />
-							<el-table-column label="蹇�掑崟鍙�" prop="expressNumber" show-overflow-tooltip />
-              <el-table-column label="鍙戣揣杞︾墝" minWidth="100px" align="center">
-                <template #default="scope">
-                  <div>
-                    <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag>
-                    <el-tag v-else type="info">-</el-tag>
-                  </div>
-                </template>
-              </el-table-column>
-							<el-table-column label="鍙戣揣鏃ユ湡"
-															 minWidth="100px"
-															 align="center">
-                <template #default="scope">
-                  <div>
-                    <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div>
-										<el-tag v-else
-														type="info">-</el-tag>
-                  </div>
-                </template>
-              </el-table-column>
-              <el-table-column label="鏁伴噺" prop="quantity" />
+              <el-table-column label="鏁伴噺" prop ="quantity" />
+					<el-table-column label="宸插彂璐ф暟閲�" prop="partSendAmount" />
               <el-table-column label="绋庣巼(%)" prop="taxRate" />
               <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
               <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
@@ -101,6 +77,13 @@
                     @click="openDeliveryForm(scope.row)">
                     鍙戣揣
                   </el-button>
+                  <el-button 
+                    link 
+                    type="primary" 
+                    size="small"
+                    @click="openDeliveryDetail(scope.row)">
+                    璇︽儏
+                  </el-button>
                 </template>
               </el-table-column>
             </el-table>
@@ -110,8 +93,7 @@
         <el-table-column label="閿�鍞悎鍚屽彿" prop="salesContractNo" width="180" show-overflow-tooltip />
         <el-table-column label="瀹㈡埛鍚嶇О" prop="customerName" width="300" show-overflow-tooltip />
         <el-table-column label="涓氬姟鍛�" prop="salesman" width="100" show-overflow-tooltip />
-        <el-table-column label="椤圭洰鍚嶇О" prop="projectName" width="180" show-overflow-tooltip />
-        <el-table-column label="浠樻鏂瑰紡" prop="paymentMethod" show-overflow-tooltip />
+
         <el-table-column label="鍚堝悓閲戦(鍏�)" prop="contractAmount" width="220" show-overflow-tooltip
           :formatter="formattedNumber" />
         <el-table-column label="褰曞叆浜�" prop="entryPersonName" width="100" show-overflow-tooltip />
@@ -169,25 +151,19 @@
               </el-select>
             </el-form-item>
           </el-col>
-					<el-col :span="12">
+					<!-- <el-col :span="12">
 						<el-form-item label="椤圭洰鍚嶇О锛�" prop="projectName">
 							<el-input v-model="form.projectName" placeholder="璇疯緭鍏�" clearable :disabled="operationType === 'view'" />
 						</el-form-item>
-					</el-col>
-        </el-row>
-        <el-row :gutter="30">
+					</el-col> -->
 					<el-col :span="12">
 						<el-form-item label="绛捐鏃ユ湡锛�" prop="executionDate">
 							<el-date-picker style="width: 100%" v-model="form.executionDate" value-format="YYYY-MM-DD"
 															format="YYYY-MM-DD" type="date" placeholder="璇烽�夋嫨" clearable :disabled="operationType === 'view'" />
 						</el-form-item>
 					</el-col>
-					<el-col :span="12">
-						<el-form-item label="浠樻鏂瑰紡">
-							<el-input v-model="form.paymentMethod" placeholder="璇疯緭鍏�" clearable :disabled="operationType === 'view'" />
-						</el-form-item>
-					</el-col>
-				</el-row>
+        </el-row>
+
 				<el-row :gutter="30">
 					<el-col :span="12">
 						<el-form-item label="褰曞叆浜猴細" prop="entryPerson">
@@ -208,14 +184,14 @@
 				</el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="浜よ揣鏃ユ湡锛�" prop="entryDate">
+            <el-form-item label="浜よ揣鏃ユ湡锛�" prop="deliveryDate">
               <el-date-picker style="width: 100%" v-model="form.deliveryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
                               type="date" placeholder="璇烽�夋嫨" clearable />
             </el-form-item>
           </el-col>
         </el-row>
 				<el-row>
-					<el-form-item label="浜у搧淇℃伅锛�" prop="entryDate">
+					<el-form-item label="浜у搧淇℃伅锛�">
 						<el-button v-if="operationType !== 'view'" type="primary" @click="openProductForm('add')">娣诲姞</el-button>
 						<el-button v-if="operationType !== 'view'" plain type="danger" @click="deleteProduct" >鍒犻櫎</el-button>
 					</el-form-item>
@@ -386,7 +362,7 @@
 						</el-form-item>
 					</el-col>
 					<el-col :span="12">
-						<el-form-item label="鏁伴噺锛�" prop="quantity">
+						<el-form-item label="鏁伴噺" prop="quantity">
 							<el-input-number  :step="0.1" :min="0" v-model="productForm.quantity" placeholder="璇疯緭鍏�" clearable
 																:precision="2"
 																@change="calculateFromQuantity" style="width: 100%" />
@@ -490,10 +466,6 @@
 										<span class="label">鍙戣揣鏃ユ湡锛�</span>
 										<span class="value">{{ formatDate(item.createTime) }}</span>
 									</div>
-									<div>
-										<span class="label">鍙戣揣杞︾墝鍙凤細</span>
-										<span class="value">{{ item.shippingCarNumber }}</span>
-									</div>
 								</div>
 								<div class="info-row">
 									<div>
@@ -583,19 +555,52 @@
 		>
 			<el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef">
 				<el-row :gutter="30">
-					<el-col :span="24">
+					<el-col :span="12">
 						<el-form-item label="鍙戣揣绫诲瀷锛�" prop="type">
 							<el-select
 								v-model="deliveryForm.type"
 								placeholder="璇烽�夋嫨鍙戣揣绫诲瀷"
+								disabled
 								style="width: 100%"
 							>
-								<el-option label="璐ц溅" value="璐ц溅" />
 								<el-option label="蹇��" value="蹇��" />
 							</el-select>
 						</el-form-item>
 					</el-col>
+      <el-col :span="12">
+						<el-form-item label="寰呭彂璐ф暟閲忥細">
+							<el-input v-model="deliveryForm.remainAmount" disabled placeholder="璇疯緭鍏ュ緟鍙戣揣鏁伴噺"></el-input>
+						</el-form-item>
+					</el-col>
+      <el-col :span="12">
+						<el-form-item label="鍙戣揣妯″紡锛�" prop="deliveryMode">
+							<el-select
+								v-model="deliveryForm.deliveryMode"
+								placeholder="璇烽�夋嫨鍙戣揣妯″紡"
+            style="width: 100%"
+            @change="onDeliveryModeChange"
+							>
+							<el-option label="鍏ㄩ儴" value="鍏ㄩ儴" />
+							<el-option label="閮ㄥ垎" value="閮ㄥ垎" />
+							</el-select>
+						</el-form-item>
+					</el-col>
+      <el-col :span="12">
+        <el-form-item label="鍙戣揣鏁伴噺锛�" prop="partSendAmount">
+          <el-input-number
+            v-model="deliveryForm.partSendAmount"
+            :min="1"
+            :max="deliveryForm.remainAmount"
+            :precision="0"
+            :step="1"
+            :disabled="deliveryForm.deliveryMode === '鍏ㄩ儴'"
+            style="width: 100%"
+            placeholder="璇疯緭鍏ユ湰娆″彂璐ф暟閲�"
+          />
+        </el-form-item>
+      </el-col>
 				</el-row>
+				
 
         <!-- 瀹℃壒浜洪�夋嫨锛堜豢鍗忓悓瀹℃壒閲岀殑瀹℃壒浜鸿妭鐐归�夋嫨锛� -->
         <el-row>
@@ -649,6 +654,48 @@
 				</div>
 			</template>
 		</el-dialog>
+
+		<!-- 鍙戣揣璇︽儏寮规 -->
+		<el-dialog
+			v-model="deliveryDetailVisible"
+			title="鍙戣揣璇︽儏"
+			width="80%"
+			:close-on-click-modal="false"
+			@close="closeDeliveryDetail"
+		>
+			<el-table
+				:data="deliveryDetailTableData"
+				border
+				stripe
+				v-loading="deliveryDetailLoading"
+				height="520px"
+			>
+				<el-table-column align="center" label="搴忓彿" type="index" width="60" />
+				<el-table-column prop="salesContractNo" label="閿�鍞鍗�" width="180" show-overflow-tooltip />
+				<el-table-column prop="shippingNo" label="鍙戣揣璁㈠崟鍙�" width="180" show-overflow-tooltip />
+				<el-table-column prop="customerName" label="瀹㈡埛鍚嶇О" min-width="200" show-overflow-tooltip />
+				<el-table-column prop="status" label="鍙戣揣鐘舵��" min-width="200" show-overflow-tooltip />
+				<el-table-column prop="productName" label="浜у搧鍚嶇О" min-width="160" show-overflow-tooltip />
+				<el-table-column prop="specificationModel" label="瑙勬牸鍨嬪彿" min-width="160" show-overflow-tooltip />
+				<el-table-column prop="type" label="鍙戣揣绫诲瀷" width="100" show-overflow-tooltip />
+				<el-table-column prop="expressCompany" label="蹇�掑叕鍙�" width="140" show-overflow-tooltip />
+				<el-table-column prop="expressNumber" label="蹇�掑崟鍙�" width="160" show-overflow-tooltip />
+				<el-table-column prop="partSendAmount" label="鏈鍙戣揣鏁伴噺" width="120" align="center" />
+			</el-table>
+			<pagination
+				v-show="deliveryDetailPage.total > 0"
+				:total="deliveryDetailPage.total"
+				layout="total, sizes, prev, pager, next, jumper"
+				:page="deliveryDetailPage.current"
+				:limit="deliveryDetailPage.size"
+				@pagination="deliveryDetailPaginationChange"
+			/>
+			<template #footer>
+				<div class="dialog-footer">
+					<el-button @click="closeDeliveryDetail">鍏抽棴</el-button>
+				</div>
+			</template>
+		</el-dialog>
 	</div>
 </template>
 
@@ -656,7 +703,7 @@
 import { getToken } from "@/utils/auth";
 import pagination from "@/components/PIMTable/Pagination.vue";
 import {onMounted, ref, getCurrentInstance} from "vue";
-import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
+import { addShippingInfo, deliveryLedgerListPage } from "@/api/salesManagement/deliveryLedger.js";
 import { ElMessageBox, ElMessage } from "element-plus";
 import { UploadFilled, Download } from "@element-plus/icons-vue";
 import useUserStore from "@/store/modules/user";
@@ -758,7 +805,6 @@
 		taxInclusiveUnitPrice: [
 			{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
 		],
-		taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
 		taxInclusiveTotalPrice: [
 			{ required: true, message: "璇疯緭鍏�", trigger: "blur" },
 		],
@@ -799,18 +845,100 @@
 
 // 鍙戣揣鐩稿叧
 const deliveryFormVisible = ref(false);
+const deliveryDetailVisible = ref(false);
+const deliveryDetailLoading = ref(false);
+const deliveryDetailTableData = ref([]);
+const deliveryDetailSalesLedgerId = ref(null);
+const deliveryDetailPage = reactive({
+	current: 1,
+	size: 10,
+	total: 0,
+});
 const currentDeliveryRow = ref(null);
 const deliveryFormData = reactive({
   deliveryForm: {
-    type: "璐ц溅", // 璐ц溅, 蹇��
+    type: "蹇��", // 璐ц溅, 蹇��
+    remainAmount: 0,
+    deliveryMode: "鍏ㄩ儴", // 鍏ㄩ儴 | 閮ㄥ垎
+    partSendAmount: 0,
   },
   deliveryRules: {
     type: [
       { required: true, message: "璇烽�夋嫨鍙戣揣绫诲瀷", trigger: "change" }
+    ],
+    deliveryMode: [
+      { required: true, message: "璇烽�夋嫨鍙戣揣妯″紡", trigger: "change" }
+    ],
+    partSendAmount: [
+      {
+        validator: (rule, value, callback) => {
+          if (deliveryFormData.deliveryForm.deliveryMode !== "閮ㄥ垎") {
+            return callback();
+          }
+          const max = Number(deliveryFormData.deliveryForm.remainAmount) || 0;
+          const v = Number(value);
+          if (!v || v <= 0) {
+            return callback(new Error("璇疯緭鍏ュ彂璐ф暟閲�"));
+          }
+          if (v > max) {
+            return callback(new Error(`鍙戣揣鏁伴噺涓嶈兘瓒呰繃寰呭彂璐ф暟閲�(${max})`));
+          }
+          return callback();
+        },
+        trigger: "change",
+      }
     ]
   },
 });
 const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
+
+const onDeliveryModeChange = (val) => {
+  const remain = Number(deliveryForm.value.remainAmount) || 0;
+  if (val === "鍏ㄩ儴") {
+    deliveryForm.value.partSendAmount = remain;
+  } else {
+    let v = Number(deliveryForm.value.partSendAmount) || 0;
+    if (v <= 0 || v > remain) {
+      deliveryForm.value.partSendAmount = remain > 0 ? Math.min(1, remain) : 0;
+    }
+  }
+};
+
+const getDeliveryDetailList = () => {
+	if (!deliveryDetailSalesLedgerId.value) return;
+	deliveryDetailLoading.value = true;
+	return deliveryLedgerListPage({
+		salesLedgerId: deliveryDetailSalesLedgerId.value,
+		current: deliveryDetailPage.current,
+		size: deliveryDetailPage.size,
+	}).then((res) => {
+		deliveryDetailTableData.value = res?.data?.records || [];
+		deliveryDetailPage.total = res?.data?.total || 0;
+	}).finally(() => {
+		deliveryDetailLoading.value = false;
+	});
+};
+
+const deliveryDetailPaginationChange = (obj) => {
+	deliveryDetailPage.current = obj.page;
+	deliveryDetailPage.size = obj.limit;
+	getDeliveryDetailList();
+};
+
+const openDeliveryDetail = (row) => {
+	deliveryDetailSalesLedgerId.value = row?.salesLedgerId ?? null;
+	deliveryDetailPage.current = 1;
+	deliveryDetailVisible.value = true;
+	getDeliveryDetailList();
+};
+
+const closeDeliveryDetail = () => {
+	deliveryDetailVisible.value = false;
+	deliveryDetailTableData.value = [];
+	deliveryDetailSalesLedgerId.value = null;
+	deliveryDetailPage.current = 1;
+	deliveryDetailPage.total = 0;
+};
 
 // 鍙戣揣瀹℃壒浜鸿妭鐐癸紙浠垮崗鍚屽鎵� infoFormDia.vue锛�
 const approverNodes = ref([{ id: 1, userId: null }]);
@@ -1295,10 +1423,15 @@
 const submitProduct = () => {
 	proxy.$refs["productFormRef"].validate((valid) => {
 		if (valid) {
+			// 濡傛灉閲岄潰鐨勬暟鎹病鏈塼axRate 閭e氨榛樿甯︿笂涓�涓猼axRate 涓虹┖
+			if (!Object.prototype.hasOwnProperty.call(productForm.value, 'taxRate') || productForm.value.taxRate === null || productForm.value.taxRate === undefined) {
+				productForm.value.taxRate = 0;
+			}
 			if (operationType.value === "edit") {
 				submitProductEdit();
 			} else {
 				if(productOperationType.value === "add"){
+					
 					productData.value.push({ ...productForm.value });
 				}else{
 					productData.value[productIndex.value] = { ...productForm.value }
@@ -1872,13 +2005,15 @@
 	// 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
 	productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
 	
-	// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+	// 鏈夌◣鐜囧垯璁$畻涓嶅惈绋庢�讳环锛屽惁鍒欎笉鍚◣鎬讳环 = 鍚◣鎬讳环
 	if (productForm.value.taxRate) {
 		productForm.value.taxExclusiveTotalPrice =
 			proxy.calculateTaxExclusiveTotalPrice(
 				totalPrice,
 				productForm.value.taxRate
 			);
+	} else {
+		productForm.value.taxExclusiveTotalPrice = totalPrice.toFixed(2);
 	}
 	
 	isCalculating.value = false;
@@ -1886,39 +2021,34 @@
 
 // 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
 const calculateFromExclusiveTotalPrice = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
 	if (isCalculating.value) return;
 	
 	const exclusiveTotalPrice = parseFloat(productForm.value.taxExclusiveTotalPrice);
 	const quantity = parseFloat(productForm.value.quantity);
-	const taxRate = parseFloat(productForm.value.taxRate);
 	
-	if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
+	if (!exclusiveTotalPrice || !quantity || quantity <= 0) {
 		return;
 	}
 	
 	isCalculating.value = true;
 	
-	// 鍏堣绠楀惈绋庢�讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
-	const taxRateDecimal = taxRate / 100;
-	const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
-	productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
-	
-	// 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
-	productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
+	if (productForm.value.taxRate) {
+		// 鏈夌◣鐜囷細鍚◣鎬讳环 = 涓嶅惈绋庢�讳环 / (1 - 绋庣巼/100)
+		const taxRateDecimal = parseFloat(productForm.value.taxRate) / 100;
+		const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
+		productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
+		productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2);
+	} else {
+		// 鏃犵◣鐜囷細鍚◣鎬讳环 = 涓嶅惈绋庢�讳环
+		productForm.value.taxInclusiveTotalPrice = exclusiveTotalPrice.toFixed(2);
+		productForm.value.taxInclusiveUnitPrice = (exclusiveTotalPrice / quantity).toFixed(2);
+	}
 	
 	isCalculating.value = false;
 };
 
 // 鏍规嵁鏁伴噺鍙樺寲璁$畻鎬讳环
 const calculateFromQuantity = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
 	if (isCalculating.value) return;
 	
 	const quantity = parseFloat(productForm.value.quantity);
@@ -1933,13 +2063,15 @@
 	// 璁$畻鍚◣鎬讳环
 	productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
 	
-	// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+	// 鏈夌◣鐜囧垯璁$畻涓嶅惈绋庢�讳环锛屽惁鍒欎笉鍚◣鎬讳环 = 鍚◣鎬讳环
 	if (productForm.value.taxRate) {
 		productForm.value.taxExclusiveTotalPrice =
 			proxy.calculateTaxExclusiveTotalPrice(
 				productForm.value.taxInclusiveTotalPrice,
 				productForm.value.taxRate
 			);
+	} else {
+		productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice;
 	}
 	
 	isCalculating.value = false;
@@ -1947,10 +2079,6 @@
 
 // 鏍规嵁鍚◣鍗曚环鍙樺寲璁$畻鎬讳环
 const calculateFromUnitPrice = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
 	if (isCalculating.value) return;
 	
 	const quantity = parseFloat(productForm.value.quantity);
@@ -1965,13 +2093,15 @@
 	// 璁$畻鍚◣鎬讳环
 	productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
 	
-	// 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
+	// 鏈夌◣鐜囧垯璁$畻涓嶅惈绋庢�讳环锛屽惁鍒欎笉鍚◣鎬讳环 = 鍚◣鎬讳环
 	if (productForm.value.taxRate) {
 		productForm.value.taxExclusiveTotalPrice =
 			proxy.calculateTaxExclusiveTotalPrice(
 				productForm.value.taxInclusiveTotalPrice,
 				productForm.value.taxRate
 			);
+	} else {
+		productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice;
 	}
 	
 	isCalculating.value = false;
@@ -1979,27 +2109,27 @@
 
 // 鏍规嵁绋庣巼鍙樺寲璁$畻涓嶅惈绋庢�讳环
 const calculateFromTaxRate = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
 	if (isCalculating.value) return;
 	
 	const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
-	const taxRate = parseFloat(productForm.value.taxRate);
 	
-	if (!inclusiveTotalPrice || !taxRate) {
+	if (!inclusiveTotalPrice) {
 		return;
 	}
 	
 	isCalculating.value = true;
 	
-	// 璁$畻涓嶅惈绋庢�讳环
-	productForm.value.taxExclusiveTotalPrice =
-		proxy.calculateTaxExclusiveTotalPrice(
-			inclusiveTotalPrice,
-			taxRate
-		);
+	if (productForm.value.taxRate) {
+		// 鏈夌◣鐜囷細閲嶆柊璁$畻涓嶅惈绋庢�讳环
+		productForm.value.taxExclusiveTotalPrice =
+			proxy.calculateTaxExclusiveTotalPrice(
+				inclusiveTotalPrice,
+				parseFloat(productForm.value.taxRate)
+			);
+	} else {
+		// 鏃犵◣鐜囷細涓嶅惈绋庢�讳环 = 鍚◣鎬讳环
+		productForm.value.taxExclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
+	}
 	
 	isCalculating.value = false;
 };
@@ -2065,6 +2195,12 @@
 	return typeTextMap[statusStr] || 'info';
 };
 
+const getRemainAmount = (row) => {
+	const total = Number(row?.quantity || 0);
+	const shipped = Number(row?.partSendAmount || 0);
+	return Math.max(0, total - shipped);
+};
+
 /**
  * 鍒ゆ柇鏄惁鍙互鍙戣揣
  * 鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐у拰瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣
@@ -2075,18 +2211,13 @@
 	if (row.approveStatus !== 1) {
 		return false;
 	}
-	
-	// 鑾峰彇鍙戣揣鐘舵��
-	const shippingStatus = row.shippingStatus;
-	
-	// 濡傛灉宸插彂璐э紙鏈夊彂璐ф棩鏈熸垨杞︾墝鍙凤級锛屼笉鑳藉啀娆″彂璐�
-	if (row.shippingDate || row.shippingCarNumber) {
+
+	if (getRemainAmount(row) <= 0) {
 		return false;
 	}
-	
-	// 鍙戣揣鐘舵�佸繀椤绘槸"寰呭彂璐�"鎴�"瀹℃牳鎷掔粷"
-	const statusStr = shippingStatus ? String(shippingStatus).trim() : '';
-	return statusStr === '寰呭彂璐�' || statusStr === '瀹℃牳鎷掔粷';
+
+
+	return true;
 };
 
 /**
@@ -2104,6 +2235,7 @@
 	});
 }
 
+
 // 鎵撳紑鍙戣揣寮规
 const openDeliveryForm = (row) => {
 	// 妫�鏌ユ槸鍚﹀彲浠ュ彂璐�
@@ -2111,10 +2243,15 @@
 		proxy.$modal.msgWarning("鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐ф垨瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣");
 		return;
 	}
-	
 	currentDeliveryRow.value = row;
+  const total = Number(row.quantity || 0);
+  const shipped = Number(row.partSendAmount || 0);
+  const remain = Math.max(0, total - shipped);
   deliveryForm.value = {
-    type: "璐ц溅",
+    type: "蹇��",
+    remainAmount: remain,
+    deliveryMode: "鍏ㄩ儴",
+    partSendAmount: remain,
   };
   // 閲嶇疆瀹℃壒浜鸿妭鐐癸紙榛樿涓�涓┖鑺傜偣锛�
   approverNodes.value = [{ id: 1, userId: null }];
@@ -2133,6 +2270,24 @@
         return;
       }
       const approveUserIds = approverNodes.value.map(node => node.userId).join(",");
+      const remain = Number(deliveryForm.value.remainAmount) || 0;
+      if (remain <= 0) {
+        proxy.$modal.msgWarning("寰呭彂璐ф暟閲忎负0锛屾棤娉曞彂璐�");
+        return;
+      }
+      const isAllSend = deliveryForm.value.deliveryMode === "鍏ㄩ儴" ? 1 : 0;
+      let quantityToSend = remain;
+      if (isAllSend === 0) {
+        quantityToSend = Number(deliveryForm.value.partSendAmount) || 0;
+        if (quantityToSend <= 0) {
+          proxy.$modal.msgWarning("璇疯緭鍏ュ彂璐ф暟閲�");
+          return;
+        }
+        if (quantityToSend > remain) {
+          proxy.$modal.msgWarning(`鍙戣揣鏁伴噺涓嶈兘瓒呰繃寰呭彂璐ф暟閲�(${remain})`);
+          return;
+        }
+      }
       // 淇濆瓨褰撳墠灞曞紑鐨勮ID锛屼互渚垮彂璐у悗閲嶆柊鍔犺浇瀛愯〃鏍兼暟鎹�
       const currentExpandedKeys = [...expandedRowKeys.value];
       const salesLedgerId = currentDeliveryRow.value.salesLedgerId;
@@ -2140,6 +2295,8 @@
         salesLedgerId: salesLedgerId,
         salesLedgerProductId: currentDeliveryRow.value.id,
         type: deliveryForm.value.type,
+        isAllSend,
+        partSendAmount: quantityToSend,
 				approveUserIds,
       })
         .then(() => {

--
Gitblit v1.9.3