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
42 lines
1.0 KiB
<?php
|
|
namespace App\Admin\Actions\Tools;
|
|
|
|
use App\Admin\Common\Auth;
|
|
use App\Models\ImsCjdcOrderMain;
|
|
use Dcat\Admin\Admin;
|
|
use Dcat\Admin\Grid\Tools\AbstractTool;
|
|
|
|
class ShowOrderStateHandle extends AbstractTool
|
|
{
|
|
protected $state;
|
|
public function __construct($state=null)
|
|
{
|
|
$this->state = $state;
|
|
parent::__construct($title=null);
|
|
}
|
|
|
|
protected function script()
|
|
{
|
|
$url = "order?state=".$this->state;
|
|
return <<<JS
|
|
$(".order_state_{$this->state}").on('click',function () {
|
|
window.location.href = "{$url}"
|
|
});
|
|
JS;
|
|
}
|
|
|
|
public function render()
|
|
{
|
|
$title = '';
|
|
$count = ImsCjdcOrderMain::getOrderStateCount($this->state,Auth::getMarket());
|
|
if ($this->state==8){
|
|
$title = "退款申请(".$count.")";
|
|
}elseif ($this->state==2){
|
|
$title = "待接单(".$count.")";
|
|
}
|
|
Admin::script($this->script());
|
|
return "<a class=\"btn btn-primary order_state_{$this->state}\">{$title}</a>";
|
|
}
|
|
|
|
|
|
}
|