<?php include_once(mvc::$cfg['PATH_TPL'].'public/topSeller.php');?>
<style>
    .page-box {
        float: left;
        height: 28px;
        margin: 5px;
        line-height: 28px;
        margin: 30px 0 20px 15px;
    }
</style>
<div class="maintb">
    <?php include_once(mvc::$cfg['PATH_TPL'].'seller/leftMenu.php');?>
    <div id="memberList-main-middle" class="main_middle">
        <div class="navrow">
            <ul class="navrow_ul">
				<li class="active">
                    <a href="memberRegister">已注册用户（公众号）</a>
                </li>
                <li>
                    <a href="memberList">店铺会员</a>
                </li>
				<li>
                    <a href="member">会员等级</a>
                </li>
                <li>
                    <a href="memberColl">店铺收藏</a>
                </li>
            </ul>
        </div>
        <div style="margin-top: 18px;" id="searchTable">
            <form class="form-inline" action="/seller/memberRegister" method="get" id="searchForm">
                <table class="table">
                    <tbody>
                    <tr>
                        <td class="thr">用户名称：</td>
                        <td><input type="text" class="form-control" name="userName" value="<?php echo $_GET['userName'];?>"></td>
                        <td class="thr">注册时间：</td>
                        <td>
                            <input type="text" id="start" onchange="reformatend(this)" style="width: 123px;" readonly="" placeholder="点击选择开始时间" class="form-control" name="starttime" value="<?php echo $_GET['starttime'];?>">
                            <strong>到</strong>
                            <input type="text" id="end"  style="width: 123px;"  readonly="" placeholder="点击选择结束时间" class="form-control" name="endtime" value="<?php echo $_GET['endtime'];?>">
                            <span class="add-on"><i class="icon-remove"></i></span>
                        </td>

                    </tr>
                    <tr>
                        <td class="thr">手机号</td>
                        <td><input type="text" class="form-control" name="mobile" value="<?php echo $_GET['mobile'];?>"></td>
                        <td colspan="6">
                            <button type="button" class="btn btn-default w100 marr10" onclick="window.location.href='/seller/memberRegister'">清空</button>
                            <button type="button" class="btn btn-danger w100" onclick="return submit();">搜索</button>
                        </td>
                    </tr>
                    </tbody>
                </table>
            </form>
        </div>
        <div style="margin-top:15px;" class="inner_container">
            <table style="border: 1px solid #ccc;width: 70%;" class="table table-striped">
                <thead>
                <tr>
                    <th style="width: 20%">用户名名称</th>
                    <th style="width: 20%">手机号</th>
                    <th style="width: 20%">会员级别</th>
                    <th style="width: 20%">注册时间</th>
                </tr>
                </thead>
                <tbody>
                <?php if(!empty($list)){ ?>
                    <?php foreach($list as $key => $value){ ?>
                        <tr>
                            <td><?php echo $value['u_name'];?></td>
                            <td><?php echo $value['u_mobile']; ?></td>
                            <td> <select onchange="addMemer(this,'<?php echo $value['u_id']; ?>');" class="form-control" name="level">
                                    <option value="-1">无</option>
                                    <?php foreach($level as $v){ ?>
                                        <option <?php if($value['level'] == $v['mel_name']){echo 'selected';}?> value="<?php echo $v['mel_id'];?>">
                                            <?php echo $v['mel_name'];?>
                                        </option>
                                    <?php } ?>
                                </select>
                            </td>
<!--                            <td>--><?php //echo $value['level']; ?><!--</td>-->
                            <td><?php echo $value['u_register_time'];?></td>
                        </tr>
                    <?php } ?>
                <?php }else{ ?>
                    <tr><td colspan="5" class="center orange">非常抱歉，未找到对应条件的会员</td></tr>
                <?php } ?>
                </tbody>
            </table>

        </div>
    </div>
    <?php echo $Page;?>
</div>

<?php include_once(mvc::$cfg['PATH_TPL'].'public/footAll.php');?>
<script type="text/javascript">
    var level = <?php echo json_encode($level);?>;
    laydate.render({
        elem: '#start' //指定元素
        ,type: 'datetime'
    });
    laydate.render({
        elem: '#end' //指定元素
        ,type: 'datetime'
    });
    function addMemer(that,uid) {
        var text = $(that).val();
        var data = [];
        data['0'] = [];
        data['0'].push(text);
        data['0'].push(uid);
        $.post('/seller/submitnewUid',{'allUid':data,'isAjax':1},function(res){
            if(MESSAGE.ajaxError(res)){
                MESSAGE.alert("保存成功");
            }
        },'json');
    }
</script>