lxf 2 years ago
parent
commit
00bc9dcca7
1 changed files with 15 additions and 0 deletions
  1. 15 0
      src/components/process/Contract.vue

+ 15 - 0
src/components/process/Contract.vue

@@ -1062,6 +1062,21 @@ const handleSubmit = async () => {
       ElMessage("请添加至少一件商品");
       return false;
     }
+    if (formData.data.contractShipmentList && formData.data.contractShipmentList.length > 0) {
+      for (let i = 0; i < formData.data.contractProductList.length; i++) {
+        let data = formData.data.contractShipmentList.filter((item) => item.productId === formData.data.contractProductList[i].productId);
+        if (data && data.length > 0) {
+          let quantity = 0;
+          for (let j = 0; j < data.length; j++) {
+            quantity = parseFloat(Number(quantity) + Number(data[j].quantity));
+          }
+          if (quantity > formData.data.contractProductList[i].quantity) {
+            ElMessage("出货数量不能大于商品数量");
+            return false;
+          }
+        }
+      }
+    }
     return true;
   } else {
     setTimeout(() => {