84 lines
2.9 KiB
PHP
Executable File
84 lines
2.9 KiB
PHP
Executable File
<?php
|
|
|
|
namespace App\Admin\Controllers;
|
|
|
|
use App\Admin\Forms\CustomerPasswordForm;
|
|
use App\Enums\BoolEnum;
|
|
use App\Model\Customer\Customer;
|
|
use Dcat\Admin\Grid;
|
|
use App\Model\Seller\Shop;
|
|
|
|
use Dcat\Admin\Http\Controllers\AdminController;
|
|
|
|
|
|
class CustomerController extends AdminController
|
|
{
|
|
protected $title='彩民管理';
|
|
/**
|
|
* Make a grid builder.
|
|
*
|
|
* @return Grid
|
|
*/
|
|
protected function grid()
|
|
{
|
|
return Grid::make(Customer::class, function (Grid $grid) {
|
|
$grid->model()->with('shop')->orderBy('id', 'desc');
|
|
|
|
$grid->column('id','ID');
|
|
|
|
$grid->column('shop.shop_sn','店铺编号');
|
|
$grid->column('shop.name','店铺名称');
|
|
$grid->column('phone','手机号');
|
|
$grid->column('name','真实名称');
|
|
$grid->column('nickname','昵称');
|
|
$grid->column('remark','店主备注');
|
|
$grid->column('agent','是否代理用户')->display(function() {
|
|
if ($this->agent == BoolEnum::YES) {
|
|
return '是';
|
|
}
|
|
return '否';
|
|
});
|
|
$grid->column('agent_brokerage','代理佣金');
|
|
$grid->column('balance','总余额')->help('可提现余额+不可提现余额+冻结余额');
|
|
$grid->column('balance_withdraw','可提现余额');
|
|
$grid->column('balance_cash','不可提现余额');
|
|
$grid->column('balance_freeze','冻结余额');
|
|
$grid->column('pd','修改(支付)密码')->modal(function (Grid\Displayers\Modal $modal){
|
|
|
|
// 标题
|
|
$modal->title('修改(支付)密码');
|
|
// 自定义图标
|
|
$modal->icon('feather icon-edit');
|
|
// 传递当前行字段值
|
|
return CustomerPasswordForm::make()->payload(['id' => $this->id]);
|
|
});
|
|
$grid->column('balance_freeze','冻结余额');
|
|
$grid->column('created_at','创建时间');
|
|
$grid->filter(function($filter){
|
|
$shops = Shop::pluck('name','id')->toArray();
|
|
$shopsn = Shop::pluck('shop_sn')->toArray();
|
|
|
|
$shopsns = [];
|
|
foreach ($shopsn as $s) {
|
|
$shopsns[$s] = $s;
|
|
}
|
|
|
|
$filter->equal('shop.id', '店铺')->select($shops);
|
|
$filter->equal('shop.shop_sn', '店铺编号')->select($shopsns);
|
|
|
|
$filter->panel();
|
|
$filter->like('name','用户名');
|
|
$filter->like('nickname','真实名称');
|
|
$filter->like('phone','手机号');
|
|
});
|
|
|
|
$grid->disableViewButton();
|
|
$grid->disableEditButton();
|
|
$grid->disableDeleteButton();
|
|
$grid->scrollbarX();//数据展开
|
|
$grid->disableActions();
|
|
$grid->disableRowSelector();
|
|
});
|
|
}
|
|
}
|