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

50 lines
1.3 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. if ($this->state){
  18. $url = "order?order_state=".$this->state.'&'."time=".(time()-(7*86400));
  19. }else{
  20. $url = "order";
  21. }
  22. return <<<JS
  23. $(".order_state_{$this->state}").on('click',function () {
  24. window.location.href = "{$url}"
  25. });
  26. JS;
  27. }
  28. public function render()
  29. {
  30. $title = '<i class="feather icon-rotate-ccw"></i> 重置';
  31. $count = ImsCjdcOrderMain::getOrderStateCount($this->state,Auth::getMarket());
  32. if ($this->state==8){
  33. $title = "退款申请(".$count.")";
  34. }elseif ($this->state==2){
  35. $title = "待接单(".$count.")";
  36. }elseif ($this->state==3){
  37. $title = "待发货(".$count.")";
  38. }elseif ($this->state==311){
  39. $title = "配送中(".$count.")";
  40. }
  41. Admin::script($this->script());
  42. return "<button class=\"btn btn-primary order_state_{$this->state}\">{$title}</button>";
  43. }
  44. }