admin_customer_922

This commit is contained in:
dengbw
2021-09-22 16:22:12 +08:00
parent 6c6cc4e1c4
commit 61b2befd09
3 changed files with 229 additions and 137 deletions
+74 -20
View File
@@ -43,7 +43,7 @@ class Customer extends HD_Controller
!$params['county_id'] && $params['county_id'] = '';
!$params['biz_id'] && $params['biz_id'] = '';
!$params['cf_title'] && $params['cf_title'] = '';
!$params['qdjl_id'] && $params['qdjl_id'] = '';
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
@@ -53,10 +53,57 @@ class Customer extends HD_Controller
}
!$params['search_tp'] && $params['search_tp'] = 'mobile';
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['qdjl_id']) {
$re_bu = $this->app_licheb_users_model->get(array('id'=>$params['qdjl_id']));
if ($re_bu['biz_id']) {
$where["biz_id in({$re_bu['biz_id']})"] = null;
} else {
$where['biz_id'] = -1;
}
}
//销售员筛选
if ($params['admin_id']) {
$where['admin_id'] = $params['admin_id'];
} else {
$where_lcb = array();
if ($params['biz_id_admin']) {//指定店铺所有销售员
$where_lcb['biz_id'] = $params['biz_id_admin'];
} else {
//指定城市的所有销售员
$where_biz = array();
if ($params['county_id_admin']) {
$where_biz['county_id'] = $params['county_id_admin'];
} else if ($params['city_id_admin']) {
$where_biz['city_id'] = $params['city_id_admin'];
}
if ($where_biz) {
$where_biz['status>-1'] = null;
$rows_biz = $this->biz_model->select($where_biz, 'id desc', 0, 0, 'id');
if ($rows_biz) {
$str_ids = implode(',', array_column($rows_biz, 'id'));
$where_lcb["biz_id in({$str_ids})"] = null;
} else {
$where_lcb['biz_id'] = -1;
}
}
}
//获取目标销售员列表
if ($where_lcb) {
$where_lcb['status>-1'] = null;
$rows_lcb = $this->app_licheb_users_model->select($where_lcb, 'id desc', 0, 0, 'id');
if ($rows_lcb) {
$str_ids = implode(',', array_column($rows_lcb, 'id'));
$where["admin_id in({$str_ids})"] = null;
} else {
$where['admin_id'] = -1;
}
}
!$params['city_id_admin'] && $params['city_id_admin'] = '';
!$params['county_id_admin'] && $params['county_id_admin'] = '';
!$params['biz_id_admin'] && $params['biz_id_admin'] = '';
$params['admin_id'] = '';
}
if ($params['c_time']) {
$c_time = explode(' ~ ', $params['c_time']);
$c_time[0] && $where["c_time >="] = strtotime($c_time[0] . ' 00:00:00');
@@ -108,7 +155,7 @@ class Customer extends HD_Controller
$biz_id_arr = array_unique(array_column($rows, 'biz_id'));
$biz_id_arr && $biz_rows = $this->biz_model->get_map_by_ids($biz_id_arr, 'id,biz_name');
foreach ($rows as $key => $val) {
if(SUPER_ADMIN == $this->role){
if (SUPER_ADMIN == $this->role) {
$mobile_sub = $val['mobile'];
} else {
$mobile_sub = $val['mobile'] ? substr_replace($val['mobile'], '*****', 0, 5) : '';
@@ -127,12 +174,16 @@ class Customer extends HD_Controller
);
}
}
//渠道经理
$qdjl_lists = $this->app_licheb_users_model->select(array('group_id' => 4, 'status' => 1, 'biz_id<>' => '0'), 'id desc', 0, 0, 'id,uname as name');
$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['qdjl_lists'] = $qdjl_lists;
$this->data['_title'] = '客户列表';
return $this->show_view('receiver/customer/lists', true);
}
@@ -165,7 +216,7 @@ class Customer extends HD_Controller
$rows_log = $this->customer_oplogs_model->select(array('customer_id' => $id), 'c_time desc', 0, 0);
//用户信息
if(SUPER_ADMIN == $this->role){
if (SUPER_ADMIN == $this->role) {
$mobile_sub = $row['mobile'];
} else {
$mobile_sub = $row['mobile'] ? substr_replace($row['mobile'], '*****', 0, 5) : '';
@@ -371,33 +422,36 @@ class Customer extends HD_Controller
}
return $id;
}
//更新晓致电话数据
public function get_update_xz(){
public function get_update_xz()
{
$page = $this->input->get('page');
$size = $this->input->get('size');
$lk = $this->input->get('lk');
!$page && $page = 1;
!$page && $page = 1;
!$size && $size = 10;
$where = [
'cf_title' => 'customer',
'cf_platform' => 'api',
'status' => 1
];
if($lk){
$rows = $this->receiver_xz_model->select($where,'id desc',$page,$size,'id,biz_id');
print_r($rows);exit;
if ($lk) {
$rows = $this->receiver_xz_model->select($where, 'id desc', $page, $size, 'id,biz_id');
print_r($rows);
exit;
}
$total = $this->receiver_xz_model->count($where);
$rows = $this->receiver_xz_model->select($where,'id desc',$page,$size,'id,cf_id');
if($rows){
foreach($rows as $key => $val){
$row = $this->customers_model->get(['id'=>$val['cf_id']],'biz_id');
if($row){
$this->receiver_xz_model->update(['biz_id'=>$row['biz_id']],['id'=>$val['id']]);
$rows = $this->receiver_xz_model->select($where, 'id desc', $page, $size, 'id,cf_id');
if ($rows) {
foreach ($rows as $key => $val) {
$row = $this->customers_model->get(['id' => $val['cf_id']], 'biz_id');
if ($row) {
$this->receiver_xz_model->update(['biz_id' => $row['biz_id']], ['id' => $val['id']]);
}
}
echo "total:{$total},剩余:".($total-$page*$size);
}else{
}
echo "total:{$total},剩余:" . ($total - $page * $size);
} else {
echo "finish";
}
}
+152 -114
View File
@@ -34,34 +34,6 @@
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">门店:</label>
<div class="am-form-group am-para-inline w150">
<select name="city_id" v-model="params.city_id">
<option value="">城市</option>
<template v-for="(v,i) in cityAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select name="county_id" v-model="params.county_id">
<option value="">行政区</option>
<template v-for="(v,i) in countyAry">
<option :value="v.id">{{v.name}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select name="biz_id" v-model="params.biz_id">
<option value="">门店</option>
<template v-for="(v,i) in bizList">
<option :value="v.id">{{v.biz_name}}</option>
</template>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">来源类型:</label>
<div class="am-form-group am-para-inline w150">
@@ -92,7 +64,47 @@
</select>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 0px;"></div>
<div class="am-form-group fl">
<label class="am-para-label w100">销售员:</label>
<div class="am-para-inline w120">
<select title="城市" name="city_id_admin" v-model="params.city_id_admin">
<option value="">选择城市</option>
<option :value="v.id" v-for="(v,i) in admins.cityAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w120">
<select title="行政区" name="county_id_admin" v-model="params.county_id_admin">
<option value="">选择行政区</option>
<option :value="v.id" v-for="(v,i) in admins.countyAry">{{v.name}}</option>
</select>
</div>
<div class="am-para-inline w120">
<select name="biz_id_admin" v-model="params.biz_id_admin">
<option value="">门店</option>
<template v-for="(v,i) in admins.bizAry">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
<div class="am-para-inline w120">
<select name="admin_id" v-model="params.admin_id">
<option value="">销售员</option>
<template v-for="(v,i) in admins.list">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">渠道经理:</label>
<div class="am-para-inline w100">
<select name="qdjl_id" v-model="params.qdjl_id">
<option value=''>请选择</option>
<option :value="v.id" v-for="(v,i) in qdjl_lists">{{v.name}}</option>
</select>
</div>
</div>
<? 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>
@@ -141,7 +153,7 @@
<th width="8%"><span>客户来源</span></th>
<th width="7%"><span>所属门店</span></th>
<th width="8%"><span>状态</span></th>
<th width="4%"><span>跟进人</span></th>
<th width="4%"><span>销售员</span></th>
<th width="7%"><span>最后联系时间</span></th>
</tr>
</thead>
@@ -238,21 +250,21 @@
params: [],
searchTpAry: [],
lists: [],
cityAry: [],
countyAry: [],
qdjl_lists: [],
cfrom_id:<?=$params['cfrom_id'] ? $params['cfrom_id'] : 0?>,
cfrom_id2:<?=$params['cfrom_id2'] ? $params['cfrom_id2'] : 0?>,
cfroms: [],
cfroms2: [],
bizList: [],
admins: {cityAry: [], countyAry: [], bizAry: [], list: []},
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.searchTpAry = <?=json_encode($searchTpAry)?>;
vm.lists = <?=json_encode($lists)?>;
this.init_citys();
vm.qdjl_lists = <?=json_encode($qdjl_lists)?>;
this.getCfroms();
vm.init_citys();
},
methods: {
getCfroms: function () {
@@ -293,28 +305,30 @@
},
init_citys: function () {
var vm = this;
$.get('common/area', {id: '350', key: 'city', type: 1}, function (response) {
if (response.code == 1) {
vm.cityAry = response.data;
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: '350',
key: 'city',
type: 1
},
success: function (response) {
if (response.code == 1) {
//vm.cityAry = response.data;
vm.admins.cityAry = JSON.parse(JSON.stringify(response.data));
}
}
});
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 () {
var that = this;
that.params.search_tp = 'mobile';
that.params.title = '';
that.params.city_id = '';
that.params.county_id = '';
that.params.biz_id = '';
that.cfrom_id = 0;
that.cfrom_id2 = 0;
that.params.city_id_admin = '';
$('#cf_time').val('');
$(".order-times").map(function () {
var id = this.value;
@@ -326,73 +340,6 @@
}
},
watch: {
'params.city_id': function (nv, ov) {
var that = this;
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) {
if (response.code == 1) {
that.countyAry = response.data;
if (that.params.county_id > 0) {
var county_id = '';
for (var i in that.countyAry) {
var county = that.countyAry[i];
if (county.id == that.params.county_id) {
county_id = county.id;
break;
}
}
that.params.county_id = county_id;
}
}
});
$.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) {
var biz_id = '';
for (var i in that.bizList) {
var biz = that.bizList[i];
if (biz.id == that.params.biz_id) {
biz_id = biz.id;
break;
}
}
that.params.biz_id = biz_id;
}
}
});
}
},
'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) {
if (response.code == 1) {
that.bizList = response.data.bizList;
if (that.params.biz_id > 0) {
var biz_id = '';
for (var i in that.bizList) {
var biz = that.bizList[i];
if (biz.id == that.params.biz_id) {
biz_id = biz.id;
break;
}
}
that.params.biz_id = biz_id;
}
}
});
},
'cfrom_id': function (nv, ov) {
var that = this;
if (nv == '') {
@@ -414,6 +361,97 @@
}
});
}
},
'params.city_id_admin': function (nv, ov) {
var that = this;
if (nv == '') {
that.admins.countyAry = [];
that.params.county_id_admin = '';
} else {
if (nv.substring(0, 4) != that.params.county_id_admin.substring(0, 4)) {
that.params.county_id_admin = '';
}
$.ajax({
type: 'get',
url: '/common/area',
dataType: 'json',
data: {
id: nv,
key: 'county',
type: 1
},
success: function (response) {
if (response.code == 1) {
that.admins.countyAry = response.data;
}
}
});
}
},
'params.county_id_admin': function (nv, ov) {
var that = this;
if (nv == '') {
that.admins.bizAry = [];
that.params.biz_id_admin = '';
} else {
$.ajax({
type: 'post',
url: '/biz/store/store/json_lists',
dataType: 'json',
data: {
city_id: that.params.city_id_admin,
county_id: that.params.county_id_admin,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.admins.bizAry = response.data.list;
if (that.params.biz_id_admin > 0) {
var biz_id = '';
for (var i in that.admins.bizAry) {
if (that.params.biz_id_admin == that.admins.bizAry[i].id) {
biz_id = that.params.biz_id_admin;
break;
}
}
that.params.biz_id_admin = biz_id;
}
}
}
});
}
},
'params.biz_id_admin': function (nv, ov) {
var that = this;
if (nv == '') {
that.admins.list = [];
that.params.admin_id = '';
} else {
$.ajax({
type: 'post',
url: '/app/licheb/member/json_lists',
dataType: 'json',
data: {
biz_id: nv,
status: 1
},
success: function (response) {
if (response.code == 1) {
that.admins.list = response.data.list;
if (that.params.admin_id > 0) {
var admin_id = '';
for (var i in that.admins.list) {
if (that.params.admin_id == that.admins.list[i].id) {
admin_id = that.params.admin_id;
break;
}
}
that.params.admin_id = admin_id;
}
}
}
});
}
}
}
});
+3 -3
View File
@@ -188,12 +188,12 @@
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="20%"><span>客户姓名</span></th>
<th width="10%"><span>客户电话</span></th>
<th width="15%"><span>客户姓名</span></th>
<th width="12%"><span>客户电话</span></th>
<th width="15%"><span>分期产品</span></th>
<th width="10%"><span>年限</span></th>
<th width="10%"><span>首付金额</span></th>
<th width="10%"><span>分期时间</span></th>
<th width="15%"><span>分期时间</span></th>
<th width="10%"><span>状态</span></th>
<th width=""><span>操作</span></th>
</tr>