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);
}
//定期获取未读的报备客户数量
......
......@@ -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