HTML
<form name="admin_list_sea" class="form-search form-horizontal" method="post" action="{:U('integral_list')}">
<div class="row maintop">
<div class="col-xs-12 col-sm-2 hidden-xs btn-sespan">
<div class="input-group">
<span class="input-group-addon">
<i class="glyphicon glyphicon-calendar fa fa-calendar"></i>
</span>
<input type="text" name="search[reservation]" id="reservation" class="sl-date" value="{$search['reservation']}" placeholder="选择日期范围"/>
</div>
</div>
<div class="col-xs-12 col-sm-2">
<select name="search[member_status]">
<option <if condition="$search.member_status eq 0"></if> value="">会员身份</option>
<option <if condition="$search.member_status eq 1">selected</if> value="1">乘客</option>
<option <if condition="$search.member_status eq 2">selected</if> value="2">司机</option>
</select>
</div>
<div class="col-xs-12 col-sm-3 btn-sespan">
<div class="input-group">
<span class="input-group-addon">
<i class="ace-icon fa fa-check"></i>
</span>
<input type="text" name="search[nickname]" id="nickname" class="form-control search-query admin_sea" value="{$search.nickname}" placeholder="请输入昵称" />
<span class="input-group-btn">
<button type="submit" class="btn btn-xs btm-input btn-purple">
<span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
搜索
</button>
</span>
</div>
</div>
</div>
</form>
<script type="text/javascript" src="__PUBLIC__/sldate/moment.js"></script>
<script type="text/javascript" src="__PUBLIC__/sldate/daterangepicker.js"></script>
<script type="text/javascript">
$('#reservation').daterangepicker(null, function (start, end, label) {
console.log(start.toISOString(), end.toISOString(), label);
});
</script>
控制器
public function integral_list(){
$search = I("search");
if($search){
if($search["reservation"]){
$arr = explode(" - ",$search["reservation"]);//转换成数组
if(count($arr)==2){
$arrdateone=strtotime($arr[0]);
$arrdatetwo=strtotime($arr[1].' 23:59:59');
$data['a.addtime'] = array(array('egt',$arrdateone),array('elt',$arrdatetwo),'AND');
}
}
if($search['member_status']){
if($search['member_status'] == '1'){
$data['b.member_status'] = 1;
}else{
$data['b.member_status'] = 2;
}
}
if($search["nickname"]){
$data['b.member_list_nickname'] = array('like',"%".$search['nickname']."%");
}
}
$count = M('account_log')->join('AS a LEFT JOIN __MEMBER_LIST__ AS b ON a.userid=b.member_list_id')->where($data)->count();
$Page= new \Think\Page($count,C('DB_PAGENUM'));
$show= $Page->show();
$account_info = M('account_log')->join('AS a LEFT JOIN __MEMBER_LIST__ AS b ON a.userid=b.member_list_id')->where($data)->select();
$this->assign('account_info',$account_info);
$this->assign('search',$search);
$this->assign('show',$show);
$this->display();
}