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

<?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()
{
if ($this->state){
$url = "order?order_state=".$this->state.'&'."time=".(time()-(7*86400));
}else{
$url = "order";
}
return <<<JS
$(".order_state_{$this->state}").on('click',function () {
window.location.href = "{$url}"
});
JS;
}
public function render()
{
$title = '<i class="feather icon-rotate-ccw"></i> 重置';
$count = ImsCjdcOrderMain::getOrderStateCount($this->state,Auth::getMarket());
if ($this->state==8){
$title = "退款申请(".$count.")";
}elseif ($this->state==2){
$title = "待接单(".$count.")";
}elseif ($this->state==3){
$title = "待发货(".$count.")";
}elseif ($this->state==311){
$title = "配送中(".$count.")";
}
Admin::script($this->script());
return "<button class=\"btn btn-primary order_state_{$this->state}\">{$title}</button>";
}
}