增加商品列表排序
This commit is contained in:
parent
4a7a1fa263
commit
8330a2ffd7
@ -81,16 +81,22 @@ class ProductLists extends BaseAdminDataLists implements ListsSearchInterface, L
|
||||
$this->searchWhere[] = ['cate_id', '=', $class_all];
|
||||
}
|
||||
}
|
||||
|
||||
$field = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch';
|
||||
$order = $this->request->get('order','');
|
||||
$field = $this->request->get('field','');
|
||||
if(empty($order)||empty($field)){
|
||||
$order = $this->sortOrder;
|
||||
}else{
|
||||
$order = [$field => $order];
|
||||
}
|
||||
$fields = 'id,product_id,cate_id,store_name,cost,store_id,vip_price,purchase,price,bar_code,image,sales,store_info,delete_time,unit,batch';
|
||||
|
||||
$this->searchWhere[] = ['status', '=', 1];
|
||||
$this->searchWhere[] = ['stock', '>', 0];
|
||||
return StoreBranchProduct::where($this->searchWhere)
|
||||
->field($field)
|
||||
->field($fields)
|
||||
->with(['className', 'unitName'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order($this->sortOrder)
|
||||
->order($order)
|
||||
// ->page($this->limitOffset +1,$this->limitLength)
|
||||
->select()->toArray();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user