From be65feb64970908c7f0a287faa7a53612686dd43 Mon Sep 17 00:00:00 2001
From: zouyu <2723363702@qq.com>
Date: 星期五, 14 十一月 2025 15:01:32 +0800
Subject: [PATCH] 销售台账、采购台账添加产品表单调整

---
 src/views/procurementManagement/procurementLedger/index.vue |   64 +++++++++++++++++--------------
 1 files changed, 35 insertions(+), 29 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 1204b4f..6c7a136 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -489,7 +489,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
                 v-model="productForm.taxInclusiveUnitPrice"
                 :precision="2"
@@ -532,7 +532,7 @@
               label="涓嶅惈绋庢�讳环(鍏�)锛�"
               prop="taxExclusiveTotalPrice"
             >
-              <el-input 
+              <el-input
                 v-model="productForm.taxExclusiveTotalPrice"
                 @change="reverseMathNum('taxExclusiveTotalPrice')"
               />
@@ -572,7 +572,7 @@
         </div>
       </template>
     </el-dialog>
-    
+
     <!-- 浜岀淮鐮佹樉绀哄璇濇 -->
     <el-dialog
       v-model="qrCodeDialogVisible"
@@ -909,7 +909,7 @@
     taxInclusiveUnitPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
-    taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    // taxRate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
 		warnNum: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
     taxInclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
@@ -917,7 +917,7 @@
     taxExclusiveTotalPrice: [
       { required: true, message: "璇疯緭鍏�", trigger: "blur" },
     ],
-    invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    // invoiceType: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
   },
 });
 const { productForm, productRules } = toRefs(productFormData);
@@ -1093,9 +1093,9 @@
 // 绉婚櫎鏂囦欢
 function handleRemove(file) {
   console.log("handleRemove", file.id);
-  if (file.size > 1024 * 1024 * 10) { 
+  if (file.size > 1024 * 1024 * 10) {
     // 浠呭墠绔竻鐞嗭紝涓嶈皟鐢ㄥ垹闄ゆ帴鍙e拰鎻愮ず
-    return; 
+    return;
   }
   if (operationType.value === "edit") {
     let ids = [];
@@ -1330,10 +1330,10 @@
   return `${year}-${month}-${day}`;
 }
 const mathNum = () => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
   if (!productForm.value.taxInclusiveUnitPrice) {
     return;
   }
@@ -1346,48 +1346,54 @@
       productForm.value.taxInclusiveUnitPrice,
       productForm.value.quantity
     );
-  if (productForm.value.taxRate) {
     // 涓嶅惈绋庢�讳环璁$畻
     productForm.value.taxExclusiveTotalPrice =
       proxy.calculateTaxExclusiveTotalPrice(
         productForm.value.taxInclusiveTotalPrice,
         productForm.value.taxRate
       );
-  }
+  // if (productForm.value.taxRate) {
+  //   // 涓嶅惈绋庢�讳环璁$畻
+  //   productForm.value.taxExclusiveTotalPrice =
+  //     proxy.calculateTaxExclusiveTotalPrice(
+  //       productForm.value.taxInclusiveTotalPrice,
+  //       productForm.value.taxRate
+  //     );
+  // }
 };
 const reverseMathNum = (field) => {
-	if (!productForm.value.taxRate) {
-		proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-		return;
-	}
-  const taxRate = Number(productForm.value.taxRate);
-  if (!taxRate) return;
+	// if (!productForm.value.taxRate) {
+	// 	proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
+	// 	return;
+	// }
+  const taxRate = productForm.value.taxRate?Number(productForm.value.taxRate):0;
+  // if (!taxRate) return;
   if (field === 'taxInclusiveTotalPrice') {
     // 宸茬煡鍚◣鎬讳环鍜屾暟閲忥紝鍙嶇畻鍚◣鍗曚环
     if (productForm.value.quantity) {
-      productForm.value.taxInclusiveUnitPrice = 
+      productForm.value.taxInclusiveUnitPrice =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
     }
     // 宸茬煡鍚◣鎬讳环鍜屽惈绋庡崟浠凤紝鍙嶇畻鏁伴噺
     else if (productForm.value.taxInclusiveUnitPrice) {
-      productForm.value.quantity = 
+      productForm.value.quantity =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
     }
     // 鍙嶇畻涓嶅惈绋庢�讳环
-    productForm.value.taxExclusiveTotalPrice = 
+    productForm.value.taxExclusiveTotalPrice =
       (Number(productForm.value.taxInclusiveTotalPrice) / (1 + taxRate / 100)).toFixed(2);
   } else if (field === 'taxExclusiveTotalPrice') {
     // 鍙嶇畻鍚◣鎬讳环
-    productForm.value.taxInclusiveTotalPrice = 
+    productForm.value.taxInclusiveTotalPrice =
       (Number(productForm.value.taxExclusiveTotalPrice) * (1 + taxRate / 100)).toFixed(2);
     // 宸茬煡鏁伴噺锛屽弽绠楀惈绋庡崟浠�
     if (productForm.value.quantity) {
-      productForm.value.taxInclusiveUnitPrice = 
+      productForm.value.taxInclusiveUnitPrice =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.quantity)).toFixed(2);
     }
     // 宸茬煡鍚◣鍗曚环锛屽弽绠楁暟閲�
     else if (productForm.value.taxInclusiveUnitPrice) {
-      productForm.value.quantity = 
+      productForm.value.quantity =
         (Number(productForm.value.taxInclusiveTotalPrice) / Number(productForm.value.taxInclusiveUnitPrice)).toFixed(2);
     }
   }
@@ -1443,7 +1449,7 @@
     proxy.$modal.msgWarning("浜岀淮鐮佹湭鐢熸垚");
     return;
   }
-  
+
   const a = document.createElement('a');
   a.href = qrCodeUrl.value;
   a.download = `閲囪喘鍚堝悓鍙蜂簩缁寸爜_${new Date().getTime()}.png`;
@@ -1503,7 +1509,7 @@
 // 瑙f瀽鎵爜鍐呭锛堟ā鎷熻В鏋愪簩缁寸爜鏁版嵁锛�
 const parseScanContent = (content) => {
   if (!content) return;
-  
+
   // 妯℃嫙瑙f瀽浜岀淮鐮佸唴瀹癸紝杩欓噷鍙互鏍规嵁瀹為檯闇�姹傝皟鏁磋В鏋愰�昏緫
   // 鍋囪鎵爜鍐呭鏍煎紡涓猴細鍚堝悓鍙穦渚涘簲鍟唡椤圭洰|閲戦|浠樻鏂瑰紡
   const parts = content.split('|');
@@ -1538,11 +1544,11 @@
         remark: scanAddForm.scanRemark,
         type: 2
       };
-      
+
       // 妯℃嫙鏂板鎴愬姛
       proxy.$modal.msgSuccess("鎵爜鏂板鎴愬姛锛�");
       closeScanAddDialog();
-      
+
       // 鍙互閫夋嫨鏄惁鍒锋柊鍒楄〃
       // getList();
     }

--
Gitblit v1.9.3