6
0
Fork 0

添加售后可修改售后商品数量,并屏蔽分区配置券,商品配置赠品

release
vine_liutk 2022-03-23 14:45:01 +08:00
parent c69334f8d2
commit c1038c1e59
4 changed files with 24 additions and 18 deletions

View File

@ -63,9 +63,9 @@ class ProductPartController extends AdminController
//删除以及自定义操作 //删除以及自定义操作
$grid->actions(function (Grid\Displayers\Actions $actions) { $grid->actions(function (Grid\Displayers\Actions $actions) {
$actions->disableDelete(Admin::user()->cannot('dcat.admin.product_parts.destroy')); $actions->disableDelete(Admin::user()->cannot('dcat.admin.product_parts.destroy'));
if (Admin::user()->can('dcat.admin.product_parts.coupons')) { // if (Admin::user()->can('dcat.admin.product_parts.coupons')) {
$actions->append(new PartCoupon()); // $actions->append(new PartCoupon());
} // }
}); });
/** 查询 **/ /** 查询 **/

View File

@ -60,7 +60,7 @@ class AfterSaleVerify extends Form implements LazyRenderable
throw new BizException('退款金额不能大于商品实付金额'); 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) {//需要补充资料 } elseif ($input['state'] == 1) {//需要补充资料
$afterSaleService->backApply($afterSale, $input['remarks1']); $afterSaleService->backApply($afterSale, $input['remarks1']);
} }
@ -83,6 +83,8 @@ 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->number('num')->value($afterSale->num)->min(1)->max($afterSale->orderProduct->quantity); //获取当前商品可发起的最大数量
if (in_array($afterSale->type, [1, 2])) { if (in_array($afterSale->type, [1, 2])) {
$this->currency('amount')->customFormat(function () use ($afterSale) { $this->currency('amount')->customFormat(function () use ($afterSale) {
return bcdiv($afterSale->amount, 100, 2); return bcdiv($afterSale->amount, 100, 2);

View File

@ -90,9 +90,9 @@ class ProductSkuTable extends Grid
if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) { if (Admin::user()->can('dcat.admin.product_skus.sku_sync_spu')) {
$actions->append(new SkuSyncSpu()); $actions->append(new SkuSyncSpu());
} }
if (Admin::user()->can('dcat.admin.product_skus.sku_gift')) { // if (Admin::user()->can('dcat.admin.product_skus.sku_gift')) {
$actions->append(new SkuGift()); // $actions->append(new SkuGift());
} // }
} }
if ($actions->row->verify_state == 1) { if ($actions->row->verify_state == 1) {
if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) { if (Admin::user()->can('dcat.admin.product_skus.release_cancel')) {

View File

@ -150,15 +150,16 @@ class AfterSaleService
* @param string $remarks * @param string $remarks
* @return void * @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)) { if ($this->isWaitVerify($afterSale)) {
switch ($afterSale->type) { switch ($afterSale->type) {
case AfterSale::TYPE_REFUND_AND_RETURN: case AfterSale::TYPE_REFUND_AND_RETURN:
$afterSale->update([ $afterSale->update([
'amount' => $amount, 'num' => $num,
'state' => $afterSale::STATE_AGREE, 'amount' => $amount,
'remarks' => $remarks, 'state' => $afterSale::STATE_AGREE,
'remarks' => $remarks,
]); ]);
AfterSaleLog::create([ AfterSaleLog::create([
'after_sale_id' => $afterSale->id, 'after_sale_id' => $afterSale->id,
@ -168,9 +169,10 @@ class AfterSaleService
break; break;
case AfterSale::TYPE_REFUND: case AfterSale::TYPE_REFUND:
$afterSale->update([ $afterSale->update([
'amount' => $amount, 'num' => $num,
'state' => $afterSale::STATE_AGREE, 'amount' => $amount,
'remarks' => $remarks, 'state' => $afterSale::STATE_AGREE,
'remarks' => $remarks,
]); ]);
AfterSaleLog::create([ AfterSaleLog::create([
'after_sale_id' => $afterSale->id, 'after_sale_id' => $afterSale->id,
@ -180,8 +182,9 @@ class AfterSaleService
break; break;
case AfterSale::TYPE_CHANGE: case AfterSale::TYPE_CHANGE:
$afterSale->update([ $afterSale->update([
'state' => $afterSale::STATE_AGREE, 'num' => $num,
'remarks' => $remarks, 'state' => $afterSale::STATE_AGREE,
'remarks' => $remarks,
]); ]);
AfterSaleLog::create([ AfterSaleLog::create([
'after_sale_id' => $afterSale->id, 'after_sale_id' => $afterSale->id,
@ -191,8 +194,9 @@ class AfterSaleService
break; break;
case AfterSale::TYPE_FILL: case AfterSale::TYPE_FILL:
$afterSale->update([ $afterSale->update([
'state' => $afterSale::STATE_AGREE, 'num' => $num,
'remarks' => $remarks, 'state' => $afterSale::STATE_AGREE,
'remarks' => $remarks,
]); ]);
AfterSaleLog::create([ AfterSaleLog::create([
'after_sale_id' => $afterSale->id, 'after_sale_id' => $afterSale->id,