From e3fadb4be511784a270775d1319b189951c12fa3 Mon Sep 17 00:00:00 2001 From: dengbw Date: Wed, 22 Sep 2021 16:22:12 +0800 Subject: [PATCH] admin_customer_922 --- admin/controllers/receiver/Customer.php | 94 ++++++-- admin/views/receiver/customer/lists.php | 266 ++++++++++++---------- admin/views/receiver/order/loan/lists.php | 6 +- 3 files changed, 229 insertions(+), 137 deletions(-) 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 @@ -
- -
- -
-
- -
-
- -
-
-
@@ -92,7 +64,47 @@
- +
+
+ +
+ +
+
+ +
+
+ +
+
+ +
+
+
+ +
+ +
+
$value) { ?>
@@ -141,7 +153,7 @@ 客户来源 所属门店 状态 - 跟进人 + 销售员 最后联系时间 @@ -238,21 +250,21 @@ params: [], searchTpAry: [], lists: [], - cityAry: [], - countyAry: [], + qdjl_lists: [], cfrom_id:, cfrom_id2:, cfroms: [], cfroms2: [], - bizList: [], + admins: {cityAry: [], countyAry: [], bizAry: [], list: []}, }, mounted: function () { var vm = this; vm.params = ; vm.searchTpAry = ; vm.lists = ; - this.init_citys(); + vm.qdjl_lists = ; this.getCfroms(); + vm.init_citys(); }, methods: { getCfroms: function () { @@ -293,28 +305,30 @@ }, init_citys: function () { var vm = this; - $.get('common/area', {id: '350', key: 'city', type: 1}, function (response) { - if (response.code == 1) { - vm.cityAry = response.data; + $.ajax({ + type: 'get', + url: '/common/area', + dataType: 'json', + data: { + id: '350', + key: 'city', + type: 1 + }, + success: function (response) { + if (response.code == 1) { + //vm.cityAry = response.data; + vm.admins.cityAry = JSON.parse(JSON.stringify(response.data)); + } } }); - if (vm.params.city_id > 0) { - $.get('common/area', {id: vm.params.city_id, key: 'county', type: 1}, function (response) { - if (response.code == 1) { - vm.countyAry = response.data; - } - }); - } }, reset: function () { var that = this; that.params.search_tp = 'mobile'; that.params.title = ''; - that.params.city_id = ''; - that.params.county_id = ''; - that.params.biz_id = ''; that.cfrom_id = 0; that.cfrom_id2 = 0; + that.params.city_id_admin = ''; $('#cf_time').val(''); $(".order-times").map(function () { var id = this.value; @@ -326,73 +340,6 @@ } }, watch: { - 'params.city_id': function (nv, ov) { - var that = this; - if (nv == '') { - that.countyAry = []; - that.bizList = []; - that.params.county_id = ''; - that.params.biz_id = ''; - } else { - $.get('common/area', {id: nv, key: 'county', type: 1}, function (response) { - if (response.code == 1) { - that.countyAry = response.data; - if (that.params.county_id > 0) { - var county_id = ''; - for (var i in that.countyAry) { - var county = that.countyAry[i]; - if (county.id == that.params.county_id) { - county_id = county.id; - break; - } - } - that.params.county_id = county_id; - } - } - }); - $.post('receiver/clues/get_adviser', { - city_id: that.params.city_id, - county_id: that.params.county_id - }, function (response) { - if (response.code == 1) { - that.bizList = response.data.bizList; - if (that.params.biz_id > 0) { - var biz_id = ''; - for (var i in that.bizList) { - var biz = that.bizList[i]; - if (biz.id == that.params.biz_id) { - biz_id = biz.id; - break; - } - } - that.params.biz_id = biz_id; - } - } - }); - } - }, - 'params.county_id': function (nv, ov) { - var that = this; - $.post('receiver/clues/get_adviser', { - city_id: that.params.city_id, - county_id: that.params.county_id - }, function (response) { - if (response.code == 1) { - that.bizList = response.data.bizList; - if (that.params.biz_id > 0) { - var biz_id = ''; - for (var i in that.bizList) { - var biz = that.bizList[i]; - if (biz.id == that.params.biz_id) { - biz_id = biz.id; - break; - } - } - that.params.biz_id = biz_id; - } - } - }); - }, 'cfrom_id': function (nv, ov) { var that = this; if (nv == '') { @@ -414,6 +361,97 @@ } }); } + }, + 'params.city_id_admin': function (nv, ov) { + var that = this; + if (nv == '') { + that.admins.countyAry = []; + that.params.county_id_admin = ''; + } else { + if (nv.substring(0, 4) != that.params.county_id_admin.substring(0, 4)) { + that.params.county_id_admin = ''; + } + $.ajax({ + type: 'get', + url: '/common/area', + dataType: 'json', + data: { + id: nv, + key: 'county', + type: 1 + }, + success: function (response) { + if (response.code == 1) { + that.admins.countyAry = response.data; + } + } + }); + } + }, + 'params.county_id_admin': function (nv, ov) { + var that = this; + if (nv == '') { + that.admins.bizAry = []; + that.params.biz_id_admin = ''; + } else { + $.ajax({ + type: 'post', + url: '/biz/store/store/json_lists', + dataType: 'json', + data: { + city_id: that.params.city_id_admin, + county_id: that.params.county_id_admin, + status: 1 + }, + success: function (response) { + if (response.code == 1) { + that.admins.bizAry = response.data.list; + if (that.params.biz_id_admin > 0) { + var biz_id = ''; + for (var i in that.admins.bizAry) { + if (that.params.biz_id_admin == that.admins.bizAry[i].id) { + biz_id = that.params.biz_id_admin; + break; + } + } + that.params.biz_id_admin = biz_id; + } + } + } + }); + } + }, + 'params.biz_id_admin': function (nv, ov) { + var that = this; + if (nv == '') { + that.admins.list = []; + that.params.admin_id = ''; + } else { + $.ajax({ + type: 'post', + url: '/app/licheb/member/json_lists', + dataType: 'json', + data: { + biz_id: nv, + status: 1 + }, + success: function (response) { + if (response.code == 1) { + that.admins.list = response.data.list; + if (that.params.admin_id > 0) { + var admin_id = ''; + for (var i in that.admins.list) { + if (that.params.admin_id == that.admins.list[i].id) { + admin_id = that.params.admin_id; + break; + } + } + that.params.admin_id = admin_id; + } + } + } + }); + } } } }); diff --git a/admin/views/receiver/order/loan/lists.php b/admin/views/receiver/order/loan/lists.php index f4bac147..153e7575 100644 --- a/admin/views/receiver/order/loan/lists.php +++ b/admin/views/receiver/order/loan/lists.php @@ -188,12 +188,12 @@ - - + + - +
客户姓名客户电话客户姓名客户电话 分期产品 年限 首付金额分期时间分期时间 状态 操作