From e508f0726a84b92af0b08c4ea03cf1ffb97ffc8a Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期六, 28 三月 2026 15:25:25 +0800
Subject: [PATCH] fix(enterpriseInfo): 优化图片路径显示逻辑

---
 src/views/salesManagement/salesLedger/index.vue |  415 ++++++++++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 327 insertions(+), 88 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 7482d2e..dec0aae 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -45,16 +45,22 @@
         <el-table-column align="center" type="selection" width="55" />
         <el-table-column type="expand">
           <template #default="props">
-            <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable">
-              <el-table-column align="center" label="搴忓彿" type="index" width="60" />
-              <el-table-column label="浜у搧澶х被" prop="productCategory" />
-              <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" />
-              <el-table-column label="鍗曚綅" prop="unit" />
-              <el-table-column label="鏁伴噺" prop="quantity" />
-              <el-table-column label="绋庣巼(%)" prop="taxRate" />
-              <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" />
-              <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
-              <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
+            <el-table :data="props.row.children" border show-summary :summary-method="summarizeChildrenTable" style="min-width: 1200px;"
+                      scrollbar-always-on>
+              <el-table-column align="center" label="搴忓彿" type="index" width="70" />
+              <el-table-column label="浜у搧澶х被" prop="productCategory" width="160" />
+              <el-table-column label="瑙勬牸鍨嬪彿" prop="specificationModel" width="220" />
+              <el-table-column label="鍗曚綅" prop="unit" width="100" />
+              <el-table-column label="鏁伴噺" prop="quantity" width="120" />
+              <el-table-column label="绋庣巼(%)" prop="taxRate" width="120" />
+              <el-table-column label="鍚◣鍗曚环(鍏�)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" width="160" />
+              <el-table-column label="鍚◣鎬讳环(鍏�)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" width="180" />
+              <el-table-column label="涓嶅惈绋庢�讳环(鍏�)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" width="180" />
+<!--              <el-table-column fixed="right" label="鎿嶄綔" width="150" align="center">-->
+<!--                <template #default="scope">-->
+<!--                  <el-button link type="primary" size="small" @click="openDeliveryForm(props.row, scope.row)">鍙戣揣</el-button>-->
+<!--                </template>-->
+<!--              </el-table-column>-->
             </el-table>
           </template>
         </el-table-column>
@@ -64,17 +70,52 @@
         <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="瀹℃牳鐘舵��" width="140">
+          <template #default="scope">
+
+              <el-tag
+                v-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 0"
+                type="warning"
+              >寰呭鏍�</el-tag>
+              <el-tag
+                v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 1"
+                type="primary"
+              >瀹℃牳涓�</el-tag>
+              <el-tag
+                v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 2"
+                type="success"
+              >瀹℃牳瀹屾垚</el-tag>
+              <el-tag
+                v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 3"
+                type="danger"
+              >瀹℃牳鏈�氳繃</el-tag>
+              <el-tag
+                v-else-if="(scope.row.approveStatus ?? scope.row.approvalStatus) == 4"
+                type="info"
+              >宸查噸鏂版彁浜�</el-tag>
+              <el-tag v-else type="info">-</el-tag>
+
+          </template>
+        </el-table-column>
+        <el-table-column label="閿�鍞被鍨�" width="120">
+          <template #default="scope">
+            <el-tag
+              :type="scope.row.salesType === '绱ф��' ? 'danger' : 'info'"
+            >{{ scope.row.salesType || '-' }}</el-tag>
+          </template>
+        </el-table-column>
         <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 />
         <el-table-column label="褰曞叆鏃ユ湡" prop="entryDate" width="120" show-overflow-tooltip />
         <el-table-column label="绛捐鏃ユ湡" prop="executionDate" width="120" show-overflow-tooltip />
-        <el-table-column fixed="right" label="鎿嶄綔" min-width="140" align="center">
+        <el-table-column fixed="right" label="鎿嶄綔" min-width="150" align="center">
           <template #default="scope">
-            <el-button link type="primary" size="small" :disabled="scope.row.invoiceTotal>0 || scope.row.entryPersonName !== userStore.nickName" @click="openForm('edit', scope.row)">缂栬緫</el-button>
+            <el-button link type="primary" size="small" @click="openForm('edit', scope.row)">缂栬緫</el-button>
 <!--            <el-button link type="primary" size="small" @click="openForm('view', scope.row)">璇︽儏</el-button>-->
             <el-button link type="primary" size="small" @click="downLoadFile(scope.row)">闄勪欢</el-button>
+            <el-button link type="primary" size="small" @click="openDeliveryForm(scope.row)">鍙戣揣</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -141,7 +182,7 @@
           <el-col :span="12">
             <el-form-item label="褰曞叆鏃ユ湡锛�" prop="entryDate">
               <el-date-picker style="width: 100%" v-model="form.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD"
-                type="date" placeholder="璇烽�夋嫨" clearable disabled />
+                type="date" placeholder="璇烽�夋嫨" clearable />
             </el-form-item>
           </el-col>
         </el-row>
@@ -149,6 +190,62 @@
           <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-col :span="12">
+            <el-form-item label="閿�鍞被鍨嬶細" prop="salesType">
+              <el-select
+                v-model="form.salesType"
+                placeholder="璇烽�夋嫨"
+                clearable
+                :disabled="operationType === 'view'"
+                style="width: 100%"
+              >
+                <el-option label="鏅��" value="鏅��" />
+                <el-option label="绱ф��" value="绱ф��" />
+              </el-select>
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row>
+          <el-col :span="24">
+            <el-form-item v-if="operationType !== 'view'">
+              <template #label>
+                <span>瀹℃壒浜洪�夋嫨锛�</span>
+                <el-button type="primary" @click="addApproverNode" style="margin-left: 8px;">鏂板鑺傜偣</el-button>
+              </template>
+              <div style="display: flex; align-items: flex-end; flex-wrap: wrap;">
+                <div
+                  v-for="(node, index) in approverNodes"
+                  :key="node.id"
+                  style="margin-right: 30px; text-align: center; margin-bottom: 10px;"
+                >
+                  <div>
+                    <span>瀹℃壒浜�</span>
+                    鈫�
+                  </div>
+                  <el-select
+                    v-model="node.userId"
+                    placeholder="閫夋嫨浜哄憳"
+                    style="width: 140px; margin-bottom: 8px;"
+                  >
+                    <el-option
+                      v-for="user in userList"
+                      :key="user.userId"
+                      :label="user.nickName"
+                      :value="user.userId"
+                    />
+                  </el-select>
+                  <div>
+                    <el-button
+                      type="danger"
+                      size="small"
+                      @click="removeApproverNode(index)"
+                      v-if="approverNodes.length > 1"
+                    >鍒犻櫎</el-button>
+                  </div>
+                </div>
+              </div>
             </el-form-item>
           </el-col>
         </el-row>
@@ -319,7 +416,7 @@
 								<div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
 								<div class="document-title">闆跺敭鍙戣揣鍗�</div>
 							</div>
-							
+
 							<div class="info-section">
 								<div class="info-row">
 									<div>
@@ -327,7 +424,7 @@
 										<span class="value">{{ formatDate(item.createTime) }}</span>
 									</div>
 									<div>
-										
+
 										<span class="label">瀹㈡埛鍚嶇О锛�</span>
 										<span class="value">{{ item.customerName || '寮犵埍鏈�' }}</span>
 									</div>
@@ -337,7 +434,7 @@
 									<span class="value">{{ item.salesContractNo }}</span>
 								</div>
 							</div>
-							
+
 							<div class="table-section">
 								<table class="product-table">
 									<thead>
@@ -375,7 +472,7 @@
 									</tfoot>
 								</table>
 							</div>
-							
+
 							<div class="footer-section">
 								<div class="footer-row">
 									<div class="footer-item">
@@ -407,6 +504,48 @@
 				</div>
 			</div>
 		</el-dialog>
+		<!-- 鍙戣揣寮规 -->
+		<el-dialog
+			v-model="deliveryFormVisible"
+			title="鍙戣揣淇℃伅"
+			width="40%"
+			@close="closeDeliveryDia"
+		>
+			<el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef">
+				<el-row :gutter="30">
+					<el-col :span="24">
+						<el-form-item label="鍙戣揣鏃ユ湡锛�" prop="shippingDate">
+							<el-date-picker
+								style="width: 100%"
+								v-model="deliveryForm.shippingDate"
+								value-format="YYYY-MM-DD"
+								format="YYYY-MM-DD"
+								type="date"
+								placeholder="璇烽�夋嫨鍙戣揣鏃ユ湡"
+								clearable
+							/>
+						</el-form-item>
+					</el-col>
+				</el-row>
+				<el-row :gutter="30">
+					<el-col :span="24">
+						<el-form-item label="鍙戣揣杞︾墝鍙凤細" prop="shippingCarNumber">
+							<el-input
+								v-model="deliveryForm.shippingCarNumber"
+								placeholder="璇疯緭鍏ュ彂璐ц溅鐗屽彿"
+								clearable
+							/>
+						</el-form-item>
+					</el-col>
+				</el-row>
+			</el-form>
+			<template #footer>
+				<div class="dialog-footer">
+					<el-button type="primary" @click="submitDelivery">纭鍙戣揣</el-button>
+					<el-button @click="closeDeliveryDia">鍙栨秷</el-button>
+				</div>
+			</template>
+		</el-dialog>
     <FileList ref="fileListRef" />
   </div>
 </template>
@@ -415,7 +554,8 @@
 import { getToken } from "@/utils/auth";
 import pagination from "@/components/PIMTable/Pagination.vue";
 import {onMounted, ref} from "vue";
-import { ElMessageBox } from "element-plus";
+import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
+import {ElMessage, ElMessageBox} from "element-plus";
 import useUserStore from "@/store/modules/user";
 import { userListNoPage } from "@/api/system/user.js";
 import FileList from "./fileList.vue";
@@ -428,11 +568,15 @@
   delLedger,
   addOrUpdateSalesLedgerProduct,
   delProduct,
-  delLedgerFile,
+  delLedgerFile, getProductInventory,
 } from "@/api/salesManagement/salesLedger.js";
 import { modelList, productTreeList } from "@/api/basicData/product.js";
 import useFormData from "@/hooks/useFormData.js";
 import dayjs from "dayjs";
+import {
+  getStockInPage
+} from "@/api/inventoryManagement/stockIn.js";
+
 
 const userStore = useUserStore();
 const { proxy } = getCurrentInstance();
@@ -451,6 +595,8 @@
 });
 const total = ref(0);
 const fileList = ref([]);
+const approverNodes = ref([{ id: 1, userId: null }]);
+let nextApproverId = 2;
 
 // 鐢ㄦ埛淇℃伅琛ㄥ崟寮规鏁版嵁
 const operationType = ref("");
@@ -461,12 +607,9 @@
     customerContractNo: "", // 瀹㈡埛鍚堝悓缂栧彿
     salesContractNo: "", // 閿�鍞悎鍚岀紪鍙�
     projectName: "", // 椤圭洰鍚嶇О
-    entryDate: [
-      dayjs().format("YYYY-MM-DD"),
-      dayjs().add(1, "day").format("YYYY-MM-DD"),
-    ], // 褰曞叆鏃ユ湡
-    entryDateStart: dayjs().format("YYYY-MM-DD"),
-    entryDateEnd: dayjs().add(1, "day").format("YYYY-MM-DD"),
+    entryDate: null, // 褰曞叆鏃ユ湡
+    entryDateStart: undefined,
+    entryDateEnd: undefined,
   },
   form: {
     salesContractNo: "",
@@ -480,8 +623,10 @@
     productData: [],
     executionDate: "",
     paymentMethod: "",
+    salesType: "鏅��",
   },
   rules: {
+    salesType: [{ required: true, message: "璇烽�夋嫨閿�鍞被鍨�", trigger: "change" }],
     salesman: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
     customerContractNo: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
@@ -495,6 +640,12 @@
 });
 const { form, rules } = toRefs(data);
 const { form: searchForm } = useFormData(data.searchForm);
+const addApproverNode = () => {
+  approverNodes.value.push({ id: nextApproverId++, userId: null });
+};
+const removeApproverNode = (index) => {
+  approverNodes.value.splice(index, 1);
+};
 // 浜у搧琛ㄥ崟寮规鏁版嵁
 const productFormVisible = ref(false);
 const productOperationType = ref("");
@@ -544,6 +695,25 @@
 // 鎵撳嵃鐩稿叧
 const printPreviewVisible = ref(false);
 const printData = ref([]);
+
+// 鍙戣揣鐩稿叧
+const deliveryFormVisible = ref(false);
+const currentDeliveryContext = ref(null);
+const deliveryFormData = reactive({
+  deliveryForm: {
+    shippingDate: "",
+    shippingCarNumber: "",
+  },
+  deliveryRules: {
+    shippingDate: [
+      { required: true, message: "璇烽�夋嫨鍙戣揣鏃ユ湡", trigger: "change" }
+    ],
+    shippingCarNumber: [
+      { required: true, message: "璇疯緭鍏ュ彂璐ц溅鐗屽彿", trigger: "blur" }
+    ],
+  },
+});
+const { deliveryForm, deliveryRules } = toRefs(deliveryFormData);
 
 const changeDaterange = (value) => {
   if (value) {
@@ -689,6 +859,8 @@
   operationType.value = type;
   form.value = {};
   productData.value = [];
+  approverNodes.value = [{ id: 1, userId: null }];
+  nextApproverId = 2;
   let userLists = await userListNoPage();
   userList.value = userLists.data;
   customerList().then((res) => {
@@ -700,8 +872,22 @@
     getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
       form.value = { ...res };
       form.value.entryPerson = Number(res.entryPerson);
+      if (!form.value.salesType) {
+        form.value.salesType = "鏅��";
+      }
       productData.value = form.value.productData;
       fileList.value = form.value.salesLedgerFiles;
+      const approveUserIds = form.value.approveUserIds || form.value.approverIds;
+      if (approveUserIds) {
+        const ids = String(approveUserIds)
+          .split(",")
+          .map((id) => Number(id.trim()))
+          .filter((id) => !Number.isNaN(id));
+        if (ids.length > 0) {
+          approverNodes.value = ids.map((id, idx) => ({ id: idx + 1, userId: id }));
+          nextApproverId = ids.length + 1;
+        }
+      }
     });
   }
   // let userAll = await userStore.getInfo()
@@ -711,6 +897,9 @@
   //   }
   // });
   form.value.entryDate = getCurrentDate(); // 璁剧疆榛樿褰曞叆鏃ユ湡涓哄綋鍓嶆棩鏈�
+  if (type === "add") {
+    form.value.salesType = "鏅��";
+  }
   dialogFormVisible.value = true;
 };
 function changs(val) {
@@ -756,6 +945,14 @@
 const submitForm = () => {
   proxy.$refs["formRef"].validate((valid) => {
     if (valid) {
+      if (operationType.value !== "view") {
+        const hasEmptyApprover = approverNodes.value.some((node) => !node.userId);
+        if (hasEmptyApprover) {
+          proxy.$modal.msgWarning("璇蜂负鎵�鏈夊鎵硅妭鐐归�夋嫨瀹℃壒浜�");
+          return;
+        }
+        form.value.approveUserIds = approverNodes.value.map((node) => node.userId).join(",");
+      }
 			console.log('productData.value--', productData.value)
       if (productData.value !== null && productData.value.length > 0) {
         form.value.productData = proxy.HaveJson(productData.value);
@@ -915,25 +1112,25 @@
 		proxy.$modal.msgWarning("璇烽�夋嫨瑕佹墦鍗扮殑鏁版嵁");
 		return;
 	}
-	
+
 	// 鏄剧ず鍔犺浇鐘舵��
 	proxy.$modal.loading("姝e湪鑾峰彇浜у搧鏁版嵁锛岃绋嶅��...");
-	
+
 	try {
 		// 涓烘瘡涓�変腑鐨勯攢鍞彴璐﹁褰曟煡璇㈠搴旂殑浜у搧鏁版嵁
 		const printDataWithProducts = [];
-		
+
 		for (const row of selectedRows.value) {
 			try {
 				// 璋冪敤productList鎺ュ彛鏌ヨ浜у搧鏁版嵁
 				const productRes = await productList({ salesLedgerId: row.id, type: 1 });
-				
+
 				// 灏嗕骇鍝佹暟鎹暣鍚堝埌閿�鍞彴璐﹁褰曚腑
 				const rowWithProducts = {
 					...row,
 					products: productRes.data || []
 				};
-				
+
 				printDataWithProducts.push(rowWithProducts);
 			} catch (error) {
 				console.error(`鑾峰彇閿�鍞彴璐� ${row.id} 鐨勪骇鍝佹暟鎹け璐�:`, error);
@@ -944,11 +1141,11 @@
 				});
 			}
 		}
-		
+
 		printData.value = printDataWithProducts;
 		console.log('鎵撳嵃鏁版嵁锛堝寘鍚骇鍝侊級:', printData.value);
 		printPreviewVisible.value = true;
-		
+
 	} catch (error) {
 		console.error('鑾峰彇浜у搧鏁版嵁澶辫触:', error);
 		proxy.$modal.msgError("鑾峰彇浜у搧鏁版嵁澶辫触锛岃閲嶈瘯");
@@ -960,10 +1157,10 @@
 const executePrint = () => {
 	console.log('寮�濮嬫墽琛屾墦鍗帮紝鏁版嵁鏉℃暟:', printData.value.length);
 	console.log('鎵撳嵃鏁版嵁:', printData.value);
-	
+
 	// 鍒涘缓涓�涓柊鐨勬墦鍗扮獥鍙�
 	const printWindow = window.open('', '_blank', 'width=800,height=600');
-	
+
 	// 鏋勫缓鎵撳嵃鍐呭
 	let printContent = `
     <!DOCTYPE html>
@@ -1099,7 +1296,7 @@
     </head>
     <body>
   `;
-	
+
 	// 涓烘瘡鏉℃暟鎹敓鎴愭墦鍗伴〉闈�
 	printData.value.forEach((item, index) => {
 		printContent += `
@@ -1109,7 +1306,7 @@
             <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
             <div class="document-title">闆跺敭鍙戣揣鍗�</div>
           </div>
-          
+
           <div class="info-section">
             <div class="info-row">
               <div>
@@ -1140,7 +1337,7 @@
                 </tr>
               </thead>
               <tbody>
-                ${item.products && item.products.length > 0 ? 
+                ${item.products && item.products.length > 0 ?
                   item.products.map(product => `
                     <tr>
                       <td>${product.productCategory || ''}</td>
@@ -1150,7 +1347,7 @@
                       <td>${product.quantity || '0'}</td>
                       <td>${product.taxInclusiveTotalPrice || '0'}</td>
                     </tr>
-                  `).join('') : 
+                  `).join('') :
                   '<tr><td colspan="6" style="text-align: center; color: #999;">鏆傛棤浜у搧鏁版嵁</td></tr>'
                 }
               </tbody>
@@ -1197,16 +1394,16 @@
       </div>
     `;
 	});
-	
+
 	printContent += `
     </body>
     </html>
   `;
-	
+
 	// 鍐欏叆鍐呭鍒版柊绐楀彛
 	printWindow.document.write(printContent);
 	printWindow.document.close();
-	
+
 	// 绛夊緟鍐呭鍔犺浇瀹屾垚鍚庢墦鍗�
 	printWindow.onload = () => {
 		setTimeout(() => {
@@ -1306,19 +1503,19 @@
 // 鏍规嵁鍚◣鎬讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
 const calculateFromTotalPrice = () => {
   if (isCalculating.value) return;
-  
+
   const totalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
   const quantity = parseFloat(productForm.value.quantity);
-  
+
   if (!totalPrice || !quantity || quantity <= 0) {
     return;
   }
-  
+
   isCalculating.value = true;
-  
+
   // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
   productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
-  
+
   // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
   if (productForm.value.taxRate) {
     productForm.value.taxExclusiveTotalPrice =
@@ -1327,7 +1524,7 @@
         productForm.value.taxRate
       );
   }
-  
+
   isCalculating.value = false;
 };
 
@@ -1338,25 +1535,25 @@
 		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) {
     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);
-  
+
   isCalculating.value = false;
 };
 
@@ -1367,19 +1564,19 @@
 		return;
 	}
   if (isCalculating.value) return;
-  
+
   const quantity = parseFloat(productForm.value.quantity);
   const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-  
+
   if (!quantity || quantity <= 0 || !unitPrice) {
     return;
   }
-  
+
   isCalculating.value = true;
-  
+
   // 璁$畻鍚◣鎬讳环
   productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-  
+
   // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
   if (productForm.value.taxRate) {
     productForm.value.taxExclusiveTotalPrice =
@@ -1388,7 +1585,7 @@
         productForm.value.taxRate
       );
   }
-  
+
   isCalculating.value = false;
 };
 
@@ -1399,19 +1596,19 @@
 		return;
 	}
   if (isCalculating.value) return;
-  
+
   const quantity = parseFloat(productForm.value.quantity);
   const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-  
+
   if (!quantity || quantity <= 0 || !unitPrice) {
     return;
   }
-  
+
   isCalculating.value = true;
-  
+
   // 璁$畻鍚◣鎬讳环
   productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
-  
+
   // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
   if (productForm.value.taxRate) {
     productForm.value.taxExclusiveTotalPrice =
@@ -1420,7 +1617,7 @@
         productForm.value.taxRate
       );
   }
-  
+
   isCalculating.value = false;
 };
 
@@ -1431,23 +1628,23 @@
 		return;
 	}
   if (isCalculating.value) return;
-  
+
   const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
   const taxRate = parseFloat(productForm.value.taxRate);
-  
+
   if (!inclusiveTotalPrice || !taxRate) {
     return;
   }
-  
+
   isCalculating.value = true;
-  
+
   // 璁$畻涓嶅惈绋庢�讳环
   productForm.value.taxExclusiveTotalPrice =
     proxy.calculateTaxExclusiveTotalPrice(
       inclusiveTotalPrice,
       taxRate
     );
-  
+
   isCalculating.value = false;
 };
 /**
@@ -1460,8 +1657,50 @@
   getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
     fileListRef.value.open(res.salesLedgerFiles)
   });
-
 }
+
+// 鎵撳紑鍙戣揣寮规
+const openDeliveryForm = (row) => {
+  getProductInventory({ salesLedgerId: row.id, type:1 }).then((res) => {
+    currentDeliveryRow.value = row;
+    deliveryForm.value = {
+      shippingDate: getCurrentDate(),
+      shippingCarNumber: "",
+    };
+    deliveryFormVisible.value = true;
+  }).catch(err => {
+    // ElMessage.error(err);
+  });
+};
+
+// 鎻愪氦鍙戣揣琛ㄥ崟
+const submitDelivery = () => {
+  proxy.$refs["deliveryFormRef"].validate((valid) => {
+    if (valid) {
+      addShippingInfo({
+        salesLedgerId: currentDeliveryContext.value.parentRow.id,
+        salesLedgerProductId: currentDeliveryContext.value.productRow.id,
+        shippingDate: deliveryForm.value.shippingDate,
+        shippingCarNumber: deliveryForm.value.shippingCarNumber,
+      })
+        .then(() => {
+          proxy.$modal.msgSuccess("鍙戣揣鎴愬姛");
+          closeDeliveryDia();
+        })
+        .catch(() => {
+          proxy.$modal.msgError("鍙戣揣澶辫触锛岃閲嶈瘯");
+        });
+    }
+  });
+};
+
+// 鍏抽棴鍙戣揣寮规
+const closeDeliveryDia = () => {
+  proxy.resetForm("deliveryFormRef");
+  deliveryFormVisible.value = false;
+  currentDeliveryContext.value = null;
+};
+
 onMounted(() => {
 	getList();
 });
@@ -1494,12 +1733,12 @@
 		padding: 15px;
 		border-bottom: 1px solid #e4e7ed;
 		text-align: center;
-		
+
 		.el-button {
 			margin: 0 10px;
 		}
 	}
-	
+
 	.print-preview-content {
 		padding: 20px;
 		background-color: #f5f5f5;
@@ -1531,13 +1770,13 @@
 .header {
 	text-align: center;
 	margin-bottom: 8px;
-	
+
 	.company-name {
 		font-size: 18px;
 		font-weight: bold;
 		margin-bottom: 4px;
 	}
-	
+
 	.document-title {
 		font-size: 16px;
 		font-weight: bold;
@@ -1549,16 +1788,16 @@
 	display: flex;
 	justify-content: space-between;
 	align-items: center;
-	
+
 	.info-row {
 		line-height: 20px;
-		
+
 		.label {
 			font-weight: bold;
 			width: 60px;
 			font-size: 14px;
 		}
-		
+
 		.value {
 			margin-right: 20px;
 			min-width: 80px;
@@ -1570,12 +1809,12 @@
 .table-section {
 	margin-bottom: 4px;
 	flex: 1;
-	
+
 	.product-table {
 		width: 100%;
 		border-collapse: collapse;
 		border: 1px solid #000;
-		
+
 		th, td {
 			border: 1px solid #000;
 			padding: 6px;
@@ -1583,16 +1822,16 @@
 			font-size: 14px;
 			line-height: 1.4;
 		}
-		
+
 		th {
 			font-weight: bold;
 		}
-		
+
 		.total-label {
 			text-align: right;
 			font-weight: bold;
 		}
-		
+
 		.total-value {
 			font-weight: bold;
 		}
@@ -1605,22 +1844,22 @@
 		margin-bottom: 3px;
 		line-height: 20px;
 		justify-content: space-between;
-		
+
 		.footer-item {
 			display: flex;
 			margin-right: 20px;
-			
+
 			.label {
 				font-weight: bold;
 				width: 80px;
 				font-size: 14px;
 			}
-			
+
 			.value {
 				min-width: 80px;
 				font-size: 14px;
 			}
-			
+
 			&.address-item {
 				.address-value {
 					min-width: 200px;
@@ -1634,7 +1873,7 @@
 	.app-container {
 		display: none;
 	}
-	
+
 	.print-page {
 		box-shadow: none;
 		margin: 0;

--
Gitblit v1.9.3