You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
<?php
|
|
|
|
|
|
namespace App\Admin\Actions\Tools;
|
|
|
|
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Grid\Tools\AbstractTool;
|
|
|
|
class DataReportOrder extends AbstractTool
|
|
{
|
|
protected $url;
|
|
protected $option;
|
|
protected $route;
|
|
public function __construct($route)
|
|
{
|
|
$this->route = $route;
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function script()
|
|
{
|
|
return <<<JS
|
|
$("#{$this->option}").change(function () {
|
|
var url = "{$this->url}"
|
|
Dcat.reload(url)
|
|
});
|
|
JS;
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$options = [
|
|
'al'=>'全部',
|
|
'online' => '外卖',
|
|
'offline' => '当面付',
|
|
|
|
|
|
];
|
|
|
|
$data = [
|
|
'al'=>'0',
|
|
'online' => '1',
|
|
'offline' => '2',
|
|
|
|
];
|
|
|
|
foreach ($data as $key=>$value){
|
|
$this->url = "{$this->route}?order_type={$key}&option={$value}&&name={$options[$key]}";
|
|
$this->option = $key;
|
|
Admin::script($this->script());
|
|
}
|
|
return view('admin.tools.data_report_order', compact('options'));
|
|
}
|
|
}
|