From bf21a2ca415784176165d61b38d8aab65daf378b Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Mon, 13 Dec 2021 21:35:30 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=94=AE=E5=90=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/Admin/Forms/AfterSaleVerify.php | 5 ++++- app/Services/AfterSaleService.php | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/app/Admin/Forms/AfterSaleVerify.php b/app/Admin/Forms/AfterSaleVerify.php index 4097fbd9..adc9db74 100644 --- a/app/Admin/Forms/AfterSaleVerify.php +++ b/app/Admin/Forms/AfterSaleVerify.php @@ -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 = ''; diff --git a/app/Services/AfterSaleService.php b/app/Services/AfterSaleService.php index 0b62a1af..b91075ad 100644 --- a/app/Services/AfterSaleService.php +++ b/app/Services/AfterSaleService.php @@ -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,