clues_601
This commit is contained in:
@@ -6,6 +6,7 @@ class Clues extends HD_Controller
|
||||
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名');
|
||||
private $cacheKeyPhone = 'xz_admin_phone';
|
||||
protected $log_dir;
|
||||
private $maintainAry = ['0-0' => '待处理', '1-10' => '已加企微', '3-7' => '明确拒绝', '2-4' => '未接通', '2-5' => '未完整触碰'];//保养客户专用
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
@@ -88,23 +89,38 @@ class Clues extends HD_Controller
|
||||
if ($count) {
|
||||
$fileds = 'id,name,mobile,cf_id,c_time,admin_id,status,status2,en_time';
|
||||
$rows = $this->clues_model->select($where, 'en_time desc,id desc', $page, $size, $fileds);
|
||||
$map_admin = $map_cf_pid = $cf_title_arr = [];
|
||||
//获取来源
|
||||
$cf_id_arr = array_unique(array_column($rows, 'cf_id'));
|
||||
$cf_rows = $this->clues_cfrom_model->get_map_by_ids($cf_id_arr, 'id,title');
|
||||
if ($cf_id_arr) {
|
||||
$cf_id_str = implode(',', $cf_id_arr);
|
||||
$res_cfrom = $this->clues_cfrom_model->select(["id in({$cf_id_str})" => null], 'id desc', 0, 0, 'id,title,pid');
|
||||
$cf_pid_arr = array_unique(array_column($res_cfrom, 'pid'));
|
||||
if ($cf_pid_arr) {
|
||||
$cf_pid_str = implode(',', $cf_pid_arr);
|
||||
$map_cf_pid = $this->clues_cfrom_model->map('id', 'title', ["id in({$cf_pid_str})" => null]);
|
||||
}
|
||||
foreach ($res_cfrom as $key => $val) {
|
||||
$title = $val['title'];
|
||||
if ($val['pid']) {//一级分类
|
||||
$map_cf_pid[$val['pid']] && $title = $map_cf_pid[$val['pid']] . '-' . $title;
|
||||
}
|
||||
$cf_title_arr[$val['id']] = $title;
|
||||
}
|
||||
}
|
||||
//获取管理员
|
||||
$this->load->model('sys/sys_admin_model', 'admin_model');
|
||||
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
|
||||
if ($admin_id_arr) {
|
||||
$str_ids = implode(',', $admin_id_arr);
|
||||
$where = array("id in ({$str_ids})" => null);
|
||||
$map_admin = $this->admin_model->map('id', 'username', $where);
|
||||
$map_admin = $this->admin_model->map('id', 'username', ["id in ({$str_ids})" => null]);
|
||||
}
|
||||
foreach ($rows as $key => $val) {
|
||||
$val['cf_title'] = isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '';
|
||||
$val['cf_title'] = $cf_title_arr[$val['cf_id']] ? $cf_title_arr[$val['cf_id']] : '';
|
||||
$status_name = $statusAry[$val['status']]['name'];
|
||||
$val['status2'] && $status_name .= '‒' . $statusAry[$val['status']]['list'][$val['status2']];
|
||||
$val['status_name'] = $status_name;
|
||||
$val['admin_name'] = isset($map_admin[$val['admin_id']]) ? $map_admin[$val['admin_id']] : '';
|
||||
$val['admin_name'] = $map_admin[$val['admin_id']] ? $map_admin[$val['admin_id']] : '';
|
||||
if (SUPER_ADMIN == $this->role) {
|
||||
$val['mobile_sub'] = $val['mobile'];
|
||||
} else {
|
||||
@@ -132,6 +148,7 @@ class Clues extends HD_Controller
|
||||
$this->data['searchTpAry'] = $this->searchTpAry;
|
||||
$this->data['params'] = $params;
|
||||
$this->data['statusList'] = $statusList;
|
||||
$this->data['maintainAry'] = $this->maintainAry;
|
||||
$this->data['_title'] = '线索池列表';
|
||||
return $this->show_view('receiver/clues/lists', true);
|
||||
}
|
||||
@@ -507,7 +524,16 @@ class Clues extends HD_Controller
|
||||
//批量操作(默认修改状态)
|
||||
public function batch()
|
||||
{
|
||||
|
||||
$id = intval($this->input->post('id'));
|
||||
$status = $this->input->post('value');
|
||||
if (!$id || !$status) {
|
||||
$this->show_json(0, '参数错误');
|
||||
}
|
||||
$status_ary = explode('-', $status);
|
||||
$up_data['status'] = intval($status_ary[0]);
|
||||
$up_data['status2'] = intval($status_ary[1]);
|
||||
$this->clues_model->update($up_data, ['id' => $id]);
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
|
||||
}
|
||||
|
||||
//导出数据列表
|
||||
|
||||
@@ -197,7 +197,20 @@
|
||||
<td><?= $v['name'] ?></td>
|
||||
<td><?= $v['mobile_sub'] ?></td>
|
||||
<td><?= $v['cf_title'] ?></td>
|
||||
<td><?= $v['status_name'] ?></td>
|
||||
<td><? if ($v['cf_id'] == 36 || $v['cf_id'] == 37) { ?>
|
||||
<input type="hidden" class="clues-id-<?= $v['id'] ?>" name="id" value="<?= $v['id'] ?>"
|
||||
checked>
|
||||
<select data-update-group="" data-list-target=".clues-id-<?= $v['id'] ?>"
|
||||
data-action="/receiver/clues/batch" data-field=""
|
||||
style="height: 26px;width: 100px;">
|
||||
<? foreach ($maintainAry as $key => $val) { ?>
|
||||
<option value="<?= $key ?>" <?= $key == $v['status'] . '-' . $v['status2'] ? 'selected' : '' ?>><?= $val ?></option>
|
||||
<? } ?>
|
||||
</select>
|
||||
<? } else { ?>
|
||||
<?= $v['status_name'] ?>
|
||||
<? } ?>
|
||||
</td>
|
||||
<td><?= $v['admin_name'] ?></td>
|
||||
<td><?= date('Y-m-d H:i:s', $v['c_time']) ?></td>
|
||||
<td><?= $v['en_time'] ?></td>
|
||||
|
||||
@@ -27,7 +27,7 @@ class Receiver_clues_model extends HD_Model
|
||||
public function statusAry($status = '')
|
||||
{
|
||||
$status_ary[0] = array('name' => '待处理', 'list' => array());
|
||||
$status_ary[1] = array('name' => '已分配', 'list' => array(1 => '强意向', 2 => '中意向', 3 => '弱意向'));
|
||||
$status_ary[1] = array('name' => '已分配', 'list' => array(1 => '强意向', 2 => '中意向', 3 => '弱意向', 10 => '已加企微'));
|
||||
$status_ary[2] = array('name' => '跟进中', 'list' => array(4 => '未接通', 5 => '未完整触碰', 6 => '近期没时间'));
|
||||
$status_ary[3] = array('name' => '无效线索', 'list' => array(7 => '明确拒绝', 8 => '误报', 9 => '战败'));
|
||||
if (strlen($status)) {
|
||||
|
||||
Reference in New Issue
Block a user