feat(StoreBranchProductLists): 修改查询条件,优化库存查询
This commit is contained in:
parent
8644e3d571
commit
528f9aff93
@ -29,7 +29,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
|
||||
{
|
||||
return [
|
||||
'=' => ['product_id', 'cate_id','store_id'],
|
||||
'%like%' => ['store_name|bar_code'],
|
||||
'%pipe_like%' => ['store_name_code'=>'store_name|bar_code'],
|
||||
];
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ class StoreBranchProductLists extends BaseAdminDataLists implements ListsSearchI
|
||||
}
|
||||
})
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->order(['sort' => 'desc','stock'=>'desc','id' => 'desc'])
|
||||
->select()
|
||||
->each(function ($item) {
|
||||
$item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
|
||||
|
@ -22,23 +22,22 @@ trait ListsSearchTrait
|
||||
return [];
|
||||
}
|
||||
$where = [];
|
||||
$class_key=$this->request->__get('class_key');
|
||||
if($class_key!==null){
|
||||
foreach($class_key as $key => $value){
|
||||
if(isset($search[$key])){
|
||||
foreach($value as $v){ // 遍历class_key的值,添加到search数组中
|
||||
$class_key = $this->request->__get('class_key');
|
||||
if ($class_key !== null) {
|
||||
foreach ($class_key as $key => $value) {
|
||||
if (isset($search[$key])) {
|
||||
foreach ($value as $v) { // 遍历class_key的值,添加到search数组中
|
||||
array_push($search[$key], $v); // 添加class_key的搜索条件
|
||||
}
|
||||
}else{
|
||||
} else {
|
||||
$search[$key] = [$value[0]]; // 创建新的搜索条件
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$class_value=$this->request->__get('class_value'); // 获取class_value的值
|
||||
if($class_value!==null){
|
||||
$this->params=array_merge($this->params,$class_value);
|
||||
|
||||
$class_value = $this->request->__get('class_value'); // 获取class_value的值
|
||||
if ($class_value !== null) {
|
||||
$this->params = array_merge($this->params, $class_value);
|
||||
}
|
||||
foreach ($search as $whereType => $whereFields) {
|
||||
switch ($whereType) {
|
||||
@ -57,6 +56,15 @@ trait ListsSearchTrait
|
||||
$where[] = [$whereField, $whereType, $this->params[$paramsName]];
|
||||
}
|
||||
break;
|
||||
case '%pipe_like%':
|
||||
foreach ($whereFields as $k=>$whereField) {
|
||||
$paramsName = substr_symbol_behind($whereField);
|
||||
if (!isset($this->params[$k]) || empty($this->params[$k])) {
|
||||
continue;
|
||||
}
|
||||
$where[] = [$whereField, 'like', '%' . $this->params[$k] . '%'];
|
||||
}
|
||||
break;
|
||||
case '%like%':
|
||||
foreach ($whereFields as $whereField) {
|
||||
$paramsName = substr_symbol_behind($whereField);
|
||||
@ -109,4 +117,4 @@ trait ListsSearchTrait
|
||||
}
|
||||
return $where;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -54,14 +54,16 @@ class StoreOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
$this->searchWhere[] = ['pay_type','=',7];
|
||||
}
|
||||
return StoreOrder::where($this->searchWhere)
|
||||
->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status'])
|
||||
->field(['id', 'order_id', 'pay_price', 'pay_time', 'pay_type', 'status','paid'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) use ($store_id) {
|
||||
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
|
||||
$item['status_name'] = OrderEnum::getOrderType($item['status']) ?? '';
|
||||
if ($item['paid'] == 0) {
|
||||
$item['status_name'] = '待支付';
|
||||
$item['paid_name'] = '待支付';
|
||||
}else{
|
||||
$item['paid_name'] = '已支付';
|
||||
}
|
||||
$product_id = StoreOrderCartInfo::where('oid', $item['id'])->limit(3)->column('product_id');
|
||||
if ($product_id) {
|
||||
|
@ -28,7 +28,7 @@ class StoreProductLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['store_name', 'cate_id', 'store_id'],
|
||||
'=' => ['cate_id', 'store_id']
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user