Browse Source

商家线上订单列表

master
Lemon 6 years ago
parent
commit
059d3b8bce
  1. 41
      app/Service/v3/Implementations/OrderListService.php

41
app/Service/v3/Implementations/OrderListService.php

@ -58,14 +58,26 @@ class OrderListService implements OrderListServiceInterface
public function onlineByStore($storeId, $tab, $page=1, $pagesize=10) public function onlineByStore($storeId, $tab, $page=1, $pagesize=10)
{ {
$builder = OrderMain::query()
->select('id','global_order_id', 'money', 'state', 'market_id', 'created_at')
->with(['orders' => function($query) use ($storeId) {
$query->where('store_id',$storeId)->with('orderGoods');
}])
->where([
'type' => 1
]);
$builder = Order::Join('lanzu_order_main','lanzu_order.order_main_id','lanzu_order_main.id')
->select(
'lanzu_order.*',
'lanzu_order_main.address',
'lanzu_order_main.name',
'lanzu_order_main.delivery_time_note',
'lanzu_order_main.shipping_type',
'lanzu_order_main.global_order_id'
)
->with('orderGoods')
->where('lanzu_order.store_id', $storeId)
->where('lanzu_order_main.type',1);
$sw = [
'all'=>'',
'completed'=> OrderState::FINISH,
'unpaid'=> OrderState::UNPAID,
'receiving' => OrderState::RECEIVING,
'refund' => OrderState::REFUND
];
switch ($tab) { switch ($tab) {
case 'all': case 'all':
break; break;
@ -85,7 +97,18 @@ class OrderListService implements OrderListServiceInterface
$paginate = $builder->paginate($pagesize); $paginate = $builder->paginate($pagesize);
$orders = $paginate->toArray(); $orders = $paginate->toArray();
return ['has_more_pages' => $paginate->hasMorePages(), 'orders' => $orders['data']];
$res = ['has_more_pages' => $paginate->hasMorePages(), 'orders' => $orders['data']];
foreach ($res['orders'] as &$v){
switch ($v['shipping_type']) {
case 1:
$v['delivery_text'] = '服务站配送';
break;
case 2:
$v['delivery_text'] = '达达配送';
break;
}
}
return $res;
} }
public function offlineByStore($storeId, $tab, $page=1, $pagesize=10) public function offlineByStore($storeId, $tab, $page=1, $pagesize=10)

Loading…
Cancel
Save