liche update for biz list search by company and clues cfrom support level2 when clues add
This commit is contained in:
@@ -38,6 +38,8 @@ class Store extends HD_Controller{
|
||||
$this->data['brand_id'] = $brand_id = intval($this->input->get('brand_id'));
|
||||
$this->data['content'] = $content = $this->input->get('content');
|
||||
$this->data['article'] = $article = $this->input->get('article');
|
||||
$this->data['company_id'] = $company_id = intval($this->input->get('company_id'));
|
||||
|
||||
$status_arr = array('del' => -1, 'off' => 0, 'on' => 1);
|
||||
$this->data['provinces'] = $this->area_model->select(array(), '', 0, 0, 'distinct(province_id), province_name');
|
||||
if($province_id){
|
||||
@@ -62,6 +64,8 @@ class Store extends HD_Controller{
|
||||
$where['status > -1'] = null;
|
||||
}
|
||||
|
||||
$company_id && $where['company_id'] = $company_id;
|
||||
|
||||
!$page && $page = 1;
|
||||
$pagesize = 20;
|
||||
$bizname && $where['biz_name like "%' . $bizname . '%"'] = null;
|
||||
@@ -71,7 +75,7 @@ class Store extends HD_Controller{
|
||||
$county_id && $where['county_id'] = $county_id;
|
||||
|
||||
$biz_lists = $this->biz_model->select($where, 'id desc', $page, $pagesize);
|
||||
$count = $this->biz_model->count();
|
||||
$count = $this->biz_model->count($where);
|
||||
$bizlists = [];
|
||||
foreach($biz_lists as $v){
|
||||
$brand = $this->bizBrand->get(array('id' => $v['brand_id']), 'brand_name');
|
||||
@@ -80,6 +84,13 @@ class Store extends HD_Controller{
|
||||
$bizlists[] = $v;
|
||||
}
|
||||
|
||||
//获取公司ID列表
|
||||
$this->load->model("sys/sys_company_model", 'company_model');
|
||||
$where = array('status' => 1);
|
||||
$orderby = 'id desc';
|
||||
$select = 'id, short';
|
||||
$map_company = $this->company_model->map('id', 'short', $where, $orderby, 0, 0, $select);
|
||||
|
||||
//获取品牌
|
||||
$lists = $this->bizBrand->select(array('status' => 1), '', '', '', 'brand_name,id');
|
||||
$data = array();
|
||||
@@ -89,7 +100,7 @@ class Store extends HD_Controller{
|
||||
}
|
||||
}
|
||||
$this->data['brand_list'] = $data;
|
||||
|
||||
$this->data['companyAry'] = $map_company;
|
||||
$this->data['lists'] = $bizlists;
|
||||
$this->data['_title'] = '门店列表';
|
||||
$this->data['pager'] = array('count' => ceil($count / $pagesize), 'curr' => $page, 'totle' => $count);
|
||||
@@ -184,6 +195,7 @@ class Store extends HD_Controller{
|
||||
|
||||
public function add(){
|
||||
|
||||
$biz['status'] = 1;
|
||||
$biz['biz_name'] = $this->input->post('biz_name', true);
|
||||
if(!$biz['biz_name']){
|
||||
return $this->show_json(SYS_CODE_FAIL, '商家名称不能为空');
|
||||
|
||||
@@ -182,10 +182,23 @@ class Clues extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '记录不存在');
|
||||
}
|
||||
|
||||
$cf_id1 = '';
|
||||
$cf_id2 = '';
|
||||
if($row['cf_id']){
|
||||
$row_cfrom = $this->clues_cfrom_model->get(array('id' => $row['cf_id']));
|
||||
if($row_cfrom['pid']){
|
||||
$cf_id1 = $row_cfrom['pid'];
|
||||
$cf_id2 = $row['cf_id'];
|
||||
} else {
|
||||
$cf_id1 = $row['cf_id'];
|
||||
}
|
||||
}
|
||||
|
||||
$info = array(
|
||||
'name' => $row['name'],
|
||||
'mobile' => $row['mobile'],
|
||||
'cf_id' => $row['cf_id'],
|
||||
'cf_id1' => $cf_id1,
|
||||
'cf_id2' => $cf_id2,
|
||||
);
|
||||
$title = "编辑线索";
|
||||
$action = "edit";
|
||||
@@ -193,18 +206,19 @@ class Clues extends HD_Controller
|
||||
$info = array(
|
||||
'name' => '',
|
||||
'mobile' => '',
|
||||
'cf_id' => '',
|
||||
'cf_id1' => '',
|
||||
'cf_id2' => '',
|
||||
);
|
||||
$title = "新增线索";
|
||||
$action = "add";
|
||||
}
|
||||
|
||||
$where = array('status' => 1);
|
||||
$where = array('status' => 1, 'pid' => 0);
|
||||
$select = 'id, title';
|
||||
$map_cfrom = $this->clues_cfrom_model->map('id', 'title', $where, '', 0, 0, $select);
|
||||
|
||||
$this->data['info'] = $info;
|
||||
$this->data['cfrom_ary'] = $map_cfrom;
|
||||
$this->data['cfromAry'] = $map_cfrom;
|
||||
$this->data['action'] = $action;
|
||||
|
||||
$this->data['_title'] = $title;
|
||||
@@ -224,10 +238,18 @@ class Clues extends HD_Controller
|
||||
return $this->show_json(SYS_CODE_FAIL, '手机号码不准确');
|
||||
}
|
||||
|
||||
$cf_id = 0;
|
||||
if($info['cf_id2']){
|
||||
$cf_id = $info['cf_id2'];
|
||||
} else if($info['cf_id1']) {
|
||||
$cf_id = $info['cf_id1'];
|
||||
}
|
||||
|
||||
$add = array(
|
||||
'name' => $info['name'],
|
||||
'mobile' => $info['mobile'],
|
||||
'cf_id' => $info['cf_id'] ? $info['cf_id'] : 0,
|
||||
'cf_id' => $cf_id,
|
||||
'admin_id' => $this->uid,
|
||||
'c_time' => time(),
|
||||
);
|
||||
$ret = $this->clues_model->add($add);
|
||||
@@ -593,6 +615,39 @@ class Clues extends HD_Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 返回map select数据
|
||||
* @return bool
|
||||
*/
|
||||
function json_map_cfrom(){
|
||||
$pid = $this->input->post('pid');
|
||||
$status = $this->input->post('status');
|
||||
|
||||
$where = array();
|
||||
if(strlen($pid) > 0){
|
||||
$where['pid'] = $pid;
|
||||
}
|
||||
|
||||
if(strlen($status) > 0){
|
||||
$where['status'] = $status;
|
||||
} else {
|
||||
$where["status>-1"] = null;
|
||||
}
|
||||
|
||||
$total = $this->clues_cfrom_model->count($where);
|
||||
$map = array();
|
||||
if($total){
|
||||
$orderby = 'id desc';
|
||||
$select= 'id, title';
|
||||
$rows = $this->clues_cfrom_model->select($where, $orderby, 0, 0, $select);
|
||||
foreach($rows as $v){
|
||||
$map[$v['id']] = $v['title'];
|
||||
}
|
||||
}
|
||||
|
||||
$this->data = $map;
|
||||
return $this->show_json(SYS_CODE_SUCCESS);
|
||||
}
|
||||
private function upload()
|
||||
{
|
||||
$config['upload_path'] = $_SERVER['DOCUMENT_ROOT'] . '/temp/';
|
||||
|
||||
@@ -69,6 +69,15 @@
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl">
|
||||
<label class="am-para-label">公司:</label>
|
||||
<div class="am-para-input w150">
|
||||
<select name="company_id" v-model="company_id">
|
||||
<option value="0">选择公司</option>
|
||||
<option v-for="(v,i) in companyAry" :value="i">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="am-form-group fl ml10">
|
||||
<button type="submit" class="am-btn am-btn-success am-btn-sm w100">搜索</button>
|
||||
</div>
|
||||
@@ -79,6 +88,7 @@
|
||||
<button type="button" data-open="/biz/store/store/get" class="am-btn am-btn-success am-btn-sm w100">新增</button>
|
||||
</p>
|
||||
<div class="coms-table-bd">
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -142,9 +152,11 @@
|
||||
el: '#vue-app',
|
||||
data: {
|
||||
brand_id: <?=$brand_id ? $brand_id : "''"?>,
|
||||
company_id:<?=$company_id?$company_id: 0?>,
|
||||
lists: {
|
||||
brand: <?=json_encode($brand_list)?>
|
||||
},
|
||||
companyAry:<?=$companyAry?json_encode($companyAry):'[]'?>
|
||||
},
|
||||
methods: {
|
||||
|
||||
|
||||
@@ -15,9 +15,13 @@
|
||||
<div class="am-form-group">
|
||||
<label class="am-para-label">来源:</label>
|
||||
<div class="am-para-input w300">
|
||||
<select name="cf_id" v-model="info.cf_id">
|
||||
<select name="cf_id1" v-model="info.cf_id1" style="width: 45%;display: inline">
|
||||
<option value="">选择来源</option>
|
||||
<option :value="i" v-for="(v,i) in cfrom_ary">{{v}}</option>
|
||||
<option :value="i" v-for="(v,i) in cfromAry">{{v}}</option>
|
||||
</select>
|
||||
<select name="cf_id2" v-model="info.cf_id2" style="width: 45%;display: inline">
|
||||
<option value="">选择来源</option>
|
||||
<option :value="i" v-for="(v,i) in cfromAry2">{{v}}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
@@ -35,13 +39,14 @@
|
||||
el: '#edit-form',
|
||||
data: {
|
||||
info:{},
|
||||
cfrom_ary:[],
|
||||
cfromAry:[],
|
||||
cfromAry2:[],
|
||||
action:""
|
||||
},
|
||||
mounted:function() {
|
||||
var vm = this;
|
||||
vm.info = <?=json_encode($info, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.cfrom_ary = <?=json_encode($cfrom_ary, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.cfromAry = <?=json_encode($cfromAry, JSON_UNESCAPED_UNICODE)?>;
|
||||
vm.action = "<?=$action?>";
|
||||
},
|
||||
methods:{
|
||||
@@ -82,6 +87,34 @@
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
watch:{
|
||||
'info.cf_id1':function(nv, ov){
|
||||
var vm = this;
|
||||
if(nv > 0){
|
||||
$.ajax({
|
||||
url: "receiver/clues/json_map_cfrom",
|
||||
type: 'post',
|
||||
dataType: 'json',
|
||||
data: {
|
||||
pid:vm.info.cf_id1,
|
||||
status:1
|
||||
},
|
||||
beforeSend: function () {},
|
||||
success: function (data) {
|
||||
if (1 == data.code) {
|
||||
vm.cfromAry2 = data.data;
|
||||
if(undefined == vm.cfromAry2[vm.info.cf_id2]){
|
||||
vm.info.cf_id2 = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
vm.cfromAry2 = [];
|
||||
vm.info.cf_id2 = '';
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -80,9 +80,7 @@
|
||||
</form>
|
||||
|
||||
<div class="coms-table-bd">
|
||||
<div class="am-form-group fr mr10">
|
||||
<span>共<?= intval($pager['totle']) ?>个客户</span>
|
||||
</div>
|
||||
<div class="fr">共有<?= $pager['totle'] ?>条数据</div>
|
||||
<table class="am-table am-table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
+26
-9
@@ -52,13 +52,30 @@ create table lc_receiver_clue_oplogs (
|
||||
-- Table:lc_receiver_clue_statistics
|
||||
-- ---------------------------
|
||||
drop table if exists lc_receiver_clue_statistics;
|
||||
CREATE TABLE `lc_receiver_clue_statistics` (
|
||||
`id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
`app_id` int(10) unsigned NOT NULL COMMENT '应用id',
|
||||
`uid` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
|
||||
`browse_num` int(10) NOT NULL DEFAULT '0' COMMENT '浏览量',
|
||||
`day` date NOT NULL DEFAULT '0000-00-00' COMMENT '日期',
|
||||
`c_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
`u_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
CREATE TABLE lc_receiver_clue_statistics (
|
||||
id int(10) NOT NULL AUTO_INCREMENT COMMENT '自增id',
|
||||
app_id int(10) unsigned NOT NULL COMMENT '应用id',
|
||||
uid int(10) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
|
||||
browse_num int(10) NOT NULL DEFAULT '0' COMMENT '浏览量',
|
||||
day date NOT NULL DEFAULT '0000-00-00' COMMENT '日期',
|
||||
c_time int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
|
||||
u_time timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
PRIMARY KEY (id)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='线索统计表'
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Title:线索来源表
|
||||
-- Author:lcc
|
||||
-- Table:lc_receiver_clues_cfrom
|
||||
-- ---------------------------
|
||||
drop table if exists lc_receiver_clues_cfrom;
|
||||
create table lc_receiver_clues_cfrom (
|
||||
id int(10) unsigned not null auto_increment comment '自增id',
|
||||
title varchar(32) not null comment '渠道名称',
|
||||
status tinyint(1) not null default '1' comment '状态:-1删除 1使用中',
|
||||
c_time int(10) unsigned not null default '0' comment '创建时间',
|
||||
u_time timestamp not null default current_timestamp on update current_timestamp,
|
||||
primary key (id)
|
||||
) engine=innodb default charset=utf8mb4 collate=utf8mb4_0900_ai_ci comment='线索来源表';
|
||||
alter table lc_receiver_clues_cfrom add column pid int unsigned not null default 0 comment '父来源ID' after title;
|
||||
|
||||
Reference in New Issue
Block a user