From ac00bb7b8eae1bf6aabb7f1ae67c2e5aa5b8ae90 Mon Sep 17 00:00:00 2001
From: gaoluyang <2820782392@qq.com>
Date: 星期五, 12 六月 2026 10:21:12 +0800
Subject: [PATCH] 宝东 1.样式问题

---
 src/views/salesManagement/salesLedger/index.vue |   97 ++++++++++++++++++++++++++++++++----------------
 1 files changed, 65 insertions(+), 32 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index 2784f80..37eb815 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -160,6 +160,8 @@
                                prop="quantity" />
               <el-table-column label="姣忎欢鏁伴噺"
                                prop="singleQuantity" />
+              <el-table-column label="鎬绘暟"
+                               prop="totalQuantity" />
               <el-table-column label="寰呭彂璐ф暟閲�"
                                prop="noQuantity" />
               <el-table-column label="绋庣巼(%)"
@@ -452,6 +454,8 @@
                            prop="quantity" />
           <el-table-column label="姣忎欢鏁伴噺"
                            prop="singleQuantity" />
+          <el-table-column label="鎬绘暟"
+                           prop="totalQuantity" />
           <el-table-column label="绋庣巼(%)"
                            prop="taxRate" />
           <el-table-column label="鍚◣鍗曚环(鍏�)"
@@ -700,6 +704,15 @@
                                style="width: 100%" />
             </el-form-item>
           </el-col>
+          <el-col :span="12">
+            <el-form-item label="鎬绘暟锛�"
+                          prop="totalQuantity">
+              <el-input v-model="productForm.totalQuantity"
+                        placeholder="鑷姩璁$畻"
+                        disabled
+                        style="width: 100%" />
+            </el-form-item>
+          </el-col>
         </el-row>
         <el-row :gutter="30">
           <el-col :span="12">
@@ -912,7 +925,7 @@
     <!-- 鍙戣揣寮规 -->
     <el-dialog v-model="deliveryFormVisible"
                title="鍙戣揣淇℃伅"
-               width="40%"
+               width="70%"
                @close="closeDeliveryDia">
       <el-form :model="deliveryForm"
                label-width="120px"
@@ -1137,6 +1150,7 @@
       unit: "",
       quantity: "",
       singleQuantity: 1,
+      totalQuantity: "",
       taxInclusiveUnitPrice: "",
       taxRate: "",
       taxInclusiveTotalPrice: "",
@@ -1728,6 +1742,7 @@
     productData.value = products.map(p => {
       const quantity = Number(p.quantity ?? 0) || 0;
       const unitPrice = Number(p.unitPrice ?? 0) || 0;
+      const singleQuantity = 1;
       const taxRate = "13"; // 榛樿 13%锛屼究浜庣洿鎺ユ彁浜わ紙濡傞渶鍙湪浜у搧涓嚜琛屼慨鏀癸級
       const taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
       const taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(
@@ -1740,6 +1755,8 @@
         specificationModel: p.specification || "",
         unit: p.unit || "",
         quantity: quantity,
+        singleQuantity: singleQuantity,
+        totalQuantity: String(quantity * singleQuantity),
         taxRate: taxRate,
         taxInclusiveUnitPrice: unitPrice.toFixed(2),
         taxInclusiveTotalPrice: taxInclusiveTotalPrice,
@@ -1807,6 +1824,12 @@
     if (type === "edit") {
       productForm.value = { ...row };
       productIndex.value = index;
+      // 濡傛灉娌℃湁 totalQuantity锛岃嚜鍔ㄨ绠楋細鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+      if (!productForm.value.totalQuantity && productForm.value.quantity) {
+        const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+        const quantity = parseFloat(productForm.value.quantity);
+        productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
+      }
       // 缂栬緫鏃舵牴鎹骇鍝佸ぇ绫诲悕绉板弽鏌� tree 鑺傜偣 id锛屽苟鍔犺浇瑙勬牸鍨嬪彿鍒楄〃
       try {
         const options =
@@ -2469,7 +2492,6 @@
 
     const totalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice);
     const quantity = parseFloat(productForm.value.quantity);
-    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
 
     if (!totalPrice || !quantity || quantity <= 0) {
       return;
@@ -2477,8 +2499,8 @@
 
     isCalculating.value = true;
 
-    // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / (鏁伴噺 * 姣忎欢鏁伴噺)
-    productForm.value.taxInclusiveUnitPrice = (totalPrice / (quantity * singleQuantity)).toFixed(2);
+    // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
+    productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
     if (productForm.value.taxRate) {
@@ -2488,6 +2510,10 @@
           productForm.value.taxRate
         );
     }
+
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
 
     isCalculating.value = false;
   };
@@ -2505,7 +2531,6 @@
     );
     const quantity = parseFloat(productForm.value.quantity);
     const taxRate = parseFloat(productForm.value.taxRate);
-    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
 
     if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) {
       return;
@@ -2518,10 +2543,14 @@
     const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal);
     productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2);
 
-    // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / (鏁伴噺 * 姣忎欢鏁伴噺)
+    // 璁$畻鍚◣鍗曚环 = 鍚◣鎬讳环 / 鏁伴噺
     productForm.value.taxInclusiveUnitPrice = (
-      inclusiveTotalPrice / (quantity * singleQuantity)
+      inclusiveTotalPrice / quantity
     ).toFixed(2);
+
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
 
     isCalculating.value = false;
   };
@@ -2536,7 +2565,6 @@
 
     const quantity = parseFloat(productForm.value.quantity);
     const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
 
     if (!quantity || quantity <= 0 || !unitPrice) {
       return;
@@ -2544,8 +2572,8 @@
 
     isCalculating.value = true;
 
-    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺 * 姣忎欢鏁伴噺
-    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity * singleQuantity).toFixed(2);
+    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
+    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
     if (productForm.value.taxRate) {
@@ -2555,6 +2583,10 @@
           productForm.value.taxRate
         );
     }
+
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
 
     isCalculating.value = false;
   };
@@ -2569,7 +2601,6 @@
 
     const quantity = parseFloat(productForm.value.quantity);
     const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
 
     if (!quantity || quantity <= 0 || !unitPrice) {
       return;
@@ -2577,8 +2608,8 @@
 
     isCalculating.value = true;
 
-    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺 * 姣忎欢鏁伴噺
-    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity * singleQuantity).toFixed(2);
+    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺
+    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2);
 
     // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
     if (productForm.value.taxRate) {
@@ -2592,35 +2623,21 @@
     isCalculating.value = false;
   };
 
-  // 鏍规嵁姣忎欢鏁伴噺鍙樺寲璁$畻鎬讳环
+  // 鏍规嵁姣忎欢鏁伴噺鍙樺寲璁$畻鎬绘暟
   const calculateFromSingleQuantity = () => {
-    if (!productForm.value.taxRate) {
-      proxy.$modal.msgWarning("璇峰厛閫夋嫨绋庣巼");
-      return;
-    }
     if (isCalculating.value) return;
 
     const quantity = parseFloat(productForm.value.quantity);
-    const unitPrice = parseFloat(productForm.value.taxInclusiveUnitPrice);
-    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
 
-    if (!quantity || quantity <= 0 || !unitPrice) {
+    if (!quantity || quantity <= 0) {
       return;
     }
 
     isCalculating.value = true;
 
-    // 璁$畻鍚◣鎬讳环 = 鍗曚环 * 鏁伴噺 * 姣忎欢鏁伴噺
-    productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity * singleQuantity).toFixed(2);
-
-    // 濡傛灉鏈夌◣鐜囷紝璁$畻涓嶅惈绋庢�讳环
-    if (productForm.value.taxRate) {
-      productForm.value.taxExclusiveTotalPrice =
-        proxy.calculateTaxExclusiveTotalPrice(
-          productForm.value.taxInclusiveTotalPrice,
-          productForm.value.taxRate
-        );
-    }
+    // 璁$畻鎬绘暟 = 姣忎欢鏁伴噺 * 鏁伴噺
+    const singleQuantity = parseInt(productForm.value.singleQuantity) || 1;
+    productForm.value.totalQuantity = (quantity * singleQuantity).toFixed(0);
 
     isCalculating.value = false;
   };
@@ -2795,6 +2812,22 @@
     const batchNoList = await getDeliveryBatchNoList(
       row.productModelId || row.modelId
     );
+    
+    // 鑷姩鍒嗛厤鍙戣揣鏁伴噺锛氭寜鐓у緟鍙戣揣鏁伴噺锛屼粠涓婂埌涓嬩緷娆″垎閰�
+    const noQuantity = Number(row?.noQuantity || 0);
+    let remainingQuantity = noQuantity;
+    batchNoList.forEach(item => {
+      if (remainingQuantity <= 0) {
+        item.deliveryQuantity = 0;
+        return;
+      }
+      const batchStockQuantity = getDeliveryBatchQuantity(item);
+      // 褰撳墠鎵规鍙垎閰嶇殑鏁伴噺锛氬彇鍓╀綑寰呭彂璐ф暟閲忓拰搴撳瓨鏁伴噺鐨勮緝灏忓��
+      const assignQuantity = Math.min(remainingQuantity, batchStockQuantity);
+      item.deliveryQuantity = assignQuantity;
+      remainingQuantity -= assignQuantity;
+    });
+    
     deliveryForm.value = {
       shippingCarNumber: "",
       expressCompany: "",

--
Gitblit v1.9.3