|
|
|
@ -41,11 +41,16 @@ class Salesman extends AdminController |
|
|
|
} else { |
|
|
|
return Grid::make(new \App\Admin\Repositories\v3\Salesman(), function (Grid $grid) { |
|
|
|
$grid->tools(new SalesmanOption()); |
|
|
|
$name = request()->get('name') ?? '今日'; |
|
|
|
$option = request()->get('option') ?? 1; |
|
|
|
$name = request()->get('name') ?(request()->get('name')=='全部'?'总':request()->get('name')): ''; |
|
|
|
$option = request()->get('option') ?? 0; |
|
|
|
$searchTime = request()->input('created_at');//搜索时间
|
|
|
|
if ($searchTime){ |
|
|
|
$content = "<a href='salesman_export?option={$option}&name={$name}&created_at[start]={$searchTime['start']}&created_at[end]={$searchTime['end']}' class='btn btn-primary feather icon-download'> 导出 </a>"; |
|
|
|
}else{ |
|
|
|
$content = "<a href='salesman_export?option={$option}&name={$name}' class='btn btn-primary feather icon-download'> 导出 </a>"; |
|
|
|
} |
|
|
|
$grid->paginate(10); |
|
|
|
$grid->tools("<a href='salesman_export?option={$option}&name={$name}' class='btn btn-primary feather icon-download'> 导出 </a>"); |
|
|
|
$grid->export(); |
|
|
|
$grid->tools($content); |
|
|
|
$grid->column('person_id', '懒ID'); |
|
|
|
$grid->column('nick_name', '拓展员'); |
|
|
|
$grid->column('total', '社区总数'); |
|
|
|
@ -58,28 +63,35 @@ class Salesman extends AdminController |
|
|
|
//$grid->column('order_user_num', $name.'下单人数');
|
|
|
|
$grid->column('order_num', $name . '订单数'); |
|
|
|
$grid->column('order_amount', $name . '成交额'); |
|
|
|
$grid->actions(function (Grid\Displayers\Actions $actions) use ($name, $option) { |
|
|
|
$grid->actions(function (Grid\Displayers\Actions $actions) use ($name, $option,$searchTime) { |
|
|
|
$row = $actions->row->toArray(); |
|
|
|
$actions->append(new \App\Admin\Extensions\Salesman($row['admin_user_id'], $name, $option, '详情')); |
|
|
|
$actions->append(new \App\Admin\Extensions\Salesman($row['admin_user_id'], $name, $option,$searchTime, '详情')); |
|
|
|
}); |
|
|
|
|
|
|
|
$grid->disableCreateButton(); |
|
|
|
$grid->disableEditButton(); |
|
|
|
$grid->disableDeleteButton(); |
|
|
|
$grid->disableViewButton(); |
|
|
|
$grid->filter(function (Grid\Filter $filter) { |
|
|
|
$grid->filter(function (Grid\Filter $filter)use ($option) { |
|
|
|
$filter->equal('person_id', '拓展员懒ID'); |
|
|
|
if ($option==0){ |
|
|
|
$filter->between('created_at','日期')->datetime(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 数据导出 |
|
|
|
* @return \Symfony\Component\HttpFoundation\BinaryFileResponse |
|
|
|
*/ |
|
|
|
public function export() |
|
|
|
{ |
|
|
|
$name = request()->get('name'); |
|
|
|
$option = request()->get('option'); |
|
|
|
return Excel::download(new \App\Admin\Actions\Exporter\SalesMan($option,$name), $name.'拓展员报表.xlsx'); |
|
|
|
$time = date('Y-m-d H:i:s',time()); |
|
|
|
return Excel::download(new \App\Admin\Actions\Exporter\SalesMan($option,$name), $time.'.xlsx'); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|