edit-admin-clues-cfrom

This commit is contained in:
lccsw
2021-08-26 13:56:52 +08:00
parent b688dece36
commit 0ef24b9818
3 changed files with 117 additions and 42 deletions
+67 -27
View File
@@ -35,22 +35,18 @@ class Clues extends HD_Controller
$status_arr = $this->clues_model->get_status();
$params = $this->input->get();
$this->data['province_id'] = $province_id = 350;//默认福建城市
$this->data['city_id'] = $city_id = intval($params['city_id']);
$this->data['county_id'] = $county_id = intval($params['county_id']);
$this->data['provinces'] = $this->area_model->select(array(), '', 0, 0, 'distinct(province_id), province_name');
if($province_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;
//获取系统配置的城市
$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));
}
@@ -76,7 +72,17 @@ class Clues extends HD_Controller
strlen($params['status']) && $where["status"] = $params['status'];
$city_id && $where['city_id'] = $city_id;
$county_id && $where['county_id'] = $county_id;
if($params['cfrom_id']||$params['cfrom_id2']){
if($params['cfrom_id2']){
$where['cf_id'] = $params['cfrom_id2'];
}else{
$cf_rows = $this->clues_cfrom_model->select(['pid'=>$params['cfrom_id']],'','','','id');
$cf_ids = array_column($cf_rows,'id');
$cf_ids[] = $params['cfrom_id'];
$cf_str_ids = implode(',',array_filter($cf_ids));
$cf_str_ids && $where["cf_id in ({$cf_str_ids})"] = null;
}
}
$count = $this->clues_model->count($where);
$lists = [];
if ($count) {
@@ -165,19 +171,8 @@ class Clues extends HD_Controller
$info_show['intention'] = $intention;
//获取城市区域
$city_id = '';
$county_id = '';
if($jsondata['info'] && $jsondata['info']['city_code']){
$city_code = $jsondata['info']['city_code'];
if('0' === $city_code[5]){
$city_id = $city_code;
} else {
$county_id = $city_code;
$city_id = substr_replace($county_id, '00', 4, 2);
}
}
$dataInfo['city_id'] = $city_id;
$dataInfo['county_id'] = $county_id;
$dataInfo['city_id'] = $re['city_id'];
$dataInfo['county_id'] = $re['county_id'];
$autoList[1] = $this->mdAutoBrand->select(array('status' => 1), 'id desc', 0, 0, 'id,name');
if ($re['brand_id']) {
@@ -736,5 +731,50 @@ class Clues extends HD_Controller
return $done;
}
//获取线索来源
public function get_cfroms(){
$id = $this->input->get('id');
$where = [
'status' => 1,
'pid' => 0
];
$id && $where['pid'] = $id;
$rows = $this->clues_cfrom_model->select($where,'id desc','','','id,title');
$this->data['data'] = $rows;
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';
}
}
}
+2 -3
View File
@@ -340,8 +340,7 @@
var vm = this;
if (vm.itemsPage.page == 1) {
layer.msg("已经是第一页了");
return;
}
return; }
vm.itemsPage.page--;
vm.getItems(vm.itemsPage.page);
},
@@ -377,7 +376,7 @@
methods: {
getCfroms: function(){
var that = this
if(that.info.cfrom_id){
if(that.info.cfrom_id>0){
$.get('/app/liche/cms/get_cfroms',{'id':that.info.cfrom_id},function(result){
that.cfroms2 = result.data.data
});
+48 -12
View File
@@ -39,18 +39,6 @@
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">报名位置:</label>
<div class="am-form-group am-para-inline w150" style="display: none">
<select name="province_id" data-toggle="next-select"
data-refurl="/common/area?key=city&id={value}&url=search" data-next="#bd-hd-city">
<option value="0">省份</option>
<?php if ($provinces) {
foreach ($provinces as $v) { ?>
<option value="<?= $v['province_id'] ?>"
<?= $v['province_id'] == $province_id ? 'selected' : '' ?>><?= $v['province_name'] ?></option>
<?php }
} ?>
</select>
</div>
<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">
@@ -76,6 +64,25 @@
</select>
</div>
</div>
<div class="am-form-group fl" id="cfrom_app">
<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()">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
<div class="am-form-group am-para-inline w150">
<select name="cfrom_id2" v-model="cfrom_id2">
<option value=0>请选择</option>
<template v-for="(v,i) in cfroms2">
<option :value="v.id">{{v.title}}</option>
</template>
</select>
</div>
</div>
<div class="am-form-group fl">
<div class="am-form-group" style="margin-bottom: 0px;"></div>
@@ -282,6 +289,35 @@
}
});
});
vue_obj = new Vue({
el: '#cfrom_app',
data: {
cfrom_id:<?=$params['cfrom_id']?$params['cfrom_id']:0?>,
cfrom_id2:<?=$params['cfrom_id2']?$params['cfrom_id2']:0?>,
cfroms:[],
cfroms2:[],
},
mounted: function(){
this.getCfroms()
this.getCfroms2()
},
methods: {
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
});
}
},
}
})
});
</script>