Commit 796f0563 authored by zhuwei's avatar zhuwei

PC-进场记录列表

parent 83da920a
<?php
namespace app\index\controller;
/**
* Created by PhpStorm.
* 进场相关
* User: zhuwei
* Date: 2018/6/13
* Time: 上午10:18
*/
use app\index\extend\Basic;
use app\model\OMarchInModel;
use think\Request;
class MarchIn extends Basic
{
protected $oMarchInModel;
public function __construct($request = null)
{
parent::__construct($request);
$this->oMarchInModel = new OMarchInModel();
}
/**
* 进场记录列表
* User: 朱伟
* Date: 2018/6/13
* Time: 上午10:34
*/
public function marchInList(){
if ($this->request->isAjax()) {
return view('marchin/marchin_list');
}
$result = '';
$params = $this->params;
$checkResult = $this->validate($params, "VerifyValidate.select");
if (true !== $checkResult) {
//return $this->response("101", $checkResult);
}
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//搜索条件 start
//1.评价时间
if (!empty($params['create_time_start']) && !empty($params['create_time_end'])) {
$where['a.create_time'] = ['between time', [$params['create_time_start']. ' 00:00:00', $params['create_time_end'] . ' 23:59:59']];
}
//2.部门
if (!empty($params['district_id'])) {
$where['a.district_id'] = $params['district_id'];
}
//3.门店名称
if (!empty($params['store_id'])) {
$where['c.store_id'] = $params['store_id'];
}
//4.姓名
if (!empty($params['user_name'])) {
$where['b.user_name'] = ['LIKE','%'.$params['user_name'].'%'];
}
//5.手机号
if (!empty($params['user_phone'])) {
$where['b.user_phone'] = ['LIKE','%'.$params['user_phone'].'%'];
}
//6.进场时间
//if (!empty($params['registration_start']) && !empty($params['registration_end'])) {
//$where['a.registration_time'] = ['between time', [$params['registration_start']. ' 00:00:00', $params['registration_end'] . ' 23:59:59']];
//}
//搜索条件 end
$fields_evaluate = 'd.user_name,d.user_phone,a.create_time,d.report_agent_name,d.report_agent_phone,e.store_name,c.house_title';
$data['list'] = $this->oMarchInModel->findmarchInList($pageNo, $pageSize, 'a.id desc', $fields_evaluate, $where);
$data['total'] = $this->oMarchInModel->findmarchInListCount($fields_evaluate, $where);
//var_dump($result);
//return $result;
return $this->response(200, 'success', $data);
}
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
</body>
</html>
\ No newline at end of file
...@@ -172,4 +172,36 @@ class OMarchInModel extends Model ...@@ -172,4 +172,36 @@ class OMarchInModel extends Model
->select(); ->select();
} }
public function findmarchInList($pageNo = 1, $pageSize = 15, $order_ = 'id desc', $field, $params = '') {
$result = $this
->field($field)
->alias('a')
->join('a_agents b', 'a.reception_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('o_report d', 'a.report_id = d.id', 'left')
->join('a_store e', 'd.report_store_id = e.id', 'left')
->where($params)
->order($order_)
->limit($pageSize)
->page($pageNo)
->select();
return $result;
}
public function findmarchInListCount($field, $params = '') {
$result = $this
->field($field)
->alias('a')
->join('a_agents b', 'a.reception_id = b.id', 'left')
->join('o_order c', 'a.order_id = c.id', 'left')
->join('o_report d', 'a.report_id = d.id', 'left')
->join('a_store e', 'd.report_store_id = e.id', 'left')
->where($params)
->count();
return $result;
}
} }
\ No newline at end of file
...@@ -243,10 +243,11 @@ Route::group('index', [ ...@@ -243,10 +243,11 @@ Route::group('index', [
'test' => ['index/WxTest/test', [ 'method' => 'POST|GET' ] ], //wx 'test' => ['index/WxTest/test', [ 'method' => 'POST|GET' ] ], //wx
//评价列表
'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13 'evaluationList' => [ 'index/Evaluation/evaluationList', [ 'method' => 'POST|GET' ] ], //评价列表 朱伟 2018-06-13
'marchInList' => [ 'index/MarchIn/marchInList', [ 'method' => 'POST|GET' ] ], //进场记录列表 朱伟 2018-06-13
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment