<!--{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=goodscustcat">商品分类</a></li>
          <li><a href="<!--{$oefile}-->&c=goods">商品管理</a></li>
		  <li><a href="<!--{$oefile}-->&c=goodsbespoke">商品预约</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"}-->
	  <script type="text/javascript">

	  function oeDel() { //删除
		$value = document.getElementsByName("id[]");;
		$valueArr = $value.length;
		$str = "";
		$num = 0;
		for (i=0; i<$valueArr; i++) {
			if($value[i].checked == true) {
				$str+=$value[i].value+",";
				$num++;
		   }
		}
		if ($num < 1) {
			ToastShow("请选择要删除的分类");
			return false;
		}
		$("#a").val("del");
		$("#myform").submit();
		return true;
	  }
	  </script>
	  <!--{if $total > 0}-->
	  <div class="oe_manage_but">
		<span><a href="javascript:;" onclick="oePopConfirm('确定要删除吗？', 'oeDel');">删除</a></span>
	  </div>
	  <!--{/if}-->
	  
	  <form id="myform" action="<!--{$oefile}-->&c=<!--{$c}-->" method="post" />
	  <input type="hidden" name="a" id="a" id="del" />
	  <table class="oe_table_list_3">
		<tr>
		  <th width="4%"><input type="checkbox" id="selAll" onclick="oemarrySelectAll(this, 'selall');" class="icon-checkbox-unchecked" /></th>
		  <th>分类名称</th>
		  <th width="12%">排序</th>
		  <th width="18%">添加时间</th>
		  <th width="25%">操作</th>
	    </tr>
		<!--{if empty($goodscustcat)}-->
		<tr>
		  <td class="text_center" colspan="6">对不起，没有找到匹配的信息！</td>
		</tr>
		<!--{else}-->
		<!--{foreach $goodscustcat as $volist}-->
		<tr>
		  <td><input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$volist.custid}-->" /></td>
		  <td><b><!--{$volist.custname}--></b></td>
		  <td class="text_center"><!--{$volist.orders}--></td>
		  <td><!--{$volist.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
		  <td>
		    <span class="span_btn3"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=add&parentid=<!--{$volist.custid}-->">添加二级分类</a></span>
		    <span class="span_btn2"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$volist.custid}-->">编辑</a></span>
		  </td>
		</tr>
		<!--{if !empty($volist.childlist)}-->
		<!--{foreach $volist.childlist as $val}-->
		<tr>
		  <td><input type="checkbox" name="id[]" id="id[]" class="selall" value="<!--{$val.custid}-->" /></td>
		  <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;|-- <!--{$val.custname}--></td>
		  <td class="text_center"><!--{$val.orders}--></td>
		  <td><!--{$val.addtime|date_format:"%Y-%m-%d %H:%M:%S"}--></td>
		  <td>
		    <span class="span_btn2"><a href="<!--{$oefile}-->&c=<!--{$c}-->&a=edit&id=<!--{$val.custid}-->">编辑</a></span>
		  </td>
		</tr>
		<!--{/foreach}-->
		<!--{/if}-->
		<!--{/foreach}-->
		<!--{/if}-->
	  </table>
	  </form>
	  <!--{if $total > 0}-->
	  <div class="oe_manage_but">
		<span><a href="javascript:;" onclick="oePopConfirm('确定要删除吗？', 'oeDel');">删除</a></span>
	  </div>
	  <!--{/if}-->
	  <div class="oe_page_layout">
	    <!--{$showpage}-->
	  </div>
	  <!--{/if}-->


	  <!--{if $a == "add"}-->
	  <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%"><font color="red">*</font> 分类名称：</th>
		  <td width="85%">
		    <input type="text" name="custname" id="custname" class="input-200" /> 
			<span id="tips_custname">（名称在20个字以内）</span>
		  </td>
	    </tr>
		<tr>
		  <th><font color="red"></font> 所属分类：</th>
		  <td>
		    <!--{hook mod="rootgoodscustcat" type="select" name="parentid" text="=不属任何分类=" value=$parentid}-->
			<span id="tips_parentid">（最多支持2级分类）</span>
		  </td>
		</tr>

		<tr>
		  <th><font color="red"></font> 分类排序：</th>
		  <td>
		    <input type="text" name="orders" id="orders" class="input-80" value="<!--{$orders}-->" /> 
			<span id="tips_orders">（数字越小越靠前）</span>
		  </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 ($("#custname").val().length == 0) {
				ToastShow("请填写分类名称", "custname");
				return false;
			}

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

	  <!--{if $a == "edit"}-->
	  <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 width="15%"><font color="red">*</font> 分类名称：</th>
		  <td width="85%">
		    <input type="text" name="custname" id="custname" class="input-200" value="<!--{$goodscustcat.custname}-->" /> 
			<span id="tips_custname">（名称在20个字以内）</span>
		  </td>
	    </tr>
		<tr>
		  <th><font color="red"></font> 所属分类：</th>
		  <td>
		    <!--{hook mod="rootgoodscustcat" type="select" name="parentid" text="=不属任何分类=" value=$goodscustcat.parentid}-->
			<span id="tips_parentid">（最多支持2级分类）</span>
		  </td>
		</tr>

		<tr>
		  <th><font color="red"></font> 分类排序：</th>
		  <td>
		    <input type="text" name="orders" id="orders" class="input-80" value="<!--{$goodscustcat.orders}-->" /> 
			<span id="tips_orders">（数字越小越靠前）</span>
		  </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 ($("#custname").val().length == 0) {
				ToastShow("请填写分类名称", "custname");
				return false;
			}

			$("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>