|
|
|
@ -59,6 +59,49 @@ class Order extends OrderModel |
|
|
|
|
* @return mixed |
|
|
|
|
*/ |
|
|
|
|
public function getList(array $param = []) |
|
|
|
|
{ |
|
|
|
|
// 检索查询条件 |
|
|
|
|
$filter = $this->getQueryFilter($param); |
|
|
|
|
|
|
|
|
|
$filterOr = []; |
|
|
|
|
if (!empty($param['searchValue']) && $param['searchType'] == 'all') { |
|
|
|
|
// $filterOr = [ |
|
|
|
|
// ['order.order_no', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
// ['user.nick_name', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
// ['address.name', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
// ['address.phone', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
// ]; |
|
|
|
|
$filterOr = [ |
|
|
|
|
['order.order_no|user.nick_name|address.name|address.phone', 'like', "%{$param['searchValue']}%"] |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// 设置订单类型条件 |
|
|
|
|
$dataTypeFilter = $this->getFilterDataType($param['dataType']); |
|
|
|
|
// 获取数据列表 |
|
|
|
|
$query = $this->with(['goods.image', 'user.avatar', 'address']) |
|
|
|
|
->alias('order') |
|
|
|
|
->field('order.*') |
|
|
|
|
->leftJoin('user', 'user.user_id = order.user_id') |
|
|
|
|
->leftJoin('order_address address', 'address.order_id = order.order_id') |
|
|
|
|
->where($dataTypeFilter) |
|
|
|
|
->where($filter) |
|
|
|
|
->where('order.is_delete', '=', 0); |
|
|
|
|
if (!empty($filterOr)) { |
|
|
|
|
// $query = $query->whereOr($filterOr); |
|
|
|
|
$query = $query->where($filterOr); |
|
|
|
|
} |
|
|
|
|
$list = $query->order(['order.create_time' => 'desc']) |
|
|
|
|
->paginate(10); |
|
|
|
|
return $list; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 订单列表 (API调用) |
|
|
|
|
* @param array $param |
|
|
|
|
* @return mixed |
|
|
|
|
*/ |
|
|
|
|
public function getNewList(array $param = []) |
|
|
|
|
{ |
|
|
|
|
// 检索查询条件 |
|
|
|
|
$filter = $this->getQueryFilter($param); |
|
|
|
|