链街Dcat后台
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.

59 lines
1.5 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <?php
  2. namespace App\Admin\Actions\Tools;
  3. use Dcat\Admin\Admin;
  4. use Dcat\Admin\Grid\Tools\AbstractTool;
  5. class DataReportOrder extends AbstractTool
  6. {
  7. protected $url;
  8. protected $option;
  9. protected $route;
  10. protected $dateTime;
  11. protected $marketId;
  12. public function __construct($route,$marketId,$dateTime)
  13. {
  14. $this->route = $route;
  15. $this->dateTime = $dateTime;
  16. $this->marketId = $marketId;
  17. parent::__construct();
  18. }
  19. protected function script()
  20. {
  21. return <<<JS
  22. $("#{$this->option}").change(function () {
  23. var url = "{$this->url}"
  24. Dcat.reload(url)
  25. });
  26. JS;
  27. }
  28. public function render()
  29. {
  30. $options = [
  31. 'amount' => '金额',
  32. 'num' => '单数',
  33. ];
  34. $data = [
  35. 'amount' => '1',
  36. 'num' => '2',
  37. ];
  38. $option = request()->get('option');
  39. $this->dateTime['start'] = date('Y-m-d',$this->dateTime['start']);
  40. $this->dateTime['end'] = date('Y-m-d',$this->dateTime['end']);
  41. foreach ($data as $key=>$value){
  42. $this->url = "{$this->route}?order_type={$key}&option={$option}&name={$options[$key]}&market_id={$this->marketId}&created_at[start]={$this->dateTime['start']}&created_at[end]={$this->dateTime['end']}";
  43. $this->option = $key;
  44. Admin::script($this->script());
  45. }
  46. return view('admin.tools.data_report_order', compact('options'));
  47. }
  48. }