- 新增epay v2、v3、v3new版本的支付类库及证书文件 - 新增cos云存储类库文件 - 调整文件上传保存格式为按分类存储 - 修复会员、规则、类目等语言翻译键名 - 新增小程序图标等静态资源文件
100 行
3.3 KiB
PHP
100 行
3.3 KiB
PHP
<?php
|
|
|
|
namespace app\admin\controller;
|
|
|
|
use app\common\controller\Backend;
|
|
|
|
/**
|
|
* 订单
|
|
*
|
|
* @icon fa fa-circle-o
|
|
*/
|
|
class Order extends Backend
|
|
{
|
|
|
|
/**
|
|
* Order模型对象
|
|
* @var \app\admin\model\Order
|
|
*/
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new \app\admin\model\Order;
|
|
$this->view->assign("priceTypeList", $this->model->getPriceTypeList());
|
|
$this->view->assign("statusList", $this->model->getStatusList());
|
|
$this->view->assign("payStatusList", $this->model->getPayStatusList());
|
|
$this->view->assign("settleStatusList", $this->model->getSettleStatusList());
|
|
$this->view->assign("isReviewList", $this->model->getIsReviewList());
|
|
$this->view->assign("hasElevatorList", $this->model->getHasElevatorList());
|
|
$this->view->assign("urgentList", $this->model->getUrgentList());
|
|
}
|
|
|
|
protected $relationSearch = true;
|
|
|
|
public function index()
|
|
{
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
if (false === $this->request->isAjax()) {
|
|
return $this->view->fetch();
|
|
}
|
|
if ($this->request->request('keyField')) {
|
|
return $this->selectpage();
|
|
}
|
|
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
|
$list = $this->model
|
|
->with(['user', 'master'])
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->paginate($limit);
|
|
$result = ['total' => $list->total(), 'rows' => $list->items()];
|
|
return json($result);
|
|
}
|
|
|
|
/**
|
|
* 工单全景详情
|
|
*/
|
|
public function detail($ids = null)
|
|
{
|
|
$row = $this->model->with(['user', 'master'])->find($ids);
|
|
if (!$row) {
|
|
$this->error(__('No Results were found'));
|
|
}
|
|
|
|
// 1. 多商品/多工项明细
|
|
$goodsList = \think\Db::name('order_goods')->where('order_id', $row['id'])->select();
|
|
|
|
// 2. 现场施工取证图片 (区分报损、过程、完工)
|
|
$mediaList = \think\Db::name('order_media')->where('order_id', $row['id'])->order('id asc')->select();
|
|
|
|
// 3. 履约轨迹日志
|
|
$logList = \think\Db::name('order_log')->where('order_id', $row['id'])->order('createtime asc')->select();
|
|
|
|
// 4. 师傅报价列表
|
|
$quoteList = \think\Db::name('order_quote')
|
|
->alias('q')
|
|
->join('fa_master m', 'q.master_id = m.id', 'LEFT')
|
|
->field('q.*, m.realname as master_name, m.mobile as master_mobile, m.score as master_score')
|
|
->where('q.order_id', $row['id'])
|
|
->order('q.id desc')
|
|
->select();
|
|
|
|
// 5. 客户评价与回复
|
|
$review = \think\Db::name('review')->where('order_id', $row['id'])->find();
|
|
|
|
// 6. 财务结算记录
|
|
$settle = \think\Db::name('settle')->where('order_id', $row['id'])->find();
|
|
|
|
$this->view->assign('row', $row);
|
|
$this->view->assign('goodsList', $goodsList);
|
|
$this->view->assign('mediaList', $mediaList);
|
|
$this->view->assign('logList', $logList);
|
|
$this->view->assign('quoteList', $quoteList);
|
|
$this->view->assign('review', $review);
|
|
$this->view->assign('settle', $settle);
|
|
|
|
return $this->view->fetch();
|
|
}
|
|
}
|