From c1038c1e59d54ee1a21f435a7620b6a4ed505910 Mon Sep 17 00:00:00 2001 From: vine_liutk <961510893@qq.com> Date: Wed, 23 Mar 2022 14:45:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=94=AE=E5=90=8E=E5=8F=AF?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=94=AE=E5=90=8E=E5=95=86=E5=93=81=E6=95=B0?= =?UTF-8?q?=E9=87=8F=EF=BC=8C=E5=B9=B6=E5=B1=8F=E8=94=BD=E5=88=86=E5=8C=BA?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=88=B8=EF=BC=8C=E5=95=86=E5=93=81=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E8=B5=A0=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ProductPartController.php | 6 ++--- app/Admin/Forms/AfterSaleVerify.php | 4 ++- app/Admin/Renderable/ProductSkuTable.php | 6 ++--- app/Services/AfterSaleService.php | 26 +++++++++++-------- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/app/Admin/Controllers/ProductPartController.php b/app/Admin/Controllers/ProductPartController.php index 8475db78..5e2a50cd 100644 --- a/app/Admin/Controllers/ProductPartController.php +++ b/app/Admin/Controllers/ProductPartController.php @@ -63,9 +63,9 @@ class ProductPartController extends AdminController //删除以及自定义操作 $grid->actions(function (Grid\Displayers\Actions $actions) { $actions->disableDelete(Admin::user()->cannot('dcat.admin.product_parts.destroy')); - if (Admin::user()->can('dcat.admin.product_parts.coupons')) { - $actions->append(new PartCoupon()); - } + // if (Admin::user()->can('dcat.admin.product_parts.coupons')) { + // $actions->append(new PartCoupon()); + // } }); /** 查询 **/ diff --git a/app/Admin/Forms/AfterSaleVerify.php b/app/Admin/Forms/AfterSaleVerify.php index 8dfe6276..0551ddf1 100644 --- a/app/Admin/Forms/AfterSaleVerify.php +++ b/app/Admin/Forms/AfterSaleVerify.php @@ -60,7 +60,7 @@ class AfterSaleVerify extends Form implements LazyRenderable throw new BizException('退款金额不能大于商品实付金额'); } } - $afterSaleService->verify($afterSale, $input['remarks3'], (int) Arr::get($input, 'amount', 0)); + $afterSaleService->verify($afterSale, $input['remarks3'], (int) Arr::get($input, 'amount', 0), (int) Arr::get($input, 'num', 0) ?: $afterSale->num); } elseif ($input['state'] == 1) {//需要补充资料 $afterSaleService->backApply($afterSale, $input['remarks1']); } @@ -83,6 +83,8 @@ class AfterSaleVerify extends Form implements LazyRenderable { $id = $this->payload['id'] ?? 0; $afterSale = AfterSale::findOrFail($id); + //可调整数量 + $this->number('num')->value($afterSale->num)->min(1)->max($afterSale->orderProduct->quantity); //获取当前商品可发起的最大数量 if (in_array($afterSale->type, [1, 2])) { $this->currency('amount')->customFormat(function () use ($afterSale) { return bcdiv($afterSale->amount, 100, 2); diff --git a/app/Admin/Renderable/ProductSkuTable.php b/app/Admin/Renderable/ProductSkuTable.php index a38c5079..d4d5e660 100644 --- a/app/Admin/Renderable/ProductSkuTable.php +++ b/app/Admin/Renderable/ProductSkuTable.php @@ -90,9 +90,9 @@ class ProductSkuTable extends Grid if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) { $actions->append(new SkuSyncSpu()); } - if (Admin::user()->can('dcat.admin.product_skus.sku_gift')) { - $actions->append(new SkuGift()); - } + // if (Admin::user()->can('dcat.admin.product_skus.sku_gift')) { + // $actions->append(new SkuGift()); + // } } if ($actions->row->verify_state == 1) { if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) { diff --git a/app/Services/AfterSaleService.php b/app/Services/AfterSaleService.php index ca6319e9..c405cf54 100644 --- a/app/Services/AfterSaleService.php +++ b/app/Services/AfterSaleService.php @@ -150,15 +150,16 @@ class AfterSaleService * @param string $remarks * @return void */ - public function verify(AfterSale $afterSale, string $remarks, int $amount) + public function verify(AfterSale $afterSale, string $remarks, int $amount, ?int $num = null) { if ($this->isWaitVerify($afterSale)) { switch ($afterSale->type) { case AfterSale::TYPE_REFUND_AND_RETURN: $afterSale->update([ - 'amount' => $amount, - 'state' => $afterSale::STATE_AGREE, - 'remarks' => $remarks, + 'num' => $num, + 'amount' => $amount, + 'state' => $afterSale::STATE_AGREE, + 'remarks' => $remarks, ]); AfterSaleLog::create([ 'after_sale_id' => $afterSale->id, @@ -168,9 +169,10 @@ class AfterSaleService break; case AfterSale::TYPE_REFUND: $afterSale->update([ - 'amount' => $amount, - 'state' => $afterSale::STATE_AGREE, - 'remarks' => $remarks, + 'num' => $num, + 'amount' => $amount, + 'state' => $afterSale::STATE_AGREE, + 'remarks' => $remarks, ]); AfterSaleLog::create([ 'after_sale_id' => $afterSale->id, @@ -180,8 +182,9 @@ class AfterSaleService break; case AfterSale::TYPE_CHANGE: $afterSale->update([ - 'state' => $afterSale::STATE_AGREE, - 'remarks' => $remarks, + 'num' => $num, + 'state' => $afterSale::STATE_AGREE, + 'remarks' => $remarks, ]); AfterSaleLog::create([ 'after_sale_id' => $afterSale->id, @@ -191,8 +194,9 @@ class AfterSaleService break; case AfterSale::TYPE_FILL: $afterSale->update([ - 'state' => $afterSale::STATE_AGREE, - 'remarks' => $remarks, + 'num' => $num, + 'state' => $afterSale::STATE_AGREE, + 'remarks' => $remarks, ]); AfterSaleLog::create([ 'after_sale_id' => $afterSale->id,