diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php
index 96bb5061..b3e62fea 100644
--- a/admin/controllers/receiver/Clues.php
+++ b/admin/controllers/receiver/Clues.php
@@ -32,7 +32,7 @@ class Clues extends HD_Controller
public function lists($where = array())
{
- $status_arr = $this->clues_model->get_status();
+ $statusAry = $this->clues_model->statusAry();
$params = $this->input->get();
$this->data['city_id'] = $city_id = intval($params['city_id']);
@@ -69,6 +69,7 @@ class Clues extends HD_Controller
}
}
strlen($params['status']) && $where["status"] = $params['status'];
+ strlen($params['status2']) && $where["status2"] = $params['status2'];
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
if ($params['cfrom_id'] || $params['cfrom_id2']) {
@@ -85,7 +86,7 @@ class Clues extends HD_Controller
$count = $this->clues_model->count($where);
$lists = [];
if ($count) {
- $fileds = 'id,name,mobile,cf_id,status_id,c_time,admin_id,status,en_time';
+ $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);
//获取来源
$cf_id_arr = array_unique(array_column($rows, 'cf_id'));
@@ -100,9 +101,11 @@ class Clues extends HD_Controller
}
foreach ($rows as $key => $val) {
$val['cf_title'] = isset($cf_rows[$val['cf_id']]) ? $cf_rows[$val['cf_id']][0]['title'] : '';
- $val['status_name'] = $status_arr[$val['status']];
+ $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']] : '';
- if(SUPER_ADMIN == $this->role){
+ if (SUPER_ADMIN == $this->role) {
$val['mobile_sub'] = $val['mobile'];
} else {
$val['mobile_sub'] = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : '';
@@ -110,11 +113,25 @@ class Clues extends HD_Controller
$lists[] = $val;
}
}
+ $statusList = array();
+ foreach ($this->clues_model->statusAry() as $key => $value) {
+ $cate = array();
+ $where = array("status" => $key);
+ $count1 = $this->clues_model->count($where);
+ if ($value['list']) {
+ foreach ($value['list'] as $key2 => $value2) {
+ $where['status2'] = $key2;
+ $count2 = $this->clues_model->count($where);
+ $cate[] = array("id" => $key2, "name" => $value2, "count" => $count2);
+ }
+ }
+ $statusList[] = array("id" => $key, "name" => $value['name'], "cate" => $cate, "count" => $count1);
+ }
$this->data['lists'] = $lists;
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['searchTpAry'] = $this->searchTpAry;
$this->data['params'] = $params;
- $this->data['status_arr'] = $status_arr;
+ $this->data['statusList'] = $statusList;
$this->data['_title'] = '线索池列表';
return $this->show_view('receiver/clues/lists', true);
}
@@ -126,23 +143,28 @@ class Clues extends HD_Controller
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '非法参数!');
}
- $statusList = $logsList = $intention = $autoList = array();
+ $statusList = $status2List = $logsList = $intention = $autoList = array();
$re = $this->clues_model->get(array('id' => $id));
if (!$re || empty($re)) {
return $this->show_json(SYS_CODE_FAIL, '线索不存在!');
}
$dataInfo = $re;
- foreach ($this->clues_model->get_status() as $key => $value) {
- $statusList[] = array("id" => $key, "name" => $value);
+ foreach ($this->clues_model->statusAry() as $key => $value) {
+ $statusList[] = array("id" => $key, "name" => $value['name']);
+ }
+ if (strlen($re['status'])) {
+ foreach ($this->clues_model->statusAry($re['status'])['list'] as $key => $value) {
+ $status2List[] = array("id" => $key, "name" => $value);
+ }
}
$dataInfo['editType'] = 0;
$re_cf = $this->clues_cfrom_model->get(array('id' => $re['cf_id']));
$info_show['cfrom_title'] = $re_cf['title'] ? $re_cf['title'] : '';
$info_show['statusList'] = $statusList;
- $info_show['status2List'] = array(array("id" => 1, "name" => '未回访'), array("id" => 2, "name" => '已回访'));
+ $info_show['status2List'] = $status2List;
$info_show['c_time'] = date('Y-m-d H:i', $re['c_time']);
$info_show['en_time'] = $re['en_time'];
- if(SUPER_ADMIN == $this->role){
+ if (SUPER_ADMIN == $this->role) {
$info_show['mobile_sub'] = $re['mobile'];
} else {
$info_show['mobile_sub'] = $re['mobile'] ? substr_replace($re['mobile'], '*****', 0, 5) : '';
@@ -217,6 +239,26 @@ class Clues extends HD_Controller
return $this->show_view('receiver/clues/edit', true);
}
+ /**
+ * Notes:二级分类
+ * Created on: 2021/9/15 14:16
+ * Created by: dengbw
+ * @return bool
+ */
+ public function get_status2()
+ {
+ $params = $this->input->post();
+ $status = $params['status'];
+ $status2List = array();
+ if (strlen($status)) {
+ foreach ($this->clues_model->statusAry($status)['list'] as $key => $value) {
+ $status2List[] = array("id" => $key, "name" => $value);
+ }
+ }
+ $this->data = $status2List;
+ return $this->show_json(SYS_CODE_SUCCESS);
+ }
+
/**
* 新增
* @return bool
@@ -386,10 +428,18 @@ class Clues extends HD_Controller
$msg = '修改成功';
$code = SYS_CODE_SUCCESS;
if ($info['editType'] == 1) {
- $status_name = $this->clues_model->get_status()[$re['status']];
- $status_name_up = $this->clues_model->get_status()[$info['status']];
+ $statusAry = $this->clues_model->statusAry();
+ if ($info['status'] == $re['status'] && $info['status2'] == $re['status2']) {
+ return $this->show_json(SYS_CODE_FAIL, '状态未修改!');
+ }
+ $status_name = $statusAry[$re['status']]['name'];
+ $status_name_up = $statusAry[$info['status']]['name'];
+ if ($info['status2']) {
+ $status_name .= '-' . $statusAry[$re['status']]['list'][$re['status2']];
+ $status_name_up .= '-' . $statusAry[$info['status']]['list'][$info['status2']];
+ }
$log = '更新状态(' . $status_name . ')为(' . $status_name_up . ')';
- $ret = $this->clues_model->update(array('status' => $info['status']), array('id' => $info['id']));
+ $ret = $this->clues_model->update(array('status' => $info['status'], 'status2' => $info['status2']), array('id' => $info['id']));
if (!$ret) {
$code = SYS_CODE_FAIL;
$msg = '修改状态失败';
diff --git a/admin/views/receiver/clues/edit.php b/admin/views/receiver/clues/edit.php
index 9267af3b..00aba13c 100644
--- a/admin/views/receiver/clues/edit.php
+++ b/admin/views/receiver/clues/edit.php
@@ -8,7 +8,7 @@
状态
+
二级状态
-
-
@@ -218,7 +219,8 @@
@@ -331,9 +333,9 @@
info: {},
infoShow: {"intention": {}, 'autoList': []},
goods: {"imgs_url": [], "imgs": [], "log": ''},
- cityAry:[],
- countyAry:[],
- bizInfo:[],
+ cityAry: [],
+ countyAry: [],
+ bizInfo: [],
},
mounted: function () {
var that = this;
@@ -347,7 +349,7 @@
updated: function () {
},
methods: {
- init_citys:function(){
+ init_citys: function () {
var vm = this;
$.ajax({
type: 'get',
@@ -355,10 +357,10 @@
dataType: 'json',
data: {
id: '350',
- key:'city',
- type:1
+ key: 'city',
+ type: 1
},
- success:function(response){
+ success: function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
@@ -370,11 +372,11 @@
if (index == 1) {
if (vm.info.editType == 1) {
$("#status").attr("disabled", "disabled");
- $("#status_id").attr("disabled", "disabled");
+ $("#status2").attr("disabled", "disabled");
vm.info.editType = 0;
} else {
$("#status").removeAttr("disabled");
- $("#status_id").removeAttr("disabled");
+ $("#status2").removeAttr("disabled");
vm.info.editType = 1;
}
} else {
@@ -442,21 +444,20 @@
getStatus2: function () {
//二级分类
var vm = this;
- // $.ajax({
- // url: '/common/receiver_status',
- // type: 'post',
- // dataType: 'json',
- // data: {
- // pid: vm.info.status,
- // type: vm.info.type
- // },
- // success: function (data) {
- // vm.info.status_id = 0;
- // if (data.data) {
- // vm.info.status2List = data.data;
- // }
- // },
- // });
+ $.ajax({
+ url: '/receiver/clues/get_status2',
+ type: 'post',
+ dataType: 'json',
+ data: {
+ status: vm.info.status,
+ },
+ success: function (data) {
+ vm.info.status2 = 0;
+ if (data.data) {
+ vm.infoShow.status2List = data.data;
+ }
+ },
+ });
},
logModal: function () {
var vm = this;
@@ -532,16 +533,16 @@
},
});
},
- randClass:function(){
- var classArr = ['default','primary','success','info','warning','danger'];
- var rand = Math.floor( Math.random() * classArr.length );
+ randClass: function () {
+ var classArr = ['default', 'primary', 'success', 'info', 'warning', 'danger'];
+ var rand = Math.floor(Math.random() * classArr.length);
return classArr[rand]
},
- showBizInfo:function(info){
+ showBizInfo: function (info) {
var that = this
- $.get('/receiver/clues/get_bizInfo',{'id':info.id},function(response){
- if(response.code){
- that.bizInfo = response.data.bizinfo
+ $.get('/receiver/clues/get_bizInfo', {'id': info.id}, function (response) {
+ if (response.code) {
+ that.bizInfo = response.data.bizinfo
layer.open({
type: 1, //Page层类型
title: info.biz_name,
@@ -553,14 +554,14 @@
})
}
},
- watch:{
- 'info.city_id':function(nv, ov){
+ watch: {
+ 'info.city_id': function (nv, ov) {
var that = this;
- if(nv == ''){
+ if (nv == '') {
that.countyAry = [];
that.info.county_id = '';
} else {
- if(nv.substring(0,4) != that.info.county_id.substring(0, 4)){
+ if (nv.substring(0, 4) != that.info.county_id.substring(0, 4)) {
that.info.county_id = '';
}
$.ajax({
@@ -569,10 +570,10 @@
dataType: 'json',
data: {
id: nv,
- key:'county',
- type:1
+ key: 'county',
+ type: 1
},
- success:function(response){
+ success: function (response) {
if (response.code == 1) {
that.countyAry = response.data;
}
diff --git a/admin/views/receiver/clues/lists.php b/admin/views/receiver/clues/lists.php
index b34fcf11..7f9aa08a 100644
--- a/admin/views/receiver/clues/lists.php
+++ b/admin/views/receiver/clues/lists.php
@@ -1,15 +1,45 @@
@@ -151,7 +189,7 @@
|
-
|
|
-
@@ -190,7 +228,7 @@
@@ -218,47 +256,47 @@
vue_obj = new Vue({
el: '#search_form',
data: {
- city_id:=$params['city_id']?$params['city_id']:0?>,
- county_id:=$params['county_id']?$params['county_id']:0?>,
- cfrom_id:=$params['cfrom_id']?$params['cfrom_id']:0?>,
- cfrom_id2:=$params['cfrom_id2']?$params['cfrom_id2']:0?>,
- cfroms:[],
- cfroms2:[],
- cityAry:[],
- countyAry:[]
+ city_id:=$params['city_id'] ? $params['city_id'] : 0?>,
+ county_id:=$params['county_id'] ? $params['county_id'] : 0?>,
+ cfrom_id:=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
+ cfrom_id2:=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
+ cfroms: [],
+ cfroms2: [],
+ cityAry: [],
+ countyAry: []
},
- mounted: function(){
+ mounted: function () {
this.getCfroms()
this.init_citys();
},
methods: {
- init_citys:function(){
+ init_citys: function () {
var vm = this;
- $.get('common/area',{id:'350',key:'city',type:1},function(response){
+ $.get('common/area', {id: '350', key: 'city', type: 1}, function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
}
});
- if(vm.city_id>0){
- $.get('common/area',{id:vm.city_id,key:'county',type:1},function(response){
+ if (vm.city_id > 0) {
+ $.get('common/area', {id: vm.city_id, key: 'county', type: 1}, function (response) {
if (response.code == 1) {
vm.countyAry = response.data;
}
});
}
},
- getCfroms: function(){
+ getCfroms: function () {
var that = this
- $.get('/receiver/clues/get_cfroms',function(result){
+ $.get('/receiver/clues/get_cfroms', function (result) {
that.cfroms = result.data.data
});
- if(that.cfrom_id>0){
- $.get('/receiver/clues/get_cfroms',{'id':that.cfrom_id},function(result){
+ if (that.cfrom_id > 0) {
+ $.get('/receiver/clues/get_cfroms', {'id': that.cfrom_id}, function (result) {
that.cfroms2 = result.data.data
});
}
},
- reset:function(){
+ reset: function () {
var that = this;
$('#search_tp').val('mobile');
$('#title').val('');
@@ -270,21 +308,21 @@
that.cfrom_id2 = 0;
}
},
- watch:{
- 'city_id':function(nv, ov){
+ watch: {
+ 'city_id': function (nv, ov) {
var that = this;
- if(nv == ''){
+ if (nv == '') {
that.countyAry = [];
that.county_id = '0';
} else {
- $.get('common/area',{id:nv,key:'county',type:1},function(response){
+ $.get('common/area', {id: nv, key: 'county', type: 1}, function (response) {
if (response.code == 1) {
that.countyAry = response.data;
- if(that.county_id>0){
+ if (that.county_id > 0) {
var county_id = '0';
- for(var i in that.countyAry){
+ for (var i in that.countyAry) {
var county = that.countyAry[i];
- if(county.id == that.county_id){
+ if (county.id == that.county_id) {
county_id = county.id;
break;
}
@@ -295,19 +333,19 @@
});
}
},
- 'cfrom_id':function(nv,ov){
+ 'cfrom_id': function (nv, ov) {
var that = this;
- if(nv == ''){
+ if (nv == '') {
that.cfrom_id2 = 0;
that.cfroms = [];
} else {
- $.get('/receiver/clues/get_cfroms',{'id':nv},function(result){
+ $.get('/receiver/clues/get_cfroms', {'id': nv}, function (result) {
that.cfroms2 = result.data.data;
- if(that.cfrom_id2>0){
+ if (that.cfrom_id2 > 0) {
var cfrom_id2 = '0';
- for(var i in that.cfroms){
+ for (var i in that.cfroms) {
var county = that.cfroms[i];
- if(county.id == that.cfrom_id2){
+ if (county.id == that.cfrom_id2) {
cfrom_id2 = county.id;
break;
}
@@ -361,7 +399,7 @@
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
break;
}
- $('#'+source_id).val(date);
+ $('#' + source_id).val(date);
});
});
diff --git a/common/models/receiver/Receiver_clues_model.php b/common/models/receiver/Receiver_clues_model.php
index 066fe20f..1b7253af 100644
--- a/common/models/receiver/Receiver_clues_model.php
+++ b/common/models/receiver/Receiver_clues_model.php
@@ -12,24 +12,45 @@ class Receiver_clues_model extends HD_Model
{
private $table_name = 'lc_receiver_clues';
- private $status_arr = [ 0 => '待处理',1 => '已处理',2 => '跟进中',3 => '无效线索'];
-
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
- //关联订单
- public function count_order($where){
- return $this->select_order($where,'','','','',1);
+ /**
+ * Notes:线索状态
+ * Created on: 2021/9/15 10:25
+ * Created by: dengbw
+ * @param $status
+ * @return array
+ */
+ public function statusAry($status = '')
+ {
+ $status_ary[0] = array('name' => '待处理', 'list' => array());
+ $status_ary[1] = array('name' => '已分配', 'list' => array(1 => '强意向', 2 => '中意向', 3 => '弱意向'));
+ $status_ary[2] = array('name' => '跟进中', 'list' => array(4 => '未接通', 5 => '未完整触碰', 6 => '近期没时间'));
+ $status_ary[3] = array('name' => '无效线索', 'list' => array(7 => '明确拒绝', 8 => '误报', 9 => '战败'));
+ if (strlen($status)) {
+ $return_status = $status_ary[$status];
+ } else {
+ $return_status = $status_ary;
+ }
+ return $return_status;
}
- public function select_order($where = array(), $order = '', $page = 0, $page_size = 20 , $fileds = '', $count = 0){
+ //关联订单
+ public function count_order($where)
+ {
+ return $this->select_order($where, '', '', '', '', 1);
+ }
+
+ public function select_order($where = array(), $order = '', $page = 0, $page_size = 20, $fileds = '', $count = 0)
+ {
!$fileds && $fileds = 'lc_receiver_clues.*';
$this->db->select($fileds);
$this->db->from('lc_receiver_clues');
- $this->db->join('lc_receiver_customers', 'lc_receiver_customers.rid = lc_receiver_clues.id','left');
- $this->db->join('lc_receiver_orders', 'lc_receiver_orders.rid = lc_receiver_customers.id','left');
+ $this->db->join('lc_receiver_customers', 'lc_receiver_customers.rid = lc_receiver_clues.id', 'left');
+ $this->db->join('lc_receiver_orders', 'lc_receiver_orders.rid = lc_receiver_customers.id', 'left');
if ($where) {
$this->db->where($where);
@@ -50,8 +71,4 @@ class Receiver_clues_model extends HD_Model
$this->db->limit($limit, $offset);
return $this->db->get()->result_array();
}
-
- public function get_status(){
- return $this->status_arr;
- }
}