调整购物车下单
parent
729f89181d
commit
64fbcb102b
|
|
@ -93,17 +93,20 @@ class OrderController extends Controller
|
|||
$shoppingCartItems->load('product');
|
||||
$totalQty = $shoppingCartItems->sum('quantity');
|
||||
$data = [];
|
||||
$totalAmount = 0;
|
||||
foreach ($shoppingCartItems as $item) {
|
||||
$dealerPrice = $orderService->getSalePrice($user, $item->product, $totalQty);
|
||||
$data[] = [
|
||||
'id' => $item->id,
|
||||
'name' => $item->name,
|
||||
'cover' => $item->cover,
|
||||
'sell_price' => $item->sell_price,
|
||||
'dealer_price' => $orderService->getSalePrice($user, $item->product, $totalQty),
|
||||
'dealer_price' => $dealerPrice,
|
||||
'quantity' => $item->quantity,
|
||||
];
|
||||
$totalAmount += $dealerPrice;
|
||||
}
|
||||
return response()->json(['data'=>$data]);
|
||||
return response()->json(['data'=>$data, 'to_lvl'=>$orderService->willBecome($user, $totalAmount)]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue