Commit 67e67a52 authored by hangjun83's avatar hangjun83

订单接口增加运费

parent 1ab8ae72
......@@ -131,6 +131,12 @@ class BhuaSordersRepositoryEloquent extends BaseRepository implements BhuaSorder
$itemRepository = app(BhuaSoitemsRepositoryEloquent::class);
$items = $itemRepository->getSorderItemsDetailFromOrderId($sOrderInfo['so_id']);
//获取运费
$freightItem = $itemRepository->findWhere(['so_id' => $sOrderInfo['so_id'], 'p_id' => 0])->first();
if($freightItem){
$freightItem = $freightItem->toArray();
$items = array_merge($items,[$freightItem]);
}
$sOrderInfo['items'] = [];
if($items){
$sOrderInfo['items'] = $items;
......
......@@ -124,6 +124,16 @@ class BhuaOrdersService
$orderId = $this->bhuaOrdersService->createOrders($data);
if($orderId){
$orderDetail = $this->bhuaOrdersService->getCustomerOrderItemsByOrderId($customer['cus_id'],$orderId);
//处理运费
if($orderDetail){
$orderDetail['so_freight_price'] = 0;
foreach($orderDetail['items'] as $key => $item){
if($item['p_id'] == 0){
$orderDetail['so_freight_price'] = $item['si_amount'];
unset($orderDetail['items'][$key]);
}
}
}
$orderDetail = app(OrderDetailTransformer::class)->transform([$orderDetail]);
return current($orderDetail);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment