{extend name="base"}

{block name="content"}
<div class="row">
	<div class="col-sm-12">
		<div class="card-box">
			<div class="row">
				<div class="col-sm-12">
					推广链接：
					<span>__PUBLIC__/register?user_id={$_user.id}</span>
					<a href="__PUBLIC__/register?user_id={$_user.id}" target="_blank" class="btn btn-purple waves-effect waves-light">查看</a>
				</div>
				<div class="col-sm-12">
					推广二维码：
					<img src="{$spread_url}" alt="">

				</div>
			</div>
			<!-- end row -->
			<div class="row">
				<table class="table table-striped m-0">
					<thead>
						<tr>
							<th>下级商户ID</th>
							<th>商户账号</th>
							<th>注册时间</th>
						</tr>
					</thead>
					<tbody>
						{foreach $subUsers as $v}
						<tr>
							<td>{$v.id}</td>
							<td>{$v.username}</td>
							<td>{$v.create_at|date="Y-m-d H:i:s",###}</td>
						</tr>
						{/foreach}
					</tbody>
				</table>
			</div>
			<!-- end row -->
		</div>
		{$page}
	</div>
</div>
{/block}

{block name="appendJS"}

<script>
	function change_status(obj,id)
	{
		var status=$(obj).prop('checked');
		if(status){
			status=1;
		}else{
			status=0;
		}
		$.post('/merchant/goods/changeStatus',{
			id:id,
			status:status
		},function(res){
			if(res.code!=0){
				alert(res.msg);
			}
		});
	}

	function del(obj,id)
	{
		swal({
			title: "确定删除吗？",
			text: "你将无法恢复该操作！",
			type: "warning",
			showCancelButton: true,
			confirmButtonColor: "#DD6B55",
			confirmButtonText: "确定删除！",
			closeOnConfirm: false
		},
		function(){
			$.post('/merchant/goods/del',{
				id:id
			},function(res){
				if(res.code!=0){
					swal('删除失败', res.msg, "error");
				}else{
					swal('删除成功', '', "success");
					setTimeout(function(){
						location.reload();
					},200);
				}
			});
		});
	}
</script>

{/block}
