From 7ac33b1148d40cf056a42e77ca34b4885f621bae Mon Sep 17 00:00:00 2001
From: zhang_nuo <zhang_12370@163.com>
Date: 星期一, 21 九月 2026 19:06:20 +0800
Subject: [PATCH] refactor(财务管理-收款单): 统一分页事件参数命名

---
 src/views/salesManagement/salesLedger/index.vue |  121 +++++++++++++++++++++++++++++++---------
 1 files changed, 93 insertions(+), 28 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index fbb0da6..5328607 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -133,6 +133,21 @@
                   </el-tag>
                 </template>
               </el-table-column>
+              <el-table-column label="鍙戣揣绫诲瀷"
+                               width="100"
+                               align="center">
+                <template #default="scope">
+                  <el-tag v-if="getShippingTypeText(scope.row)"
+                          :type="getShippingTypeTag(scope.row)"
+                          size="small">
+                    {{ getShippingTypeText(scope.row) }}
+                  </el-tag>
+                  <el-tag v-else
+                          type="info"
+                          size="small">-
+                  </el-tag>
+                </template>
+              </el-table-column>
               <el-table-column label="蹇�掑叕鍙�"
                                prop="expressCompany"
                                show-overflow-tooltip />
@@ -941,6 +956,8 @@
                            value="璐ц溅" />
                 <el-option label="蹇��"
                            value="蹇��" />
+                <el-option label="鑷��"
+                           value="鑷��" />
               </el-select>
             </el-form-item>
           </el-col>
@@ -950,10 +967,16 @@
                         disabled />
             </el-form-item>
           </el-col>
+          <el-col :span="24">
+            <el-form-item label="宸查�夋嫨鍙戣揣鏁伴噺锛�">
+              <el-input :model-value="selectedDeliveryQuantity"
+                        disabled />
+            </el-form-item>
+          </el-col>
         </el-row>
-        <el-row :gutter="30">
-          <el-col :span="24"
-                  v-if="deliveryForm.type === '璐ц溅'">
+        <el-row :gutter="30"
+                v-if="deliveryForm.type === '璐ц溅'">
+          <el-col :span="24">
             <el-form-item label="鍙戣揣杞︾墝鍙凤細"
                           prop="shippingCarNumber">
               <el-input v-model="deliveryForm.shippingCarNumber"
@@ -961,8 +984,10 @@
                         clearable />
             </el-form-item>
           </el-col>
-          <el-col :span="24"
-                  v-else>
+        </el-row>
+        <el-row :gutter="30"
+                v-else-if="deliveryForm.type === '蹇��'">
+          <el-col :span="24">
             <el-form-item label="蹇�掑叕鍙革細"
                           prop="expressCompany">
               <el-input v-model="deliveryForm.expressCompany"
@@ -1088,6 +1113,7 @@
     tableAmountFormatter,
     formatDecimal,
     buildAmountSummaryFormat,
+    roundAmount,
   } from "@/utils/numberFormat";
   import ImageUpload from "@/components/AttachmentUpload/image/index.vue";
   import ProductSelectDialog from "@/views/basicData/product/ProductSelectDialog.vue";
@@ -1250,7 +1276,7 @@
       rawList.forEach(item => {
         total += Number(getDeliveryBatchQuantity(item) || 0);
       });
-      currentStock.value = total;
+      currentStock.value = roundAmount(total);
     } catch (e) {
       console.error(e);
       currentStock.value = 0;
@@ -1259,35 +1285,45 @@
   const getCurrentDeliveryRowQuantity = () => {
     return Number(currentDeliveryRow.value?.noQuantity || 0);
   };
+  const selectedDeliveryQuantity = computed(() => {
+    return roundAmount(
+      (deliveryForm.value.batchNoList || []).reduce(
+        (sum, item) => sum + Number(item?.deliveryQuantity || 0),
+        0
+      )
+    );
+  });
   const getDeliveryBatchDeliveryMax = row => {
     const productQuantity = getCurrentDeliveryRowQuantity();
     const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
-    const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
-      (sum, item) => {
-        if (item?.id === row?.id) return sum;
-        return sum + Number(item?.deliveryQuantity || 0);
-      },
-      0
+    const otherBatchTotal = roundAmount(
+      (deliveryForm.value.batchNoList || []).reduce(
+        (sum, item) => {
+          if (item?.id === row?.id) return sum;
+          return sum + Number(item?.deliveryQuantity || 0);
+        },
+        0
+      )
     );
-    const remainingProductQuantity = Math.max(
-      0,
-      productQuantity - otherBatchTotal
+    const remainingProductQuantity = roundAmount(
+      Math.max(0, productQuantity - otherBatchTotal)
     );
     return Math.max(0, Math.min(batchQuantity, remainingProductQuantity));
   };
   const handleDeliveryBatchQuantityChange = row => {
     const productQuantity = getCurrentDeliveryRowQuantity();
     const batchQuantity = Number(getDeliveryBatchQuantity(row) || 0);
-    const otherBatchTotal = (deliveryForm.value.batchNoList || []).reduce(
-      (sum, item) => {
-        if (item?.id === row?.id) return sum;
-        return sum + Number(item?.deliveryQuantity || 0);
-      },
-      0
+    const otherBatchTotal = roundAmount(
+      (deliveryForm.value.batchNoList || []).reduce(
+        (sum, item) => {
+          if (item?.id === row?.id) return sum;
+          return sum + Number(item?.deliveryQuantity || 0);
+        },
+        0
+      )
     );
-    const remainingProductQuantity = Math.max(
-      0,
-      productQuantity - otherBatchTotal
+    const remainingProductQuantity = roundAmount(
+      Math.max(0, productQuantity - otherBatchTotal)
     );
     const currentValue = Number(row?.deliveryQuantity || 0);
 
@@ -1341,7 +1377,7 @@
       shippingCarNumber: "",
       expressCompany: "",
       expressNumber: "",
-      type: "璐ц溅", // 璐ц溅, 蹇��
+      type: "璐ц溅", // 璐ц溅, 蹇��, 鑷��
     },
     deliveryRules: {
       shippingCarNumber: [
@@ -2426,6 +2462,29 @@
   };
 
   /**
+   * 鑾峰彇鍙戣揣绫诲瀷鏂囨湰锛堣揣杞�/蹇��/鑷�侊級
+   * 瀛愯〃琛屾湭杩斿洖鍙戣揣绫诲瀷瀛楁锛屼緷鎹簰鏂ョ殑鍙戣揣淇℃伅鎺ㄦ柇锛�
+   * 鏈夎溅鐗屼负璐ц溅锛屾湁蹇�掑叕鍙�/鍗曞彿涓哄揩閫掞紝宸插彂璐т絾涓よ�呯殕鏃犱负鑷��
+   */
+  const getShippingTypeText = row => {
+    if (!row) return "";
+    if (row.shippingCarNumber) return "璐ц溅";
+    if (row.expressCompany || row.expressNumber) return "蹇��";
+    if (row.shippingDate) return "鑷��";
+    return "";
+  };
+
+  const getShippingTypeTag = row => {
+    const type = getShippingTypeText(row);
+    const typeTagMap = {
+      璐ц溅: "warning",
+      蹇��: "primary",
+      鑷��: "success",
+    };
+    return typeTagMap[type] || "info";
+  };
+
+  /**
    * 鍒ゆ柇鏄惁鍙互鍙戣揣
    * 鍙湁鍦ㄤ骇鍝佺姸鎬佹槸鍏呰冻锛屽彂璐х姸鎬佹槸寰呭彂璐у拰瀹℃牳鎷掔粷鐨勬椂鍊欐墠鍙互鍙戣揣
    * @param row 琛屾暟鎹�
@@ -2521,9 +2580,11 @@
           proxy.$modal.msgWarning("璇疯嚦灏戝~鍐欎竴涓壒鍙风殑鍙戣揣鏁伴噺");
           return;
         }
-        const totalDeliveryQuantity = selectedBatchRows.reduce(
-          (sum, item) => sum + Number(item.deliveryQuantity || 0),
-          0
+        const totalDeliveryQuantity = roundAmount(
+          selectedBatchRows.reduce(
+            (sum, item) => sum + Number(item.deliveryQuantity || 0),
+            0
+          )
         );
         const currentRowNoQuantity = Number(
           currentDeliveryRow.value?.noQuantity || 0
@@ -2605,8 +2666,12 @@
     if (val === "璐ц溅") {
       deliveryForm.value.expressCompany = "";
       deliveryForm.value.expressNumber = "";
+    } else if (val === "蹇��") {
+      deliveryForm.value.shippingCarNumber = "";
     } else {
       deliveryForm.value.shippingCarNumber = "";
+      deliveryForm.value.expressCompany = "";
+      deliveryForm.value.expressNumber = "";
     }
   };
 

--
Gitblit v1.9.3