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
7.6 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<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>添加{$promoteTypeName}</span></div>
</div>
<img src="__IMG__/20180207/icon_normal_ziqudao.png">
<span class="title_main">添加{$promoteTypeName}</span>
</div>
<div class="trunk-content article">
<div class="trunk-list list_normal">
<form action="{:U('Promote/addPromote')}" novalidate="novalidate" method="post" class="base_info" id="form_reg">
<table class="table2">
<input type="hidden" name="promote_type" value="{:I('promote_type', 0)}">
<?php if($promotes != null):?>
<tr>
<td class="l"><span class="req">*</span>{$parentTypeName}</td>
<td class="r">
<select id="parent_id" name="parent_id" class="reselect select_gallery" style="width: 252px;" >
<option value="0">请选择所属{$parentTypeName}</option>
<volist name="promotes" id="promote">
<option value="{$promote.id}">{$promote.account}({$promote.real_name})</option>
</volist>
</select>
</td>
</tr>
<?php endif;?>
<tr>
<td class="l"><span class="req">*</span>帐号:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="account" id="account" maxlength="15" minlength="6" placeholder="请输入帐号">
</td>
</tr>
<tr>
<td class="l"><span class="req">*</span>姓名:</td>
<td class="r">
<input type="text" class="name input-txt txt" name="real_name" id="real_name" maxlength="4" minlength="2" placeholder="请输入姓名">
</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" style="cursor: pointer;">
<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();
if ($('#parent_id').length > 0 && parent_id == 0) {
layer.msg('请选择所属上级');
return
}
console.log(promote_type)
$.ajax({
type:"POST",
url:"{:U('addPromote')}",
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('children', ['promote_type' => I('promote_type', 0)])}";
},1000);
}else{
layer.msg(res.msg);
}
}
});
// $('#form_reg').submit();
}
function validation(){
var json_data = "";
if($('#account').val()==""){
return json_data = {'status':0,'msg':'子渠道账号不能为空'}
}
// 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位字符'}
}
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>