6
0
Fork 0

添加用户列表,售后显示用户昵称

release
vine_liutk 2022-01-04 18:01:02 +08:00
parent 7c87db03b1
commit 11c1f93e56
4 changed files with 18 additions and 5 deletions

View File

@ -31,7 +31,7 @@ class AfterSaleController extends AdminController
*/
protected function grid()
{
$builder = AfterSale::with(['user', 'order', 'orderProduct', 'tags']);
$builder = AfterSale::with(['user', 'user.userInfo', 'order', 'orderProduct', 'tags']);
return Grid::make($builder, function (Grid $grid) {
$orderProductId = Request::query('order_product_id', 0);
@ -48,6 +48,7 @@ class AfterSaleController extends AdminController
return $array;
})->label();
$grid->column('user.phone')->copyable();
$grid->column('user.userInfo.nickname');
$grid->column('order.sn')->if(function () {
return Admin::user()->can('dcat.admin.orders.show');
})
@ -123,16 +124,14 @@ class AfterSaleController extends AdminController
{
return function (Row $row) use ($id) {
$row->column(4, function ($column) use ($id) {
$builder = AfterSale::with(['user', 'order', 'orderProduct', 'tags']);
$builder = AfterSale::with(['user', 'user.userInfo', 'order', 'orderProduct', 'tags']);
$column->row(Show::make($id, $builder, function (Show $show) {
$show->field('id');
$show->field('sn');
$show->field('order.sn');
$show->field('user.phone');
$show->field('user.user_info.nickname');
$show->field('order_product.name');
$show->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
$show->field('num');
if (in_array($show->model()->type, [AfterSaleModel::TYPE_REFUND_AND_RETURN, AfterSaleModel::TYPE_REFUND])) {
$show->field('amount')->as(function ($amount) {
@ -157,6 +156,9 @@ class AfterSaleController extends AdminController
AfterSaleModel::STATE_FINISH=>'success',
AfterSaleModel::STATE_CANCEL=>'#b3b9bf',
]);
$show->field('tags')->as(function () {
return $this->tags->pluck('name');
})->label();
// $show->field('order_product.cover')->image();
$show->field('created_at');
$show->field('updated_at');

View File

@ -42,6 +42,8 @@ class UserController extends AdminController
return Grid::make($builder, function (Grid $grid) {
// $grid->column('id')->sortable();
$grid->column('phone')->copyable();
$grid->column('userInfo.nickname');
$grid->column('userInfo.agent_level')->display(function ($value) {
return $this->userInfo?->agent_level_name??'未知';
})->label();
@ -144,6 +146,7 @@ class UserController extends AdminController
$column->row(Show::make($id, $builder, function (Show $show) {
$show->field('id');
$show->field('phone');
$show->field('user_info.nickname');
$show->field('user_info.agent_level')->as(function ($value) {
return $this->userInfo?->agent_level_name??'未知';
})->label();

View File

@ -9,6 +9,12 @@ return [
'user_id' => '用户ID',
'user'=>[
'phone' => '手机号',
'userInfo' => [
'nickname' => '昵称',
],
'user_info'=>[
'nickname' => '昵称',
],
],
'order_id' => '原订单ID',
'order'=>[

View File

@ -23,6 +23,7 @@ return [
],
'userInfo'=>[
'avatar' => '头像',
'nickname' => '昵称',
'agent_level'=>'管理级别',
'growth_value'=>'消费值',
'group_sales_value'=>'业绩',
@ -34,6 +35,7 @@ return [
],
'user_info'=>[
'avatar' => '头像',
'nickname' => '昵称',
'agent_level'=>'管理级别',
'growth_value'=>'消费值',
'group_sales_value'=>'业绩',