diff --git a/admin/controllers/biz/store/Store.php b/admin/controllers/biz/store/Store.php index 545db0f3..21c064df 100755 --- a/admin/controllers/biz/store/Store.php +++ b/admin/controllers/biz/store/Store.php @@ -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, '商家名称不能为空'); diff --git a/admin/controllers/receiver/Clues.php b/admin/controllers/receiver/Clues.php index e8d2457f..e04f876d 100644 --- a/admin/controllers/receiver/Clues.php +++ b/admin/controllers/receiver/Clues.php @@ -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/'; diff --git a/admin/views/biz/store/lists.php b/admin/views/biz/store/lists.php index 5061df34..9c00524b 100755 --- a/admin/views/biz/store/lists.php +++ b/admin/views/biz/store/lists.php @@ -69,6 +69,15 @@ +