<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<!-- <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,member-scalable=no" /> -->
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/html5.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/respond.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/PIE_IE678.js"></script>
<![endif]-->
<link href="${pageContext.request.contextPath }/common/css/bootstrap.min-3.3.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/select2/select2.min.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath }/common/admin/lib/Hui-iconfont/1.0.1/iconfont.css" rel="stylesheet" type="text/css" />
<!--[if IE 6]>
<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->

<style>
#datainit{
 margin-left:5px;
}

</style>
<title>分销商管理操作</title>
</head>
<body>
<div class="codeView">
			<form action="/iamberry/admin/drp/addPlaceInfoDeal" method="post" class="form form-horizontal" id="form-Validform" novalidate="novalidate">
				<!-- <input type="hidden" name="supperId" value=0 id="supperId"/> -->
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>公司名称：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="text" class="input-text" datatype="*2-30" nullmsg="公司名称或者门店名不能为空" placeholder="4~16个字符，字母/中文/数字/下划线" nullmsg="用户名不能为空" name="name" id="name">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>姓名：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="text" class="input-text" placeholder="2~16个字符，字母/中文/数字/下划线" datatype="*2-16" nullmsg="姓名不能为空" name="userName" id="userName">
					</div>
				</div>
				<!-- <div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">openid：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="text" class="input-text" placeholder="4~16个字符，字母/中文/数字/下划线" nullmsg="微信号不能为空！" name="openid" id="openid">
					</div>
				</div> -->
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>所属角色：</label>
					<div class="formControls col-xs-6 col-sm-6"> <span class="select-box">
						<select class="select" size="1" id="roleId" name="roleId">
							<c:forEach items="${roles}" var="role">
							   <option value="${role.roleId}" selected>${role.roleName}</option>
							</c:forEach>
						</select>
						</span> 
					</div>
					
				</div>
				<div class="row cl"  id="isHide">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red"></span>区域：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="text" class="input-text" placeholder="请输入城市，多个城市用逗号隔开"  name="areaName" id="areaName">
					</div>
				</div>
			
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>二维码功能:</label>
					<div class="formControls col-xs-6 col-sm-6"> <span class="select-box">
						<select class="select" size="1" id="hasQrcode" name="hasQrcode">
							<option value=1 selected>没有</option>
							<option value=2>是</option>
						</select>
						</span> </div>
				</div>
				<!-- <div id="selectAuthor" class="row cl">
					<label class="form-label col-xs-4 col-sm-3">所需权限：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<span><input type="checkbox" id="store" name="jurisdiction" value="1" />门店</span>&nbsp;&nbsp;
						<span><input type="checkbox" id="partners" name="jurisdiction" value="2" />合作商</span>&nbsp;&nbsp;
						<span><input type="checkbox" id="broker" name="jurisdiction"  value="3" />微代理</span>&nbsp;&nbsp;
						<span><input type="hidden" id="placeAuthor" name="placeAuthor"  /></span>
						<span id="textJurisdiction" style="display: none; color: red;">*权限不能为空</span>
					</div>
				</div> -->
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">选择父级：</label>
					<div class="formControls col-xs-6 col-sm-6"> 
						<select class="select"  id="getPid"  name="PlacePid">
							<option value=0 selected>省代</option>
						</select>
						 </div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">选择模板：</label>
					<div class="formControls col-xs-6 col-sm-6"> 
						<select class="select"  id="templateId"  name="templateId">
						 <option value=0 selected>无模板</option>
						<c:forEach items="${templates}" var="template">
							   <option value="${template.templateId}">${template.templateName}</option>
						</c:forEach>
							<!-- <option value=1 selected>省代+代理+门店</option>
							<option value=2 >省代+母婴店</option> -->
						</select>
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>联系方式：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="text" class="input-text" autocomplete="off" dataType="m" placeholder="手机/电话" nullmsg="联系方式不能为空" name="tel" id="tel">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>代理商信息是否完善：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="radio" name="placeInfoStus"  value="2">完善
						<input type="radio" name="placeInfoStus"  value="1" checked="checked">不完善
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>代理商地址：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<input type="text" class="input-text" placeholder="分销联系地址" datatype="*" name="addr" nullmsg="联系地址不能为空" id="addr">
					</div>
				</div>
				<div class="row cl">
					<label class="form-label col-xs-4 col-sm-3">备注：</label>
					<div class="formControls col-xs-6 col-sm-6">
						<textarea class="textarea" placeholder="说点什么...最少输入10个字符" name="remark" onkeyup="textarealength(this,500)"></textarea>
						<p class="textarea-numberbar"><em class="textarea-length">0</em>/500</p>
					</div>
				</div>
				<div class="row cl">
					<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
					    
						 <input class="btn btn-primary" type="submit"  value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
					     <input class="btn btn-primary" type="button" onclick="closeWindow()"  value="&nbsp;&nbsp;取消&nbsp;&nbsp;">
					</div>
				</div>
			</form>
		</div>



<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/layer/1.9.3/layer.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/laypage/1.2/laypage.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/My97DatePicker/WdatePicker.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/datatables/1.10.0/jquery.dataTables.min.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.js"></script> 
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/select2/select2.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/select2/zh-CN.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/common/admin/lib/Validform/5.3.2/Validform.min.js"></script>
<script type="text/javascript"> 

$("#supperId").val(0);
$(function(){ 
	
	
  $("#form-Validform").Validform({ 
    tiptype:4, 
    ajaxPost:true, 
    beforeCheck:function(curform){
    	var placeRole = $('#placeRole').val();
    },
    callback:function(data){ 
      if(data.result=="200"){ 
        layer.msg(data.message, {icon:data.message,time: 1000}, function(){ 
        	 var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
        	 parent.searchInfo();
       	     parent.layer.close(index); 
        	 //parent.searchInfo();
          });  
      } 
      else{ 
        layer.msg(data.message, {icon: data.message,time: 3000}); 
      } 
    } 
  });  
  
  roleHide();
}); 

 //提交表单
 function submitpage(){
	 return $("#form-Validform").submitForm(false);
 }

//关闭窗口
function closeWindow(){
	  var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
	  parent.layer.close(index);
}
var pageNo=1;
//下拉搜索框
$("#getPid").select2({
  language: "zh-CN",
  ajax: {
    url: "/iamberry/admin/drp/searchPlaceInfoParent",
    dataType: 'json',
    delay: 250,
    data: function (params) {
      return {
        search: params.term, // search term
        pageNo: pageNo
        //type:$("#placeType").val()=='1'?0:parseInt($("#placeType").val())-1
      };
    },
    processResults: function (data, params) {
      // parse the results into the format expected by Select2
      // since we are using custom formatting functions we do not need to
      // alter the remote JSON data, except to indicate that infinite
      // scrolling can be used
      params.page = params.page || 1;
      pageNo=pageNo+1;
      console.info(JSON.stringify(data));
      return {
        results: data.data,
        pagination: {
          more: (params.page * 15) < data.totalNumber
        }
      };
    },
    cache: true
  },
  escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
  minimumInputLength: 1,
  templateResult:function(item){ //下拉框渲染拉下列表的格式
		var itemStr="<option value='"+item.id+"' selected>"+item.name+"</option>";
		return itemStr;
	}, 
  templateSelection:function(item){ //下拉框渲染选择后的格式
	    //alert(item.supperId);
        //$("#supperId").val(item.supperId);
		var itemStr="<option value='"+item.id+"' selected>"+item.name+"</option>";
		return itemStr;
	} 
});

$("#roleId").change(function(){
	var textstr=$("#roleId").find("option:selected").text();
	if(textstr=='省代'){
		$("#isHide").removeClass("hide");
	}else{
		$("#isHide").addClass("hide");
	}
});

function roleHide() {
	var textstr=$("#roleId").find("option:selected").text();
	if(textstr=='省代'){
		$("#isHide").removeClass("hide");
	}else{
		$("#isHide").addClass("hide");
	}
}

/* function selectAuthor() {
	var placeType = $('#placeType').val();
	var placeRole = $('#placeRole').val();
	if (placeType == 1 && placeRole == 1) {
		$('#selectAuthor').show();
	} else {
		$('#selectAuthor').hide();
	}
} 

$('#store').click(function(){
	if ($('#store').is(":checked")) {
		$("[name='jurisdiction']").prop("checked",true);
	} else {
		$("[name='jurisdiction']").prop("checked",false);
	}
});

*/


</script> 


</body>
</html>