{include file="templates/html_header.html"}
		<!-- /section:basics/navbar.layout -->
		<div class="main-container ace-save-state" id="main-container">
			<script type="text/javascript">
			{literal}
				try{ace.settings.loadState('main-container')}catch(e){}
			{/literal}
			</script>
			<!-- #section:basics/sidebar -->
			{include file="templates/html_sidebar.html"}
			<!-- /section:basics/sidebar -->
			<div class="main-content">
				<div class="main-content-inner">
					<!-- #section:basics/content.breadcrumbs -->
					<div class="breadcrumbs ace-save-state" id="breadcrumbs">
						<ul class="breadcrumb">
							<li>
								<i class="ace-icon fa fa-home home-icon"></i>
								<a href="index.php">首页</a>
							</li>

							<li>
								<a href="#">幸运手机号内定</a>
							</li>
							<li class="active">{$title}</li>
						</ul><!-- /.breadcrumb -->
						<!-- /section:basics/content.searchbox -->
					</div>

					<!-- /section:basics/content.breadcrumbs -->
					<div class="page-content">
					<h3 class="header smaller lighter blue">
						{$title}
						<small>幸运手机号的内定设置</small>
					</h3>
						<div class="row">
							<div class="col-xs-12">
							<!-- #section:elements.tab -->
										<div class="tabbable">
											<ul class="nav nav-tabs" id="myTab">
												<li >
													<a href="./xingyunshoujihaodesignatedlist.php" >
														幸运手机号内定列表
													</a>
												</li>

												<li class="active">
													<a data-toggle="tab" href="#designated">
														幸运手机号内定设置
													</a>
												</li>

											</ul>

											<div class="tab-content">
												<div id="home" class="tab-pane fade in active">
												<style>
													.avatar img{
														width:50px;
														height:50px;
													}
												</style>
													<table class="table table-striped table-bordered table-hover">
															<thead class="thin-border-bottom">
																<tr>
																	<th>微信</th>
																	<th>
																		中奖号码
																	</th>
																	<th>
																		中奖状态
																	</th>

																	<th >操作</th>
																</tr>
															</thead>

															<tbody>
															{foreach $flag $item}
																<tr >
																	<td class="avatar"><img src="{$item['avatar']}" />{$item['nickname']}</td>
																	<td class="phone">{$item['phone']}</td>
																	<td class="status">{$item['statustext']}</td>
																	<td >
																		<a href="###" onclick="opendesignatedform('{$item['openid']}')"><span class="label label-info">修改</span></a>
																	</td>
																</tr>
															{/foreach}
															</tbody>
														</table>
														{$pagehtml}
												</div>
											</div>
										</div>

										<!-- /section:elements.tab -->
							
							
								<!-- PAGE CONTENT BEGINS -->
								
									
									<div id="designatedmodal" class="modal" tabindex="-1">
									<div class="modal-dialog">
										<div class="modal-content">
											<div class="modal-header">
												<button type="button" class="close" data-dismiss="modal">&times;</button>
												<h4 class="blue bigger">内定设置</h4>
											</div>
											<div class="modal-body">
												<div class="row">
													<div class="col-sm-12">
														<div class="form-group">
															<label for="form-field-select-3">中奖序号：</label>
															<div>
																<input class="form-control" name="ordernum" value="" placeholder="设置第几位执行，要第5位中奖就设置5"/>
															</div>
														</div>
														<div class="space-4"></div>
														<div class="form-group">
															<label >内定状态</label>
															<div>
																<select class="chosen-select" name="designated" >
										                          	<option value="2">必中</option>
										                          	<option value="3">不会中</option>
																</select>
															</div>
														</div>
													</div>
												</div>
											</div>

											<div class="modal-footer">
												<input type="hidden" name="openid" value=""/>
												<button class="btn btn-sm" data-dismiss="modal" >
													<i class="ace-icon fa fa-times"></i>
													取消
												</button>
												<button class="btn btn-sm btn-primary" onclick="submitdesignatedform();">
													<i class="ace-icon fa fa-check"></i>
													保存
												</button>
											</div>
										</div>
									</div>
								</div>
								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					</div><!-- /.page-content -->
				</div>
			</div><!-- /.main-content -->
{include file="templates/html_footercontent.html"}
<!-- 写每个页面自定的js -->
<script type="text/javascript">
{literal}
function opendesignatedform(openid){
	openid=openid==undefined?0:openid;
	if(openid==''){
		alert('数据错误');
		return false;
	}else{
		$('input[name=ordernum]').val('');
		$('select[name=designated]').val(2);
	}
	$('input[name=openid]').val(openid);
	$('#designatedmodal').modal('show');
}

function submitdesignatedform(){
	var ordernum=$('input[name=ordernum]').val();;
	var designated=$('select[name=designated]').val();
	var openid=$('input[name=openid]').val();
	
	$.ajax({
		"url":"doxingyunshoujihao.php?action=setdesignated",
		"type":"post",
		"data":{"ordernum":ordernum,"designated":designated,"openid":openid},
		"dataType":"json",
		"success":function(json){
			alert(json.message);
			if(json.code>0){
				window.location.reload();
			}
		}
	});
}
{/literal}
</script>
{include file="templates/html_footer.html"}