From ae5cdfbb2fc7d8581b18360658f5837d690222e8 Mon Sep 17 00:00:00 2001
From: yuan <123@>
Date: 星期日, 21 六月 2026 13:28:39 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev_pro_河南鹤壁_泽淇实业' into dev_pro_河南鹤壁_泽淇实业

---
 src/views/salesManagement/salesLedger/index.vue |   66 +++++++++++++++++++++++++++++----
 1 files changed, 58 insertions(+), 8 deletions(-)

diff --git a/src/views/salesManagement/salesLedger/index.vue b/src/views/salesManagement/salesLedger/index.vue
index be61035..ff5d53f 100644
--- a/src/views/salesManagement/salesLedger/index.vue
+++ b/src/views/salesManagement/salesLedger/index.vue
@@ -123,9 +123,11 @@
               </el-table-column>
               <el-table-column label="蹇�掑叕鍙�"
                                prop="expressCompany"
+                               v-if="false"
                                show-overflow-tooltip />
               <el-table-column label="蹇�掑崟鍙�"
                                prop="expressNumber"
+                               v-if="false"
                                show-overflow-tooltip />
               <el-table-column label="鍙戣揣杞︾墝"
                                minWidth="100px"
@@ -725,12 +727,33 @@
           <el-col :span="12">
             <el-form-item label="鏄惁鐢熶骇锛�"
                           prop="isProduction">
-              <el-radio-group v-model="productForm.isProduction">
-                <el-radio label="鏄�"
-                          :value="true" />
-                <el-radio label="鍚�"
-                          :value="false" />
-              </el-radio-group>
+              <div style="display: flex; align-items: center; width: 100%;">
+                <el-radio-group v-model="productForm.isProduction">
+                  <el-radio label="鏄�"
+                            :value="true" />
+                  <el-radio label="鍚�"
+                            :value="false" />
+                </el-radio-group>
+                <div 
+                  v-if="currentStock !== null" 
+                  :style="{
+                    marginLeft: '20px',
+                    padding: '0 12px',
+                    height: '28px',
+                    lineHeight: '28px',
+                    borderRadius: '4px',
+                    fontSize: '13px',
+                    fontWeight: '500',
+                    display: 'inline-block',
+                    whiteSpace: 'nowrap',
+                    backgroundColor: (productForm.quantity || 0) > currentStock ? '#fff0f0' : '#f0f9eb',
+                    border: (productForm.quantity || 0) > currentStock ? '1px solid #ffcccc' : '1px solid #e1f3d8',
+                    color: (productForm.quantity || 0) > currentStock ? '#f56c6c' : '#67c23a'
+                  }"
+                >
+                  <span>褰撳墠搴撳瓨锛歿{ currentStock }} {{ productForm.unit || '' }}</span>
+                </div>
+              </div>
             </el-form-item>
           </el-col>
         </el-row>
@@ -917,6 +940,7 @@
                 <el-option label="璐ц溅"
                            value="璐ц溅" />
                 <el-option label="蹇��"
+                           v-if="false"
                            value="蹇��" />
               </el-select>
             </el-form-item>
@@ -939,7 +963,7 @@
             </el-form-item>
           </el-col>
           <el-col :span="24"
-                  v-else>
+                  v-else-if="false">
             <el-form-item label="蹇�掑叕鍙革細"
                           prop="expressCompany">
               <el-input v-model="deliveryForm.expressCompany"
@@ -949,7 +973,7 @@
           </el-col>
         </el-row>
         <el-row :gutter="30"
-                v-if="deliveryForm.type === '蹇��'">
+                v-if="false">
           <el-col :span="24">
             <el-form-item label="蹇�掑崟鍙凤細"
                           prop="expressNumber">
@@ -1194,6 +1218,27 @@
       item?.qualifiedQuantity ??
       item?.stockQuantity;
     return quantity ?? 0;
+  };
+  const currentStock = ref(null);
+  const fetchCurrentStock = async (productModelId) => {
+    if (!productModelId) {
+      currentStock.value = null;
+      return;
+    }
+    try {
+      const res = await getStockInventoryByModelId(productModelId);
+      const rawList = Array.isArray(res?.data)
+        ? res.data
+        : res?.data?.records || res?.data?.rows || [];
+      let total = 0;
+      rawList.forEach(item => {
+        total += Number(getDeliveryBatchQuantity(item) || 0);
+      });
+      currentStock.value = total;
+    } catch (e) {
+      console.error(e);
+      currentStock.value = 0;
+    }
   };
   const getCurrentDeliveryRowQuantity = () => {
     return Number(currentDeliveryRow.value?.noQuantity || 0);
@@ -1460,6 +1505,7 @@
   // 鑾峰彇tree瀛愭暟鎹�
   const getModels = value => {
     productForm.value.productCategory = findNodeById(productOptions.value, value);
+    currentStock.value = null;
     modelList({ id: value }).then(res => {
       modelOptions.value = res;
     });
@@ -1469,9 +1515,11 @@
     if (index !== -1) {
       productForm.value.specificationModel = modelOptions.value[index].model;
       productForm.value.unit = modelOptions.value[index].unit;
+      fetchCurrentStock(value);
     } else {
       productForm.value.specificationModel = null;
       productForm.value.unit = null;
+      currentStock.value = null;
     }
   };
   const findNodeById = (nodes, productId) => {
@@ -1795,6 +1843,7 @@
 
     productOperationType.value = type;
     productForm.value = {};
+    currentStock.value = null;
     if (type === "add") {
       productForm.value.isProduction = false;
     }
@@ -1821,6 +1870,7 @@
           );
           if (currentModel) {
             productForm.value.productModelId = currentModel.id;
+            fetchCurrentStock(currentModel.id);
           }
         }
       } catch (e) {

--
Gitblit v1.9.3