customer cs_biz_id about

This commit is contained in:
qianhy
2023-02-08 09:39:30 +08:00
parent 3092dee7f1
commit e91b2be754
4 changed files with 71 additions and 8 deletions
+12 -5
View File
@@ -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" => "下单时间",
+1 -1
View File
@@ -63,7 +63,7 @@
<td class="table-td"><span class="mr5">客户等级:</span>{{info.level}}</td>
</tr>
<tr v-if="info.to_send || info.cf_user">
<td class="table-td" v-if="info.to_send"><span class="mr5">改派:</span>{{info.to_send}}</td>
<td class="table-td" v-if="info.to_send"><span class="mr5">是否改派:</span>{{info.to_send}}</td>
<td class="table-td" v-if="info.cf_user"><span class="mr5">分销来源:</span>{{info.cf_user}}</td>
<td class="table-td" v-if="info.to_send && info.cf_user"></td>
<td class="table-td" v-else colspan="2"></td>
+13 -2
View File
@@ -61,6 +61,15 @@
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w80">是否改派:</label>
<div class="am-para-inline w100">
<select name="cs_biz_id" v-model="params.cs_biz_id">
<option value=''>请选择</option>
<option :value="i" v-for="(v,i) in show_info.csbizidAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<label class="am-para-label w80">客户来源:</label>
@@ -170,6 +179,7 @@
<th width="10%"><span>客户来源</span></th>
<th width="10%"><span>所属门店</span></th>
<th width="5%"><span>状态</span></th>
<th width="5%"><span>是否改派</span></th>
<th width="5%"><span>销售员</span></th>
<th width="5%"><span>企微好友</span></th>
<th width="6%"><span>最后联系时间</span></th>
@@ -185,12 +195,13 @@
<td>{{v.of_title}}</td>
<td>{{v.biz_name}}</td>
<td>{{v.status_name}}</td>
<td>{{v.to_send}}</td>
<td>{{v.admin_name}}</td>
<td>{{v.wxqy_name}}</td>
<td>{{v.cont_time}}</td>
</tr>
<tr>
<td colspan="10">
<td colspan="11">
<div class="row">
<div class="col-md-4 align-l">
</div>
@@ -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,
@@ -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);