6
0
Fork 0

调整售后

release
vine_liutk 2021-12-13 21:35:30 +08:00
parent 5b4ce30231
commit bf21a2ca41
2 changed files with 16 additions and 13 deletions

View File

@ -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 = '';

View File

@ -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,