diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 3e79b3c4..cf162a69 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -43,7 +43,7 @@ class Customer extends HD_Controller !$params['county_id'] && $params['county_id'] = ''; !$params['biz_id'] && $params['biz_id'] = ''; !$params['cf_title'] && $params['cf_title'] = ''; - + !$params['qdjl_id'] && $params['qdjl_id'] = ''; $page = $params['page'] = $params['page'] ? intval($params['page']) : 1; $size = $params['size'] = $params['size'] ? intval($params['size']) : 20; @@ -53,10 +53,57 @@ class Customer extends HD_Controller } !$params['search_tp'] && $params['search_tp'] = 'mobile'; strlen($params['status']) && $where["status"] = $params['status']; - $params['city_id'] && $where['city_id'] = $params['city_id']; - $params['county_id'] && $where['county_id'] = $params['county_id']; - $params['biz_id'] && $where['biz_id'] = $params['biz_id']; $params['cf_title'] && $where['cf_title'] = $params['cf_title']; + if ($params['qdjl_id']) { + $re_bu = $this->app_licheb_users_model->get(array('id'=>$params['qdjl_id'])); + if ($re_bu['biz_id']) { + $where["biz_id in({$re_bu['biz_id']})"] = null; + } else { + $where['biz_id'] = -1; + } + } + //销售员筛选 + if ($params['admin_id']) { + $where['admin_id'] = $params['admin_id']; + } else { + $where_lcb = array(); + if ($params['biz_id_admin']) {//指定店铺所有销售员 + $where_lcb['biz_id'] = $params['biz_id_admin']; + } else { + //指定城市的所有销售员 + $where_biz = array(); + if ($params['county_id_admin']) { + $where_biz['county_id'] = $params['county_id_admin']; + } else if ($params['city_id_admin']) { + $where_biz['city_id'] = $params['city_id_admin']; + } + if ($where_biz) { + $where_biz['status>-1'] = null; + $rows_biz = $this->biz_model->select($where_biz, 'id desc', 0, 0, 'id'); + if ($rows_biz) { + $str_ids = implode(',', array_column($rows_biz, 'id')); + $where_lcb["biz_id in({$str_ids})"] = null; + } else { + $where_lcb['biz_id'] = -1; + } + } + } + //获取目标销售员列表 + if ($where_lcb) { + $where_lcb['status>-1'] = null; + $rows_lcb = $this->app_licheb_users_model->select($where_lcb, 'id desc', 0, 0, 'id'); + if ($rows_lcb) { + $str_ids = implode(',', array_column($rows_lcb, 'id')); + $where["admin_id in({$str_ids})"] = null; + } else { + $where['admin_id'] = -1; + } + } + !$params['city_id_admin'] && $params['city_id_admin'] = ''; + !$params['county_id_admin'] && $params['county_id_admin'] = ''; + !$params['biz_id_admin'] && $params['biz_id_admin'] = ''; + $params['admin_id'] = ''; + } if ($params['c_time']) { $c_time = explode(' ~ ', $params['c_time']); $c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00'); @@ -108,7 +155,7 @@ class Customer extends HD_Controller $biz_id_arr = array_unique(array_column($rows, 'biz_id')); $biz_id_arr && $biz_rows = $this->biz_model->get_map_by_ids($biz_id_arr, 'id,biz_name'); foreach ($rows as $key => $val) { - if(SUPER_ADMIN == $this->role){ + if (SUPER_ADMIN == $this->role) { $mobile_sub = $val['mobile']; } else { $mobile_sub = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : ''; @@ -127,12 +174,16 @@ class Customer extends HD_Controller ); } } + //渠道经理 + $qdjl_lists = $this->app_licheb_users_model->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name'); + $this->data['lists'] = $lists; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); $this->data['searchTpAry'] = $this->searchTpAry; $this->data['searchTimeAry'] = $this->searchTimeAry; $this->data['params'] = $params; $this->data['status_arr'] = $status_arr; + $this->data['qdjl_lists'] = $qdjl_lists; $this->data['_title'] = '客户列表'; return $this->show_view('receiver/customer/lists', true); } @@ -165,7 +216,7 @@ class Customer extends HD_Controller $rows_log = $this->customer_oplogs_model->select(array('customer_id' => $id), 'c_time desc', 0, 0); //用户信息 - if(SUPER_ADMIN == $this->role){ + if (SUPER_ADMIN == $this->role) { $mobile_sub = $row['mobile']; } else { $mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : ''; @@ -371,33 +422,36 @@ class Customer extends HD_Controller } return $id; } + //更新晓致电话数据 - public function get_update_xz(){ + public function get_update_xz() + { $page = $this->input->get('page'); $size = $this->input->get('size'); $lk = $this->input->get('lk'); - !$page && $page = 1; + !$page && $page = 1; !$size && $size = 10; $where = [ 'cf_title' => 'customer', 'cf_platform' => 'api', 'status' => 1 ]; - if($lk){ - $rows = $this->receiver_xz_model->select($where,'id desc',$page,$size,'id,biz_id'); - print_r($rows);exit; + if ($lk) { + $rows = $this->receiver_xz_model->select($where, 'id desc', $page, $size, 'id,biz_id'); + print_r($rows); + exit; } $total = $this->receiver_xz_model->count($where); - $rows = $this->receiver_xz_model->select($where,'id desc',$page,$size,'id,cf_id'); - if($rows){ - foreach($rows as $key => $val){ - $row = $this->customers_model->get(['id'=>$val['cf_id']],'biz_id'); - if($row){ - $this->receiver_xz_model->update(['biz_id'=>$row['biz_id']],['id'=>$val['id']]); + $rows = $this->receiver_xz_model->select($where, 'id desc', $page, $size, 'id,cf_id'); + if ($rows) { + foreach ($rows as $key => $val) { + $row = $this->customers_model->get(['id' => $val['cf_id']], 'biz_id'); + if ($row) { + $this->receiver_xz_model->update(['biz_id' => $row['biz_id']], ['id' => $val['id']]); } - } - echo "total:{$total},剩余:".($total-$page*$size); - }else{ + } + echo "total:{$total},剩余:" . ($total - $page * $size); + } else { echo "finish"; } } diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index 75b80956..a0c7ca39 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -34,34 +34,6 @@ -
| 客户姓名 | -客户电话 | +客户姓名 | +客户电话 | 分期产品 | 年限 | 首付金额 | -分期时间 | +分期时间 | 状态 | 操作 |
|---|