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

View File

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