Commit 203afb92 by HTML5-侯张振

分销商保护期变更

parent 0afbdea0
......@@ -382,6 +382,7 @@ class Distributionadmin extends CI_Controller
$dataR['distributor_id'] = $distributor_id;
$dataR['building_id'] = $building_ids[$i];
$dataR['create_time'] = time();
$dataR['set_protection'] = $post['protection'];
$this->relate->add($dataR);
}
......
......@@ -48,13 +48,13 @@ class Index extends CI_Controller{
alert_redirect(site_url('admin/index/login'));
return;
}
$user_data=$this->session->userdata;
//获取总数
$this->load->model('user_model', 'user');
$this->data['user_count'] = $this->user->get_count(array('user_type' => 2, 'user_role' => 0, 'is_deleted' => 0));
$this->load->model('building_model', 'building');
$this->data['building_count'] = $this->building->get_building_count(array('B.is_deleted' => 0));
$this->load->model('customer_building_model', 'customer_building');
$this->data['sales_count'] = $this->customer_building->get_count(array('is_deleted' => 0, 'recommend_status' => 4));
......@@ -64,14 +64,14 @@ class Index extends CI_Controller{
//操作日志
$this->load->model('op_log_model');
$logs = $this->op_log_model->get_page(array('manager_id' => $manager_id),'id desc',1,self::PAGE_SIZE + 2);
$this->load->model('building_distributor_model', 'building_distributor'); //销管与分销商的关联
//销管登录,有小红点
$last = $this->op_log_model->get_last_by_manager($manager_id);
$last_time = $last['create_time'];
$update_time = $last['update_time'] ? : '0';
if ($update_time)
{
$where = 'M.id = '.$manager_id.' and CB.distributor_id > 0 and CB.create_time >=' . $update_time;
......@@ -80,9 +80,10 @@ class Index extends CI_Controller{
}
$this->op_log_model->update_time($last['id']);
$red_count = $this->customer_building->get_count_by_where($where);
$this->data['red_count'] = $red_count;
$this->data['log_data'] = $logs;
$this->load->view('admin/index',$this->data);
}
//定期获取未读的报备客户数量
......
......@@ -473,19 +473,19 @@ class Report extends CI_Controller
$time=date("Y-m-d",$t);
//分配给销售
// if ($post['userType'] == 'sale') {
// $newcustomerId = $api->newimportCustomer($newcustomerInfo['customer_user'], $newcustomerInfo['customer_mobile'], $newcustomerInfo['buildingId'], $newcustomerInfo['building_title'],$newcustomerInfo['rongchuang_id'],$newcustomerInfo['user_mobile'],$time);
// //分配给销售经理
// } else if ($post['userType'] == 'manager'){
// $newcustomerId = $api->importCustomer($newcustomerInfo['customer_user'], $newcustomerInfo['customer_mobile'], $newcustomerInfo['buildingId'], $newcustomerInfo['building_title']);
// }
// $newcustomer = array(
// 'rongchuang_id' => $newcustomerId
// );
// if($newcustomerId){
// $this->customer->add_rongchuang_id($newcustomerInfo['customerId'],$newcustomer);
// }
if ($post['userType'] == 'sale') {
$newcustomerId = $api->newimportCustomer($newcustomerInfo['customer_user'], $newcustomerInfo['customer_mobile'], $newcustomerInfo['buildingId'], $newcustomerInfo['building_title'],$newcustomerInfo['rongchuang_id'],$newcustomerInfo['user_mobile'],$time);
//分配给销售经理
} else if ($post['userType'] == 'manager'){
$newcustomerId = $api->importCustomer($newcustomerInfo['customer_user'], $newcustomerInfo['customer_mobile'], $newcustomerInfo['buildingId'], $newcustomerInfo['building_title']);
}
$newcustomer = array(
'rongchuang_id' => $newcustomerId
);
if($newcustomerId){
$this->customer->add_rongchuang_id($newcustomerInfo['customerId'],$newcustomer);
}
}
......@@ -505,254 +505,253 @@ class Report extends CI_Controller
}
//正式
// //记录客户到访在后台自执行
// public function dnCustomerVisit(){
// $this->load->model('customer_model','customer');
// $this->load->model('customer_building_model', 'customer_building');
// $this->load->model('recommend_trace_model', 'recommend');
// $this->load->model('customer_building_log_model','customer_building_log');
// $this->load->model('sales_model','sales');
// $this->load->model('customer_sales_model','customer_sales');
// $this->load->helper('eas');
// $api=new easApi;
// $customerId = $this->customer->search_rongchuang_id();
// if($customerId){
// foreach ($customerId as $value) {
public function dnCustomerVisit(){
$this->load->model('customer_model','customer');
$this->load->model('customer_building_model', 'customer_building');
$this->load->model('recommend_trace_model', 'recommend');
$this->load->model('customer_building_log_model','customer_building_log');
$this->load->model('sales_model','sales');
$this->load->model('customer_sales_model','customer_sales');
$this->load->helper('eas');
$api=new easApi;
$customerId = $this->customer->search_rongchuang_id();
if($customerId){
foreach ($customerId as $value) {
// //获取接口返回值
// $results = $api->newgetCustomerVisit(array('customer_id'=>$value['rongchuang_id']));
// if(!empty($results)){
// $entity_id = $this->customer_building->get_building_id($value['id']);
//
// $customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
$results = $api->newgetCustomerVisit(array('customer_id'=>$value['rongchuang_id']));
if(!empty($results)){
$entity_id = $this->customer_building->get_building_id($value['id']);
$customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
// //获取返回的sale_id
// $checksalesnum=array();
// $checksales=$results[0]["saleManColl"];
// foreach($checksales as $checksale){
// $checksalesID=$this->sales->get(array('rongchuang_user_id'=> $checksale["id"]));
// $checksalesnum[]=array('sale_id'=>$checksalesID['user_id']);
// };
// $customer_sales_id = $this->customer_building->get_sale_id(array('customer_building_id'=>$customerBuilding['id']));
// if(!($customer_sales_id==$checksalesnum)){
// $this->customer_sales->delete_sale_id(array('customer_building_id'=>$customerBuilding['id']));
// foreach($checksalesnum as $checksales){
//
// $customersales['customer_building_id'] = $customerBuilding['id'];
// $customersales['sale_id'] = $checksales['sale_id'];
// $customersales['create_time'] = time();
// $this->customer_sales->add_sale_id($customersales);
// }
// $datasales['user_id'] = $customerBuilding['user_id'];
// $datasales['customer_id'] = $customerBuilding['customer_id'];
// $datasales['building_id'] = $customerBuilding['building_id'];
// $datasales['distributor_id'] = $customerBuilding['distributor_id'];
// $datasales['building_title'] = $customerBuilding['building_title'];
// $datasales['sale_id'] = $customerBuilding['sale_id'];
// $datasales['manager_id'] = $customerBuilding['manager_id'];
// $datasales['distribution_status'] = $customerBuilding['distribution_status'];
// $datasales['recommend_status'] = $customerBuilding['recommend_status'];
// $datasales['is_deleted'] = $customerBuilding['is_deleted'];
// $datasales['create_time'] = $customerBuilding['create_time'];
// $datasales['action_time'] = time();
// if($customerBuilding['sale_id']==0){
// $datasales['remark'] = '分配';
// }else{
// $datasales['remark'] = '重新分配';
// }
// $this->customer_building_log->add($datasales);
// }
// if($customerBuilding['recommend_status'] < 2){
// $this->customer_building->update_customer_building($value['id'],array('recommend_status' => 2));
// $customerBuilding['recommend_status']=2;
// }
$checksalesnum=array();
$checksales=$results[0]["saleManColl"];
foreach($checksales as $checksale){
$checksalesID=$this->sales->get(array('rongchuang_user_id'=> $checksale["id"]));
$checksalesnum[]=array('sale_id'=>$checksalesID['user_id']);
};
$customer_sales_id = $this->customer_building->get_sale_id(array('customer_building_id'=>$customerBuilding['id']));
if(!($customer_sales_id==$checksalesnum)){
$this->customer_sales->delete_sale_id(array('customer_building_id'=>$customerBuilding['id']));
foreach($checksalesnum as $checksales){
$customersales['customer_building_id'] = $customerBuilding['id'];
$customersales['sale_id'] = $checksales['sale_id'];
$customersales['create_time'] = time();
$this->customer_sales->add_sale_id($customersales);
}
$datasales['user_id'] = $customerBuilding['user_id'];
$datasales['customer_id'] = $customerBuilding['customer_id'];
$datasales['building_id'] = $customerBuilding['building_id'];
$datasales['distributor_id'] = $customerBuilding['distributor_id'];
$datasales['building_title'] = $customerBuilding['building_title'];
$datasales['sale_id'] = $customerBuilding['sale_id'];
$datasales['manager_id'] = $customerBuilding['manager_id'];
$datasales['distribution_status'] = $customerBuilding['distribution_status'];
$datasales['recommend_status'] = $customerBuilding['recommend_status'];
$datasales['is_deleted'] = $customerBuilding['is_deleted'];
$datasales['create_time'] = $customerBuilding['create_time'];
$datasales['action_time'] = time();
if($customerBuilding['sale_id']==0){
$datasales['remark'] = '分配';
}else{
$datasales['remark'] = '重新分配';
}
$this->customer_building_log->add($datasales);
}
if($customerBuilding['recommend_status'] < 2){
$this->customer_building->update_customer_building($value['id'],array('recommend_status' => 2));
$customerBuilding['recommend_status']=2;
}
// //记录客户跟进信息
// if ($customerBuilding) {
// $dataLog['user_id'] = $customerBuilding['user_id'];
// $dataLog['customer_id'] = $customerBuilding['customer_id'];
// $dataLog['building_id'] = $customerBuilding['building_id'];
// $dataLog['distributor_id'] = $customerBuilding['distributor_id'];
// $dataLog['building_title'] = $customerBuilding['building_title'];
// $dataLog['sale_id'] = $customerBuilding['sale_id'];
// $dataLog['manager_id'] = $customerBuilding['manager_id'];
// $dataLog['distribution_status'] = $customerBuilding['distribution_status'];
// $dataLog['recommend_status'] = $customerBuilding['recommend_status'];
// $dataLog['is_deleted'] = $customerBuilding['is_deleted'];
// $dataLog['create_time'] = $customerBuilding['create_time'];
// $dataLog['action_time'] = time();
// $dataLog['remark'] = '客户到访';
//
// }
// $parme = array(
// 'entity_type' => '1',
// 'entity_id' => $entity_id['id'],
// 'trace_status' => '2',
// 'create_time' => time()
// );
if ($customerBuilding) {
$dataLog['user_id'] = $customerBuilding['user_id'];
$dataLog['customer_id'] = $customerBuilding['customer_id'];
$dataLog['building_id'] = $customerBuilding['building_id'];
$dataLog['distributor_id'] = $customerBuilding['distributor_id'];
$dataLog['building_title'] = $customerBuilding['building_title'];
$dataLog['sale_id'] = $customerBuilding['sale_id'];
$dataLog['manager_id'] = $customerBuilding['manager_id'];
$dataLog['distribution_status'] = $customerBuilding['distribution_status'];
$dataLog['recommend_status'] = $customerBuilding['recommend_status'];
$dataLog['is_deleted'] = $customerBuilding['is_deleted'];
$dataLog['create_time'] = $customerBuilding['create_time'];
$dataLog['action_time'] = time();
$dataLog['remark'] = '客户到访';
}
$parme = array(
'entity_type' => '1',
'entity_id' => $entity_id['id'],
'trace_status' => '2',
'create_time' => time()
);
// //防止重复记录log
// $log_screening = array(
// 'customer_id' => $customerBuilding['customer_id'],
// 'recommend_status' => '2'
// );
//
// $logfahui = $this->customer_building_log->screening_recommend_status($log_screening);
//
// if(empty($logfahui)){
// $this->customer_building_log->add($dataLog);
// }
$log_screening = array(
'customer_id' => $customerBuilding['customer_id'],
'recommend_status' => '2'
);
$logfahui = $this->customer_building_log->screening_recommend_status($log_screening);
if(empty($logfahui)){
$this->customer_building_log->add($dataLog);
}
// ////防止重复报备recommend_trace
// $screening = array(
// 'entity_id' => $entity_id['id'],
// 'trace_status' => '2'
// );
//
// $screeningfahui = $this->recommend->screening_recommend_status($screening);
//
// if(empty($screeningfahui)){
// $this->recommend->add_recommend_trace($parme);
// }
// }
// };
//
// }
// }
$screening = array(
'entity_id' => $entity_id['id'],
'trace_status' => '2'
);
$screeningfahui = $this->recommend->screening_recommend_status($screening);
if(empty($screeningfahui)){
$this->recommend->add_recommend_trace($parme);
}
}
};
}
}
// //记录客户认购在后台自执行
// public function dnPurchase(){
// $this->load->model('customer_model','customer');
// $this->load->model('customer_building_model', 'customer_building');
// $this->load->model('recommend_trace_model', 'recommend');
// $this->load->model('customer_building_log_model','customer_building_log');
// $this->load->helper('eas');
// $api=new easApi;
// $customerId = $this->customer->search_rongchuang_id();
// if($customerId){
// foreach ($customerId as $value) {
public function dnPurchase(){
$this->load->model('customer_model','customer');
$this->load->model('customer_building_model', 'customer_building');
$this->load->model('recommend_trace_model', 'recommend');
$this->load->model('customer_building_log_model','customer_building_log');
$this->load->helper('eas');
$api=new easApi;
$customerId = $this->customer->search_rongchuang_id();
if($customerId){
foreach ($customerId as $value) {
// //获取返回值
// $results = $api->newgetCustomerPurchase(array('customer_id'=>$value['rongchuang_id']));
//
// if(!empty($results)){
// $entity_id = $this->customer_building->get_building_id($value['id']);
$results = $api->newgetCustomerPurchase(array('customer_id'=>$value['rongchuang_id']));
if(!empty($results)){
$entity_id = $this->customer_building->get_building_id($value['id']);
// //记录客户跟进信息
// $customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
// if($customerBuilding['recommend_status'] < 3){
// $this->customer_building->update_customer_building($value['id'],array('recommend_status' => 3));
// $customerBuilding['recommend_status']=3;
// }
// if ($customerBuilding) {
// $dataLog['user_id'] = $customerBuilding['user_id'];
// $dataLog['customer_id'] = $customerBuilding['customer_id'];
// $dataLog['building_id'] = $customerBuilding['building_id'];
// $dataLog['distributor_id'] = $customerBuilding['distributor_id'];
// $dataLog['building_title'] = $customerBuilding['building_title'];
// $dataLog['sale_id'] = $customerBuilding['sale_id'];
// $dataLog['manager_id'] = $customerBuilding['manager_id'];
// $dataLog['distribution_status'] = $customerBuilding['distribution_status'];
// $dataLog['recommend_status'] = $customerBuilding['recommend_status'];
// $dataLog['is_deleted'] = $customerBuilding['is_deleted'];
// $dataLog['create_time'] = $customerBuilding['create_time'];
// $dataLog['action_time'] = time();
// $dataLog['remark'] = '客户认购';
//
// }
// $parme = array(
// 'entity_type' => '1',
// 'entity_id' => $entity_id['id'],
// 'trace_status' => '3',
// 'create_time' => time()
// );
$customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
if($customerBuilding['recommend_status'] < 3){
$this->customer_building->update_customer_building($value['id'],array('recommend_status' => 3));
$customerBuilding['recommend_status']=3;
}
if ($customerBuilding) {
$dataLog['user_id'] = $customerBuilding['user_id'];
$dataLog['customer_id'] = $customerBuilding['customer_id'];
$dataLog['building_id'] = $customerBuilding['building_id'];
$dataLog['distributor_id'] = $customerBuilding['distributor_id'];
$dataLog['building_title'] = $customerBuilding['building_title'];
$dataLog['sale_id'] = $customerBuilding['sale_id'];
$dataLog['manager_id'] = $customerBuilding['manager_id'];
$dataLog['distribution_status'] = $customerBuilding['distribution_status'];
$dataLog['recommend_status'] = $customerBuilding['recommend_status'];
$dataLog['is_deleted'] = $customerBuilding['is_deleted'];
$dataLog['create_time'] = $customerBuilding['create_time'];
$dataLog['action_time'] = time();
$dataLog['remark'] = '客户认购';
}
$parme = array(
'entity_type' => '1',
'entity_id' => $entity_id['id'],
'trace_status' => '3',
'create_time' => time()
);
// //防止重复报备log
// $log_screening = array(
// 'customer_id' => $customerBuilding['customer_id'],
// 'recommend_status' => '3'
// );
//
// $logfahui = $this->customer_building_log->screening_recommend_status($log_screening);
//
// if(empty($logfahui)){
// $this->customer_building_log->add($dataLog);
// }
$log_screening = array(
'customer_id' => $customerBuilding['customer_id'],
'recommend_status' => '3'
);
$logfahui = $this->customer_building_log->screening_recommend_status($log_screening);
if(empty($logfahui)){
$this->customer_building_log->add($dataLog);
}
// //防止重复报备recommend_trace
// $screening = array(
// 'entity_id' => $entity_id['id'],
// 'trace_status' => '3'
// );
//
// $screeningfahui = $this->recommend->screening_recommend_status($screening);
//
// if(empty($screeningfahui)){
// $this->recommend->add_recommend_trace($parme);
// }
// }
// };
// }
// }
$screening = array(
'entity_id' => $entity_id['id'],
'trace_status' => '3'
);
$screeningfahui = $this->recommend->screening_recommend_status($screening);
if(empty($screeningfahui)){
$this->recommend->add_recommend_trace($parme);
}
}
};
}
}
// //记录客户签约在后台自执行
// public function dnSign(){
// $this->load->model('customer_model','customer');
// $this->load->model('customer_building_model', 'customer_building');
// $this->load->model('recommend_trace_model', 'recommend');
// $this->load->model('customer_building_log_model','customer_building_log');
// $this->load->helper('eas');
// $api=new easApi;
// $customerId = $this->customer->search_rongchuang_id();
// if($customerId){
// foreach ($customerId as $value) {
// $results = $api->newgetCustomerSign(array('customer_id'=>$value['rongchuang_id']));
//
// if(!empty($results)){
// $entity_id = $this->customer_building->get_building_id($value['id']);
// //记录客户跟进信息
// $customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
// if($customerBuilding['recommend_status'] < 4){
// $this->customer_building->update_customer_building($value['id'],array('recommend_status' => 4));
// $customerBuilding['recommend_status']=4;
// }
// if ($customerBuilding) {
// $dataLog['user_id'] = $customerBuilding['user_id'];
// $dataLog['customer_id'] = $customerBuilding['customer_id'];
// $dataLog['building_id'] = $customerBuilding['building_id'];
// $dataLog['distributor_id'] = $customerBuilding['distributor_id'];
// $dataLog['building_title'] = $customerBuilding['building_title'];
// $dataLog['sale_id'] = $customerBuilding['sale_id'];
// $dataLog['manager_id'] = $customerBuilding['manager_id'];
// $dataLog['distribution_status'] = $customerBuilding['distribution_status'];
// $dataLog['recommend_status'] = $customerBuilding['recommend_status'];
// $dataLog['is_deleted'] = $customerBuilding['is_deleted'];
// $dataLog['create_time'] = $customerBuilding['create_time'];
// $dataLog['action_time'] = time();
// $dataLog['remark'] = '客户签约';
//
// }
// $parme = array(
// 'entity_type' => '1',
// 'entity_id' => $entity_id['id'],
// 'trace_status' => '4',
// 'create_time' => time()
// );
//
public function dnSign(){
$this->load->model('customer_model','customer');
$this->load->model('customer_building_model', 'customer_building');
$this->load->model('recommend_trace_model', 'recommend');
$this->load->model('customer_building_log_model','customer_building_log');
$this->load->helper('eas');
$api=new easApi;
$customerId = $this->customer->search_rongchuang_id();
if($customerId){
foreach ($customerId as $value) {
$results = $api->newgetCustomerSign(array('customer_id'=>$value['rongchuang_id']));
if(!empty($results)){
$entity_id = $this->customer_building->get_building_id($value['id']);
//记录客户跟进信息
$customerBuilding = $this->customer_building->get(array('id' => $entity_id['id']));
if($customerBuilding['recommend_status'] < 4){
$this->customer_building->update_customer_building($value['id'],array('recommend_status' => 4));
$customerBuilding['recommend_status']=4;
}
if ($customerBuilding) {
$dataLog['user_id'] = $customerBuilding['user_id'];
$dataLog['customer_id'] = $customerBuilding['customer_id'];
$dataLog['building_id'] = $customerBuilding['building_id'];
$dataLog['distributor_id'] = $customerBuilding['distributor_id'];
$dataLog['building_title'] = $customerBuilding['building_title'];
$dataLog['sale_id'] = $customerBuilding['sale_id'];
$dataLog['manager_id'] = $customerBuilding['manager_id'];
$dataLog['distribution_status'] = $customerBuilding['distribution_status'];
$dataLog['recommend_status'] = $customerBuilding['recommend_status'];
$dataLog['is_deleted'] = $customerBuilding['is_deleted'];
$dataLog['create_time'] = $customerBuilding['create_time'];
$dataLog['action_time'] = time();
$dataLog['remark'] = '客户签约';
}
$parme = array(
'entity_type' => '1',
'entity_id' => $entity_id['id'],
'trace_status' => '4',
'create_time' => time()
);
// //防止重复报备log
// $log_screening = array(
// 'customer_id' => $customerBuilding['customer_id'],
// 'recommend_status' => '4'
// );
//
// $logfahui = $this->customer_building_log->screening_recommend_status($log_screening);
//
// if(empty($logfahui)){
// $this->customer_building_log->add($dataLog);
// }
$log_screening = array(
'customer_id' => $customerBuilding['customer_id'],
'recommend_status' => '4'
);
$logfahui = $this->customer_building_log->screening_recommend_status($log_screening);
if(empty($logfahui)){
$this->customer_building_log->add($dataLog);
}
// ////防止重复报备recommend_trace
// $screening = array(
// 'entity_id' => $entity_id['id'],
// 'trace_status' => '4'
// );
//
// $screeningfahui = $this->recommend->screening_recommend_status($screening);
//
// if(empty($screeningfahui)){
// $this->recommend->add_recommend_trace($parme);
// }
// }
// };
// }
// }
$screening = array(
'entity_id' => $entity_id['id'],
'trace_status' => '4'
);
$screeningfahui = $this->recommend->screening_recommend_status($screening);
if(empty($screeningfahui)){
$this->recommend->add_recommend_trace($parme);
}
}
};
}
}
/**
......@@ -804,20 +803,66 @@ class Report extends CI_Controller
public function updateDay($id = '0')
{
$post = $this->input->post();
$get=$this->input->get();
// var_dump($get);
if ($post && $post['op'] == 'edit') {
$data['valid_day'] = (int)$this->input->post('valid_day');
$where = "id = " . $post['id'];
$flag = $this->building->update($where, $data);
$protection = array('set_protection'=>$post["valid_day"][0]);
foreach($post['manager_id'] as $manager_id){
if($manager_id!=''){
//获取distributor_id
$distributor=$this->distributor->get(array('manager_id'=>$manager_id));
$this->distributor->updata_set_protection($id,$distributor['id'],$protection);
}
}
if ($flag) {
alert_redirect(site_url('admin/report/circulation'));
return;
}
} else {
$this->data['info'] = $this->building->get(array('id' =>(int)$id));
$this->load->model('distributor_model', 'distributor');
$user_id = (int)$this->session->userdata('u_id');
$manager_info = $this->manager->get(array('id' => $user_id));
$user_data=$this->session->userdata;
//$where = 'R.user_id = ' . $user_id;
$where = 'B.id in (' . $manager_info['building_id'].')';
$con_arr = array();
if ($get) {
$con_arr = array(
'company_name' => $get['company_name'] ? : '',
'uniqid_id' => $get['uniqid_id'] ? : ''
);
if (isset($get['company_name']) && $get['company_name']) {
$where .= ' and D.company_name like "%' . trim($get['company_name']) . '%"';
}
if (isset($get['uniqid_id'])) {
$where .= ' and D.uniqid_id like "%' . trim($get['uniqid_id']) . '%"';
}
}
$count = $this->distributor->get_distributor_count_new($where);
if($user_data['role'] == 12){
$where.= ' and A.id ='.$user_data['u_id'];
};
$this->data['admins'] = $this->distributor->get_distributor_new($where,1, self::PAGE_SIZE);
//var_dump($this->data['admins']);
$this->load->view('admin/report/updateDay',$this->data);
}
if($post['manager_id'] != ''){
$result = array('errcode' => 0,'errmsg' => '更改成功');
echo json_encode($result);
return;
}
}
/**
......@@ -1092,7 +1137,8 @@ class Report extends CI_Controller
//邦定分销商
public function distributorSelect($distributor_building = '0_0')
{
{
if ($distributor_building)
{
//$this->load->model('user_building_model', 'Ubuilding');
......@@ -1102,7 +1148,7 @@ class Report extends CI_Controller
$distributor_id = isset($ids[0]) ? $ids[0] : '0';
$building_id = isset($ids[1]) ? $ids[1] : '0';
$protection = isset($ids[2]) ? $ids[2] : '0';
//根据销管-〉楼盘 -〉WEB端用户ID
$manager_id = (int)$this->session->userdata('u_id');
$manager_info = $this->manager->get(array('id' => $manager_id));
......@@ -1120,7 +1166,7 @@ class Report extends CI_Controller
$data['distributor_id'] = (int)$distributor_id;
$data['building_id'] = (int)$building_id;
$data['create_time'] = time();
$data['set_protection'] = $protection;
$flag = $this->relate->add($data);
if ($flag)
......
......@@ -3,7 +3,7 @@
* 微信快速登陆
* Class Controller_Index
*/
class Controller_Index extends Stourweb_Controller
class Weixin extends CI_Controller
{
private $_api;
private $_conf = null;
......
......@@ -197,5 +197,10 @@ class Distributor_model extends MY_Model{
}
return array();
}
public function updata_set_protection($id,$distributor,$protection){
$this->db->where('building_id = '.$id.' and distributor_id = '.$distributor);
$this->db->update('tb_building_distributor_relate', $protection);
}
}
\ No newline at end of file
......@@ -62,6 +62,15 @@
</table>
</div>
</div>
<div class="protection_alert" style="position: absolute;height: 150px;width: 500px;background: #DB6;top: 50%;left: 30%;display: none;">
<label style="padding-top:10%;padding-left:15%;">
设置保护期 <input id="protection_v" type="text" value="" style="width:230px;outline:none;margin-left:20px;" name="protection">
</label>
<div style="width:100%;padding-top:30px;">
<button class="alert_none" style="display: block;width: 50px;float: right;margin-right:20px;background:#4d90fe;outline:none;border: none;">确定</button>
<button class="alert_determine" style="display: block;width: 50px;float: right;margin-right:20px;background:#d84a38;outline:none;border:none">取消</button>
</div>
</div>
</div>
</div>
</div>
......@@ -83,7 +92,7 @@
<script type="text/javascript">
jQuery(document).ready(function() {
App.init();
var protection = '';
$('form').submit(function(event) {
event.preventDefault();
var _type = $('#type').val();
......@@ -112,7 +121,7 @@ jQuery(document).ready(function() {
_html += '<td>' + item.uniqid_id + '</td>';
_html += '<td>' + item.building_title + '</td>';
//_html += '<td>' + item.remark + '</td>';
_html += '<td><a class="btn sel default btn-xs purple" href="javascript:;" data-href="' + _selectUrl + '/' + item.distributor_id + '_' + item.building_id + '">选择此分销商</a></td>';
_html += '<td><a class="btn sel default btn-xs purple" href="javascript:;" data-href="' + _selectUrl + '/' + item.distributor_id + '_' + item.building_id +'">选择此分销商</a></td>';
_html += '</tr>';
}
......@@ -130,12 +139,27 @@ jQuery(document).ready(function() {
})
});
$('#add-con').delegate('.sel', 'click', function() {
if (confirm('确定选择此分销商?')) {
window.location.href = $(this).attr('data-href');
}
$('#add-con').delegate('.sel', 'click', function(e) {
e.stopPropagation()
$(".protection_alert").css({"display":"block"});
var _this = $(this);
// if (confirm('确定选择此分销商?')) {
// window.location.href = $(this).attr('data-href');
// }
$(".alert_none").click(function(e){
e.stopPropagation();
$(".protection_alert").css({"display":"none"});
protection = $('#protection_v').val();
window.location.href = _this.attr('data-href') + '_' + protection;
})
});
$(".alert_determine").click(function(e){
e.stopPropagation();
$(".protection_alert").css({"display":"none"});
})
});
</script>
</body>
......
......@@ -28,29 +28,49 @@
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form action="<?php echo site_url('admin/report/updateDay');?>" method="post" class="form-horizontal">
<form action="" method="post" id="form" class="form-horizontal">
<div class="form-body">
<div class="row">
<div class="col-md-10">
<div class="form-group">
<label class="control-label col-md-2">项目名称:</label>
<div class="col-md-4">
<input type="text" readonly="readonly" class="form-control" id="building_title" name="building_title" value="<?php echo isset($info['building_title']) ? $info['building_title'] : "";?>">
<input type="text" readonly="readonly" class="form-control" id="building_title" name="building_title[]" value="<?php echo isset($info['building_title']) ? $info['building_title'] : "";?>">
</div>
</div>
<div class="form-group">
<!--<div class="form-group">
<label class="control-label col-md-2">当前保护期(天):</label>
<div class="col-md-4">
<?php echo !empty($info['valid_day']) ? $info['valid_day'] : "7";?>
</div>
</div>-->
<div class="form-group">
<label class="control-label col-md-2">设置保护期(天):</label>
<div class="col-md-4">
<input type="text" class="form-control" id="valid_day" name="valid_day[]" value="">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-2">修改保护期(天)</label>
<label class="control-label col-md-2">搜索分销商</label>
<div class="col-md-4">
<input type="text" class="form-control" id="valid_day" name="valid_day" value="">
<input type="text" class="form-control" id="comany_name" name="company_name[]" value="">
</div>
<div class="col-md-1" style="height: 34px; background: #4d90fe;color:#fff;line-height: 34px;text-align: center;" id="search_distributors">搜索</div>
</div>
<label style="width: 24%;float: left;">
<input id="all" type="checkbox" checked="checked" name="building_all[]" value="">全选
</label>
<br/><br/>
<div class="form-group" id="checked_list" style="padding-left:15px;">
<?php foreach($admins as $i=>$admin):?>
<label style="width: 24%;float: left;">
<input type="checkbox" class="checked_list" checked="checked" name="manager_id[]" value="<?php echo $admins[$i]['manager_id']?>"> <?php echo $admins[$i]["company_name"]; ?>
</label>
<?php endforeach?>
</div>
</div>
</div>
</div>
......@@ -94,21 +114,68 @@ jQuery(document).ready(function() {
$("#prev-btn").click(function(){
var valid_day = $("#valid_day").val();
if(valid_day == '')
// console.log($('.checked_list').parent().attr('class'));
var num_array = [];
num_array="<?php echo sizeof($admins)?>";
console.log(num_array);
for(var i=0;i<(Number(num_array) + 1);i++){
if($('.checked_list').parent().eq(i).attr('class')!='checked'){
$('.checked_list').eq(i).val("");
}
}
//验证保护期是否填写
if(valid_day == '')
{
alert('请填写保护期');
$("#valid_day").focus();
return false;
}
$(form).submit();
$.ajax({
url:"<?php echo site_url('admin/report/updateDay');?>",
type:'post',
dataType:'json',
data:$('#form').serialize(),
success:function(res){
if(res.errcode == 0)
{
window.location.href = "<?php echo site_url('admin/report/circulation');?>"
}
else
{
alert(0);
}
}
});
});
$('.back-btn').click(function(){
history.go(-1);
})
$('#search_distributors').click(function(){
var html='';
console.log(55);
var comany_name = $('#comany_name').val();
<?php foreach($admins as $i => $admin):?>
var companyof = "<?php echo $admins[$i]['company_name']?>"
var companyofi = "<?php echo $admins[$i]['manager_id']?>"
if(!companyof.indexOf(comany_name)){
html += '<label style="width: 24%;float: left;"><div class="checker"><span class="checked"><input type="checkbox" class="checked_list" checked="checked" name="manager_id[]" value="'+companyofi+'"></span></div>'+companyof+'</label>'
}
<?php endforeach?>
$('#checked_list').html(html);
});
$(".form-body").on('click','#all',function(){
console.log(12211);
if(this.checked){
console.log(3);
$(".checked_list").parent().addClass('checked');
}else{
$(".checked_list").parent().removeClass('checked');
}
});
});
</script>
</body>
......
......@@ -41,7 +41,7 @@
<div class="portlet-body">
<div class="table-toolbar">
<div class="btn-group">
<?php if($role!=10){?>
<?php if($role!=12){?>
<button class="btn green" onclick="window.location.href='<?php echo site_url('/admin/distributionadmin/distributorAdd');?>'"> 新增分销商 <i class="fa fa-plus"></i> </button>
<?php }?>
</div>
......
......@@ -190,6 +190,12 @@
<input type="text" class="form-control" id="remark" name="remark" value="<?php echo isset($data['remark']) ? $data['remark'] : '' ?>">
</div>
</div>
<div class="form-group">
<label class="control-label col-md-3">保护期设置</label>
<div class="col-md-4">
<input type="text" class="form-control" id="protection" name="protection" value="">
</div>
</div>
</div>
<div class="form-actions fluid">
<div class="col-md-offset-3 col-md-9">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment