|
|
|
@ -164,6 +164,7 @@ class OrderController extends Controller |
|
|
|
if ($spec->isEmpty()) { |
|
|
|
return $this->error('你选择的产品规格不存在'); |
|
|
|
} |
|
|
|
|
|
|
|
$spec = $spec->toArray(); |
|
|
|
$spec = array_map(function ($v) { |
|
|
|
$v = array_merge($v['product_spec'] ?? [], $v); |
|
|
|
@ -171,7 +172,8 @@ class OrderController extends Controller |
|
|
|
return $v; |
|
|
|
}, $spec); |
|
|
|
|
|
|
|
$order_price = 0; //订单总价
|
|
|
|
//订单总价
|
|
|
|
$order_price = 0; |
|
|
|
foreach ($spec as $v) { |
|
|
|
$order_price += $v['price'] * $formData['num']; |
|
|
|
} |
|
|
|
@ -283,11 +285,11 @@ class OrderController extends Controller |
|
|
|
//处理预付金额
|
|
|
|
if ($formData['pay_type'] == PayType::DEPOSIT_PAY) { |
|
|
|
//订金支付
|
|
|
|
$prepayPrice = $ap->deposit * $formData['num']; |
|
|
|
$prepayPrice = count($spec) * $ap->deposit * $formData['num']; |
|
|
|
$prepayTimeout = $ap->deposit_timeout; |
|
|
|
} else if($formData['pay_type'] == PayType::EARNEST_PAY) { |
|
|
|
//定金支付
|
|
|
|
$prepayPrice = $ap->earnest * $formData['num']; |
|
|
|
$prepayPrice = count($spec) * $ap->earnest * $formData['num']; |
|
|
|
$prepayTimeout = $ap->earnest_timeout; |
|
|
|
} |
|
|
|
|
|
|
|
@ -429,23 +431,22 @@ class OrderController extends Controller |
|
|
|
$spec = AgentProductSpec::where('agent_product_id', $formData['id']) |
|
|
|
->whereIn('id', $formData['spec_id']) |
|
|
|
->get(); |
|
|
|
|
|
|
|
if ($spec->isEmpty()) { |
|
|
|
return $this->error('你选择的产品规格不存在'); |
|
|
|
} |
|
|
|
$spec = $spec->toArray(); |
|
|
|
|
|
|
|
$ap->final_price = 0; |
|
|
|
if ($formData['pay_type'] == PayType::DEPOSIT_PAY) { //订金支付
|
|
|
|
$single_price = $ap->deposit; |
|
|
|
$ap->final_price = count($spec) * $ap->deposit * $formData['num']; |
|
|
|
} |
|
|
|
else if($formData['pay_type'] == PayType::EARNEST_PAY) { //定金支付
|
|
|
|
$single_price = $ap->earnes; |
|
|
|
$ap->final_price = count($spec) * $ap->earnes * $formData['num']; |
|
|
|
} else { |
|
|
|
$single_price = $ap->price; |
|
|
|
} |
|
|
|
|
|
|
|
$ap->final_price = 0; |
|
|
|
foreach ($spec as $v) { |
|
|
|
$ap->final_price += $single_price * $formData['num']; |
|
|
|
foreach ($spec as $v) { |
|
|
|
$ap->final_price += $v['price'] * $formData['num']; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
$ap->num = $formData['num']; |
|
|
|
|