|
|
|
@ -65,14 +65,11 @@ class Order extends OrderModel |
|
|
|
|
|
|
|
|
|
$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']}%"] |
|
|
|
|
['order.order_no', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
['user.nick_name', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
['address.name', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
['address.phone', 'like', "%{$param['searchValue']}%"], |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -88,8 +85,7 @@ class Order extends OrderModel |
|
|
|
|
->where($filter) |
|
|
|
|
->where('order.is_delete', '=', 0); |
|
|
|
|
if (!empty($filterOr)) { |
|
|
|
|
// $query = $query->whereOr($filterOr); |
|
|
|
|
$query = $query->where($filterOr); |
|
|
|
|
$query = $query->whereOr($filterOr); |
|
|
|
|
} |
|
|
|
|
$list = $query->order(['order.create_time' => 'desc']) |
|
|
|
|
->paginate(10); |
|
|
|
@ -125,7 +121,7 @@ class Order extends OrderModel |
|
|
|
|
// 设置订单类型条件 |
|
|
|
|
$dataTypeFilter = $this->getFilterDataType($param['dataType']); |
|
|
|
|
// 获取数据列表 |
|
|
|
|
$query = $this->with(['goods.image', 'user.avatar', 'address']) |
|
|
|
|
$query = $this->with(['goods.image', 'user.avatar', 'address', 'delivery']) |
|
|
|
|
->alias('order') |
|
|
|
|
->field('order.*') |
|
|
|
|
->leftJoin('user', 'user.user_id = order.user_id') |
|
|
|
@ -320,6 +316,31 @@ class Order extends OrderModel |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改物流信息 |
|
|
|
|
* @param array $data |
|
|
|
|
* @return bool |
|
|
|
|
*/ |
|
|
|
|
public function updateDelivery(array $data): bool |
|
|
|
|
{ |
|
|
|
|
if ($this['pay_status'] != PayStatusEnum::SUCCESS |
|
|
|
|
|| $this['delivery_status'] == DeliveryStatusEnum::DELIVERED || $this['delivery_type'] != 10) { |
|
|
|
|
$this->error = "订单号[{$this['order_no']}]不满足修改条件!"; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
if (empty($data['express_id']) || empty($data['express_no'])) { |
|
|
|
|
$this->error = "请补全物流信息!"; |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
$update = [ |
|
|
|
|
'express_id' => $data['express_id'], |
|
|
|
|
'express_no' => $data['express_no'], |
|
|
|
|
|
|
|
|
|
]; |
|
|
|
|
return (bool)\app\common\model\order\Delivery::where(['order_id' => $this['order_id']])->update($update); |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 修改商家备注 |
|
|
|
|
* @param array $data |
|
|
|
|