<extend name="Public:base" />

<block name="content">
	
<div class="page-header">
	<a href="{:U('SellerManage/add')}" class="btn btn-primary">新增卖家</a>
</div>		
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>											
						<th>用户名</th>
						<th>店铺浏览</th>
						<th>店铺名称</th> 
						<th>手机号码</th>  
						<th>店铺类型</th>
						<th>登录IP</th>
						<th>创建时间</th>
						<th>最后登录</th>
						<th>状态</th>
						<th>操作</th>				
					</tr>
				</thead>
				<tbody>
						<volist name="list" id="m" empty="$empty">
						<tr>							
							<td>{$m.s_uname}</td>
							<td><img src="http://qr.topscan.com/api.php?text={$m.seller_view_link}" width="100" /></td>
							<td>{$m.s_true_name}</td>
							<td>{$m.s_telephone}</td>
							<td>
								
								<select class="certif" rel="{$m.s_id}">
									<option value="0" <?php if($m['certification'] == 0){echo 'selected';} ?>>普通</option>
									<option value="1" <?php if($m['certification'] == 1){echo 'selected';} ?>>个人认证</option>
									<option value="2" <?php if($m['certification'] == 2){echo 'selected';} ?>>企业认证</option>
									<option value="3" <?php if($m['certification'] == 3){echo 'selected';} ?>>平台自营</option>
								</select>
							</td>
							<td>{$m.s_last_login_ip}</td>
							<td><?php echo empty($m['s_create_time'])?'无':date('Y-m-d H:i:s',$m['s_create_time']); ?></td>
							
							<td><?php echo empty($m['s_last_login_time'])?'无':date('Y-m-d H:i:s',$m['s_last_login_time']); ?></td>
							<td>
								<?php
								switch($m['s_status']){
									case '1':
									echo '<span class="green bold">启用</span>';
									break;
									case '0':
									echo '<span class="red bold">禁用</span>';
									break;
								}
								?>
							</td>
							<td>
								<a  class="btn btn-xs btn-info" href='{:U("SellerManage/info",array("id"=>$m["s_id"]))}'>
									<i class="icon-eye-open bigger-120"></i>
								</a> 
								<a  class="btn btn-xs btn-info" href='{:U("SellerManage/store_bind_class",array("id"=>$m["s_id"]))}'>
									<i class="icon-cogs bigger-120"></i>
									<span>经营类目</span>
								</a> 
							</td>
						</tr>
						</volist>	
						
						<tr>
							<td colspan="20" class="page">{$page}</td>
						</tr>
				</tbody>
				
			</table>
		</div>
	</div>
</div>
</block>
<block name="javascript">
<script>
$(function(){
	
	$('.certif').change(function(){
		var s_id = $(this).attr('rel');
		var certif = $(this).val();
		
		$.ajax({
			url:"{:U('SellerManage/certif_chang')}",
			type:'post',
			data:{s_id:s_id,certif:certif},
			dataType:'json',
			success:function(ret){
				if(ret.code == 1)
				{
					alert('更改成功');
					return false;
				} else {
					alert('更改失败');
					return false;
				}
				
			}
		})
	})
	
	$("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });
	
	
});		
</script>
</block>