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