2 Commits 5e0aac8033 ... 3d646f676c

Author SHA1 Message Date
  liyuan 3d646f676c Merge remote-tracking branch 'origin/master' 2 weeks ago
  liyuan 88ee088b99 库存刷新采购价格更改问题 2 weeks ago
1 changed files with 25 additions and 4 deletions
  1. 25 4
      src/views/businessManagement/salesOrder/detailsPageEdit.vue

+ 25 - 4
src/views/businessManagement/salesOrder/detailsPageEdit.vue

@@ -4100,13 +4100,28 @@ export default {
         }
       });
     },
-    //修改提交触发
+      validateInventoryAndPrice() {
+          const data = this.goodsActives === "gift" ? this.contactsData : this.goodsShowData;
+          for (let i = 0; i < data.length; i++) {
+              const item = data[i];
+              if (Number(item.orderQuantity) > Number(item.storageQuantity)) {
+                  return this.$message.error(`商品信息第${i + 1}行订货数量大于库存数量`);
+              }
+              if (!Number(item.purchaseAmount)) {
+                  return this.$message.error(`商品信息第${i + 1}行采购价格不能为空`);
+              }
+              if (Number(item.purchaseAmount) === 0) {
+                  return this.$message.error(`商品信息第${i + 1}行采购价格不能为0`);
+              }
+          }
+      },
+      //修改提交触发
     async editCustomer(isBack = false, type, other) {
       this.$refs["form"].validate(async valid => {
         if (valid) {
           console.log(this.contactsData);
-          const length = this.goodsActives === "gift" ? this.contactsData.length : this.goodsShowData.length;
           const length1 = this.goodsActives === "goods" ? this.giftData : this.goodsShowData;
+            const length = this.goodsActives === "gift" ? this.contactsData.length : this.goodsShowData.length;
           for (let i = 0; i < length; i++) {
             const data = this.goodsActives === "gift" ? this.contactsData : this.goodsShowData;
             if (Number(data[i].orderQuantity) > Number(data[i].storageQuantity)) {
@@ -4205,7 +4220,6 @@ export default {
           //     console.log(itm.storageId);
           //   })
           console.log(this.form.contactsForm);
-          //todo
           /*  this.form.orderItemsList.forEach((item) => {
               item.storageQuantity = item.storageQuantity.surplusRouteQuantity;
               item.storageId = this.contactsForm.storageId
@@ -4794,6 +4808,13 @@ export default {
       if (!this.form.id) {
         return this.editCustomer(false, "", "check");
       }
+/*      this.validateInventoryAndPrice()
+        let goodsData = this.form.orderItemsList.filter(item => item.goodType == 0);
+        for (let item in goodsData) {
+            if (Number(goodsData[item].orderQuantity) > Number(goodsData[item].storageQuantity)) {
+                return this.$message.error("商品信息第" + (parseInt(item) + 1) + "行订货数量不能超过库存");
+            }
+        }*/
       const giftList = this.goodsActives == "gift" ? this.goodsShowData : this.giftData;
       if (this.verification()) {
         this.$confirm(giftList.length == 0 ? "此单没有赠品,确定提交此次审批吗?" : "您确定提交此次申请吗?", {
@@ -5014,7 +5035,7 @@ export default {
             // 获取供应商名称
             item.corpId = res.data.data[0].corpId;
             item.corpName = res.data.data[0].corpName;
-            if (res.data.data[0].tenantId !== "681169") {
+            if (res.data.data[0].tenantId !== "681169" && res.data.data[0].tenantId !== "941197") {
               item.purchaseAmount = res.data.data[0].stockPrice;
             }
           }