Browse Source

bug修改

cz 2 years ago
parent
commit
d64ae4432f

+ 1 - 1
src/api/purchase-management/purchase/index.js

@@ -58,7 +58,7 @@ export function logisticsSelectData(data = {}) {
 // 根据供应商ID获取价格
 export function getSupplierPrice(data = {}) {
   return request({
-    url: '/api/victoriatourist/supplierPrice/list',
+    url: '/api/victoriatourist/supplierPrice/getSupplierPriceByProductIds',
     method: 'post',
     data: data,
   })

+ 14 - 0
src/views/product-material/product/index.vue

@@ -56,6 +56,7 @@
               prop="deptName"
               width="120"
             />
+            <!-- :formatter="(row) => handleDeptName(row.deptId, deptList)" -->
             <el-table-column
               label="生命周期"
               align="left"
@@ -470,6 +471,18 @@ export default {
     this.getList();
   },
   methods: {
+    handleDeptName(id, list) {
+      for (let i = 0; i < list.length; i++) {
+        const x = list[i];
+        if (x.id === id) {
+          return x.deptName;
+        } else {
+          if (x.children && x.children.length > 0) {
+            this.handleDeptName(id, x.children);
+          }
+        }
+      }
+    },
     popoverDeptHide(data) {
       console.log(data);
       // 部门数据处理
@@ -701,6 +714,7 @@ export default {
   }
   .bottom {
     flex: 1;
+    overflow-y: auto;
   }
 }
 </style>

+ 7 - 0
src/views/product-material/spu/addSpu.vue

@@ -132,6 +132,13 @@ export default {
       this.$emit("cancel");
     },
     handleSelect(row) {
+      const flag = this.form.productIdList.some((x) => {
+        return x.productId === row.id;
+      });
+      if (flag) {
+        return this.msgInfo("该物品已选择!");
+      }
+
       this.form.productIdList.push({
         productId: row.id,
         productCode: row.code,

+ 3 - 3
src/views/product-material/supply/index.vue

@@ -360,7 +360,7 @@ export default {
         cityId: "",
         detailedAddress: "",
         accountPeriod: "0",
-        returnPeriod: "5",
+        returnPeriod: "0",
         accountName: "",
         bankAccount: "",
         bankOfDeposit: "",
@@ -432,7 +432,7 @@ export default {
         cityId: "",
         detailedAddress: "",
         accountPeriod: "0",
-        returnPeriod: "5",
+        returnPeriod: "0",
         accountName: "",
         bankAccount: "",
         bankOfDeposit: "",
@@ -460,7 +460,7 @@ export default {
         cityId: "",
         detailedAddress: "",
         accountPeriod: "0",
-        returnPeriod: "5",
+        returnPeriod: "0",
         accountName: "",
         bankAccount: "",
         bankOfDeposit: "",

+ 22 - 4
src/views/purchase-management/purchase/addPurchase.vue

@@ -61,8 +61,7 @@
               :formatter="(row) => dictDataEcho(row.goodsType, productTypeList)"
             >
             </el-table-column>
-            <el-table-column label="单位12312312" prop="goodsUnit">
-            </el-table-column>
+            <el-table-column label="单位" prop="goodsUnit"> </el-table-column>
 
             <el-table-column label="采购数量" prop="quantity">
             </el-table-column>
@@ -113,7 +112,7 @@
 
 <script>
 import labelTitle from "@/components/label-title/index.vue";
-import * as API from "@/api/purchase-management/purchase/index.js";
+import { getSupplierPrice } from "@/api/purchase-management/purchase/index.js";
 import { supplyPriceList } from "@/api/product-material/supply/priceMaintenance.js";
 
 import { getToken } from "@/util/auth";
@@ -175,6 +174,7 @@ export default {
         materialType: "",
       },
       tableList: [],
+      priceData: {},
     };
   },
   created() {
@@ -205,7 +205,25 @@ export default {
       });
     },
     handleChangeSupply(val) {
-      // const current = this.tableList.find((x) => x.supplierId === val);
+      const productIdList = this.form.goodsList.map((x) => {
+        return x.goodsId;
+      });
+      getSupplierPrice({ supplierId: val, productIdList }).then((res) => {
+        const priceData = res.data.data;
+        for (let i = 0; i < this.form.goodsList.length; i++) {
+          const x = this.form.goodsList[i];
+          if (Object.keys(priceData).length > 0) {
+            for (const key in priceData) {
+              if (x.goodsId === key) {
+                this.form.goodsList[i].unitPrice = priceData[key];
+              }
+            }
+          } else {
+            this.form.goodsList[i].unitPrice = "";
+            return;
+          }
+        }
+      });
     },
   },
 };

+ 12 - 27
src/views/purchase-management/purchase/index.vue

@@ -195,33 +195,18 @@ export default {
         quantity: x.quantity,
       }));
       this.form.goodsList = goodsList;
-      if (!this.form.id) {
-        API.sendPurchase(this.form).then(
-          () => {
-            this.msgSuccess("添加成功");
-            this.$refs.sendSubscribe.loading = false;
-            this.open = false;
-            this.getList();
-          },
-          (err) => {
-            console.log("sendPurchase: " + err);
-            this.$refs.sendSubscribe.loading = false;
-          }
-        );
-      } else {
-        API.purchaseEdit(this.form).then(
-          () => {
-            this.msgSuccess("编辑成功");
-            this.open = false;
-            this.$refs.sendSubscribe.loading = false;
-            this.getList();
-          },
-          (err) => {
-            console.log("purchaseEdit: " + err);
-            this.$refs.sendSubscribe.loading = false;
-          }
-        );
-      }
+      API.sendPurchase(this.form).then(
+        () => {
+          this.msgSuccess("发起成功");
+          this.$refs.sendSubscribe.loading = false;
+          this.open = false;
+          this.getList();
+        },
+        (err) => {
+          console.log("sendPurchase: " + err);
+          this.$refs.sendSubscribe.loading = false;
+        }
+      );
     },
 
     handleDelete(row) {