feat : order list
This commit is contained in:
@@ -114,11 +114,7 @@ class OrderInfoService extends BaseService
|
||||
$skuList = array_column($skuList, null,'id');
|
||||
$imageList = $this->getOssObjects(array_column($skuList,'image_ids'));
|
||||
|
||||
$spuIds = array_unique(array_column($skuList,'spu_id'));
|
||||
$spuList = $this->spuModel->getDataArrByIds($spuIds);
|
||||
$spuList = array_column($spuList, null,'id');
|
||||
|
||||
$chefId = array_unique(array_column($spuList,'chef_id'));
|
||||
$chefId = array_unique(array_column($skuList,'chef_id'));
|
||||
$chefList = $this->adminUserModel->getDataArrByIds($chefId);
|
||||
$chefList = array_column($chefList, null,'id');
|
||||
|
||||
@@ -169,7 +165,7 @@ class OrderInfoService extends BaseService
|
||||
'unit_price' => $item['unit_price'],
|
||||
'quantity' => $item['quantity'],
|
||||
'price' => bcmul((string)$item['unit_price'], (string)$item['quantity'], 2),
|
||||
'chef_name' => $chefList[$spuList[$skuList[$item['sku_id']]['spu_id']]['chef_id']]['chinese_name'] ?? '',
|
||||
'chef_name' => $chefList[$item['sku_id']]['chinese_name'] ?? '',
|
||||
];
|
||||
$oneCopiesInfo['total_price'] = bcadd((string)$oneCopiesInfo['total_price'], bcmul((string)$item['unit_price'],(string)$item['quantity'],2), 2);
|
||||
$oneCopiesInfo['total_quantity'] += $item['quantity'];
|
||||
|
||||
@@ -24,7 +24,16 @@ use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class OrderListService extends BaseService
|
||||
{
|
||||
|
||||
use OssTrait;
|
||||
|
||||
/**
|
||||
* @var int 当前订单/历史订单
|
||||
*/
|
||||
CONST CURRENT_ORDER = 1;
|
||||
|
||||
CONST HISTORY_ORDER = 2;
|
||||
|
||||
/**
|
||||
* @var Order
|
||||
*/
|
||||
@@ -58,11 +67,19 @@ class OrderListService extends BaseService
|
||||
{
|
||||
$limit = (int)$this->request->input('limit', 20);
|
||||
|
||||
$type = (int)$this->request->input('type',self::CURRENT_ORDER);
|
||||
|
||||
$status = match ($type){
|
||||
self::CURRENT_ORDER => [OrderCode::WAIT_PAY,OrderCode::PAYED,OrderCode::PLAN,OrderCode::DEPART],
|
||||
self::HISTORY_ORDER => [OrderCode::FINISH,OrderCode::CANCEL,OrderCode::FINISH_REFUND,OrderCode::UNCOMPLETED_REFUND]
|
||||
};
|
||||
|
||||
$orderList = $this->orderModel
|
||||
->where('user_id', $this->userId)
|
||||
->when($this->request->input('status'), function ($query) {
|
||||
$query->where('status', $this->request->input('status'));
|
||||
})
|
||||
->whereIn('status', $status)
|
||||
// ->when($this->request->input('status'), function ($query) {
|
||||
// $query->where('status', $this->request->input('status'));
|
||||
// })
|
||||
->select([
|
||||
'id',
|
||||
'order_sno',
|
||||
|
||||
Reference in New Issue
Block a user