173 lines
6.8 KiB
PHP
173 lines
6.8 KiB
PHP
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Actions\Show\DealerWalletPay;
|
|
use App\Admin\Actions\Show\DealerWalletRefuse;
|
|
use App\Admin\Repositories\DealerWalletToBankLog;
|
|
use App\Models\DealerWalletToBankLog as DealerWalletToBankLogModel;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Form;
|
|
use Dcat\Admin\Grid;
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
use Dcat\Admin\Show;
|
|
|
|
class DealerWalletToBankLogController extends AdminController
|
|
{
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
$builder = DealerWalletToBankLog::with(['user']);
|
|
return Grid::make($builder, function (Grid $grid) {
|
|
$grid->column('id')->sortable();
|
|
$grid->column('user.phone');
|
|
$grid->column('amount')->prepend('¥');
|
|
$grid->column('rate')->append('%');
|
|
$grid->column('service_amount')->prepend('¥');
|
|
$grid->column('account_amount')->prepend('¥');
|
|
$grid->column('status')->using([
|
|
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
|
DealerWalletToBankLogModel::STATUS_AGREE=>'同意',
|
|
DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
|
])->dot([
|
|
0=>'primary',
|
|
1=>'success',
|
|
2=>'danger',
|
|
]);
|
|
$grid->column('remarks');
|
|
$grid->column('created_at')->sortable();
|
|
// $grid->column('updated_at')
|
|
$grid->model()->orderBy('status', 'asc');
|
|
$grid->model()->orderBy('created_at', 'desc');
|
|
|
|
$grid->actions(function (Grid\Displayers\Actions $actions) {
|
|
if (Admin::user()->can('dcat.admin.dealer_wallet_to_bank_logs.show')) {
|
|
$actions->append('<a style="cursor: pointer;" target="_blank" href="'.admin_route('dealer_wallet_to_bank_logs.show', ['dealer_wallet_to_bank_log'=>$actions->row]).'"><i class="feather icon-eye"></i> 显示 </a>');
|
|
}
|
|
});
|
|
|
|
$grid->filter(function (Grid\Filter $filter) {
|
|
$filter->panel();
|
|
$filter->equal('status')->select([
|
|
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
|
DealerWalletToBankLogModel::STATUS_AGREE=>'已同意',
|
|
DealerWalletToBankLogModel::STATUS_REFUSE=>'已拒绝',
|
|
])->width(3);
|
|
$filter->equal('user.phone')->width(3);
|
|
$filter->between('created_at')->dateTime()->width(7);
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a show builder.
|
|
*
|
|
* @param mixed $id
|
|
*
|
|
* @return Show
|
|
*/
|
|
protected function detail($id)
|
|
{
|
|
$builder = DealerWalletToBankLog::with(['user']);
|
|
return Show::make($id, $builder, function (Show $show) {
|
|
$show->field('id');
|
|
$show->field('user.phone');
|
|
$show->field('amount')->prepend('¥');
|
|
$show->field('rate')->append('%');
|
|
$show->field('service_amount')->prepend('¥');
|
|
$show->field('account_amount')->prepend('¥');
|
|
$show->field('status')->using([
|
|
DealerWalletToBankLogModel::STATUS_PENDING=>'待处理',
|
|
DealerWalletToBankLogModel::STATUS_AGREE=>'同意',
|
|
DealerWalletToBankLogModel::STATUS_REFUSE=>'拒绝',
|
|
])->dot([
|
|
0=>'primary',
|
|
1=>'success',
|
|
2=>'danger',
|
|
]);
|
|
$show->field('pay_image')->image();
|
|
$show->field('remarks');
|
|
$show->divider('收款信息-银行');
|
|
$show->field('bank_user_name', '银行-收款人')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['bank']['user_name']??'';
|
|
});
|
|
$show->field('bank_bank_name', '银行-名称')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['bank']['bank_name']??'';
|
|
});
|
|
$show->field('bank_bank_number', '银行-卡号')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['bank']['bank_number']??'';
|
|
});
|
|
$show->field('bank_bank_description', '银行-开户行')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['bank']['bank_description']??'';
|
|
});
|
|
$show->divider('收款信息-支付宝');
|
|
$show->field('alipay_user_name', '支付宝-真实名称')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['alipay']['user_name']??'';
|
|
});
|
|
$show->field('alipay_ali_name', '支付宝-账户')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['alipay']['ali_name']??'';
|
|
});
|
|
$show->field('alipay_image', '支付宝-收款码')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['alipay']['image']??'';
|
|
})->image();
|
|
$show->divider('收款信息-微信');
|
|
$show->field('wechat_user_name', '微信-真实名称')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['wechat']['user_name']??'';
|
|
});
|
|
$show->field('wechat_wechat_name', '微信-ID')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['wechat']['wechat_name']??'';
|
|
});
|
|
$show->field('wechat_image', '微信-收款码')->as(function () {
|
|
$payInfo = $this->getPayInfo();
|
|
return $payInfo['wechat']['image']??'';
|
|
})->image();
|
|
$show->field('created_at');
|
|
|
|
$show->panel()
|
|
->tools(function (Show\Tools $tools) use ($show) {
|
|
$tools->disableEdit();
|
|
$tools->disableDelete();
|
|
if ($show->model()->isPending() && Admin::user()->can('dcat.admin.dealer_wallet_to_bank_logs.verify')) {
|
|
$tools->append(new DealerWalletRefuse());
|
|
$tools->append(new DealerWalletPay());
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Make a form builder.
|
|
*
|
|
* @return Form
|
|
*/
|
|
protected function form()
|
|
{
|
|
return Form::make(new DealerWalletToBankLog(), function (Form $form) {
|
|
$form->display('id');
|
|
$form->text('user_id');
|
|
$form->text('amount');
|
|
$form->text('rate');
|
|
$form->text('service_amount');
|
|
$form->text('account_amount');
|
|
$form->text('status');
|
|
$form->text('remarks');
|
|
|
|
$form->display('created_at');
|
|
$form->display('updated_at');
|
|
});
|
|
}
|
|
}
|