<form action="shop.manage.php?action=check" id="form1" name="form1" method="post" style="padding-bottom:20px">
	<input type="hidden" id="check_type" name="check_type" />
   <table class="from_table2_one top-1" >	
	<thead>
		<tr class="area_ajax_list_title">
		  <th class="pd-left" width="30"><tpl> $langSysShopSelect </tpl></th>
          <th width="80"><tpl> $langSysName </tpl></th>
          <th width="80"><tpl> $langSysShopHost </tpl></th>
          <th width="100"><tpl> $langSysShopTime </tpl></th>
          <th width="50"><tpl> $langSysSEstate </tpl></th>
          <th width="100"><tpl> $langCOperation </tpl></th>
      </tr>
	 </thead>
		  <tpl> if $shop_array[0].shop_id neq'' </tpl>
		  	<tpl> section name=i loop=$shop_array </tpl>
			<tr>
			  <td class="pd-left" width="30" align="left"><input name="shop_id[]" type="checkbox" value="<tpl> $shop_array[i].shop_id </tpl>_<tpl> $shop_array[i].member_id </tpl>"/>
			  </td>
			  <td width="80" align="left">
			  <tpl> if $shop_array[i].ischeck eq 1 </tpl>
			 	<a href="../store/index.php?userid=<tpl> $shop_array[i].member_id </tpl>" target="_blank"><tpl> $shop_array[i].shop_name </tpl></a>
			  <tpl>else</tpl>
			  	<a href="../store/index.php?userid=<tpl> $shop_array[i].member_id </tpl>" target="_blank"><tpl> $shop_array[i].shop_name </tpl></a>
			  <tpl>/if</tpl>
			  </td>
			  <td width="80" align="left">
			  <tpl> if $shop_array[i].ischeck eq 1 </tpl>
			  	<a href="../store/index.php?userid=<tpl> $shop_array[i].member_id </tpl>" target="_blank"><tpl> $shop_array[i].login_name </tpl></a>
			  <tpl>else</tpl>
			  	<a href="../store/index.php?userid=<tpl> $shop_array[i].member_id </tpl>" target="_blank"><tpl> $shop_array[i].login_name </tpl></a>
			  <tpl>/if</tpl>
			  </td>
			  <td width="100" align="left"><span class="fonttime">
		      <tpl> $shop_array[i].practice_time </tpl></span></td>
			  <td width="50" align="left"><tpl> $shop_array[i].open_state </tpl></td>
			  <td width="80" align="left">
			  	<a href="javascript:;" onclick="ajax_view('<tpl> $shop_array[i].shop_id </tpl>');" title="<tpl> $langCview </tpl>" class="view_a_pic">			  </a>
				<tpl> if $shop_array[i].ischeck eq '0' </tpl><!--  申请  -->
					<a href="javascript:;" onclick="ajax_operate('<tpl> $shop_array[i].shop_id </tpl>',1)" title="<tpl> $langSysShopAuditing </tpl>" class="management_a_pic"></a>
					<a href="javascript:;" onclick="ajax_operate('<tpl> $shop_array[i].shop_id </tpl>',2)" title="<tpl> $langSysShopClose </tpl>" class="lock_a_pic"></a>
				<tpl> /if </tpl>
				<tpl> if $shop_array[i].ischeck eq '1' </tpl><!--  正常  -->
					<a href="javascript:;" onclick="ajax_operate('<tpl> $shop_array[i].shop_id </tpl>',2)" title="<tpl> $langSysShopClose </tpl>" class="lock_a_pic"></a>
				<tpl> /if </tpl>
				<tpl> if $shop_array[i].ischeck eq '2' </tpl><!--  关闭  -->
					<a href="javascript:;" onclick="ajax_operate('<tpl> $shop_array[i].shop_id </tpl>',1)" title="<tpl> $langSysShopCheckOpen </tpl>" class="open_a_pic"></a>
				<tpl> /if </tpl>
				<a href="javascript:;" onclick="$.blockUI(ui_question, { width: '275px' });$('#del_value').val('<tpl> $shop_array[i].shop_id </tpl>'); " title="<tpl> $langSysShopDel </tpl>" class="del_a_pic"></a>
		      </td>
			</tr>
			<tpl> /section </tpl>
			
		<tpl> else  </tpl>
			<tr>
				<td colspan="10" align="center"><tpl> $langCNull </tpl></td>
			</tr>
		<tpl> /if  </tpl>
		</tbody>
  </table>
  <tpl> if $shop_array[0].shop_id neq'' </tpl>
  <div class="table-5-bottom">
  <div class="p-left">
  <span class="btn_left"><input class="btn_submit" name="selectall" type="button" id="selectall" value="<tpl> $langSysShopAllSelect </tpl>" /></span>
				<span class="btn_left"><input class="btn_submit" name="negative" type="button" id="negative" value="<tpl> $langSysShopContrarySelect </tpl>" /></span>
				<span class="btn_left"><input  class="btn_submit" type="button" id="openbutton" name="openbutton" value="<tpl> $langSysShopAuditing </tpl>" /></span>
				<span class="btn_left"><input  class="btn_submit" type="button" id="closebutton" name="closebutton" value="<tpl> $langSysShopClose </tpl>" /></span>

				<div class="btn_marginright">
				<tpl>$shop_page</tpl></div>
  
  </div></div>
  <tpl> /if  </tpl>
</form>
<div id="ui_question" style="display:none; cursor: default; padding:10px"> 
        <b style=" font-size:14px; margin-top:10px; line-height:50px; height:50px;padding-top:10px; padding-bottom:10px"><tpl> $langCConfirmDelete </tpl></b> <br />
        <input type="button" id="yes" value="<tpl> $langCYes </tpl>"  style=" border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/> 
        <input type="button" id="no" value="<tpl> $langCNo </tpl>"  style="border:1px solid #CCCCCC;width:80px; margin:5px; background-image:url(../templates/system_new/images/anniu.gif)"/>
		<input type="hidden" id="del_value" />
</div>  

<script>
var ui_question = $("#ui_question")[0];
$(document).ready(function(){
	$('#negative').click(
		function(){
			$('#form1 input[@type=checkbox]').each(function(){
				$(this).attr('checked',!$(this).attr('checked'))
			})
		}
	);
	$('#selectall').click(
		function(){
			$('#form1 input[@type=checkbox]').each(function(){
				$(this).attr('checked',true)
			})
		}
	);
	
	var options_close = {
		beforeSubmit:  function(){showLoading(showText);},
		success:       function(msg){
						hideLoading();
						showMessage(msg.message,msg.type);
						if(msg.type == '1'){
							ShowDiv = "result_content";
							getPageContent("shop.manage.php?action=ajax_list&curpage=<tpl>$curpage</tpl>");
						}
					},
		type:      'post',
		dataType:  'json'
	};
	//关闭
	$("#closebutton").click(function(){
		$('#check_type').val('2');
		$('#form1').ajaxSubmit(options_close);	
	});
	//通过
	$("#openbutton").click(function(){
		$('#check_type').val('1');
		$('#form1').ajaxSubmit(options_close);	
	});
	
	$('#yes').click(function() {
		ajax_del();
	})
	$('#no').click($.unblockUI);
})

//查看
function ajax_view(id){
	ShowDiv = 'result_content';
	getPageContent('shop.manage.php?action=show&shopid='+id+'&curpage=<tpl>$curpage</tpl>');
}

//对店铺进行操作 id 店铺ID type 修改状态类别
function ajax_operate(id,type){
	$.ajax({
		url: "shop.manage.php",
		data: 'action=update_check&id='+id+'&check_state='+type,
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			if(msg.type == 1){
				ShowDiv = "result_content";
				getPageContent("shop.manage.php?action=ajax_list&curpage=<tpl>$curpage</tpl>");
			}
		}
	});
	return false;
}
//删除店铺
function ajax_del(){
	$.ajax({
		url: "shop.manage.php",
		data: 'action=del&id='+$('#del_value').val(),
		type:'post',
		dataType:"json",
		beforeSubmit:  showLoading(showText),
		success: function(msg){
			hideLoading();
			showMessage(msg.message,msg.type);
			$.unblockUI();
			if(msg.type == 1){
				ShowDiv = "result_content";
				getPageContent("shop.manage.php?action=ajax_list&curpage=<tpl>$curpage</tpl>");
			}
		}
	});
	return false;
}
</script>