修改预订单列表查询

This commit is contained in:
lewis 2025-03-18 16:07:45 +08:00
parent 98815747f5
commit 0eb1586076
3 changed files with 20 additions and 5 deletions

View File

@ -34,7 +34,7 @@ class BeforehandOrderLists extends BaseAdminDataLists implements ListsSearchInte
public function setSearch(): array
{
return [
'=' => ['store_id', 'paid', 'status', 'order_type', 'admin_id'],
'=' => ['id', 'store_id', 'paid', 'status', 'order_type', 'admin_id'],
'%like' => ['order_id','order_sn'],
'%like%' => ['mark'],
'between_time' => 'create_time'

View File

@ -76,6 +76,10 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
$this->searchWhere[] = ['product_id', 'in', $ids];
}
}
if (!empty($this->params['store_id'])) {
$orderIds = BeforehandOrder::where('store_id', $this->params['store_id'])->column('id');
$this->searchWhere[] = ['bhoid', 'in', $orderIds];
}
$list = BeforehandOrderCartInfo::where($this->searchWhere)
->field(['id', 'bhoid', 'package', 'store_info', 'marques', 'gross_weight', 'net_weight', 'accept_num', 'after_sales', 'loss', 'uid', 'pay_price', 'is_buyer', 'buyer_uid', 'product_id', 'attr_value_id', 'purchase', 'price', 'total_price', 'cart_num', 'mark','create_time', 'procurement_order_id', 'store_sale'])
->limit($this->limitOffset, $this->limitLength)
@ -137,6 +141,10 @@ class BeforehandOrderCartInfoLists extends BaseAdminDataLists implements ListsSe
*/
public function count(): int
{
if (!empty($this->params['store_id'])) {
$orderIds = BeforehandOrder::where('store_id', $this->params['store_id'])->column('id');
$this->searchWhere[] = ['bhoid', 'in', $orderIds];
}
return BeforehandOrderCartInfo::where($this->searchWhere)->count();
}

View File

@ -76,9 +76,12 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
}
$query = WarehouseProduct::where($this->searchWhere);
if (isset($this->params['is_group']) && $this->params['is_group'] == 1) {
$query->group('product_id')->field(['id', 'code','pay_type','oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'sum(nums) nums', 'price', 'purchase', 'cost', 'sum(total_price) total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay', 'order_type','vip_price']);
$query->group('product_id')->field(['id', 'code','pay_type','oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'sum(nums) nums', 'price', 'purchase', 'cost', 'sum(total_price) total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay', 'order_type','vip_price', 'delete_time']);
} else {
$query->field(['id', 'code','pay_type','oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'nums', 'price', 'purchase', 'cost', 'total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay', 'order_type','vip_price']);
$query->field(['id', 'code','pay_type','oid','admin_id','supplier_id', 'store_id', 'warehouse_id', 'product_id', 'financial_pm', 'batch', 'nums', 'price', 'purchase', 'cost', 'total_price', 'manufacture', 'expiration_date', 'status', 'mark', 'create_time','is_pay', 'order_type','vip_price', 'delete_time']);
}
if (!empty($this->params['product_status'])) {
$query->onlyTrashed();
}
return $query
->limit($this->limitOffset, $this->limitLength)
@ -168,10 +171,14 @@ class WarehouseProductLists extends BaseAdminDataLists implements ListsSearchInt
*/
public function count(): int
{
$query = WarehouseProduct::where($this->searchWhere);
if (!empty($this->params['product_status'])) {
$query->onlyTrashed();
}
if ($this->ids) {
return WarehouseProduct::whereIn('id', $this->ids)->where($this->searchWhere)->count();
return $query->whereIn('id', $this->ids)->count();
} else {
return WarehouseProduct::where($this->searchWhere)->count();
return $query->count();
}
}
/**