From ed292abb61f8f5d0028591fc2475731c2fa17b93 Mon Sep 17 00:00:00 2001 From: qianhy Date: Wed, 8 Feb 2023 09:39:30 +0800 Subject: [PATCH] customer cs_biz_id about --- admin/controllers/receiver/Customer.php | 17 ++++--- admin/views/receiver/customer/get.php | 2 +- admin/views/receiver/customer/lists.php | 15 ++++++- .../receiver/Receiver_customers_model.php | 45 +++++++++++++++++++ 4 files changed, 71 insertions(+), 8 deletions(-) diff --git a/admin/controllers/receiver/Customer.php b/admin/controllers/receiver/Customer.php index 2201dbb1..62d3994a 100644 --- a/admin/controllers/receiver/Customer.php +++ b/admin/controllers/receiver/Customer.php @@ -51,7 +51,7 @@ class Customer extends HD_Controller $offlineSources = $this->customers_model->offlineSources(); $wxqyAry = $this->customers_model->wxqyAry(); if ($count) { - $fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,level,of_id,of2_id,wxqy'; + $fileds = 'id,name,mobile,cf_title,cont_time,admin_id,status,biz_id,cs_biz_id,level,of_id,of2_id,wxqy'; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); //获取销售员 $admin_id_arr = array_unique(array_column($rows, 'admin_id')); @@ -81,6 +81,7 @@ class Customer extends HD_Controller 'of2_id' => $val['of2_id'], 'status_name' => $status_arr[$val['status']], 'wxqy_name' => $wxqyAry[$val['wxqy']], + 'to_send' => $this->customers_model->csbizidAry($val['cs_biz_id'] ? $val['cs_biz_id'] : 0), 'admin_name' => isset($admin_rows[$val['admin_id']]) ? $admin_rows[$val['admin_id']][0]['uname'] : '', 'biz_name' => isset($biz_rows[$val['biz_id']]) ? $biz_rows[$val['biz_id']][0]['biz_name'] : '', 'cont_time' => $val['cont_time'] != '0000-00-00 00:00:00' ? $val['cont_time'] : '', @@ -92,6 +93,7 @@ class Customer extends HD_Controller $show_info['levelAry'] = $this->customers_model->get_sdata('level'); $show_info['offlineSourcesAry'] = $offlineSources; $show_info['wxqyAry'] = $wxqyAry; + $show_info['csbizidAry'] = $this->customers_model->csbizidAry(); $this->data['show_info'] = $show_info; $this->data['lists'] = $lists; $this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count); @@ -107,6 +109,7 @@ class Customer extends HD_Controller private function get_where(&$params){ !$params['biz_id'] && $params['biz_id'] = ''; + !strlen($params['cs_biz_id']) && $params['cs_biz_id'] = ''; !$params['cf_title'] && $params['cf_title'] = ''; !$params['qdjl_id'] && $params['qdjl_id'] = ''; !$params['level'] && $params['level'] = ''; @@ -160,6 +163,7 @@ class Customer extends HD_Controller } else if ($params['city_id_admin']) { $where["biz_id in(select id from lc_biz where city_id={$params['city_id_admin']})"] = null; } + $where[$this->customers_model->csbizidWhere($params['cs_biz_id'])] = null; !$params['city_id_admin'] && $params['city_id_admin'] = ''; !$params['county_id_admin'] && $params['county_id_admin'] = ''; !$params['biz_id_admin'] && $params['biz_id_admin'] = ''; @@ -272,12 +276,13 @@ class Customer extends HD_Controller } $invalid_user_tag = []; $row['status']==3 && $invalid_user_tag = $this->get_tag($row['id'],1); - $to_send = ''; + /*$to_send = ''; if ($row['cs_biz_id'] == -1) { $to_send = '已改派'; } else if ($row['cs_biz_id'] > 0) { $to_send = '接收线索'; - } + }*/ + $to_send = $this->customers_model->csbizidAry($row['cs_biz_id'] ? $row['cs_biz_id'] : 0); $info = array( 'id' => $row['id'], 'name' => $row['name'], @@ -525,7 +530,7 @@ class Customer extends HD_Controller $params = $this->input->get(); $where = $this->get_where($params); - $where["cs_biz_id >= 0"] = null; + #$where["cs_biz_id >= 0"] = null; $page = 1; $size = 10000; @@ -535,7 +540,7 @@ class Customer extends HD_Controller $status_arr = $this->customers_model->get_status(); unset($status_arr['-1']); if ($count) { - $fileds = "id, name, mobile, level, status, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_time, cf_title, cf_id, of_id, of2_id, (SELECT biz_name FROM `lc_biz` where id = `lc_receiver_customers`.biz_id) as biz_name, (SELECT uname FROM `lc_app_licheb_users` where id = `lc_receiver_customers`.admin_id) as admin_name, biz_id, admin_id"; + $fileds = "id, name, mobile, level, status, cs_biz_id, FROM_UNIXTIME(c_time) as c_time, if(dt_time>0, dt_time,'') as dt_time, if(order_time>0, order_time,'') as order_time, if(cont_time>0, cont_time,'') as cont_time, cf_title, cf_id, of_id, of2_id, (SELECT biz_name FROM `lc_biz` where id = `lc_receiver_customers`.biz_id) as biz_name, (SELECT uname FROM `lc_app_licheb_users` where id = `lc_receiver_customers`.admin_id) as admin_name, biz_id, admin_id"; $rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds); foreach ($rows as $key => $val) { $of_title = ''; @@ -553,6 +558,7 @@ class Customer extends HD_Controller 'mobile' => $val['mobile'], 'level' => $val['level'], 'status_name' => $status_arr[$val['status']], + 'to_send' => $this->customers_model->csbizidAry($val['cs_biz_id'] ? $val['cs_biz_id'] : 0), 'c_time' => $val['c_time'], 'dt_time' => $val['dt_time'], 'order_time' => $val['order_time'], @@ -570,6 +576,7 @@ class Customer extends HD_Controller 'mobile' => '手机', 'level' => '客户等级', 'status_name' => '客户状态', + 'to_send' => '是否改派', 'c_time' => '建档时间', "dt_time" => "到店时间", "order_time" => "下单时间", diff --git a/admin/views/receiver/customer/get.php b/admin/views/receiver/customer/get.php index 2e46066b..a44fd0c7 100644 --- a/admin/views/receiver/customer/get.php +++ b/admin/views/receiver/customer/get.php @@ -63,7 +63,7 @@ 客户等级:{{info.level}} - 改派:{{info.to_send}} + 是否改派:{{info.to_send}} 分销来源:{{info.cf_user}} diff --git a/admin/views/receiver/customer/lists.php b/admin/views/receiver/customer/lists.php index 06e7c06c..e21cd6eb 100644 --- a/admin/views/receiver/customer/lists.php +++ b/admin/views/receiver/customer/lists.php @@ -61,6 +61,15 @@ +
+ +
+ +
+
@@ -170,6 +179,7 @@ 客户来源 所属门店 状态 + 是否改派 销售员 企微好友 最后联系时间 @@ -185,12 +195,13 @@ {{v.of_title}} {{v.biz_name}} {{v.status_name}} + {{v.to_send}} {{v.admin_name}} {{v.wxqy_name}} {{v.cont_time}} - +
@@ -283,7 +294,7 @@ lists: [], qdjl_lists: [], admins: {cityAry: [], countyAry: [], bizAry: [], list: []}, - show_info: {levelAry: [], offlineSourcesAry: [], wxqyAry: []}, + show_info: {levelAry: [], offlineSourcesAry: [], wxqyAry: [], csbizidAry: []}, of2Ary: [], bizTypeAry: [], export_button: 0, diff --git a/common/models/receiver/Receiver_customers_model.php b/common/models/receiver/Receiver_customers_model.php index e0d143df..6470dd95 100644 --- a/common/models/receiver/Receiver_customers_model.php +++ b/common/models/receiver/Receiver_customers_model.php @@ -130,6 +130,51 @@ class Receiver_customers_model extends HD_Model } } + /** + * Notes:改派类型 + * Created on: 2023/2/7 17:00 + * Created by: qianhy + * @param int $cs_biz_id + * @return array|mixed + */ + public function csbizidAry($cs_biz_id=null){ + $arr = [-1 => '已改派', 0 => '本店线索', 1 => '接收线索']; + if (!$cs_biz_id && strlen($cs_biz_id) == 0){ + return $arr; + } + if ($cs_biz_id == -1 || $cs_biz_id == 0) { + return $arr[$cs_biz_id]; + } + elseif ($cs_biz_id > 0){ + return $arr[1]; + } + else { + return $arr; + } + } + + /** + * Notes:改派搜索条件 + * Created on: 2023/2/7 17:00 + * Created by: qianhy + * @param int $cs_biz_id + * @return string + */ + public function csbizidWhere($cs_biz_id=null){ + if (!$cs_biz_id && strlen($cs_biz_id) == 0){ + return '1 = 1'; + } + if ($cs_biz_id == -1 || $cs_biz_id == 0) { + return 'cs_biz_id = '.$cs_biz_id; + } + elseif ($cs_biz_id == 1){ + return 'cs_biz_id > 0'; + } + else { + return '1 = 1'; + } + } + public function count_order($where) { return $this->select_order($where, '', '', '', '', 1);