edit-admin-clues-log
This commit is contained in:
@@ -37,19 +37,6 @@ class Clues extends HD_Controller
|
||||
|
||||
$this->data['city_id'] = $city_id = intval($params['city_id']);
|
||||
$this->data['county_id'] = $county_id = intval($params['county_id']);
|
||||
//获取系统配置的城市
|
||||
$map_city = $this->city_ary();
|
||||
$rows_city = array();
|
||||
foreach($map_city as $k => $v){
|
||||
$rows_city[] = array(
|
||||
'city_id' => $k,
|
||||
'city_name' => $v
|
||||
);
|
||||
}
|
||||
$this->data['citys'] = $rows_city;
|
||||
if($city_id){
|
||||
$this->data['countys'] = $this->area_model->select(array('city_id' => $city_id));
|
||||
}
|
||||
|
||||
$page = $params['page'] = $params['page'] ? intval($params['page']) : 1;
|
||||
$size = $params['size'] = $params['size'] ? intval($params['size']) : 20;
|
||||
@@ -185,6 +172,18 @@ class Clues extends HD_Controller
|
||||
$autoList[4] = $this->mdAutoAttr->select(array('type' => 0, 's_id' => $re['s_id']), 'id desc', 0, 0, 'id,title as name');
|
||||
}
|
||||
$info_show['autoList'] = $autoList;
|
||||
//获取已分配店铺
|
||||
$cus = $this->customers_model->select(['rid'=>$re['id']],'','','','biz_id');
|
||||
$biz_arr = [];
|
||||
if($cus){
|
||||
$biz_ids = implode(array_column($cus,'biz_id'),',');
|
||||
if($biz_ids){
|
||||
$where_biz["id in ($biz_ids)"] = null;
|
||||
$cus_biz = $this->biz_model->select($where_biz,'','','','biz_name');
|
||||
$biz_arr = array_column($cus_biz,'biz_name');
|
||||
}
|
||||
}
|
||||
$info_show['cus_bizs'] = implode($biz_arr,',');
|
||||
$this->data['info'] = $dataInfo;
|
||||
$this->data['info_show'] = $info_show;
|
||||
$this->data['_title'] = '线索详情';
|
||||
@@ -474,17 +473,27 @@ class Clues extends HD_Controller
|
||||
public function get_adviser()
|
||||
{
|
||||
$ids = $this->input->get('ids');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
$bizList = $this->biz_model->select($where, '', '', '', 'id,biz_name');
|
||||
$this->data['bizList'] = $bizList;
|
||||
if($this->input->method()=='post'){
|
||||
$city_id = $this->input->post('city_id');
|
||||
$county_id = $this->input->post('county_id');
|
||||
$where = [
|
||||
'status' => 1,
|
||||
];
|
||||
$city_id && $where['city_id'] = $city_id;
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
$bizList = $this->biz_model->select($where, '', '', '', 'id,biz_name');
|
||||
$this->data['bizList'] = $bizList;
|
||||
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
|
||||
}
|
||||
$this->data['ids'] = $ids;
|
||||
return $this->show_view('receiver/clues/get_adviser');
|
||||
}
|
||||
|
||||
public function edit_adviser()
|
||||
{
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$this->load->library('receiver/customers_entity');
|
||||
|
||||
$biz_id = $this->input->post('biz_id');
|
||||
$ids = $this->input->post('ids');
|
||||
$ids_arr = explode(',', $ids);
|
||||
@@ -526,10 +535,10 @@ class Clues extends HD_Controller
|
||||
$customers_id = $this->customers_model->add($add_data);
|
||||
if ($customers_id) {
|
||||
$this->clues_model->update(['status' => 1], ['id' => $val]);
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$this->clues_entity->add_log($val, $this->uid, $this->username, "分配给【{$biz['biz_name']}】商家");
|
||||
$this->load->library('receiver/customers_entity');
|
||||
//同步线索日志到客户日志
|
||||
$this->customers_entity->syn_clues($customers_id,$val);
|
||||
$this->customers_entity->add_log($customers_id, $this->uid, $this->username, "平台分配", 0, 'admin');
|
||||
$this->clues_entity->add_log($val, $this->uid, $this->username, "分配给【{$biz['biz_name']}】商家");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -744,37 +753,9 @@ class Clues extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
public function get_change(){
|
||||
$page = $this->input->get('page');
|
||||
$size = $this->input->get('size');
|
||||
!$page && $page = 1;
|
||||
!$size && $size = 20;
|
||||
|
||||
$where = [
|
||||
'c_time<' => 1629907200,
|
||||
];
|
||||
$rows = $this->clues_model->select($where,'id desc',$page,$size,'id,jsondata');
|
||||
if($rows){
|
||||
$this->load->model('sys/sys_area_model');
|
||||
$up_ids = [];
|
||||
foreach($rows as $key => $val){
|
||||
$jsondata = json_decode($val['jsondata'],true);
|
||||
if($jsondata['info']['city_code']){
|
||||
$city_code = $jsondata['info']['city_code'];
|
||||
$city = $this->sys_area_model->get(['county_id'=>$city_code],'city_id,county_id');
|
||||
if($city){
|
||||
$update = [
|
||||
'city_id' => $city['city_id'],
|
||||
'county_id' => $city['county_id']
|
||||
];
|
||||
$this->clues_model->update($update,['id'=>$val['id']]);
|
||||
$up_ids[] = $val['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
echo "do up ids: ".implode(',',$up_ids);
|
||||
}else{
|
||||
echo 'finish';
|
||||
}
|
||||
public function get_city(){
|
||||
$citys = $this->city_ary();
|
||||
$this->data['citys'] = $citys;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,11 +59,14 @@ class Customer extends HD_Controller
|
||||
$count = $this->customers_model->count($where);
|
||||
$lists = [];
|
||||
if ($count) {
|
||||
$fileds = 'id,name,mobile,cf_title,c_time,admin_id,status';
|
||||
$fileds = 'id,name,mobile,cf_title,c_time,admin_id,status,biz_id';
|
||||
$rows = $this->customers_model->select($where, 'id desc', $page, $size, $fileds);
|
||||
//获取销售员
|
||||
$admin_id_arr = array_unique(array_column($rows, 'admin_id'));
|
||||
$admin_id_arr && $admin_rows = $this->app_licheb_users_model->get_map_by_ids($admin_id_arr, 'id,uname');
|
||||
//获取门店
|
||||
$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) {
|
||||
$lists[] = array(
|
||||
'id' => $val['id'],
|
||||
@@ -73,6 +76,7 @@ class Customer extends HD_Controller
|
||||
'cf_title' => $val['cf_title'],
|
||||
'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'] : '',
|
||||
'c_time' => $val['c_time'] > 0 ? date('Y-m-d H:i:s', $val['c_time']) : '',
|
||||
);
|
||||
}
|
||||
@@ -90,7 +94,6 @@ class Customer extends HD_Controller
|
||||
{
|
||||
$id = $this->input->get('id');
|
||||
|
||||
$this->load->model("biz/biz_model");
|
||||
$this->load->model('auto/auto_brand_model');
|
||||
$this->load->model('auto/auto_series_model');
|
||||
|
||||
|
||||
@@ -88,6 +88,25 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="table-td">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">分配商家:</div>
|
||||
<template v-if="infoShow.cus_bizs">
|
||||
{{infoShow.cus_bizs}}
|
||||
</template>
|
||||
<template v-else>
|
||||
未分配
|
||||
</template>
|
||||
</div>
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
<td class="table-td">
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="am-form-inline" style="padding-right: 30px;padding-top: 10px;">
|
||||
|
||||
@@ -1,20 +1,114 @@
|
||||
<form class="am-form am-form-horizontal ptb20 pr20 mt10" data-auto="true" method="post" style="padding-top: 10px;padding-bottom: 10px;"
|
||||
action="/receiver/clues/edit_adviser" id="edit-form">
|
||||
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">商家地址:</label>
|
||||
<div class="am-para-input">
|
||||
<div class="am-form-inline">
|
||||
<div class="am-form-group w100">
|
||||
<select name="city_id" v-model="city_id">
|
||||
<option value="0">城市</option>
|
||||
<template v-for="(v,i) in cityAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
<div class="am-form-group w100">
|
||||
<select name="county_id" v-model="county_id">
|
||||
<option value="0">行政区</option>
|
||||
<template v-for="(v,i) in countyAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">门店:</label>
|
||||
<div class="am-para-input w300">
|
||||
<select name="biz_id">
|
||||
<select name="biz_id" v-model="biz_id">
|
||||
<option value="">请选择门店</option>
|
||||
<?php foreach ($bizList as $key => $value) { ?>
|
||||
<option value="<?= $value['id'] ?>"><?= $value['biz_name'] ?></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">
|
||||
<div class="am-para-input">
|
||||
<input type="hidden" name="ids" value="<?= $ids ?>">
|
||||
<button class="am-btn am-btn-secondary" type="submit" id="add-btn">保存分配</button>
|
||||
<button class="am-btn am-btn-secondary" type="button" @click="save()">保存分配</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
$(function () {
|
||||
vue_obj = new Vue({
|
||||
el: '#edit-form',
|
||||
data: {
|
||||
city_id:<?=$params['city_id']?$params['city_id']:0?>,
|
||||
county_id:<?=$params['county_id']?$params['county_id']:0?>,
|
||||
cityAry:[],
|
||||
countyAry:[],
|
||||
bizList:[],
|
||||
biz_id:'',
|
||||
},
|
||||
mounted: function(){
|
||||
this.init_citys();
|
||||
},
|
||||
methods: {
|
||||
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;
|
||||
}
|
||||
});
|
||||
},
|
||||
save:function(){
|
||||
pdata = {'biz_id':this.biz_id,'ids':'<?=$ids?>'}
|
||||
$.post('receiver/clues/edit_adviser',pdata,function(response){
|
||||
if (response.code == 1) {
|
||||
layer.msg(response.msg,{'icon':1},function(){
|
||||
layer.closeAll();
|
||||
$.form.reload();
|
||||
})
|
||||
}else{
|
||||
layer.msg(response.msg,{'icon':2});
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'city_id':function(nv, ov){
|
||||
var that = this;
|
||||
if(nv == ''){
|
||||
that.countyAry = [];
|
||||
that.county_id = '';
|
||||
} else {
|
||||
$.get('common/area',{id:nv,key:'county',type:1},function(response){
|
||||
if (response.code == 1) {
|
||||
that.countyAry = response.data;
|
||||
}
|
||||
});
|
||||
$.post('receiver/clues/get_adviser',{city_id:that.city_id,county_id:that.county_id},function(response){
|
||||
if (response.code == 1) {
|
||||
that.bizList = response.data.bizList;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'county_id':function(nv, ov){
|
||||
var that = this;
|
||||
$.post('receiver/clues/get_adviser',{city_id:that.city_id,county_id:that.county_id},function(response){
|
||||
if (response.code == 1) {
|
||||
that.bizList = response.data.bizList;
|
||||
}
|
||||
});
|
||||
|
||||
},
|
||||
}
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
<div class="coms-table-wrap mt10">
|
||||
<form class="form-search coms-table-hd clearfix no-border" onsubmit="return false"
|
||||
action="/receiver/clues">
|
||||
action="/receiver/clues" id="search_form">
|
||||
<input type="hidden" name="status_pid" value="<?= $params['status_pid'] != -99 ? $params['status_pid'] : '' ?>">
|
||||
<input type="hidden" name="status_id" value="<?= $params['status_id'] ?>">
|
||||
<div class="am-form am-form-horizontal">
|
||||
@@ -40,34 +40,26 @@
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">报名位置:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select id="bd-hd-city" name="city_id" data-toggle="next-select"
|
||||
data-refurl="/common/area?key=county&id={value}" data-next="#bd-hd-county">
|
||||
<select name="city_id" v-model="city_id">
|
||||
<option value="0">城市</option>
|
||||
<?php if ($citys) {
|
||||
foreach ($citys as $v) { ?>
|
||||
<option value="<?= $v['city_id'] ?>"
|
||||
<?= $v['city_id'] == $city_id ? 'selected' : '' ?>><?= $v['city_name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
<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 id="bd-hd-county" name="county_id" data-toggle="next-select"
|
||||
data-refurl="/common/areas?id={value}" data-next="#bd-hd-area">
|
||||
<select name="county_id" v-model="county_id">
|
||||
<option value="0">行政区</option>
|
||||
<?php if ($countys) {
|
||||
foreach ($countys as $value) { ?>
|
||||
<option value="<?= $value['county_id'] ?>"
|
||||
<?= $value['county_id'] == $county_id ? 'selected' : '' ?>><?= $value['county_name'] ?></option>
|
||||
<?php }
|
||||
} ?>
|
||||
<template v-for="(v,i) in countyAry">
|
||||
<option :value="v.id">{{v.name}}</option>
|
||||
</template>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl" id="cfrom_app">
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label w100">客户来源:</label>
|
||||
<div class="am-form-group am-para-inline w150">
|
||||
<select name="cfrom_id" v-model="cfrom_id" @change="getCfroms2()">
|
||||
<select name="cfrom_id" v-model="cfrom_id">
|
||||
<option value=0>请选择</option>
|
||||
<template v-for="(v,i) in cfroms">
|
||||
<option :value="v.id">{{v.title}}</option>
|
||||
@@ -290,32 +282,74 @@
|
||||
});
|
||||
});
|
||||
vue_obj = new Vue({
|
||||
el: '#cfrom_app',
|
||||
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:[]
|
||||
},
|
||||
mounted: function(){
|
||||
this.getCfroms()
|
||||
this.getCfroms2()
|
||||
this.init_citys();
|
||||
},
|
||||
methods: {
|
||||
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;
|
||||
}
|
||||
});
|
||||
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(){
|
||||
var that = this
|
||||
$.get('/receiver/clues/get_cfroms',function(result){
|
||||
that.cfroms = result.data.data
|
||||
});
|
||||
},
|
||||
getCfroms2: function(){
|
||||
var that = this
|
||||
if(that.cfrom_id>0){
|
||||
$.get('/receiver/clues/get_cfroms',{'id':that.cfrom_id},function(result){
|
||||
that.cfroms2 = result.data.data
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
watch:{
|
||||
'city_id':function(nv, ov){
|
||||
var that = this;
|
||||
if(nv == ''){
|
||||
that.countyAry = [];
|
||||
that.county_id = '';
|
||||
} else {
|
||||
$.get('common/area',{id:nv,key:'county',type:1},function(response){
|
||||
if (response.code == 1) {
|
||||
that.countyAry = response.data;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
'cfrom_id':function(nv,ov){
|
||||
var that = this;
|
||||
if(nv == ''){
|
||||
that.cfrom_id2 = 0;
|
||||
that.cfroms = [];
|
||||
} else {
|
||||
$.get('/receiver/clues/get_cfroms',{'id':nv},function(result){
|
||||
that.cfroms2 = result.data.data
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
@@ -70,6 +70,7 @@
|
||||
<th width="5%"><span>客户姓名</span></th>
|
||||
<th width="5%"><span>客户电话</span></th>
|
||||
<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="7%"><span>创建时间</span></th>
|
||||
@@ -82,12 +83,13 @@
|
||||
<td>{{v.name}}</td>
|
||||
<td>{{v.mobile_sub}}</td>
|
||||
<td>{{v.cf_title}}</td>
|
||||
<td>{{v.biz_name}}</td>
|
||||
<td>{{v.status_name}}</td>
|
||||
<td>{{v.admin_name}}</td>
|
||||
<td>{{v.c_time}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="7">
|
||||
<td colspan="8">
|
||||
<div class="row">
|
||||
<div class="col-md-4 align-l">
|
||||
</div>
|
||||
|
||||
@@ -164,7 +164,11 @@ class Aptinfo extends Wxapp{
|
||||
$city_row && $add_data['county_id'] = $city_row['county_id'];
|
||||
$lat && $add_data['lat'] = $lat;
|
||||
$lng && $add_data['lng'] = $lng;
|
||||
$this->clues_model->add($add_data);
|
||||
$id = $this->clues_model->add($add_data);
|
||||
if($id){
|
||||
$this->load->library('receiver/clues_entity');
|
||||
$this->clues_entity->add_log($id, $this->session['uid'], $this->session['nickname'], "用户报名");
|
||||
}
|
||||
throw new Exception('预约成功', API_CODE_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,18 @@ class Customers_entity{
|
||||
}
|
||||
return $level;
|
||||
}
|
||||
|
||||
/**
|
||||
* 同步线索日志到客户日志
|
||||
* @param $customer_id int 客户id
|
||||
* @param $clue_id int 线索id
|
||||
*/
|
||||
public function syn_clues($customer_id,$clue_id){
|
||||
$n_time = time();
|
||||
$sql = "insert into lc_receiver_customer_oplogs (customer_id,cf_platform,c_time,uid,uname,type,log) select {$customer_id},'admin',{$n_time},uid,uname,type,log from lc_receiver_clue_oplogs where clue_id={$clue_id}";
|
||||
$this->ci->load->model('receiver/receiver_customer_oplogs_model','customer_oplogs_model');
|
||||
$this->ci->customer_oplogs_model->db->query($sql);
|
||||
return $this->ci->customer_oplogs_model->db->affected_rows();
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -17,6 +17,23 @@ class Biz_model extends HD_Model
|
||||
parent::__construct($this->table_name, 'default');
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id获取数据
|
||||
* @param array() $ids
|
||||
*/
|
||||
public function get_map_by_ids($ids,$fileds=''){
|
||||
$rows = [];
|
||||
$ids = array_filter($ids);
|
||||
if($ids){
|
||||
$cf_ids = implode(',',$ids);
|
||||
$where = [
|
||||
"id in ($cf_ids)" => null
|
||||
];
|
||||
$rows = $this->map('id','',$where,'','','',$fileds);
|
||||
}
|
||||
return $rows;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取类型
|
||||
* @param null $key
|
||||
|
||||
Reference in New Issue
Block a user