Эх сурвалжийг харах

编辑SKU,选择BOM后根据规格尺寸替换包材配件

lxf 1 жил өмнө
parent
commit
9d1299dd7b

+ 14 - 0
src/components/makeGroupProduct/index.vue

@@ -632,6 +632,20 @@ const selectBOM = (item) => {
     formData.data.skuSpecList[rowIndex.value].netWeight = item.netWeight;
     ElMessage({ message: "选择完成", type: "success" });
     openBOM.value = false;
+    proxy.post("/skuDefaultPackageSpec/getPackList", { skuId: formData.data.id, spec: item.length + "*" + item.width + "*" + item.height }).then((res) => {
+      if (res && res.length > 0) {
+        formData.data.skuSpecList[rowIndex.value].packagingMaterialList = res.map((val) => {
+          return {
+            bomSpecId: val.bomSpecId,
+            quantity: 1,
+            name: val.bomSpecName,
+          };
+        });
+      } else {
+        formData.data.skuSpecList[rowIndex.value].packagingMaterialList = [];
+      }
+      ElMessage({ message: "根据规格尺寸替换包材配件完成", type: "success" });
+    });
   }
 };
 const clickRemoveBOM = (index) => {

+ 14 - 0
src/components/makeProduct/index.vue

@@ -630,6 +630,20 @@ const selectBOM = (item) => {
     formData.data.skuSpecList[rowIndex.value].netWeight = item.netWeight;
     ElMessage({ message: "选择完成", type: "success" });
     openBOM.value = false;
+    proxy.post("/skuDefaultPackageSpec/getPackList", { skuId: formData.data.id, spec: item.length + "*" + item.width + "*" + item.height }).then((res) => {
+      if (res && res.length > 0) {
+        formData.data.skuSpecList[rowIndex.value].packagingMaterialList = res.map((val) => {
+          return {
+            bomSpecId: val.bomSpecId,
+            quantity: 1,
+            name: val.bomSpecName,
+          };
+        });
+      } else {
+        formData.data.skuSpecList[rowIndex.value].packagingMaterialList = [];
+      }
+      ElMessage({ message: "根据规格尺寸替换包材配件完成", type: "success" });
+    });
   }
 };
 const clickRemoveBOM = (index) => {

+ 6 - 4
src/views/group/BOM/management/index.vue

@@ -417,10 +417,12 @@ const getList = async (req, status) => {
   if (props.bomClassifyIdList) {
     sourceList.value.pagination.bomClassifyIdList = props.bomClassifyIdList;
   }
-  if (props.expressStatus && props.bomClassifyId) {
-    sourceList.value.pagination.bomClassifyId = props.bomClassifyId;
-  } else {
-    sourceList.value.pagination.bomClassifyId = "1682221528948760578";
+  if (props.expressStatus) {
+    if (props.bomClassifyId) {
+      sourceList.value.pagination.bomClassifyId = props.bomClassifyId;
+    } else {
+      sourceList.value.pagination.bomClassifyId = "1682221528948760578";
+    }
   }
   loading.value = true;
   let path = "/bom/page";