<!--<?php
require($this->getSegmentFile('dianpu.nav'));
if(!$_viewer->dianpuinfo->dianpuid){
print <<<EOT
-->
<div class="nav4 mb10">
	<ul class="cc">
		<li class="current"><a href="{$_viewer->baseUrl}&action=add">单个添加</a></li>
		<li><a href="{$_viewer->baseUrl}&action=import">批量导入</a></li>
	</ul>
</div>
<h2 class="h1">添加店铺</h2>
<!--
EOT;
}else{
$_readonly =  'readonly="readonly"';
print <<<EOT
-->
<h2 class="h1">编辑店铺</h2>
<!--
EOT;
}
print <<<EOT
-->
<script type="text/javascript" src="js/date.js"></script>
<form action="{$_viewer->baseUrl}&action=add" enctype="multipart/form-data" method="post" name="FORM" onsubmit="return identify.submitRequest(document.FORM)">
<input type="hidden" value="2" name="step"/>
<input type="hidden" value="{$_viewer->dianpuinfo->dianpuid}" name="dianpuid"/>
<input type="hidden" value="{$_viewer->page}" name="page"/>
<input type="hidden" name="params[old_username]" value="{$_viewer->dianpuinfo->username}"/>
<input type="hidden" name="params[old_url]" value="{$_viewer->dianpuinfo->url}"/>
<div class="admin_table mb10">
	<table width="100%">
		<tr class="tr1">
			<td class="td1">店主<span class="s1">*</span></td>
			<td class="td2"><input name="params[username]" value="{$_viewer->dianpuinfo->username}" type="text" class="input input_wa" /></td>
			<td class="td2"><div  class="help_a"  style="display: block;">请输入已存在的用户名</div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">店铺组<span class="s1">*</span></td>
			<td class="td2">{$_viewer->groupsSelectHtml}</td>
			<td class="td2"><div  class="help_a"  style="display: block;"></div></td>
		</tr>
		<tr class="tr1 vt">
			<td class="td1">店铺认证</td>
			<td class="td2">{$_viewer->checkWaySelectHtml}</td>
			<td class="td2"></td>
		</tr>
		<tr class="tr1">
			<td class="td1">店铺名称<span class="s1">*</span></td>
			<td class="td2"><input name="params[title]" value="{$_viewer->dianpuinfo->title}" type="text" class="input input_wa" /></td>
			<td class="td2"><div  class="help_a"  style="display: block;">将显示在店铺首页和店铺标题中</div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">地区<span class="s1">*</span></td>
			<td class="td2">{$_viewer->areaSelectHtml}</td>
			<td class="td2"><div  class="help_a"  style="display: block;"></div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">行业分类<span class="s1">*</span></td>
			<td class="td2">{$_viewer->parentCategorySelectHtml}<span id="optionitem">{$_viewer->childCategorySelectHtml}</span></td>
			<td class="td2"><div  class="help_a"  style="display: block;"></div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">分类推荐</td>
			<td class="td2">{$_viewer->recommendLevel}</td>
			<td class="td2"><div  class="help_a"  style="display: block;">店铺分类列表置顶显示级别</div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">推荐过期时间</td>
			<td class="td2"><div class="input_img fl"><i title="选择时间" class="input_time" onclick="this.nextSibling.onclick()">选择时间</i><input type="text" value="{$_viewer->dianpuinfo->overtime}" name="params[overtime]" onclick="ShowCalendar(this.id,1)" id="overtime"></div></td>
			<td class="td2"><div  class="help_a"  style="display: block;">默认为'0'永不过期</div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">实体店地址<span class="s1">*</span></td>
			<td class="td2"><input name="params[address]" value="{$_viewer->dianpuinfo->address}" type="text" class="input input_wb" /></td>
			<td class="td2"><div  class="help_a"  style="display: block;">店铺实体店地址</div></td>
		</tr>
		<tr class="tr1">
			<td class="td1">店铺电话<span class="s1">*</span></td>
			<td class="td2"><input name="params[areanumber]" value="{$_viewer->dianpuinfo->areanumber}" type="text" class="input input_wc" /> - <input name="params[phone]" value="{$_viewer->dianpuinfo->phone}" type="text" class="input input_wa" /></td>
			<td class="td2"><div  class="help_a"  style="display: block;">店铺联系电话</div></td>
		</tr>
		<tbody id="dianpu_qq">
			<tr class="tr1">
				<td class="td1">QQ</td>
				<td class="td2"><input name="params[qq]" value="{$_viewer->dianpuinfo->qq}" type="text" class="input input_wa" /></td>
				<td class="td2"><div  class="help_a"  style="display: block;">咨询QQ</div></td>
			</tr>
		</tbody>
		<tbody id="dianpu_wangwang">
			<tr class="tr1">
				<td class="td1">旺旺</td>
				<td class="td2"><input name="params[wangwang]" value="{$_viewer->dianpuinfo->wangwang}" type="text" class="input input_wa" /></td>
				<td class="td2"><div  class="help_a"  style="display: block;">咨询旺旺</div></td>
			</tr>
		</tbody>
		<tbody id="dianpu_logo">
			<tr>
				<td class="td1">店铺logo</td>
				<td class="td2"><input name="logo" type="file" class="input input_wb" id="logo" title="店铺Logo"/>
<!--
EOT;
if($_viewer->dianpuinfo->logo && strpos($_viewer->dianpuinfo->logo,'default.jpg') === false){
print <<<EOT
-->
				<span style="margin-left: 50px"><img src="{$_viewer->dianpuinfo->logo}" height="60" /> 
				<a href="{$_viewer->baseUrl}&action=deletelogo&id={$_viewer->dianpuinfo->dianpuid}" onclick="">[删]</a></span></td>
<!--
EOT;
}print <<<EOT
-->
				<td class="td2"><div  class="help_a"  style="display: block;">显示在店铺首页左侧及搜索列表中</div></td>
			</tr>
		</tbody>
		<tr class="tr1">
			<td class="td1">店铺公交</td>
			<td class="td2"><input name="params[businfo]" type="text" value="{$_viewer->dianpuinfo->businfo}" class="input input_wb" /></td>
			<td class="td2"><div  class="help_a"  style="display: block;">设置店铺周围的公交信息</div></td>
		</tr>
		<tr class="tr1 vt">
			<td class="td1">店铺公告</td>
			<td class="td2"><textarea class="textarea" name="bulletin">{$_viewer->dianpuinfo->bulletin}</textarea></td>
			<td class="td2"><div  class="help_a"  style="display: block;">用于店铺列表和店铺页显示</div></td>
		</tr>
<!--
EOT;
if($_viewer->dianpuinfo->dianpuid){
print <<<EOT
-->
	<tr class="tr1 vt">
	    <td class="td1">店铺说明</td>
		<td class="td2" colspan="2">
			<div class="admin_table_b" style="width:auto;">
			   <table cellpadding="0" cellspacing="0">
				<tr class="s6">
					<td width="60">序号</td>
					<td width="150">页面名称</td>
					<td>操作</td>
					<td><a href="javascript:;" onclick="addNewPage()"><span class="s2">[添加]</span></a></td>
				</tr>
<!--
EOT;
foreach($_viewer->dianpuinfo->contentorder as $key => $value){
$value[o] = $value[o] ? $value[o] : 0;
print <<<EOT
-->
				<tr id="order_{$key}">
					<td><input type="text" class="input input_wc" value="{$value[o]}" name="params[orders][{$key}]"/> </td>
					<td>{$value[t]}</td>
					<td><a href="{$_viewer->baseUrl}&action=addcontent&dianpuid={$_viewer->dianpuinfo->dianpuid}&contentid={$key}" class="mr5 s4">[编辑]</a></td>
					<td><a href="javascript:;" onclick="deletePage('order_{$key}', '{$key}')">[删除]</a></td>
				</tr>
<!--
EOT;
}print <<<EOT
-->
			</table></div>
		</td>
	</tr>
<!--
EOT;
}
$_maxCount = $_viewer->dianpuinfo->group['configinfo']['maxexplain'];
print <<<EOT
-->
	</table>
</div>
<div class="p10 tac"><span class="btn"><span><button type="submit" name="Submit">提 交</button></span></span></div>
</form>
<script type="text/javascript">
var identify = {
	submitRequest : function (form) {
		if (!this.validation(form,'')) return false;
		return true;
	},
	
	validation : function (form,type) {
		if(form == null || form == undefined || form == "") {
			DP.tips('error','非法的请求，请检查后再提交');
			return false;
		}
		if(type == '' || type == 'logo') VALIDATOR.uploadsize('logo',true);
		if(!VALIDATOR.result)return false;
		return true;
	}
};
function addNewPage() {
	var count = '{$_viewer->countexplain}';
	var maxcount = '{$_maxCount}';
	if(count >= maxcount){
		alert('您所在的用户组最多可添加店铺说明'+maxcount+'页');
		return false;
	}
	var url = "{$_viewer->baseUrl}&action=addcontent&dianpuid={$_viewer->dianpuinfo->dianpuid}";
	setTimeout(function(){
		window.location.href = url;
	},100);
}
function deletePage(pageid, contentid){
	var obj = getObj(pageid);
	if (obj == null) return false;
	var url = '{$_viewer->baseUrl}&action=deletepage&dianpuid={$_viewer->dianpuinfo->dianpuid}&contentid=' + contentid;
	DP.post(url,'',function(){
		if(ajax.request.responseText == 'success'){
			DP.tips('success', '操作成功！', '2');
			var objparent = obj.parentNode;
			setTimeout(function(){
				objparent.removeChild(obj);
			},1000);
		}else{
			DP.tips('error', '操作失败！', '2');
		}
	});
}
DP.baseUrl = '{$_viewer->baseUrl}&action=getgroupinfo&gid=';
DP.showManagePane('{$_viewer->dianpuinfo->group[configinfo][qq]}','dianpu_qq');
DP.showManagePane('{$_viewer->dianpuinfo->group[configinfo][wangwang]}','dianpu_wangwang');
DP.showManagePane('{$_viewer->dianpuinfo->group[configinfo][uploadlogo]}','dianpu_logo');
DP.setDianpuGroupsEvent();
</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>
<!--
EOT;
?>
