From 9d2f568a86ab9ab212965de5c18681cc2bd21bb7 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 08 六月 2026 15:39:27 +0800
Subject: [PATCH] feat(采购管理,审批管理): 新增采购运费功能并完善审批详情展示

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

diff --git a/src/views/procurementManagement/procurementLedger/index.vue b/src/views/procurementManagement/procurementLedger/index.vue
index c560cb7..cab2a26 100644
--- a/src/views/procurementManagement/procurementLedger/index.vue
+++ b/src/views/procurementManagement/procurementLedger/index.vue
@@ -125,6 +125,12 @@
                                prop="availableQuality" />
               <el-table-column label="閫�璐ф暟閲�"
                                prop="returnQuality" />
+              <el-table-column label="杩愯垂鍗曚环(鍏�)"
+                               prop="freightUnitPrice"
+                               :formatter="formattedNumber" />
+              <el-table-column label="鎬昏繍璐�(鍏�)"
+                               prop="totalFreight"
+                               :formatter="formattedNumber" />
               <el-table-column label="绋庣巼(%)"
                                prop="taxRate" />
               <el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -188,6 +194,14 @@
         <el-table-column label="浠樻鏂瑰紡"
                          width="100"
                          prop="paymentMethod"
+                         show-overflow-tooltip />
+        <el-table-column label="杞︾墝鍙�"
+                         prop="carPlateNumber"
+                         width="140"
+                         show-overflow-tooltip />
+        <el-table-column label="杩愯緭鍗曚綅/涓汉"
+                         prop="transportUnitOrPerson"
+                         width="180"
                          show-overflow-tooltip />
         <el-table-column label="鍚堝悓閲戦(鍏�)"
                          prop="contractAmount"
@@ -319,6 +333,24 @@
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
+            <el-form-item label="杞︾墝鍙凤細"
+                          prop="carPlateNumber">
+              <el-input v-model="form.carPlateNumber"
+                        placeholder="璇疯緭鍏�"
+                        clearable />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="杩愯緭鍗曚綅/涓汉锛�"
+                          prop="transportUnitOrPerson">
+              <el-input v-model="form.transportUnitOrPerson"
+                        placeholder="璇疯緭鍏�"
+                        clearable />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
             <el-form-item label="褰曞叆浜猴細"
                           prop="recorderId">
               <el-select v-model="form.recorderId"
@@ -418,6 +450,14 @@
           <el-table-column label="鏁伴噺"
                            prop="quantity"
                            width="70" />
+          <el-table-column label="杩愯垂鍗曚环(鍏�)"
+                           prop="freightUnitPrice"
+                           :formatter="formattedNumber"
+                           width="150" />
+          <el-table-column label="鎬昏繍璐�(鍏�)"
+                           prop="totalFreight"
+                           :formatter="formattedNumber"
+                           width="150" />
           <el-table-column label="搴撳瓨棰勮鏁伴噺"
                            prop="warnNum"
                            width="120"
@@ -616,7 +656,32 @@
                                style="width: 100%"
                                v-model="productForm.quantity"
                                placeholder="璇疯緭鍏�"
-                               @change="mathNum" />
+                               @change="handleQuantityChange" />
+            </el-form-item>
+          </el-col>
+        </el-row>
+        <el-row :gutter="30">
+          <el-col :span="12">
+            <el-form-item label="杩愯垂鍗曚环(鍏�)锛�"
+                          prop="freightUnitPrice">
+              <el-input-number v-model="productForm.freightUnitPrice"
+                               :precision="2"
+                               :step="0.1"
+                               :min="0"
+                               clearable
+                               style="width: 100%"
+                               @change="handleFreightUnitPriceChange" />
+            </el-form-item>
+          </el-col>
+          <el-col :span="12">
+            <el-form-item label="鎬昏繍璐�(鍏�)锛�"
+                          prop="totalFreight">
+              <el-input-number v-model="productForm.totalFreight"
+                               :precision="2"
+                               :step="0.1"
+                               :min="0"
+                               clearable
+                               style="width: 100%" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -1013,6 +1078,8 @@
       supplierName: "",
       supplierId: "",
       paymentMethod: "",
+      carPlateNumber: "",
+      transportUnitOrPerson: "",
       executionDate: "",
       isChecked: false,
     },
@@ -1053,6 +1120,8 @@
       specificationModel: "",
       unit: "",
       quantity: "",
+      freightUnitPrice: "",
+      totalFreight: "",
       taxInclusiveUnitPrice: "",
       taxRate: "",
       taxInclusiveTotalPrice: "",
@@ -1170,7 +1239,12 @@
   };
 
   const formattedNumber = (row, column, cellValue) => {
-    return parseFloat(cellValue).toFixed(2);
+    if (cellValue === undefined || cellValue === null || cellValue === "") {
+      return "0.00";
+    }
+    const num = Number(cellValue);
+    if (Number.isNaN(num)) return "0.00";
+    return num.toFixed(2);
   };
   // 鏌ヨ鍒楄〃
   /** 鎼滅储鎸夐挳鎿嶄綔 */
@@ -1281,6 +1355,8 @@
     return proxy.summarizeTable(
       param,
       [
+        "freightUnitPrice",
+        "totalFreight",
         "taxInclusiveUnitPrice",
         "taxInclusiveTotalPrice",
         "taxExclusiveTotalPrice",
@@ -1463,6 +1539,7 @@
       "taxInclusiveUnitPrice",
       "taxInclusiveTotalPrice",
       "taxExclusiveTotalPrice",
+      "totalFreight",
     ]);
   };
   // 鎵撳紑寮规
@@ -1669,6 +1746,12 @@
     if (type === "edit") {
       // 澶嶅埗琛屾暟鎹�
       productForm.value = { ...row };
+      if (productForm.value.freightUnitPrice === undefined) {
+        productForm.value.freightUnitPrice = "";
+      }
+      if (productForm.value.totalFreight === undefined) {
+        productForm.value.totalFreight = "";
+      }
 
       // 濡傛灉鏄粠妯℃澘鍔犺浇鐨勬暟鎹紝鍙兘娌℃湁 productId 鍜� productModelId
       // 闇�瑕佹牴鎹� productCategory 鍜� specificationModel 鏉ユ煡鎵惧搴旂殑 ID
@@ -1733,6 +1816,34 @@
       // 鏈�鍚庡啀绛夊緟涓�娆� DOM 鏇存柊锛岀‘淇濇墍鏈夋暟鎹兘宸茶缃�
       await nextTick();
     }
+    computeTotalFreight();
+  };
+
+  const computeTotalFreight = () => {
+    const hasQuantity =
+      productForm.value.quantity !== "" &&
+      productForm.value.quantity !== null &&
+      productForm.value.quantity !== undefined;
+    const hasFreightUnitPrice =
+      productForm.value.freightUnitPrice !== "" &&
+      productForm.value.freightUnitPrice !== null &&
+      productForm.value.freightUnitPrice !== undefined;
+    if (!hasQuantity || !hasFreightUnitPrice) return;
+
+    const quantity = Number(productForm.value.quantity);
+    const freightUnitPrice = Number(productForm.value.freightUnitPrice);
+    if (!Number.isFinite(quantity) || !Number.isFinite(freightUnitPrice)) return;
+
+    productForm.value.totalFreight = (quantity * freightUnitPrice).toFixed(2);
+  };
+
+  const handleQuantityChange = () => {
+    mathNum();
+    computeTotalFreight();
+  };
+
+  const handleFreightUnitPriceChange = () => {
+    computeTotalFreight();
   };
   const getProductOptions = () => {
     return productTreeList().then(res => {

--
Gitblit v1.9.3