调整售后
parent
5b4ce30231
commit
bf21a2ca41
|
|
@ -63,7 +63,10 @@ class AfterSaleVerify extends Form implements LazyRenderable
|
|||
{
|
||||
$id = $this->payload['id'] ?? 0;
|
||||
$afterSale = AfterSale::findOrFail($id);
|
||||
$this->currency('amount')->symbol('¥')->value($afterSale->amount);
|
||||
if (!in_array($afterSale->type, [3, 4])) {
|
||||
$this->currency('amount')->symbol('¥')->value($afterSale->amount);
|
||||
}
|
||||
|
||||
$this->radio('state')
|
||||
->when(3, function (Form $form) use ($afterSale) {
|
||||
$defaultRemarks = '';
|
||||
|
|
|
|||
|
|
@ -36,18 +36,18 @@ class AfterSaleService
|
|||
throw new BizException('申请售后的数量不能大于订单商品数量');
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
case 3:
|
||||
$amount = 0;
|
||||
break;
|
||||
case 4:
|
||||
$amount = 0;
|
||||
break;
|
||||
default:
|
||||
// dd(bcmul(bcdiv(10, 3, 2), 3, 2));如果数量相等,则直接取总额
|
||||
$amount = ($num == $orderProduct->quantity) ? $orderProduct->total_amount : bcmul(bcdiv($orderProduct->total_amount, $orderProduct->quantity, 2), $num, 2);
|
||||
break;
|
||||
}
|
||||
// switch ($type) {
|
||||
// case 3:
|
||||
// $amount = 0;
|
||||
// break;
|
||||
// case 4:
|
||||
// $amount = 0;
|
||||
// break;
|
||||
// default:
|
||||
// dd(bcmul(bcdiv(10, 3, 2), 3, 2));如果数量相等,则直接取总额
|
||||
$amount = ($num == $orderProduct->quantity) ? $orderProduct->total_amount : bcmul(bcdiv($orderProduct->total_amount, $orderProduct->quantity, 2), $num, 2);
|
||||
// break;
|
||||
// }
|
||||
$afterSale = AfterSale::create(array_merge($params, [
|
||||
'user_id' => $user->id,
|
||||
'order_id' => $orderProduct->order_id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue