Pārlūkot izejas kodu

新增分类删除

hwb0 3 gadi atpakaļ
vecāks
revīzija
ac6ff63263
1 mainītis faili ar 35 papildinājumiem un 5 dzēšanām
  1. 35 5
      src/views/business/category/index.vue

+ 35 - 5
src/views/business/category/index.vue

@@ -68,7 +68,7 @@
           <div>{{ row.sort }}</div>
         </template>
       </el-table-column>
-      <el-table-column label="状态" prop="status"  align="center">
+      <el-table-column label="状态" prop="status" align="center">
         <template slot-scope="{ row }">
           <el-tag :type="row.isShow === 1 ? 'success' : 'info'">{{
             row.isShow === 1 ? "显示" : "不显示"
@@ -76,12 +76,16 @@
         </template>
       </el-table-column>
       <el-table-column label="操作" align="center">
-        <template>
+        <template slot-scope="{ row }">
           <div>
             <el-button v-hasPermi="['order:deliver:query']" type="text" disabled
               >编辑</el-button
             >
-            <el-button v-hasPermi="['order:deliver:ship']" type="text" disabled
+            <el-button
+              v-hasPermi="['business:category:remove']"
+              type="text"
+              class="del"
+              @click="del(row)"
               >删除</el-button
             >
           </div>
@@ -98,7 +102,11 @@
       @pagination="getList"
     />
 
-    <category-create v-if="createShow" :dialog-show="createShow" @close="close" />
+    <category-create
+      v-if="createShow"
+      :dialog-show="createShow"
+      @close="close"
+    />
   </div>
 </template>
 <script>
@@ -156,10 +164,32 @@ export default {
           this.loading = false;
         });
     },
-    handleQuery() {},
+
+    del(item) {
+      this.$confirm(`确认删除分类 “${item.name}” 吗?`, "删除分类", {
+        confirmButtonText: "确定",
+        cancelButtonText: "取消",
+        type: "warning",
+      }).then(() => {
+        goodsCategoryRemove({ categoryId: item.categoryId }).then((res) => {
+          if (res.code === 0) {
+            this.$message.success("操作已完成!");
+            this.getList();
+          }
+        });
+      });
+    },
+
+    // 重置
+    resetQuery() {
+      this.pageParams.pageNum = 1
+      this.getList();
+    },
+
     handleAdd() {
       this.createShow = true;
     },
+
     // 关闭发货弹框
     close() {
       this.createShow = false;