调整购物车下单
parent
729f89181d
commit
64fbcb102b
|
|
@ -93,17 +93,20 @@ class OrderController extends Controller
|
||||||
$shoppingCartItems->load('product');
|
$shoppingCartItems->load('product');
|
||||||
$totalQty = $shoppingCartItems->sum('quantity');
|
$totalQty = $shoppingCartItems->sum('quantity');
|
||||||
$data = [];
|
$data = [];
|
||||||
|
$totalAmount = 0;
|
||||||
foreach ($shoppingCartItems as $item) {
|
foreach ($shoppingCartItems as $item) {
|
||||||
|
$dealerPrice = $orderService->getSalePrice($user, $item->product, $totalQty);
|
||||||
$data[] = [
|
$data[] = [
|
||||||
'id' => $item->id,
|
'id' => $item->id,
|
||||||
'name' => $item->name,
|
'name' => $item->name,
|
||||||
'cover' => $item->cover,
|
'cover' => $item->cover,
|
||||||
'sell_price' => $item->sell_price,
|
'sell_price' => $item->sell_price,
|
||||||
'dealer_price' => $orderService->getSalePrice($user, $item->product, $totalQty),
|
'dealer_price' => $dealerPrice,
|
||||||
'quantity' => $item->quantity,
|
'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