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.
109 lines
3.0 KiB
109 lines
3.0 KiB
<?php
|
|
|
|
namespace app\admin\controller\project;
|
|
|
|
use app\common\controller\Backend;
|
|
use app\common\model\ProjectCategory;
|
|
use app\common\model\ProjectOrderAfterSales;
|
|
use app\common\model\ProjectOrderMaterial;
|
|
use app\common\model\ProjectWorkerOrder;
|
|
use function fast\e;
|
|
|
|
/**
|
|
* 项目工单管理
|
|
*
|
|
* @icon fa fa-circle-o
|
|
*/
|
|
class Order extends ProjectBase
|
|
{
|
|
|
|
/**
|
|
* Order模型对象
|
|
* @var \app\admin\model\project\Order
|
|
*/
|
|
protected $model = null;
|
|
/**
|
|
* @var array|mixed
|
|
*/
|
|
private $order_id;
|
|
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new \app\admin\model\project\Order;
|
|
$this->view->assign('company_id', $this->auth->company_id);
|
|
}
|
|
|
|
public function index()
|
|
{
|
|
//设置过滤方法
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
if (false === $this->request->isAjax()) {
|
|
return $this->view->fetch();
|
|
}
|
|
//如果发送的来源是 Selectpage,则转发到 Selectpage
|
|
if ($this->request->request('keyField')) {
|
|
return $this->selectpage();
|
|
}
|
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
|
$list = $this->model;
|
|
if ($this->auth->isCompanyAdmin()) {
|
|
$list->where('company_id', $this->auth->company_id);
|
|
}
|
|
$list = $list
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->paginate($limit);
|
|
foreach ($list as $row) {
|
|
$row['build_status'] = $row['build_status'] ? $row['build_status'] : '未开始';
|
|
}
|
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
return json($result);
|
|
}
|
|
|
|
|
|
/**
|
|
* 售后详情
|
|
*/
|
|
public function salesDetail($ids) {
|
|
if ($this->request->isAjax()) {
|
|
$order = \app\admin\model\project\Order::get($ids);
|
|
if (empty($order->after_sale_status)) {
|
|
$this->error('非售后订单无法查看');
|
|
} else {
|
|
$this->success('跳转','',['url'=>'project/order/salesDetail/ids/'.$ids."?addtabs=1",'title'=>'售后单']);
|
|
}
|
|
}
|
|
$data = ProjectOrderAfterSales::getSales($ids);
|
|
return $this->view->fetch('salesDetail',['data' => $data]);
|
|
}
|
|
|
|
/**
|
|
* 工单详情
|
|
*/
|
|
public function detail($ids) {
|
|
$data = ProjectWorkerOrder::where('id', $ids)->find();
|
|
$category_info = ProjectCategory::getProgress($ids,$data['category_id']);
|
|
if (!$category_info) {
|
|
$this->error('暂无数据','');
|
|
}
|
|
$data = array_merge($data->toArray(), $category_info);
|
|
$this->view->assign('data', $data);
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
|
|
/**
|
|
* 材料单
|
|
*/
|
|
public function orderMaterial($ids) {
|
|
$data = ProjectOrderMaterial::getListByOrderId($ids);
|
|
if (!$data){
|
|
$this->error('暂无数据', url('index'));
|
|
}
|
|
return $this->view->fetch("orderMaterial", ['data' => $data]);
|
|
}
|
|
|
|
|
|
}
|
|
|