|
|
|
@ -111,30 +111,16 @@ class Order extends OrderModel |
|
|
|
|
*/ |
|
|
|
|
public function getList(string $dataType = 'all') |
|
|
|
|
{ |
|
|
|
|
$keyword = $_GET['keyword']; |
|
|
|
|
// 设置订单类型条件 |
|
|
|
|
$dataTypeFilter = $this->getFilterDataType($dataType); |
|
|
|
|
// 当前用户ID |
|
|
|
|
$userId = UserService::getCurrentLoginUserId(); |
|
|
|
|
$query = $this->with(['goods.image']); |
|
|
|
|
if (!empty($keyword) && $keyword !== 'undefined') { |
|
|
|
|
$query->where('order_no', 'like', "%{$keyword}%"); |
|
|
|
|
} |
|
|
|
|
$query->where($dataTypeFilter) |
|
|
|
|
->where('user_id', '=', $userId) |
|
|
|
|
->where('is_delete', '=', 0) |
|
|
|
|
->order(['create_time' => 'desc']); |
|
|
|
|
$list = $query->paginate(15)->toArray(); |
|
|
|
|
|
|
|
|
|
//这边后面改成多商户的话需要根据storeid去获取信息 |
|
|
|
|
$service = new StoreService; |
|
|
|
|
$info = $service->data()['storeInfo']->toArray(); |
|
|
|
|
|
|
|
|
|
foreach ($list['data'] as &$v) { |
|
|
|
|
$v['storeInfo'] = $info; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return $list; |
|
|
|
|
return $query->paginate(15); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
@ -253,15 +239,12 @@ class Order extends OrderModel |
|
|
|
|
switch ($dataType) { |
|
|
|
|
case 'all': |
|
|
|
|
break; |
|
|
|
|
case 'pay': |
|
|
|
|
case 'payment': |
|
|
|
|
$filter[] = ['pay_status', '=', PayStatusEnum::PENDING]; |
|
|
|
|
$filter[] = ['order_status', '=', OrderStatusEnum::NORMAL]; |
|
|
|
|
break; |
|
|
|
|
//待付款 |
|
|
|
|
case 'pay': |
|
|
|
|
$filter[] = ['pay_status', '=', PayStatusEnum::PENDING]; |
|
|
|
|
$filter[] = ['order_status', '=', OrderStatusEnum::NORMAL]; |
|
|
|
|
break; |
|
|
|
|
//待发货 |
|
|
|
|
case 'delivery': |
|
|
|
|
$filter = [ |
|
|
|
@ -272,6 +255,7 @@ class Order extends OrderModel |
|
|
|
|
]; |
|
|
|
|
break; |
|
|
|
|
//待收货 |
|
|
|
|
case 'received': |
|
|
|
|
case 'receipt': |
|
|
|
|
$filter = [ |
|
|
|
|
['pay_status', '=', PayStatusEnum::SUCCESS], |
|
|
|
@ -281,14 +265,6 @@ class Order extends OrderModel |
|
|
|
|
]; |
|
|
|
|
break; |
|
|
|
|
//待收货 |
|
|
|
|
case 'received': |
|
|
|
|
$filter = [ |
|
|
|
|
['pay_status', '=', PayStatusEnum::SUCCESS], |
|
|
|
|
['delivery_status', '=', DeliveryStatusEnum::DELIVERED], |
|
|
|
|
['receipt_status', '=', ReceiptStatusEnum::NOT_RECEIVED], |
|
|
|
|
['order_status', '=', OrderStatusEnum::NORMAL] |
|
|
|
|
]; |
|
|
|
|
break; |
|
|
|
|
//已完成 |
|
|
|
|
case 'complete': |
|
|
|
|
$filter = [ |
|
|
|
@ -315,6 +291,8 @@ class Order extends OrderModel |
|
|
|
|
]; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
//非售后订单 |
|
|
|
|
$filter[] = ['is_refund', '=', 10]; |
|
|
|
|
return $filter; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|