链街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.

42 lines
1.0 KiB

  1. <?php
  2. namespace App\Admin\Actions\Tools;
  3. use App\Admin\Common\Auth;
  4. use App\Models\ImsCjdcOrderMain;
  5. use Dcat\Admin\Admin;
  6. use Dcat\Admin\Grid\Tools\AbstractTool;
  7. class ShowOrderStateHandle extends AbstractTool
  8. {
  9. protected $state;
  10. public function __construct($state=null)
  11. {
  12. $this->state = $state;
  13. parent::__construct($title=null);
  14. }
  15. protected function script()
  16. {
  17. $url = "order?state=".$this->state;
  18. return <<<JS
  19. $(".order_state_{$this->state}").on('click',function () {
  20. window.location.href = "{$url}"
  21. });
  22. JS;
  23. }
  24. public function render()
  25. {
  26. $title = '';
  27. $count = ImsCjdcOrderMain::getOrderStateCount($this->state,Auth::getMarket());
  28. if ($this->state==8){
  29. $title = "退款申请(".$count.")";
  30. }elseif ($this->state==2){
  31. $title = "待接单(".$count.")";
  32. }
  33. Admin::script($this->script());
  34. return "<a class=\"btn btn-primary order_state_{$this->state}\">{$title}</a>";
  35. }
  36. }