diff --git a/app/admin/lists/store_branch_product/StoreBranchProductLists.php b/app/admin/lists/store_branch_product/StoreBranchProductLists.php index c4ced3bf6..50b5906e7 100644 --- a/app/admin/lists/store_branch_product/StoreBranchProductLists.php +++ b/app/admin/lists/store_branch_product/StoreBranchProductLists.php @@ -32,6 +32,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI '=' => ['product_id', 'cate_id','store_id','status'], '%pipe_like%' => ['store_name_code'=>'store_name|bar_code'], '%like%' => ['store_name'], + '<='=> ['stock'], ]; } @@ -47,7 +48,6 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI */ public function lists(): array { - $status = $this->params['status'] ?? ''; $class_all=$this->request->get('class_all'); $where=[]; if($class_all){ @@ -69,17 +69,6 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); }) - ->when(!empty($status), function ($query) use ($status) { - if ($status == 1) { - $query->where('status', $status); - } elseif ($status == 2) { - $query->where('status', 0); - } elseif ($status == 3) { - $query->where('stock', '<=', 0); - } elseif ($status == 4) { - $query->where('stock', '<', 10)->where('stock', '>', 0); - } - }) ->limit($this->limitOffset, $this->limitLength) ->order(['sort' => 'desc','stock'=>'desc','id' => 'desc']) ->select() @@ -101,22 +90,10 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI */ public function count(): int { - $status = $this->params['status'] ?? ''; return StoreBranchProduct::where($this->searchWhere) ->when(!empty($this->adminInfo['store_id']), function ($query) { $query->where('store_id', $this->adminInfo['store_id']); }) - ->when(!empty($status), function ($query) use ($status) { - if ($status == 1) { - $query->where('status', $status); - } elseif ($status == 2) { - $query->where('status', 0); - } elseif ($status == 3) { - $query->where('stock', '<=', 0); - } elseif ($status == 4) { - $query->where('stock', '<', 10)->where('stock', '>', 0); - } - }) ->count(); }