6
0
Fork 0
release
李静 2022-02-21 17:26:18 +08:00
parent dd6aa228e1
commit 4f4d6a5115
3 changed files with 19 additions and 1 deletions

View File

@ -92,7 +92,11 @@ class DealerOrderController extends AdminController
$actions->append(new DealerOrderPaid()); $actions->append(new DealerOrderPaid());
} }
if ($actions->row->isPay() && Admin::user()->can('dcat.admin.dealer_orders.refuse')) { if (
$actions->row->isPay() &&
$actions->row->isPayWayOffline() &&
Admin::user()->can('dcat.admin.dealer_orders.refuse')
) {
$actions->append(new DealerOrderRefuse()); $actions->append(new DealerOrderRefuse());
} }

View File

@ -30,6 +30,10 @@ class DealerOrderRefuse extends Form
$order = DealerOrder::lockForUpdate()->findOrFail($id); $order = DealerOrder::lockForUpdate()->findOrFail($id);
if (! $order->isPayWayOffline()) {
throw new BizException('订单付款方式不是线下打款');
}
if (! $order->isPay()) { if (! $order->isPay()) {
throw new BizException('无法收款:订单状态异常,请刷新后再试'); throw new BizException('无法收款:订单状态异常,请刷新后再试');
} }

View File

@ -244,6 +244,16 @@ class DealerOrder extends Model
return $this->status == DealerOrderStatus::Cancelled; return $this->status == DealerOrderStatus::Cancelled;
} }
/**
* 支付方式是否是线下打款
*
* @return bool
*/
public function isPayWayOffline(): bool
{
return $this->pay_way === static::PAY_WAY_OFFLINE;
}
/** /**
* 能否操作 * 能否操作
* *