Browse Source

获取所有供应商列表,为了超管账号切换到供应商模式时使用,展现在页面右上角

wufeng 2 years ago
parent
commit
9c65c70258
2 changed files with 26 additions and 0 deletions
  1. 25 0
      app/admin/controller/Supplier.php
  2. 1 0
      app/admin/route/app.php

+ 25 - 0
app/admin/controller/Supplier.php

@@ -209,5 +209,30 @@ class Supplier extends BaseController
         return $udap ? app_show(0,"修改成功") :error_show(1003,"修改失败");
     }
 
+    //获取所有供应商列表,为了超管账号切换到供应商模式时使用,展现在页面右上角
+    public function supplierListBySuper(){
+
+        $post = $this->request->only(['code'=>'','name'=>'','page'=>1,'size'=>10],'post','trim');
+
+        $where=[['type','<>',3]];//type==3业务公司,其他都是供应商
+
+        if($post['code']!=='') $where[]=['code','like','%'.$post['code'].'%'];
+        if($post['name']!=='') $where[]=['name','like','%'.$post['name'].'%'];
+
+        $count = Db::name('supplier_info')
+            ->where($where)
+            ->count('id');
+
+        $list =Db::name('supplier_info')
+            ->field('id,code,name')
+            ->where($where)
+            ->page((int)$post['page'],(int)$post['size'])
+            ->order(['id'=>'asc'])
+            ->select()
+            ->toArray();
+        return app_show(0,'获取供应商列表成功',['count'=>$count,'list'=>$list]);
+
+    }
+
 
 }

+ 1 - 0
app/admin/route/app.php

@@ -52,6 +52,7 @@ Route::rule('groupstatus', 'admin/Group/GroupStatus');
 
 Route::rule("supplierlist","admin/Supplier/SupplierList");
 Route::rule("supplierall","admin/Supplier/SupplierAll");
+Route::rule("supplier_by_super","admin/Supplier/supplierListBySuper");
 
 
 Route::rule("customerlist","admin/Customer/list");