You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

182 lines
8.0 KiB
HTML

5 years ago
<extend name="Public/promote_base"/>
<block name="css">
<link href="__CSS__/20180207/account.css" rel="stylesheet" >
</block>
<block name="body">
<div class="page-list normal_list promote-add_chlid-form">
<div class="trunk-title">
<div class="location">
<div class="location-container">当前位置:<span>管理中心></span><span><if condition="I('type') == 1">添加组长<else/>添加推广员</if></span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main"><if condition="I('type') == 1">添加组长<else/>添加推广员</if></span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('Promote/add_chlid')}" novalidate="novalidate" method="post" class="base_info" id="form_reg">
<table class="table2">
<if condition="($parent_id eq 0) and ($grand_id eq 0) and (I('type') == 1)">
<input type="hidden" name="promote_type" value="1">
<else/>
<input type="hidden" name="promote_type" value="2">
<if condition="($parent_id eq 0) and ($grand_id eq 0)">
<tr>
<td class="l"><span class="req">*</span>上级渠道:</td>
<td class="r">
<select id="parent_id" name="parent_id" class="reselect select_gallery" style="width: 252px;" >
<option value="0">请选择上级渠道</option>
<volist name="promotes" id="promote">
<option ba-id="{$promote.id}" value="{$promote.id}">{$promote.account}</option>
</volist>
</select>
</td>
</tr>
</if>
</if>
<tr>
<td class="l"><span class="req">*</span>帐号:</td>
<td class="r">
5 years ago
<input type="text" class="name input-txt txt" name="account" id="account" maxlength="15" minlength="6" placeholder="请输入帐号">
5 years ago
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>姓名:</td>
<td class="r">
5 years ago
<input type="text" class="name input-txt txt" name="real_name" id="real_name" maxlength="4" minlength="2" placeholder="请输入姓名">
5 years ago
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>身份证:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="idcard" id="idcard" placeholder="请输入身份证">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>手机号:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="mobile_phone" id="mobile_phone" placeholder="请输入手机号">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>密码:</td>
<td class="r">
<input type="password" class="name txt" name="password" id="password" placeholder="请输入子渠道密码">
<span id="password_tip"></span>
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>确认密码:</td>
<td class="r">
<input type="password" class="name txt" name="repassword" id="repassword" placeholder="请输入确认密码">
<span id="repassword_tip"></span>
</td>
</tr>
<tr>
<td class="l">昵称:</td>
<td class="r">
<input type="text" class="name txt" name="nickname" id="nickname" placeholder="请输入子渠道昵称">
<span id="nickname_tip"></span>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="button" class="tj btn ajax-post" onclick="check()" value="确认添加" title="" target-form="base_info">
<a class="back_btn " alt="返回上一页" title="返回上一页" href="javascript:window.history.back();">返回</a>
</td>
</tr>
</table>
</form>
</div>
</div>
</div>
</block>
<block name="script">
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
<script type="text/javascript">
$(".select_gallery").select2();
function check() {
data = validation();
if(data.status !=1){layer.msg(data.msg,{icon:2}); return false;};
var account = $('#account').val();
var password = $('#password').val();
var nickname = $('#nickname').val();
var idcard = $('#idcard').val();
var mobile_phone = $('#mobile_phone').val();
var real_name = $('#real_name').val();
var promote_type = $('[name=promote_type]').val();
var repassword = $('#repassword').val();
var parent_id = $('#parent_id').val();
$.ajax({
type:"POST",
url:"{:U('add_chlid')}",
data:{
account: account,
password: password,
real_name: real_name,
repassword: repassword,
promote_type: promote_type,
parent_id: parent_id,
mobile_phone: mobile_phone,
idcard: idcard,
nickname: nickname,
},
success:function(res){
if(res.status == 1){
layer.msg(res.msg);
setTimeout(function(){
window.location.href="{:U(I('type') == 2 ? 'mygrand' : 'mychlid')}";
},1000);
}else{
layer.msg(res.msg);
}
}
});
// $('#form_reg').submit();
}
function validation(){
var json_data = "";
if($('#account').val()==""){
return json_data = {'status':0,'msg':'子渠道账号不能为空'}
}
5 years ago
// if($.trim($('#account').val()).length < 6){
// return json_data = {'status':0,'msg':'子渠道账号不能小于6位字符'}
// }
if($.trim($('#account').val()).length < 6 || $.trim($('#account').val()).length > 15){
return json_data = {'status':0,'msg':'子渠道账号长度为6-15位字符'}
}
if($.trim($('#real_name').val()).length < 2 || $.trim($('#real_name').val()).length > 4){
return json_data = {'status':0,'msg':'子渠道姓名长度为2-4位字符'}
5 years ago
}
if($('#password').val()==""){
return json_data = {'status':0,'msg':'子渠道密码不能为空'}
}
if($.trim($('#password').val()).length < 6){
return json_data = {'status':0,'msg':'子渠道密码不能小于6位字符'}
}
if($('#repassword').val()==""){
return json_data = {'status':0,'msg':'确认密码不能为空'}
}
if($('#repassword').val()!==$('#password').val()){
return json_data = {'status':0,'msg':'子渠道密码和确认密码不一致'}
}
var myreg = /^(((13[0-9]{1})|(15[0-9]{1})|(17[0-9]{1})|(18[0-9]{1}))+\d{8})$/;
// if(!myreg.test($('#mobile_phone').val())){
// return json_data = {'status':0,'msg':'请输入正确的手机号'}
// }
// var myreg = /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/;
// if(!myreg.test($('#email').val())){
// return json_data = {'status':0,'msg':'请输入正确的邮箱'}
// }
// if($.trim($('#nickname').val()).length == 0){
// return json_data = {'status':0,'msg':'昵称不能为空'};
// }
return json_data = {'status':1,'msg':'成功'};
}
</script>
</block>