Commit e5b5596f authored by zfc's avatar zfc

跟进列表

parent 836a7438
......@@ -95,7 +95,7 @@ class Agent extends Basic
['auth_group g','a.auth_group_id=g.id','left']
];
$data['list'] = $table->getListJoin($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal2($where);
$data['total'] = $table->getTotal2($join,$where);
// prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr
return $this->response(200,'成功',$data);
......
<?php
/**
* Created by PhpStorm.
* User: zfc
* Date: 2018/2/9
* Time: 14:23
*/
namespace app\index\controller;
use app\index\extend\Basic;
use app\model\Remarks;
use think\Session;
class Remark extends Basic
{
//跟进主界面
public function RemarkFollowIndex(){
return view('remark_follow_index');
}
/**跟进列表
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function RemarkFollowList(){
$table= new Remarks;
$data['status'] = 200;
$data['msg'] = '';
//获取当前模块可操作按钮start********************************
$userRule = Session::get('userRule');
$data['cz']=$userRule['cz'];
//获取当前模块可操作按钮end**********************************
$params = $this->request->param();
//获取操作权限
$userRule=Session::get('userRule');
$data['userRule']=$userRule;
$pageNo = empty($params['pageNo']) ? 1 : $params['pageNo'];
$pageSize = empty($params['pageSize']) ? 15 : $params['pageSize'];
//条件
$where="r.isinstatus=1 and r.content like '%【跟进】%' ";
//--查询条件
//----跟进内容
if(!empty($params['content'])){
$where.=" and r.content like '%{$params['content']}%'";
}
//----客户手机号
if(!empty($params['phone'])){
$where.=" and a.phpone like '%{$params['phone']}%'";
}
//----客户姓名
if(!empty($params['customer'])){
$where.=" and a.customer like '%{$params['customer']}%'";
}
//----时间选择
if(!empty($params['start_time']) && !empty($params['end_time'])){
$where .= " and r.created (BETWEEN '{$params['start_time']} 00:00:00' and '{$params['start_time']} 23:59:59')";
}else if(!empty($params['start_time']) && empty($params['end_time'])){
$where .= " and '{$params['start_time']} 00:00:00' <= r.created ";
}else if(empty($params['start_time']) && !empty($params['end_time'])){
$where .= " and '{$params['end_time']} 00:00:00' >= r.created ";
}
$field = "r.id,r.apply_id,r.shopuser_id,r.content,r.house_id,r.created,
a.customer,a.phpone,
a2.realname";
$order = 'r.id asc';
$join = [
['applies a', ' a.id=r.apply_id','left'],
['agents a2','a2.id=r.shopuser_id','left']
];
$data['list'] = $table->getListJoin($pageNo, $pageSize,$order,$field,$join, $where);
$data['total'] = $table->getTotal2($join,$where);
// prt($list);//转化arr
//prt(collection($list)->toArray());//转化arr
return $this->response(200,'成功',$data);
}
}
\ No newline at end of file
......@@ -103,9 +103,11 @@ public function saveList(){
* @param $params
* @return int|string
*/
public function getTotal2($params)
public function getTotal2($join,$params)
{
return $this->alias('a')->where($params)->count();
return $this->alias('a')
->join($join)
->where($params)->count();
}
/**
......
......@@ -6,16 +6,14 @@ use think\Model;
class Remarks extends Model
{
/**
* 成交记录列表
*
/**成交记录列表
* @param int $pageNo
* @param int $pageSize
* @param string $order_
* @param $field
* @param $params
* @param string $agent_id
* @return mixed
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
......@@ -48,4 +46,43 @@ class Remarks extends Model
return $data;
}
/**
* @param int $p
* @param int $pageSize
* @param string $order_
* @param string $field
* @param string $join
* @param string $where
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getListJoin($p = 1, $pageSize = 15, $order_ = 'id desc', $field = '',$join='', $where = '')
{
$data = $this->field($field)
->alias('r')
->join($join)
->where($where)
->order($order_)
->limit($pageSize)
->page($p)
->select();
//echo $this->getLastSql();
return $data;
}
/**
* @param $params
* @return int|string
*/
public function getTotal2($join,$params)
{
return $this->alias('r')
->join($join)
->where($params)->count();
}
}
......@@ -134,6 +134,10 @@ Route::group('index', [
'getDistrictStoreList' => ['index/Store/getStoreByDistrictId',['method'=>'get']], //通过部门id获得门店列表
'labelEdit' => ['index/label/index',['method'=>'get|post']], //编辑标签
'getLabelsList' => ['index/label/getLabelsList',['method'=>'get']], //标签列表
//数据统计
'RemarkFollowIndex'=>['index/Remark/RemarkFollowIndex',['method'=>'get']],//跟进列表主界面
'RemarkFollowList'=>['index/Remark/RemarkFollowList',['method'=>'get']],//跟进列表【接口】
]);
......
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