Parcourir la source

修改产品状态启用/停用

1018653686@qq.com il y a 1 an
Parent
commit
6db56a7c81
1 fichiers modifiés avec 10 ajouts et 16 suppressions
  1. 10 16
      src/views/XMHJC/product/info/index.vue

+ 10 - 16
src/views/XMHJC/product/info/index.vue

@@ -370,28 +370,22 @@ const submitForm = () => {
 };
 
 const changeStatus = (row) => {
-  modalType.value = "edit";
-  let status = row.status == "1" ? 0 : 1;
-  proxy.post("/productInfo/detail", { id: row.id }).then((res) => {
-    res.status = status;
-    formData.data = res;
+    let status = row.status == "1" ? 0 : 1;
     ElMessageBox.confirm("你是否确认此操作?", "提示", {
-      confirmButtonText: "确定",
-      cancelButtonText: "取消",
-      type: "warning",
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
     }).then(() => {
       // 删除
-      proxy
-        .post("/productInfo/" + modalType.value, formData.data)
+        proxy.post("/productInfo/changeStatus", {id:row.id,status:status})
         .then((res) => {
-          ElMessage({
-            message: "操作成功",
-            type: "success",
-          });
-          getList();
+            ElMessage({
+                message: "操作成功",
+                type: "success",
+            });
+            getList();
         });
     });
-  });
 };
 
 //编辑详情