From 7b7accc4ce1c1ccfc7a006980e1d3e4d0fbc56e8 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期二, 06 一月 2026 16:57:33 +0800
Subject: [PATCH] 双奇点 1.编辑采购台账时,删除产品时,弹出两个提示需修改下 2.采购台账添加附件操作按钮和页面

---
 src/views/salesManagement/salesLedger/index.vue |  209 +++++++++++++++++++++++++++++++++++++++------------
 1 files changed, 159 insertions(+), 50 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 7482d2e..cfdf052 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -47,14 +47,18 @@
           <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="productCategory"/>
+              <el-table-column label="浜у搧楂樺害" prop="specificationModel" width="100">
+                <template #default="scope">
+                  <div>{{ scope.row.specificationModel }}{{ scope.row.unit }}</div>
+                </template>
+              </el-table-column>
+              <el-table-column label="鏁伴噺" prop="quantity"/>
+              <el-table-column label="鍗曚环(缇庡厓)/浠�" prop="taxInclusiveUnitPrice" :formatter="formattedNumber"></el-table-column>
+
               <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-column label="鍚◣鎬讳环(缇庡厓)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" />
+              <el-table-column label="涓嶅惈绋庢�讳环(缇庡厓)" prop="taxExclusiveTotalPrice" :formatter="formattedNumber" />
             </el-table>
           </template>
         </el-table-column>
@@ -70,11 +74,12 @@
         <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="200" 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('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 +146,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>
@@ -162,14 +167,18 @@
           :summary-method="summarizeMainTable">
           <el-table-column align="center" type="selection" width="55" v-if="operationType !== 'view'" />
           <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="productCategory" />
+          <el-table-column label="浜у搧楂樺害" prop="specificationModel">
+            <template #default="scope">
+              <div>{{ scope.row.specificationModel }}{{ scope.row.unit }}</div>
+            </template>
+          </el-table-column>
+          <!-- <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-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-column fixed="right" label="鎿嶄綔" min-width="60" align="center" v-if="operationType !== 'view'">
             <template #default="scope">
               <el-button link type="primary" size="small" @click="openProductForm('edit', scope.row,scope.$index)">缂栬緫</el-button>
@@ -213,7 +222,7 @@
       <el-form :model="productForm" label-width="140px" label-position="top" :rules="productRules" ref="productFormRef">
         <el-row :gutter="30">
           <el-col :span="24">
-            <el-form-item label="浜у搧澶х被锛�" prop="productCategory">
+            <el-form-item label="浜у搧鍚嶇О锛�" prop="productCategory">
               <!-- <el-select v-model="productForm.productCategory" placeholder="璇烽�夋嫨" clearable>
                 <el-option v-for="item in userList" :key="item.nickName" :label="item.nickName" :value="item.nickName"/>
               </el-select> -->
@@ -224,7 +233,7 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="24">
-            <el-form-item label="瑙勬牸鍨嬪彿锛�" prop="productModelId">
+            <el-form-item label="浜у搧楂樺害锛�" prop="productModelId">
               <el-select v-model="productForm.productModelId" placeholder="璇烽�夋嫨" clearable @change="getProductModel">
                 <el-option v-for="item in modelOptions" :key="item.id" :label="item.model" :value="item.id" />
               </el-select>
@@ -233,7 +242,7 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="鍗曚綅锛�" prop="unit">
+            <el-form-item label="楂樺害鍗曚綅锛�" prop="unit">
               <el-input v-model="productForm.unit" placeholder="璇疯緭鍏�" clearable />
             </el-form-item>
           </el-col>
@@ -249,7 +258,7 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="鍚◣鍗曚环(鍏�)锛�" prop="taxInclusiveUnitPrice">
+            <el-form-item label="鍗曚环(缇庡厓)/浠讹細" prop="taxInclusiveUnitPrice">
               <el-input-number :step="0.01" :min="0" v-model="productForm.taxInclusiveUnitPrice" style="width: 100%"
 															 :precision="2"
 															 placeholder="璇疯緭鍏�" clearable @change="calculateFromUnitPrice" />
@@ -257,20 +266,19 @@
           </el-col>
 					<el-col :span="12">
 						<el-form-item label="鏁伴噺锛�" prop="quantity">
-							<el-input-number  :step="0.1" :min="0" v-model="productForm.quantity" placeholder="璇疯緭鍏�" clearable
-																:precision="2"
+							<el-input-number  :min="0" v-model="productForm.quantity" placeholder="璇疯緭鍏�" clearable
 																@change="calculateFromQuantity" style="width: 100%" />
 						</el-form-item>
 					</el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
-            <el-form-item label="鍚◣鎬讳环(鍏�)锛�" prop="taxInclusiveTotalPrice">
+            <el-form-item label="鍚◣鎬讳环(缇庡厓)锛�" prop="taxInclusiveTotalPrice">
               <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable @change="calculateFromTotalPrice" />
             </el-form-item>
           </el-col>
           <el-col :span="12">
-            <el-form-item label="涓嶅惈绋庢�讳环(鍏�)锛�" prop="taxExclusiveTotalPrice">
+            <el-form-item label="涓嶅惈绋庢�讳环(缇庡厓)锛�" prop="taxExclusiveTotalPrice">
               <el-input v-model="productForm.taxExclusiveTotalPrice" placeholder="璇疯緭鍏�" clearable @change="calculateFromExclusiveTotalPrice" />
             </el-form-item>
           </el-col>
@@ -316,7 +324,7 @@
 					<div v-for="(item, index) in printData" :key="index" class="print-page">
 						<div class="delivery-note">
 							<div class="header">
-								<div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
+								<div class="company-name">鍙屽鐐规湁闄愯矗浠诲叕鍙�</div>
 								<div class="document-title">闆跺敭鍙戣揣鍗�</div>
 							</div>
 							
@@ -407,6 +415,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,6 +465,7 @@
 import { getToken } from "@/utils/auth";
 import pagination from "@/components/PIMTable/Pagination.vue";
 import {onMounted, ref} from "vue";
+import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js";
 import { ElMessageBox } from "element-plus";
 import useUserStore from "@/store/modules/user";
 import { userListNoPage } from "@/api/system/user.js";
@@ -461,12 +512,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: "",
@@ -510,6 +558,7 @@
     taxInclusiveTotalPrice: "",
     taxExclusiveTotalPrice: "",
     invoiceType: "",
+    cartonSpecifications:'',
   },
   productRules: {
     productCategory: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
@@ -522,6 +571,7 @@
     taxInclusiveUnitPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
+    cartonSpecifications: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
     taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
     taxInclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
@@ -544,6 +594,25 @@
 // 鎵撳嵃鐩稿叧
 const printPreviewVisible = ref(false);
 const printData = ref([]);
+
+// 鍙戣揣鐩稿叧
+const deliveryFormVisible = ref(false);
+const currentDeliveryRow = 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) {
@@ -584,7 +653,7 @@
       tableLoading.value = false;
     });
 };
-// 鑾峰彇浜у搧澶х被tree鏁版嵁
+// 鑾峰彇浜у搧鍚嶇Оtree鏁版嵁
 const getProductOptions = () => {
   productTreeList().then((res) => {
     productOptions.value = convertIdToValue(res);
@@ -596,6 +665,7 @@
 // 鑾峰彇tree瀛愭暟鎹�
 const getModels = (value) => {
   productForm.value.productCategory = findNodeById(productOptions.value, value);
+  productForm.value.productId = value;
   modelList({ id: value }).then((res) => {
     modelOptions.value = res;
   });
@@ -808,6 +878,7 @@
         }else{
           productData.value[productIndex.value] = { ...productForm.value }
         }
+        console.log('productData',productData)
         closeProductDia();
       }
     }
@@ -1106,7 +1177,7 @@
       <div class="print-page">
         <div class="delivery-note">
           <div class="header">
-            <div class="company-name">榧庤瘹鐟炲疄涓氭湁闄愯矗浠诲叕鍙�</div>
+            <div class="company-name">鍙屽鐐规湁闄愯矗浠诲叕鍙�</div>
             <div class="document-title">闆跺敭鍙戣揣鍗�</div>
           </div>
           
@@ -1333,10 +1404,10 @@
 
 // 鏍规嵁涓嶅惈绋庢�讳环璁$畻鍚◣鍗曚环鍜屾暟閲�
 const calculateFromExclusiveTotalPrice = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
   if (isCalculating.value) return;
   
   const exclusiveTotalPrice = parseFloat(productForm.value.taxExclusiveTotalPrice);
@@ -1362,10 +1433,10 @@
 
 // 鏍规嵁鏁伴噺鍙樺寲璁$畻鎬讳环
 const calculateFromQuantity = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
   if (isCalculating.value) return;
   
   const quantity = parseFloat(productForm.value.quantity);
@@ -1394,10 +1465,10 @@
 
 // 鏍规嵁鍚◣鍗曚环鍙樺寲璁$畻鎬讳环
 const calculateFromUnitPrice = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
   if (isCalculating.value) return;
   
   const quantity = parseFloat(productForm.value.quantity);
@@ -1426,10 +1497,10 @@
 
 // 鏍规嵁绋庣巼鍙樺寲璁$畻涓嶅惈绋庢�讳环
 const calculateFromTaxRate = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
   if (isCalculating.value) return;
   
   const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
@@ -1460,8 +1531,46 @@
   getSalesLedgerWithProducts({ id: row.id, type: 1 }).then((res) => {
     fileListRef.value.open(res.salesLedgerFiles)
   });
-
 }
+
+// 鎵撳紑鍙戣揣寮规
+const openDeliveryForm = (row) => {
+  currentDeliveryRow.value = row;
+  deliveryForm.value = {
+    shippingDate: getCurrentDate(),
+    shippingCarNumber: "",
+  };
+  deliveryFormVisible.value = true;
+};
+
+// 鎻愪氦鍙戣揣琛ㄥ崟
+const submitDelivery = () => {
+  proxy.$refs["deliveryFormRef"].validate((valid) => {
+    if (valid) {
+      addShippingInfo({
+        salesLedgerId: currentDeliveryRow.value.id,
+        shippingDate: deliveryForm.value.shippingDate,
+        shippingCarNumber: deliveryForm.value.shippingCarNumber,
+      })
+        .then(() => {
+          proxy.$modal.msgSuccess("鍙戣揣鎴愬姛");
+          closeDeliveryDia();
+          getList();
+        })
+        .catch(() => {
+          proxy.$modal.msgError("鍙戣揣澶辫触锛岃閲嶈瘯");
+        });
+    }
+  });
+};
+
+// 鍏抽棴鍙戣揣寮规
+const closeDeliveryDia = () => {
+  proxy.resetForm("deliveryFormRef");
+  deliveryFormVisible.value = false;
+  currentDeliveryRow.value = null;
+};
+
 onMounted(() => {
 	getList();
 });

--
Gitblit v1.9.3