admin_customers_913
This commit is contained in:
@@ -543,7 +543,7 @@ class Clues extends HD_Controller
|
||||
'if_driver' => $clues_row['if_driver'],
|
||||
'cf_title' => '平台分配',
|
||||
'p_time' => date('Y-m-d H:i:s'),
|
||||
'c_time' => time()
|
||||
'c_time' => $clues_row['c_time']
|
||||
];
|
||||
if ($jsondata['car']) {
|
||||
isset($jsondata['car']['version']) && $add_data['v_id'] = $jsondata['car']['version']['id'];
|
||||
|
||||
@@ -10,6 +10,8 @@ defined('BASEPATH') OR exit('No direct script access allowed');
|
||||
class Customer extends HD_Controller
|
||||
{
|
||||
private $searchTpAry = array('mobile' => '客户手机号', 'name' => '客户姓名');
|
||||
private $searchTimeAry = array('c_time' => '创建时间', 'p_time' => '分配时间', 'cont_time' => '最后联系时间', 'u_time' => '最后操作时间'
|
||||
, 'dt_time' => '最后到店时间');
|
||||
|
||||
protected $log_dir;
|
||||
|
||||
@@ -49,23 +51,36 @@ class Customer extends HD_Controller
|
||||
$where["{$params['search_tp']} like '%{$params['title']}%'"] = null;
|
||||
}
|
||||
!$params['search_tp'] && $params['search_tp'] = 'mobile';
|
||||
|
||||
//最近联系时间
|
||||
if ($params['cont_time']) {
|
||||
$cont_time = explode(' ~ ', $params['cont_time']);
|
||||
if ($cont_time[0]) {
|
||||
$where["cont_time >="] = $cont_time[0] . ' 00:00:00';
|
||||
}
|
||||
if ($cont_time[1]) {
|
||||
$where["cont_time <="] = $cont_time[1] . ' 23:59:59';
|
||||
}
|
||||
}
|
||||
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['c_time']) {
|
||||
$c_time = explode(' ~ ', $params['c_time']);
|
||||
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
|
||||
$c_time[1] && $where["c_time <="] = strtotime($c_time[1] . ' 23:59:59');
|
||||
}
|
||||
if ($params['p_time']) {
|
||||
$p_time = explode(' ~ ', $params['p_time']);
|
||||
$p_time[0] && $where["p_time >="] = $p_time[0] . ' 00:00:00';
|
||||
$p_time[1] && $where["p_time <="] = $p_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['cont_time']) {
|
||||
$cont_time = explode(' ~ ', $params['cont_time']);
|
||||
$cont_time[0] && $where["cont_time >="] = $cont_time[0] . ' 00:00:00';
|
||||
$cont_time[1] && $where["cont_time <="] = $cont_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['u_time']) {
|
||||
$u_time = explode(' ~ ', $params['u_time']);
|
||||
$u_time[0] && $where["u_time >="] = $u_time[0] . ' 00:00:00';
|
||||
$u_time[1] && $where["u_time <="] = $u_time[1] . ' 23:59:59';
|
||||
}
|
||||
if ($params['dt_time']) {
|
||||
$dt_time = explode(' ~ ', $params['dt_time']);
|
||||
$dt_time[0] && $where["dt_time >="] = $dt_time[0] . ' 00:00:00';
|
||||
$dt_time[1] && $where["dt_time <="] = $dt_time[1] . ' 23:59:59';
|
||||
}
|
||||
$count = $this->customers_model->count($where);
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
@@ -87,13 +102,14 @@ class Customer extends HD_Controller
|
||||
'status_name' => $status_arr[$val['status']],
|
||||
'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'] : '',
|
||||
'cont_time' => $val['cont_time'] != '0000-00-00 00:00:00' ? $val['cont_time'] : '',
|
||||
);
|
||||
}
|
||||
}
|
||||
$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['_title'] = '客户列表';
|
||||
@@ -180,7 +196,7 @@ class Customer extends HD_Controller
|
||||
'log' => $value['log'],
|
||||
'rec_url' => $rec_url,
|
||||
'rec_text' => $rec_text,
|
||||
'type_name' => $this->customer_oplogs_model->typeAry()[$value['type']],
|
||||
'type_name' => $this->customer_oplogs_model->typeAry()[$value['type']],
|
||||
'c_time' => date('Y-m-d H:i', $value['c_time'])
|
||||
);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/receiver/customer">
|
||||
<input name="status" value="<?=$params['status']?>" type="hidden">
|
||||
<input name="status" value="<?= $params['status'] ?>" type="hidden">
|
||||
<div class="am-form am-form-horizontal">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">客户搜索:</label>
|
||||
@@ -67,33 +67,39 @@
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="cf_title" id="cf_time">
|
||||
<option value="">客户来源</option>
|
||||
<option value="平台分配" <?=$params['cf_title'] == '平台分配' ? 'selected' : ''?>>平台分配</option>
|
||||
<option value="自有资源" <?=$params['cf_title'] == '自有资源' ? 'selected' : ''?>>自有资源</option>
|
||||
<option value="平台分配" <?= $params['cf_title'] == '平台分配' ? 'selected' : '' ?>>平台分配</option>
|
||||
<option value="自有资源" <?= $params['cf_title'] == '自有资源' ? 'selected' : '' ?>>自有资源</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<label class="am-para-label w100">最近联系时间:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="id-create-time" name="cont_time" type="text" value="<?= $params['cont_time'] ?>"
|
||||
placeholder="时间范围" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="today">今天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
|
||||
<a class="mr10 id-day-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
|
||||
<? foreach ($searchTimeAry as $key => $value) { ?>
|
||||
<div id="show-<?= $key ?>" style="display:<?= $params[$key] ? 'block' : 'none' ?>">
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<label class="am-para-label w100"><?= $value ?>:</label>
|
||||
<div class="am-form-group fl">
|
||||
<div class="am-para-inline w300">
|
||||
<input id="id-<?= $key ?>" name="<?= $key ?>" type="text" value="<?= $params[$key] ?>"
|
||||
placeholder="<?= $value ?>范围" autocomplete="off"/>
|
||||
</div>
|
||||
<div class="am-para-inline" style="padding-top: 5px;">
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="today">今天</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="yesterday">昨日</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="7day">最近7天</a>
|
||||
<a class="mr10 id-<?= $key ?>-btn" href="javascript:void (0);" data-date="30day">最近30天</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<? } ?>
|
||||
|
||||
<div class="am-form-group" style="margin-bottom: 0px;"></div>
|
||||
<div class="am-form-group fl" style="margin-bottom: 0px;">
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<input type="button" @click="btnTimes" value="选择筛选时间" class="am-btn am-btn-success am-btn-sm">
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="button" class="am-btn am-btn-success am-btn-sm w100" @click="reset">重置</button>
|
||||
</div>
|
||||
@@ -115,7 +121,7 @@
|
||||
<th width="7%"><span>所属门店</span></th>
|
||||
<th width="8%"><span>状态</span></th>
|
||||
<th width="4%"><span>跟进人</span></th>
|
||||
<th width="7%"><span>最近联系时间</span></th>
|
||||
<th width="7%"><span>最后联系时间</span></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@@ -157,13 +163,29 @@
|
||||
<?php page_view($pager) ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="times-modal" style="display: none;">
|
||||
<div class="modal-body">
|
||||
<label class="checkall" style="margin-left: 30px;">
|
||||
<input type="checkbox" data-check-target=".order-times"> 全选</label>
|
||||
<div style="margin-left: 40px;">
|
||||
<?php foreach ($searchTimeAry as $key => $value) { ?>
|
||||
<label class="am-checkbox" style="padding-bottom: 8px;">
|
||||
<input type="checkbox" class="order-times" <?= $params[$key] ? 'checked' : '' ?>
|
||||
value='<?= $key ?>'><?= $value ?></label>
|
||||
<? } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
require(['laydate', 'autocomplete'], function (laydate) {
|
||||
<? foreach ($searchTimeAry as $key => $value) { ?>
|
||||
laydate.render({
|
||||
elem: '#id-create-time', range: '~'
|
||||
elem: '#id-<?=$key?>', range: '~'
|
||||
});
|
||||
$('.id-day-btn').click(function () {
|
||||
$('.id-<?=$key?>-btn').click(function () {
|
||||
var type = $(this).data('date'), date = '', d_obj = new Date();
|
||||
switch (type) {
|
||||
case 'today':
|
||||
@@ -181,8 +203,9 @@
|
||||
date = (new Date(d_obj.getTime() - 86400000 * 30)).Format('yyyy-MM-dd') + ' ~ ' + d_obj.Format('yyyy-MM-dd');
|
||||
break;
|
||||
}
|
||||
$('#id-create-time').val(date);
|
||||
$('#id-<?=$key?>').val(date);
|
||||
});
|
||||
<?}?>
|
||||
});
|
||||
|
||||
var vue_obj;
|
||||
@@ -193,9 +216,9 @@
|
||||
params: [],
|
||||
searchTpAry: [],
|
||||
lists: [],
|
||||
cityAry:[],
|
||||
countyAry:[],
|
||||
bizList:[],
|
||||
cityAry: [],
|
||||
countyAry: [],
|
||||
bizList: [],
|
||||
},
|
||||
mounted: function () {
|
||||
var vm = this;
|
||||
@@ -205,25 +228,47 @@
|
||||
this.init_citys();
|
||||
},
|
||||
methods: {
|
||||
btnTimes: function () {
|
||||
layer.open({
|
||||
type: 1,
|
||||
area: ['25%', '35%'], //宽高
|
||||
content: $('#times-modal'),
|
||||
title: '选择筛选时间',
|
||||
shade: false,
|
||||
btn: ['确定', '取消'],
|
||||
yes: function (index) {
|
||||
layer.close(index);
|
||||
$(".order-times").map(function () {
|
||||
var id = this.value;
|
||||
if (this.checked) {
|
||||
$('#show-' + id).show();
|
||||
} else {
|
||||
$('#id-' + id).val('');
|
||||
$('#show-' + id).hide();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
saveEdit: function () {
|
||||
$("form").submit();
|
||||
},
|
||||
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.params.city_id>0){
|
||||
$.get('common/area',{id:vm.params.city_id,key:'county',type:1},function(response){
|
||||
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(){
|
||||
reset: function () {
|
||||
var that = this;
|
||||
that.params.search_tp = 'mobile';
|
||||
that.params.title = '';
|
||||
@@ -231,26 +276,25 @@
|
||||
that.params.county_id = '';
|
||||
that.params.biz_id = '';
|
||||
$('#cf_time').val('');
|
||||
$('#id-create-time').val('');
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
'params.city_id':function(nv, ov){
|
||||
'params.city_id': function (nv, ov) {
|
||||
var that = this;
|
||||
if(nv == ''){
|
||||
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){
|
||||
$.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){
|
||||
if (that.params.county_id > 0) {
|
||||
var county_id = '';
|
||||
for(var i in that.countyAry){
|
||||
for (var i in that.countyAry) {
|
||||
var county = that.countyAry[i];
|
||||
if(county.id == that.params.county_id){
|
||||
if (county.id == that.params.county_id) {
|
||||
county_id = county.id;
|
||||
break;
|
||||
}
|
||||
@@ -259,14 +303,17 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
$.post('receiver/clues/get_adviser',{city_id:that.params.city_id,county_id:that.params.county_id},function(response){
|
||||
$.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){
|
||||
if (that.params.biz_id > 0) {
|
||||
var biz_id = '';
|
||||
for(var i in that.bizList){
|
||||
for (var i in that.bizList) {
|
||||
var biz = that.bizList[i];
|
||||
if(biz.id == that.params.biz_id){
|
||||
if (biz.id == that.params.biz_id) {
|
||||
biz_id = biz.id;
|
||||
break;
|
||||
}
|
||||
@@ -277,16 +324,19 @@
|
||||
});
|
||||
}
|
||||
},
|
||||
'params.county_id':function(nv, ov){
|
||||
'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){
|
||||
$.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){
|
||||
if (that.params.biz_id > 0) {
|
||||
var biz_id = '';
|
||||
for(var i in that.bizList){
|
||||
for (var i in that.bizList) {
|
||||
var biz = that.bizList[i];
|
||||
if(biz.id == that.params.biz_id){
|
||||
if (biz.id == that.params.biz_id) {
|
||||
biz_id = biz.id;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -267,6 +267,9 @@ class Customers extends Wxapp{
|
||||
$result = true;
|
||||
if($up_data){
|
||||
$status==1 && $up_data['cont_time'] = date('Y-m-d H:i:s'); //修改到店状态修改最后联系时间
|
||||
if($status==1 || $a_num){//修改最后到店时间
|
||||
$up_data['dt_time'] = date('Y-m-d H:i:s');
|
||||
}
|
||||
$result = $this->customers_model->update($up_data,['id'=>$id]);
|
||||
if($result){ //添加日志
|
||||
$this->load->library('receiver/customers_entity');
|
||||
|
||||
@@ -34,7 +34,7 @@ class Customers_entity{
|
||||
$cf_platform && $add_data['cf_platform'] = $cf_platform;
|
||||
$imgs && $add_data['imgs'] = json_encode($imgs,JSON_UNESCAPED_UNICODE);
|
||||
$result = $this->ci->customer_oplogs_model->add($add_data);
|
||||
if($type==2 && $result){ //更新最后联系时间
|
||||
if(($type==2 || $type==1) && $result){ //更新最后联系时间
|
||||
$this->ci->load->model('receiver/receiver_customers_model');
|
||||
$this->ci->receiver_customers_model->update(['cont_time'=>date('Y-m-d H:i:s')],['id'=>$customer_id]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user