<!--<?php
require($this->getSegmentFile('dianpu.nav'));
print <<<EOT
-->
<script type="text/javascript">
var dianpu = {
	doSearch : function(obj){
		var url = obj.action;
		var types = obj.type;
		for (var i = 0 ; i < types.length ; i++) {
			if(types[i].checked) {
				url += '&type=' + types[i].value;
				break;
			}
		}
		if (obj.act_title.value) url += '&act_title=' + obj.act_title.value;
		if (obj.areaid.value) url += '&areaid=' + obj.areaid.value;
		if (obj.categoryid.value) url += '&categoryid=' + obj.categoryid.value;
		if (obj.childid.value) url += '&childid=' + obj.childid.value;
		setTimeout(function(){
			window.location.href = url;
		},100);
		return false;
	},
	doClose : function(){
		if(!confirm('你确定要批量关闭吗?')) return false;
		var obj = document.FORM;
		if(!DP.isClicked(obj)) {
			DP.tips('error','请选择要批量关闭的店铺');
			return false;
		}
		var url = obj.action;
		ajax.send(url,obj,function(){
			DP.tips('success','批量关闭操作成功');
			setTimeout("window.location.reload();",1000);
		});
		return false;
	},
	close : function(obj){
		if(!confirm('你确定要关闭吗?')) return false;
		var url = obj.href;
		ajax.send(url,'',function(){
			if (ajax.request.responseText == 'error') {
				DP.tips('error','操作失败！');
				return false;
			}
			DP.tips('success','关闭操作成功');
			setTimeout("window.location.reload();",1000);
		});
		return false;
	},
	open : function(obj){
		var url = obj.href;
		ajax.send(url,'',function(){
			if (ajax.request.responseText == 'error') {
				DP.tips('error','操作失败！');
				return false;
			}
			DP.tips('success','开启操作成功');
			setTimeout("window.location.reload();",1000);
		});
		return false;
	}
};
</script>
<script language='javascript' type="text/javascript">
window.onload = function(){
    tools.getChildCategory('index.php?m=dianpu&c=checkin&a=categorychildlist', getObj('categoryid'), '{$_viewer->categoryid}');
}
</script>
<h2 class="h1">店铺搜索</h2>
<!--
EOT;
$keyword = ($_viewer->keyword) ? stripslashes($_viewer->keyword) : '';
print <<<EOT
-->
<div class="admin_table mb10">
<form action="{$_viewer->baseUrl}" method="post" name="SEARCH" onsubmit="return dianpu.doSearch(document.SEARCH)">
	<table width="100%">
		<tr class="tr1">
			<td class="td2">
				<input name="act_title" type="text" class="input input_wa mr10" value="{$keyword}"/>
				<label class="mr10"><input name="type" type="radio" value="dianpu" {$_viewer->checked['dianpu']}/>店铺名</label>
				<label class="mr10"><input name="type" type="radio" value="owner" {$_viewer->checked['owner']}/>店主</label>
				<span class="mr10">地区: {$_viewer->areaSelectHtml}</span>
				<span class="mr10">行业: {$_viewer->parentCategorySelectHtml}<span id="optionitem"></span></span>
				<span class="btn2"><span><button type="submit">搜索</button></span></span>
			</td>
		</tr>
	</table>
</form>
</div>
<h2 class="h1">店铺列表</h2>
<div class="admin_table mb10">
<!--
EOT;
if(!$_viewer->dianpus){
print <<<EOT
-->
		<div class="admin_tips">啊哦，没有你要的信息！</div>
<!--
EOT;
}else{
print <<<EOT
-->
<form action="{$_viewer->baseUrl}&action=statedianpu&" method="post" name="FORM">
	<table width="100%">
		<tr class="tr2">
			<td class="td2" width="35"><span onClick="CheckAll(document.FORM)" style = "cursor:pointer;">全选</span></td>
			<td class="td2">店铺名称</td>
			<td class="td2">店铺组</td>
			<td class="td2">地区</td>
			<td class="td2">分类</td>
			<td class="td2">店主</td>
			<td width="110">创建时间</td>
			<td width="200">操作</td>
		</tr>
<!--
EOT;
$groups = L::config('dianpuGroups', 'dianpu_groups');
foreach($_viewer->dianpus as $key => $dianpu){
$dianpu['group'] = $groups[$dianpu['groupid']]['title'] ? $groups[$dianpu['groupid']]['title'] : '--';
print <<<EOT
-->
		<tr class="tr1">
			<td class="td2"><input name="dianpus[]" type="checkbox" value="{$dianpu[dianpuid]}" /></td>
			<td class="td2"><a href="{$_viewer->indexUrl}&c=info&id={$dianpu[dianpuid]}" target="_blank">{$dianpu[title]}</a> <span class="s1"></span></td>
			<td class="td2">{$dianpu[group]}</td>
			<td class="td2">{$dianpu[area]}</td>
			<td class="td2">{$dianpu[parent]} &raquo; {$dianpu[child]}</td>
			<td class="td2"><a href="u.php?uid=$dianpu[uid]" target="_blank">{$dianpu[username]}</a></td>
			<td class="td2">{$dianpu[createtime]}</td>
			<td class="td2">
				<a href="{$_viewer->indexUrl}&c=pmanage&a=add&id={$dianpu[dianpuid]}&dianpuid={$dianpu['dianpuid']}" class="mr5" target="_blank">[商品添加]</a>
				<a href="{$_viewer->baseUrl}&action=edit&id={$dianpu[dianpuid]}" class="mr5">[编辑]</a>
<!--
EOT;
if($dianpu[state]){print <<<EOT
-->
				<a href="{$_viewer->baseUrl}&action=statedianpu&dianpus={$dianpu[dianpuid]}&state=0" onclick="return dianpu.close(this);">[关闭]</a>
<!--
EOT;
}else{print <<<EOT
-->
				<a href="{$_viewer->baseUrl}&action=statedianpu&dianpus={$dianpu[dianpuid]}&state=1" onclick="return dianpu.open(this);">[开启]</a>
<!--
EOT;
}print <<<EOT
-->
			</td>
		</tr>
<!--
EOT;
}print <<<EOT
-->
	</table>
	<table width="100%">
		<tr class="tr2">
			<td colspan="2"><input type="checkbox" onclick="PW.selectAll('dianpus[]',this)" /><span class="mr10" onClick="CheckAll(document.FORM)" style = "cursor:pointer;"> 全选</span> <span class="bt2"><span><button type="button" onclick="dianpu.doClose()">批量关闭</button></span></span></td>
			<td colspan="6">&nbsp;</td>
		</tr>
	</table>
	</form>
	<div class="cc">&nbsp;</div>
	<div class="cc">{$_viewer->paper}</div> 
<!--
EOT;
}print <<<EOT
-->
</div>
<!--
EOT;
?>