<!--{include file="<!--{$oetplpath}-->block_head.tpl"}-->
<!--{if $a == "run"}-->
<div class="oemarry_layout">
  <div class="oe_top_nav"><i></i>活动管理->活动列表</div>
  <div class="oe_content">
	
	<form id="serform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
	<div class="oe_txtwrap">
	  分类：<!--{hook mod='activitycat' name='scatid' type='select' text='=默认=' value=$scatid}-->&nbsp;
	  标题：<input type="text" name="stitle" id="stitle" class="input-150" value="<!--{$stitle}-->" />&nbsp;
	  店铺：<input type="text" name="sshopname" id="sshopname" class="input-150" value="<!--{$sshopname}-->" />&nbsp;
	  状态：
	  <select name="sflag" id="sflag">
	  <option value=""></option>
	  <option value="1"<!--{if $sflag == '1'}--> selected<!--{/if}-->>待审核</option>
	  <option value="2"<!--{if $sflag == '2'}--> selected<!--{/if}-->>已通过</option>
	  <option value="3"<!--{if $sflag == '3'}--> selected<!--{/if}-->>未通过</option>
	  </select>
	  &nbsp;&nbsp;<input type="submit" name="btn_search" id="btn_search" class="button_2" value="搜索" />
	</div>
	</form>

    <div class="oe_tools_bar clearfix">
      <a class="icon-checkbox-unchecked" href="javascript:;" id="selAll" onclick="oemarrySelectAll(this, 'selall');">全选/反选</a>
      <a class="icon-remove-2" onclick="oemarryDialogFormDel('myform');">删除</a>
      <span class="fr"><a class="icon-plus" href="<!--{$oefile}-->&c=<!--{$c}-->&a=add">添加</a></span>
    </div>
    
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&a=del" method="post">
    <table class="oe_table_list table_cs">
	  <tr>
	    <th width="8%">ID</th>
		<th width="12%">店铺</th>
		<th width="13%">标题</th>
		<th width="8%">分类</th>
		<th width="6%">图片</th>
		<th width="7%">价格</th>
		<th width="10%">添加时间</th>
		<th width="6%">状态</th>
		<th width="6%">推荐</th>
		<th width="7%">浏览</th>
		<th width="7%">预约数</th>
		<th>操作</th>
	  </tr>
	  <!--{if empty($activity)}-->
	  <tr>
	    <td class="text_center" colspan="12">没有符合条件的信息！</td>
	  </tr>
	  <!--{else}-->
	  <!--{foreach $activity as $volist}-->
	  <tr>
	    <td class="text_center"><input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$volist.actid}-->" /><!--{$volist.actid}--></td>
		<td><!--{$volist.shopname}--></td>
		<td><a href="<!--{$urlpath}-->index.php?c=activity&a=detail&id=<!--{$volist.actid}-->" target="_blank"><!--{$volist.title}--></a></td>
		<td class="text_center"><!--{$volist.catname}--></td>
		<td class="text_center">
		<!--{if !empty($volist.thumbimg)}-->
		<img src="<!--{$volist.thumbimg}-->" width="20px" height="20px" data-img="<!--{$volist.drawimg}-->" f="viewimg" />
		<!--{else}-->
		~~
		<!--{/if}-->
		</td>
		<td>¥<!--{doubleval($volist.price)}--></td>
		<td class="text_center"><!--{$volist.addtime|date_format:"%Y-%m-%d"}--><br /><!--{$volist.addtime|date_format:"%H:%M:%S"}--></td>
		<td class="text_center">
		<!--{if $volist.flag=='1'}-->
			<input type="hidden" id="attr_flag<!--{$volist.actid}-->" value="flagclose" />
			<img id="flag<!--{$volist.actid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('flag', '<!--{$volist.actid}-->');" style="cursor:pointer;">	
		<!--{else}-->
			<input type="hidden" id="attr_flag<!--{$volist.actid}-->" value="flagopen" />
			<img id="flag<!--{$volist.actid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('flag', '<!--{$volist.actid}-->');" style="cursor:pointer;">
		<!--{/if}-->
		</td>
		<td class="text_center">
		<!--{if $volist.elite=='0'}-->
			<input type="hidden" id="attr_elite<!--{$volist.actid}-->" value="eliteopen" />
			<img id="elite<!--{$volist.actid}-->" src="<!--{$urlpath}-->tpl/static/images/img_close.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.actid}-->');" style="cursor:pointer;">
		<!--{else}-->
			<input type="hidden" id="attr_elite<!--{$volist.actid}-->" value="eliteclose" />
			<img id="elite<!--{$volist.actid}-->" src="<!--{$urlpath}-->tpl/static/images/img_open.gif" onClick="oemarryUpdateFlag('elite', '<!--{$volist.actid}-->');" style="cursor:pointer;">	
		<!--{/if}-->
		</td>
		<td class="text_center"><!--{$volist.hits}--></td>
		<td class="text_center"><!--{$volist.bespokes}--></td>
		<td class="text_center">
		 <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.actid}-->&<!--{$comeurl}-->" class="oe_ico_blue">编辑</a>
		 <a href="javascript:;" onclick="oemarryDialogUrlDel('<!--{$oefile}-->&c=<!--{$c}-->&a=del&id[]=<!--{$volist.actid}-->&<!--{$comeurl}-->');" class="oe_ico_red">删除</a>
		</td>
	  </tr>
	  <!--{/foreach}-->
	  <!--{/if}-->
	</table>
	</form>

	<div class="oe_page_box"><!--{$showpage}--></div>

  </div>
</div>
<!--{/if}-->

<!--{if $a == 'add'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>活动管理->添加
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>添加活动</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveadd" />
    <table class="oe_table_wrap">
	  <tr>
	    <th width="15%">分类：<span class="f_red"></span></th>
		<td width="35%"><!--{hook mod='activitycat' type='select' name='catid' text='=请选择='}--></td>
		<th width="15%">所属店铺：<span class="f_red">*</span></th>
		<td width="35%">
		  <input type="text" name="shopid" id="shopid" readonly="only" class="input-100" /> 
		  <span id="shopid_tips"></span>
		  <a href="###" onclick="oemarry_varpop_shop('shopid');" style="color:blue;">选择店铺</a>
		  <span class="oe_trap"></span>
		</td>
	  </tr>
	  <tr>
	    <th>标题：<span class="f_red">*</span></th>
		<td>
		  <input type="text" name="title" id="title" class="input-b" />
		  <span class="oe_trap">（100个字以内）</span>
		</td>
		<th>活动时间：<span class="f_red"></span></th>
		<td>
		  <input type="text" name="acttime" id="acttime" class="input-b" />
		  <span class="oe_trap"></span>
		</td>
	  </tr>

	  <tr>
		<th>活动图片：<span class="f_red"></span> </th>
		<td>
		  <table class="oe_table_wrap">
		    <tr>
			  <td width="150px">
				  <div class="oe_img_upload">
					<label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
					<label class="_uploading" id="img_loading">
					  <img src="<!--{$urlpath}-->tpl/admin/images/loading.gif" />上传中...
					</label>
					<input type="hidden" id="img_thumb" name="thumbimg" value="" />
					<input type="hidden" id="img_url" name="drawimg" value="" />
				  </div>
				  <script type="text/javascript">
				  $(function(){
					  $("#img").live("change", function(){
						oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=activity&thumbfiles=1");
					  });
				  });
				  </script>
			  </td>
			  <td width="50px">预览：</td>
			  <td width="80px">
			    <img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" width="30px" height="30px" id="img_preview" f="viewimg" />
				<a href="javascript:;" class="_removeimg" f="removeimg" data-preview="img_preview" data-thumb="img_thumb" data-draw="img_url">移除</a>
			  </td>
			  <td></td>
			</tr>
		  </table>
		</td>
		<th>截止预约时间：<span class="f_red"></span></th>
		<td>
		<input type="text" name="endbespoke" id="endbespoke" class="input-150" />
		（开启预约有效）
		<script>
		laydate({
			elem: '#endbespoke',
			format: 'YYYY-MM-DD hh:mm:ss',
			istime: true,
			choose: function(datas){ //选择日期完毕的回调
			}
		});
		</script>

		</td>
	  </tr>
	  <tr>
	    <th>原价：<span class="f_red"></span> </th>
		<td><input type="text" name="oldprice" id="oldprice" class="input-100" /> 元 （填写数字）</td>
		<th>现价(优惠价)：<span class="f_red"></span></th>
		<td><input type="text" name="price" id="price" class="input-100" /> 元（填写数字）</td>
	  </tr>
	  <tr>
	    <th>允许预约：<span class="f_red"></span> </th>
		<td>
		<input type="radio" name="canbespoke" id="canbespoke" value="1" checked />开启，
		<input type="radio" name="canbespoke" id="canbespoke" value="0" />关闭
		</td>
		<th>已预约人数：</th>
		<td><input type="text" name="bespokes" id="bespokes" class="input-100" /></td>
	  </tr>
	  <tr>
	    <th>状态：<span class="f_red"></span> </th>
		<td>
		<input type="radio" name="flag" id="flag" value="1" checked />正常，
		<input type="radio" name="flag" id="flag" value="0" />锁定
		</td>
		<th>推荐：</th>
		<td>
		<input type="radio" name="elite" id="elite" value="1" />是，
		<input type="radio" name="elite" id="elite" value="0" checked />否
		</td>
	  </tr>
	  <tr>
	    <th>活动简介：<span class="f_red"></span> </th>
		<td><textarea name="intro" id="intro" style="width:80%;height:40px;"></textarea></td>
		<th>浏览次数：</th>
		<td><input type="text" name="hits" id="hits" class="input-100" /></td>
	  </tr>

	  <tr>
	    <th>优惠/活动详情：</th>
		<td colspan="3">
		<textarea name="content" id="content" style="width:90%;height:350px;display:none;"></textarea>
		</td>
	  </tr>
	  <tr>
		<th>meta标题：<span class="f_red"></span> </th>
		<td colspan="3"><input type="text" name="metatitle" id="metatitle" class="input-b" /></td>
	  </tr>
	  <tr>
		<th>meta描述：<span class="f_red"></span> </th>
		<td colspan="3"><textarea name="metadesc" id="metadesc" style="width:50%;height:40px;"></textarea></td>
	  </tr>
	  <tr>
		<th>meta关键词：<span class="f_red"></span> </th>
		<td colspan="3">
		  <textarea name="metakeyword" id="metakeyword" style="width:50%;height:40px;"></textarea><br />
		  （多个关键词请使用英文逗号“,”隔开）
		</td>
	  </tr>
	  <tr>
	    <td></td>
		<td colspan="3"> <input type="button" id="btn_save" class="button_2" value="添加保存" /> </td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){
	var myeditor;
	KindEditor.ready(function(K) {myeditor = K.create("#content");});

	$("#btn_save").bind("click", function(){
		if ($("#title").val().length == 0) {
			ToastShow("请填写标题", "title");
			return false;
		}
		$("#content").text(myeditor.html());
		$("#myform").submit();
	});
});
</script>
<!--{/if}-->


<!--{if $a == 'edit'}-->
<div class="oemarry_layout">
  <div class="oe_top_nav">
	<i></i>活动管理->编辑
	<span><a href="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->">&lt;&lt;返回列表</a></span>
  </div>
  <div class="oe_content">
    <h6>编辑活动</h6>
	<form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->&<!--{$comeurl}-->" method="post" />
	<input type="hidden" name="a" id="a" value="saveedit" />
	<input type="hidden" name="id" id="id" value="<!--{$id}-->" />
    <table class="oe_table_wrap">
	  <tr>
	    <th width="15%">分类：<span class="f_red"></span></th>
		<td width="35%"><!--{hook mod='activitycat' type='select' name='catid' text='=请选择=' value=$activity.catid}--></td>
		<th width="15%">所属店铺：<span class="f_red">*</span></th>
		<td width="35%">
		  <input type="text" name="shopid" id="shopid" value="<!--{$activity.shopid}-->" readonly="only" class="input-100" /> 
		  <span id="shopid_tips"><!--{$activity.shopname}--></span>
		  <a href="###" onclick="oemarry_varpop_shop('shopid');" style="color:blue;">选择店铺</a>
		  <span class="oe_trap"></span>
		</td>
	  </tr>
	  <tr>
	    <th>标题：<span class="f_red">*</span></th>
		<td>
		  <input type="text" name="title" id="title" class="input-b" value="<!--{$activity.title}-->" />
		  <span class="oe_trap">（100个字以内）</span>
		</td>
		<th>活动时间：<span class="f_red"></span></th>
		<td>
		  <input type="text" name="acttime" id="acttime" class="input-b" value="<!--{$activity.acttime}-->" />
		  <span class="oe_trap"></span>
		</td>
	  </tr>

	  <tr>
		<th>活动图片：<span class="f_red"></span> </th>
		<td>
		  <table class="oe_table_wrap">
		    <tr>
			  <td width="150px">
				  <div class="oe_img_upload">
					<label class="_uploadbtn">点击上传<input type="file" name="img" id="img" value="" /></label>
					<label class="_uploading" id="img_loading">
					  <img src="<!--{$urlpath}-->tpl/admin/images/loading.gif" />上传中...
					</label>
					<input type="hidden" id="img_thumb" name="thumbimg" value="<!--{$activity.thumbimg}-->" />
					<input type="hidden" id="img_url" name="drawimg" value="<!--{$activity.drawimg}-->" />
				  </div>
				  <script type="text/javascript">
				  $(function(){
					  $("#img").live("change", function(){
						oemarryUploadImg("img", "<!--{$oefile}-->&c=index&a=uploadimg&module=activity&thumbfiles=1");
					  });
				  });
				  </script>
			  </td>
			  <td width="50px">预览：</td>
			  <td width="80px">
			    <!--{if !empty($activity.thumbimg)}-->
			    <img src="<!--{$urlpath}--><!--{$activity.thumbimg}-->" width="30px" height="30px" id="img_preview" f="viewimg" />
				<!--{else}-->
				<img src="<!--{$urlpath}-->tpl/static/images/waitimg.jpg" width="30px" height="30px" id="img_preview" f="viewimg" />
				<!--{/if}-->
				<a href="javascript:;" class="_removeimg" f="removeimg" data-preview="img_preview" data-thumb="img_thumb" data-draw="img_url">移除</a>
			  </td>
			  <td></td>
			</tr>
		  </table>
		</td>
		<th>截止预约时间：<span class="f_red"></span></th>
		<td>
		<input type="text" name="endbespoke" id="endbespoke" class="input-150" value="<!--{$activity.endbespoke|date_format:"%Y-%m-%d %H:%M:%S"}-->" />
		（开启预约有效）
		<script>
		laydate({
			elem: '#endbespoke',
			format: 'YYYY-MM-DD hh:mm:ss',
			istime: true,
			choose: function(datas){ //选择日期完毕的回调
			}
		});
		</script>

		</td>
	  </tr>
	  <tr>
	    <th>原价：<span class="f_red"></span> </th>
		<td><input type="text" name="oldprice" id="oldprice" class="input-100" value="<!--{$activity.oldprice}-->" /> 元 （填写数字）</td>
		<th>现价(优惠价)：<span class="f_red"></span></th>
		<td><input type="text" name="price" id="price" class="input-100" value="<!--{$activity.price}-->" /> 元（填写数字）</td>
	  </tr>
	  <tr>
	    <th>允许预约：<span class="f_red"></span> </th>
		<td>
		<input type="radio" name="canbespoke" id="canbespoke" value="1"<!--{if $activity.canbespoke == '1'}--> checked<!--{/if}--> />开启，
		<input type="radio" name="canbespoke" id="canbespoke" value="0"<!--{if $activity.canbespoke == '0'}--> checked<!--{/if}--> />关闭
		</td>
		<th>已预约人数：</th>
		<td><input type="text" name="bespokes" id="bespokes" class="input-100" value="<!--{$activity.bespokes}-->" /></td>
	  </tr>
	  <tr>
	    <th>状态：<span class="f_red"></span> </th>
		<td>
		<input type="radio" name="flag" id="flag" value="1"<!--{if $activity.flag == '1'}--> checked<!--{/if}--> />正常，
		<input type="radio" name="flag" id="flag" value="0"<!--{if $activity.flag == '0'}--> checked<!--{/if}--> />锁定
		</td>
		<th>推荐：</th>
		<td>
		<input type="radio" name="elite" id="elite" value="1"<!--{if $activity.elite == '1'}--> checked<!--{/if}--> />是，
		<input type="radio" name="elite" id="elite" value="0"<!--{if $activity.elite == '0'}--> checked<!--{/if}--> />否
		</td>
	  </tr>
	  <tr>
	    <th>活动简介：<span class="f_red"></span> </th>
		<td><textarea name="intro" id="intro" style="width:80%;height:40px;"><!--{$activity.intro}--></textarea></td>
		<th>浏览次数：</th>
		<td><input type="text" name="hits" id="hits" class="input-100" value="<!--{$activity.hits}-->" /></td>
	  </tr>

	  <tr>
	    <th>优惠/活动详情：</th>
		<td colspan="3">
		<textarea name="content" id="content" style="width:90%;height:350px;display:none;"><!--{$activity.content}--></textarea>
		</td>
	  </tr>
	  <tr>
		<th>meta标题：<span class="f_red"></span> </th>
		<td colspan="3"><input type="text" name="metatitle" id="metatitle" class="input-b" value="<!--{$activity.metatitle}-->" /></td>
	  </tr>
	  <tr>
		<th>meta描述：<span class="f_red"></span> </th>
		<td colspan="3"><textarea name="metadesc" id="metadesc" style="width:50%;height:40px;"><!--{$activity.metadesc}--></textarea></td>
	  </tr>
	  <tr>
		<th>meta关键词：<span class="f_red"></span> </th>
		<td colspan="3">
		  <textarea name="metakeyword" id="metakeyword" style="width:50%;height:40px;"><!--{$activity.metakeyword}--></textarea><br />
		  （多个关键词请使用英文逗号“,”隔开）
		</td>
	  </tr>

	  <tr>
	    <td></td>
		<td colspan="3"> <input type="button" id="btn_save" class="button_2" value="编辑保存" /> </td>
	  </tr>
	</table>
	</form>
  </div>
</div>
<script type="text/javascript">
$(function(){
	var myeditor;
	KindEditor.ready(function(K) {myeditor = K.create("#content");});

	$("#btn_save").bind("click", function(){
		if ($("#title").val().length == 0) {
			ToastShow("请填写标题", "title");
			return false;
		}
		$("#content").text(myeditor.html());
		$("#myform").submit();
	});
});
</script>
<!--{/if}-->
</body>
</html>