zhanglinxin 1 anno fa
parent
commit
b441792bb3

+ 22 - 2
application/approve/controller/GoodsCategory.php

@@ -19,6 +19,7 @@ use app\common\constant\CommonConstant;
 use app\common\service\GoodsCategoryService;
 use library\Controller;
 use library\tools\Data;
+use think\Db;
 
 /**
  * 商品分类
@@ -114,8 +115,8 @@ class GoodsCategory extends Controller
     protected function _form_filter(&$data)
     {
         if ($this->request->isGet()) {
-            $category_list = GoodsCategoryService::get_list([]);
-            $this->category_list = array_merge([['id' => '0', 'pid' => '-1', 'name' => '顶级']],$category_list ? $category_list->toArray() : []);
+            $this->category_list = GoodsCategoryService::get_list([]);
+            $this->category_list = array_merge([['id' => '0', 'pid' => '-1', 'name' => '顶级']],$this->category_list ? $this->category_list->toArray() : []);
         }
         if ($this->request->isPost()) {
 
@@ -135,4 +136,23 @@ class GoodsCategory extends Controller
         $this->_delete($this->table);
     }
 
+    /**
+     * 删除结果处理
+     * @param boolean $result
+     * @throws \think\Exception
+     * @throws \think\exception\PDOException
+     */
+    protected function _remove_delete_result($result)
+    {
+        if ($result) {
+            list($data) = [$this->request->post()];
+            if($data['pid'] == 0){
+                Db::name($this->table)->where('pid',$data['id'])->update(['is_deleted' => CommonConstant::IS_DELETED_1]);
+            }
+            $this->success("删除成功!", '');
+        } else {
+            $this->error("删除失败,请稍候再试!");
+        }
+    }
+
 }

+ 1 - 1
application/approve/view/approve_maintain_user/index.html

@@ -53,7 +53,7 @@
                 {/if}
 
                 {if auth("remove")}
-                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
+                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该维修人员吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                 {/if}
 
             </td>

+ 1 - 1
application/approve/view/goods/index.html

@@ -85,7 +85,7 @@
                 {/if}
 
                 {if auth("remove") and $vo.status eq 0}
-                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
+                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该商品吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
                 {/if}
 
             </td>

+ 8 - 1
application/approve/view/goods_category/index.html

@@ -45,7 +45,14 @@
                 {/if}
 
                 {if auth("remove")}
-                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该用户吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}" data-csrf="{:systoken('remove')}">删 除</a>
+                {if $vo.pid == 0}
+                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该分类及其子分类吗?"
+                   data-action="{:url('remove')}" data-value="id#{$vo.id};pid#{$vo.pid}" data-csrf="{:systoken('remove')}">删
+                    除</a>
+                {else/}
+                <a class="layui-btn layui-btn-xs layui-btn-danger" data-confirm="确定要删除该分类吗?"
+                   data-action="{:url('remove')}" data-value="id#{$vo.id};pid#{$vo.pid}" data-csrf="{:systoken('remove')}">删 除</a>
+                {/if}
                 {/if}
 
             </td>