<!--{include file="<!--{$oetplpath}-->widget_header.tpl"}-->

<div class="oe_content_layout">
  <!--{include file="<!--{$oetplpath}-->widget_menu.tpl"}-->

  <div class="oe_cont_rt">
    
	<div class="oe_content_widget">
	
	  <div class="oe_tab_list">
        <ul>
          <li class="current"><a href="<!--{$oefile}-->&c=activity">商家活动</a></li>
		  <li><a href="<!--{$oefile}-->&c=activitybespoke">活动预约</a></li>
        </ul>
      </div>

	  <h3 class="oe_f_title _bottom_border _margin_bottom">
	    商家活动<span>（商家发布活动信息，活动可以开启和关闭在线预约）</span>
		<strong><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add">发布活动+</a></strong>
	  </h3>

	  <!--{if $a == "run"}-->
	  <form id="search_form" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post">
	  <div class="oe_mer_search">
		分类：<!--{hook mod='activitycat' name='scatid' type='select' text='=不限=' value=$scatid}-->
		&nbsp;&nbsp;
	    标题：
		<input type="text" name="stitle" id="stitle"  class="input-200" value="<!--{$stitle}-->" />
		&nbsp;&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;
		<span class="_search_btn" id="btn_ser">搜索</span>
	  </div>
	  </form>
	  <script type="text/javascript">
	  $(function(){
		$("#btn_ser").bind("click", function(){
			$("#search_form").submit();
		});
	  });
	  </script>

	  <table class="oe_table_list_3 table_cs">
		<tr>
		  <th width="8%"></th>
	      <th>活动</th>
		  <th width="12%">分类</th>
		  <th width="10%">发布时间</th>
		  <th width="8%">价格</th>
		  <th width="8%">审核</th>
		  <th width="8%">推荐</th>
		  <th width="12%">操作</th>
	    </tr>
		<!--{if empty($activity)}-->
		<tr>
		  <td class="text_center" colspan="8">对不起，没有找到匹配的信息！</td>
		</tr>
		<!--{else}-->
		<!--{foreach $activity as $volist}-->
		<tr>
		  <td>
		  <!--{if !empty($volist.drawimg)}-->
		  <img f="view" src="<!--{$volist.drawimg}-->" width="60px" height="60px" />
		  <!--{else}-->
		  <img src="tpl/static/images/waitimg_s.jpg" width="60px" height="60px" />
		  <!--{/if}-->
		  </td>
		  <td>
		  <!--{if $volist.flag == '1'}-->
		  <a href="javascript:;" f="detail" data-mod="activity" data-id="<!--{$volist.actid}-->"><!--{$volist.title}--></a>
		  <!--{else}-->
		  <!--{$volist.title}-->
		  <!--{/if}-->
		  </td>
		  <td class="text_center">
		  <!--{if $volist.catid == '0'}-->
		  ~~
		  <!--{else}-->
		  <!--{$volist.catname}-->
		  <!--{/if}-->
		  </td>
		  <td class="text_center" title="<!--{$volist.addtime|date_format:" %H:%M:%S"}-->"><!--{$volist.addtime|date_format:"%Y-%m-%d"}--></td>
		  <td class="text_center">￥<!--{doubleval($volist.price)}--></td>
		  <td class="text_center">
			  <!--{if $volist.flag == '0'}-->
			  <font color="gray">待审</font>
			  <!--{elseif $volist.flag == '1'}-->
			  <font color="green">通过</span>
			  <!--{else}-->
			  <font color="red">未通过</span>
			  <!--{/if}-->
		  </td>
		  <td class="text_center">
			  <!--{if $volist.elite == '1'}-->
			  <font color="green">是</font>
			  <!--{else}-->
			  <font color="gray">否</span>
			  <!--{/if}-->
		  </td>
		  <td class="text_center">
		    <a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.actid}-->">编辑</a> | 
			<a href="javascript:;" onclick="oePopConfirm('确定要删除吗？', '<!--{$oefile}-->&c=<!--{$c}-->&a=del&id=<!--{$volist.actid}-->', 'url');">删除</a>
		  </td>
		</tr>
		<!--{/foreach}-->
		<!--{/if}-->
	  </table>
	  <div class="oe_page_layout">
	    <!--{$showpage}-->
	  </div>
	  <!--{/if}-->


	  <!--{if $a == "add"}-->
	  <!--{include file="<!--{$oetplpath}-->widget_editor.tpl"}-->
	  <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>活动分类：</th>
		  <td>
		    <!--{hook mod='activitycat' type='select' name='catid' text='=请选择='}-->
		  </td>
	    </tr>
		<tr>
		  <th width="18%"><font color="red">*</font> 活动标题：</th>
		  <td width="82%">
		    <input type="text" name="title" id="title" class="input-b" f="checktitle" data-tips="tips_title" />
			<span id="tips_title">（30个字以内）</span>
		  </td>
		</tr>
		<tr>
		  <th>活动时间：</th>
		  <td>
		    <input type="text" name="acttime" id="acttime" class="input-b" />
		  </td>
		</tr>
		<tr>
		  <th>活动地点：</th>
		  <td>
		    <input type="text" name="actaddress" id="actaddress" class="input-b" />
		  </td>
		</tr>
	    <tr>
		  <th><font color="red">*</font> 活动图片：</th>
		  <td>
			<table class="oe_table_wrap">
			  <tr>
				<td width="60px">
				  <img f="view" style="cursor:pointer;" src="tpl/static/images/waitimg_s.jpg" width="60px" height="60px" class="_img_border" id="img_preview" />
				</td>
			    <td width="90px">
				  <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/static/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></td>
			  </tr>
			</table>
		  </td>
		</tr>

		<tr>
		  <th><font color="red">*</font> 价格设置：</th>
		  <td>
		    原价：<input type="text" name="oldprice" id="oldprice" class="input-100" /> 元&nbsp;&nbsp;
		    现价：<input type="text" name="price" id="price" class="input-100" /> 元
		  </td>
		</tr>
		<tr>
		  <th>预约设置：</th>
		  <td>
		   <input type="checkbox" name="canbespoke" id="canbespoke" value="1" checked />开启预约&nbsp;&nbsp;&nbsp;
		   截止预约时间：
			<input type="text" name="endbespoke" id="endbespoke" class="input-150" readonly="only" />
			<script>
			laydate({
				elem: '#endbespoke',
				format: 'YYYY-MM-DD hh:mm:ss',
				istime: true,
				choose: function(datas){}
			});
			</script>

			&nbsp;&nbsp;&nbsp;
			已预约人数：<input type="text" name="bespokes" id="bespokes" class="input-s" />人
		  </td>
		</tr>
		<tr>
	      <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>浏览次数：</th>
		  <td>
		    <input type="text" name="hits" id="hits" class="input-100" />次
		  </td>
	    </tr>
		<tr>
	      <th>活动简介：</th>
		  <td>
		    <textarea name="intro" id="intro" style="width:70%;height:60px;"></textarea><br />
		  （活动简介，描述，200个字以内）
		  </td>
	    </tr>
		<tr>
	      <th><font color="red">*</font> 内容详情：</th>
		  <td>
		    <textarea name="content" id="content" style="width:98%;height:400px;"></textarea>
		  </td>
	    </tr>
		<tr>
	      <th>Meta标题：</th>
		  <td>
		    <input type="text" name="metatitle" id="metatitle" class="input-b" />
		  </td>
	    </tr>
		<tr>
	      <th>Meta描述：</th>
		  <td>
		    <textarea name="metadesc" id="metadesc" style="width:60%;height:40px;"></textarea>
		  </td>
	    </tr>
		<tr>
	      <th>Meta关键字：</th>
		  <td>
		    <textarea name="metakeyword" id="metakeyword" style="width:60%;height:40px;"></textarea><br />
		  （多个关键词请使用英文逗号“,”隔开）
		  </td>
	    </tr>
		<tr>
		  <td></td>
		  <td>
			<input type="button" id="btn_post" class="submit_btn1" value="添加保存" /> 
		  </td>
		</tr>
	  </table>
	  </form>
	  <script type="text/javascript">
	  $(function(){

		$("#btn_post").bind("click", function(){ //提交
			if ($("#title").val().length == 0) {
				ToastShow("请填写标题", "title");
				return false;
			}

			if ($("input[name='drawimg']").val().length == 0) {
				ToastShow("请上传图片");
				return false;
			}

			if ($("#oldprice").val().length == 0 || $("#price").val().length == 0) {
				ToastShow("请设置价格", "oldprice");
				return false;
			}
			if (OEeditor.html().length == 0) {
				ToastShow("请填写内容详情");
				return false;
			}
			$("#content").text(OEeditor.html());

			$("form").submit();
		});
	  });
	  </script>
	  <!--{/if}-->

	  <!--{if $a == "edit"}-->
	  <!--{include file="<!--{$oetplpath}-->widget_editor.tpl"}-->
	  <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" 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><font color="red"></font> 活动分类：</th>
		  <td>
		    <!--{hook mod='activitycat' type='select' name='catid' text='=请选择=' value=$activity.catid}-->
		  </td>
	    </tr>
		<tr>
		  <th width="18%"><font color="red">*</font> 活动标题：</th>
		  <td width="82%">
		    <input type="text" name="title" id="title" class="input-b" value="<!--{$activity.title}-->" f="checktitle" data-tips="tips_title" />
			<span id="tips_title">（30个字以内）</span>
		  </td>
		</tr>
		<tr>
		  <th>活动时间：</th>
		  <td>
		    <input type="text" name="acttime" id="acttime" class="input-b" value="<!--{$activity.acttime}-->" />
		  </td>
		</tr>
		<tr>
		  <th>活动地点：</th>
		  <td>
		    <input type="text" name="actaddress" id="actaddress" class="input-b" value="<!--{$activity.actaddress}-->" />
		  </td>
		</tr>
	    <tr>
		  <th><font color="red">*</font> 活动图片：</th>
		  <td>
			<table class="oe_table_wrap">
			  <tr>
				<td width="60px">
				  <!--{if !empty($activity.drawimg)}-->
				  <img f="view" style="cursor:pointer;" src="<!--{$activity.drawimg}-->" width="60px" height="60px" class="_img_border" id="img_preview" />
				  <!--{else}-->
				  <img f="view" style="cursor:pointer;" src="tpl/static/images/waitimg_s.jpg" width="60px" height="60px" class="_img_border" id="img_preview" />
				  <!--{/if}-->
				</td>
			    <td width="90px">
				  <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/static/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></td>
			  </tr>
			</table>
		  </td>
		</tr>

		<tr>
		  <th><font color="red">*</font> 价格设置：</th>
		  <td>
		    原价：<input type="text" name="oldprice" id="oldprice" class="input-100" value="<!--{doubleval($activity.oldprice)}-->" /> 元&nbsp;&nbsp;
		    现价：<input type="text" name="price" id="price" class="input-100" value="<!--{doubleval($activity.price)}-->" /> 元
		  </td>
		</tr>
		<tr>
		  <th>预约设置：</th>
		  <td>
		   <input type="checkbox" name="canbespoke" id="canbespoke" value="1"<!--{if $activity.canbespoke=='1'}--> checked<!--{/if}--> />开启预约&nbsp;&nbsp;&nbsp;
		   截止预约时间：
			<input type="text" name="endbespoke" id="endbespoke" class="input-150" readonly="only" value="<!--{if $activity.endbespoke>0}--><!--{$activity.endbespoke|date_format:"%Y-%m-%d %H:%M:%S"}--><!--{/if}-->" />
			<script>
			laydate({
				elem: '#endbespoke',
				format: 'YYYY-MM-DD hh:mm:ss',
				istime: true,
				choose: function(datas){}
			});
			</script>

			&nbsp;&nbsp;&nbsp;
			已预约人数：<input type="text" name="bespokes" id="bespokes" class="input-s" value="<!--{$activity.bespokes}-->" />人
		  </td>
		</tr>
		<tr>
	      <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>浏览次数：</th>
		  <td>
		    <input type="text" name="hits" id="hits" class="input-100" value="<!--{$activity.hits}-->" />次
		  </td>
	    </tr>
		<tr>
	      <th>活动简介： </th>
		  <td>
		    <textarea name="intro" id="intro" style="width:70%;height:60px;"><!--{$activity.intro}--></textarea><br />
		  （活动简介，描述，200个字以内）
		  </td>
	    </tr>
		<tr>
	      <th><font color="red">*</font> 内容详情： </th>
		  <td>
		    <textarea name="content" id="content" style="width:98%;height:400px;"><!--{$activity.content}--></textarea>
		  </td>
	    </tr>
		<tr>
	      <th>Meta标题：</th>
		  <td>
		    <input type="text" name="metatitle" id="metatitle" class="input-b" value="<!--{$activity.metatitle}-->" />
		  </td>
	    </tr>
		<tr>
	      <th>Meta描述：</th>
		  <td>
		    <textarea name="metadesc" id="metadesc" style="width:60%;height:40px;"><!--{$activity.metadesc}--></textarea>
		  </td>
	    </tr>
		<tr>
	      <th>Meta关键字： </th>
		  <td>
		    <textarea name="metakeyword" id="metakeyword" style="width:60%;height:40px;"><!--{$activity.metakeyword}--></textarea><br />
		  （多个关键词请使用英文逗号“,”隔开）
		  </td>
	    </tr>
		<tr>
		  <td></td>
		  <td>
			<input type="button" id="btn_post" class="submit_btn1" value="编辑保存" /> 
		  </td>
		</tr>
	  </table>
	  </form>
	  <script type="text/javascript">
	  $(function(){

		$("#btn_post").bind("click", function(){ //提交
			if ($("#title").val().length == 0) {
				ToastShow("请填写标题", "title");
				return false;
			}

			if ($("input[name='drawimg']").val().length == 0) {
				ToastShow("请上传图片");
				return false;
			}

			if ($("#oldprice").val().length == 0 || $("#price").val().length == 0) {
				ToastShow("请设置价格", "oldprice");
				return false;
			}
			if (OEeditor.html().length == 0) {
				ToastShow("请填写内容详情");
				return false;
			}
			$("#content").text(OEeditor.html());

			$("form").submit();
		});
	  });
	  </script>
	  <!--{/if}-->


	</div>
	<!--//oe_content_widget End-->

  </div>
  <div class="clear"></div>
  <!--//oe_cont_rt Enc-->
</div>
<!--{include file="<!--{$oetplpath}-->widget_footer.tpl"}-->
</body>
</html>