43 lines
1021 B
PHP
43 lines
1021 B
PHP
<?php
|
|
|
|
namespace Modules\Mall\Http\Controllers\Admin\Action\Order;
|
|
|
|
use Encore\Admin\Actions\Response;
|
|
use Encore\Admin\Actions\RowAction;
|
|
use Encore\Admin\Facades\Admin;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class RefundSign extends RowAction
|
|
{
|
|
|
|
public $name = '签收';
|
|
|
|
public function handle(Model $model): Response
|
|
{
|
|
try {
|
|
$admin = Admin::user();
|
|
|
|
if (!$model->can('sign')) {
|
|
return $this->response()->error('不可操作')->refresh();
|
|
}
|
|
|
|
$res = $model->setOperator($admin)->receive();
|
|
|
|
if ($res === true) {
|
|
return $this->response()->success('操作成功')->refresh();
|
|
}
|
|
|
|
return $this->response()->error('操作失败')->refresh();
|
|
} catch (\Exception $exception) {
|
|
return $this->response()->error($exception->getMessage())->refresh();
|
|
}
|
|
|
|
}
|
|
|
|
public function dialog()
|
|
{
|
|
$this->confirm('您确定已经收到货了吗');
|
|
}
|
|
|
|
}
|