From 636e2cae8b77fd62496ba4d2006965f6376668f2 Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期二, 18 十一月 2025 17:41:35 +0800
Subject: [PATCH] yys 1.销售、采购关于发票的改成不必填 2.回款类型字典改-下 3.销售台账、采购台账可能不开票直接回款 4.销售台账要直接查产品名字 5.指标维护-内控值为非必填 6.所有税率都自己填,有时候可能不含税

---
 src/views/procurementManagement/procurementLedger/index.vue |  115 ++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 69 insertions(+), 46 deletions(-)

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index 5165df7..86864d5 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -53,7 +53,7 @@
         show-summary
         :summary-method="summarizeMainTable"
         @expand-change="expandChange"
-        height="calc(100vh - 18.5em)"
+        height="calc(100vh - 19em)"
       >
         <el-table-column align="center" type="selection" width="55" />
         <el-table-column type="expand">
@@ -301,6 +301,14 @@
               />
             </el-form-item>
           </el-col>
+          <el-col :span="12">
+            <el-form-item label="鏄惁寮�绁�" prop="isInvoice">
+              <el-select v-model="form.isInvoice" placeholder="璇烽�夋嫨" clearable>
+                <el-option label="鏄�" value="1" />
+                <el-option label="鍚�" value="2" />
+              </el-select>
+            </el-form-item>
+          </el-col>
         </el-row>
         <el-row>
           <el-form-item label="浜у搧淇℃伅锛�" prop="entryDate">
@@ -474,22 +482,24 @@
           </el-col>
 					<el-col :span="12">
 						<el-form-item label="绋庣巼(%)锛�" prop="taxRate">
-							<el-select
-								v-model="productForm.taxRate"
-								placeholder="璇烽�夋嫨"
-								clearable
-								@change="mathNum"
-							>
-								<el-option label="1" value="1" />
-								<el-option label="6" value="6" />
-								<el-option label="13" value="13" />
-							</el-select>
+<!--							<el-select-->
+<!--								v-model="productForm.taxRate"-->
+<!--								placeholder="璇烽�夋嫨"-->
+<!--								clearable-->
+<!--								@change="mathNum"-->
+<!--							>-->
+<!--								<el-option label="1" value="1" />-->
+<!--								<el-option label="6" value="6" />-->
+<!--								<el-option label="13" value="13" />-->
+<!--							</el-select>-->
+              <el-input-number :step="1" :min="0" v-model="productForm.taxRate" style="width: 100%"
+                               placeholder="璇疯緭鍏�" clearable @change="calculateFromTaxRate" />
 						</el-form-item>
 					</el-col>
         </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 +542,7 @@
               label="涓嶅惈绋庢�讳环(鍏�)锛�"
               prop="taxExclusiveTotalPrice"
             >
-              <el-input 
+              <el-input
                 v-model="productForm.taxExclusiveTotalPrice"
                 @change="reverseMathNum('taxExclusiveTotalPrice')"
               />
@@ -572,7 +582,7 @@
         </div>
       </template>
     </el-dialog>
-    
+
     <!-- 浜岀淮鐮佹樉绀哄璇濇 -->
     <el-dialog
       v-model="qrCodeDialogVisible"
@@ -867,6 +877,7 @@
     supplierId: "",
     paymentMethod: "",
 		executionDate: "",
+    isInvoice: "",
   },
   rules: {
     purchaseContractNumber: [
@@ -876,6 +887,7 @@
     supplierId: [{ required: true, message: "璇疯緭鍏�", trigger: "blur" }],
 		entryDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
 		executionDate: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
+    isInvoice: [{ required: true, message: "璇烽�夋嫨", trigger: "change" }],
   },
 });
 const {  form, rules } = toRefs(data);
@@ -909,7 +921,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 +929,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 +1105,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 = [];
@@ -1152,10 +1164,15 @@
   });
 };
 const getModels = (value) => {
-  productForm.value.productCategory = findNodeById(productOptions.value, value);
-  modelList({ id: value }).then((res) => {
-    modelOptions.value = res;
-  });
+  if (value) {
+    productForm.value.productCategory = findNodeById(productOptions.value, value) || "";
+    modelList({ id: value }).then((res) => {
+      modelOptions.value = res;
+    });
+  } else {
+    productForm.value.productCategory = "";
+    modelOptions.value = [];
+  }
 };
 const getProductModel = (value) => {
   const index = modelOptions.value.findIndex((item) => item.id === value);
@@ -1170,12 +1187,12 @@
 const findNodeById = (nodes, productId) => {
   for (let i = 0; i < nodes.length; i++) {
     if (nodes[i].value === productId) {
-      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣
+      return nodes[i].label; // 鎵惧埌鑺傜偣锛岃繑鍥炶鑺傜偣鐨刲abel
     }
     if (nodes[i].children && nodes[i].children.length > 0) {
       const foundNode = findNodeById(nodes[i].children, productId);
       if (foundNode) {
-        return foundNode.label; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝杩斿洖璇ヨ妭鐐�
+        return foundNode; // 鍦ㄥ瓙鑺傜偣涓壘鍒帮紝鐩存帴杩斿洖锛堝凡缁忔槸label瀛楃涓诧級
       }
     }
   }
@@ -1325,10 +1342,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;
   }
@@ -1341,48 +1358,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);
     }
   }
@@ -1438,7 +1461,7 @@
     proxy.$modal.msgWarning("浜岀淮鐮佹湭鐢熸垚");
     return;
   }
-  
+
   const a = document.createElement('a');
   a.href = qrCodeUrl.value;
   a.download = `閲囪喘鍚堝悓鍙蜂簩缁寸爜_${new Date().getTime()}.png`;
@@ -1498,7 +1521,7 @@
 // 瑙f瀽鎵爜鍐呭锛堟ā鎷熻В鏋愪簩缁寸爜鏁版嵁锛�
 const parseScanContent = (content) => {
   if (!content) return;
-  
+
   // 妯℃嫙瑙f瀽浜岀淮鐮佸唴瀹癸紝杩欓噷鍙互鏍规嵁瀹為檯闇�姹傝皟鏁磋В鏋愰�昏緫
   // 鍋囪鎵爜鍐呭鏍煎紡涓猴細鍚堝悓鍙穦渚涘簲鍟唡椤圭洰|閲戦|浠樻鏂瑰紡
   const parts = content.split('|');
@@ -1533,11 +1556,11 @@
         remark: scanAddForm.scanRemark,
         type: 2
       };
-      
+
       // 妯℃嫙鏂板鎴愬姛
       proxy.$modal.msgSuccess("鎵爜鏂板鎴愬姛锛�");
       closeScanAddDialog();
-      
+
       // 鍙互閫夋嫨鏄惁鍒锋柊鍒楄〃
       // getList();
     }

--
Gitblit v1.9.3