87,838
社区成员




var customerName = "";
var password = "";
var confirmPassword = "";
var tradePassword = "";
var confirmTradePassword = "";
var myMobile = "";
var myQQ = "";
var myParentID = "";
var contactName = "";
var identityCard = "";
var myPhone = "";
var myEmail = "";
checkCode = false;
$(function () {
$(function () {
var opclose = $("#openclose");
var informore = $("#informore");
opclose.toggle(function () {
opclose.val("点击关闭以下更多内容").css("background", "url(webblack/images/open.gif) no-repeat");
informore.slideDown(1000);
}, function () { opclose.val("点击展开以下更多内容").css("background", "url(webblack/images/close.gif) no-repeat"); informore.slideUp(1000); }
);
var rewrite_btn = $("#rewrite_btn");
var register_btn = $("#register_btn");
//绑定按钮点击事件
$("#btnSina").click(function () {
window.open("#");
});
$("#btnQQ").click(function () {
window.open("../qqlogin");
});
$("#taobao").click(function () {
window.open("$");
});
GetUserType();
$("#select01").jQSelect({ id: "listVal1" });
$(".lists").on("click", function () {
if ($.trim($("#listTxt1").val()) != "请选择") {
$("#listTxt1").stip(this, "", 3);
} else {
$("#listTxt1").stip(this, "请选择用户类型", 2);
}
});
})
function GetUserType() {
var sel = $("#sel");
}
$("#customerName").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请填写登录名称", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}).blur(function () {
$(this).addClass("inputactive");
chkNameIsExist();
if (customerName == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, customerName, 2);
}
})
$("#password").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请输入密码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkPwd();
if (password == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, password, 2);
}
}
)
$("#confirmPassword").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请再次输入密码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
pwdIsSame();
if (confirmPassword == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, confirmPassword, 2);
}
}
)
$("#tradePassword").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请输入交易密码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkTradePwd();
if (tradePassword == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, tradePassword, 2);
}
}
)
$("#confirmTradePassword").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "重复输入交易密码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
TradePwdIsSame();
if (tradePassword == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, tradePassword, 2);
}
}
)
$("#mobile").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请输入11位数字组成的号码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkMobile();
if (myMobile == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, myMobile, 2);
}
}
)
$("#qq").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请输入11位及以内数字组成的号码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkQQ();
if (myQQ == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, myQQ, 2);
}
}
)
$("#parentID").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "5位或5位以上数字", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkParentId();
if (myParentID == "OK") {
$(this).stip(this, "", 3);
} else {
$(this).stip(this, myParentID, 2);
}
}
)
$("#contactName").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "2~4个中文汉字", 1);
} else {
$(this).stip(this, "2~4个中文汉字", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkChiName();
if (contactName == "OK") {
$(this).stip(this, "", 3);
}
else {
if ($(this).val() != "") {
$(this).stip(this, "您输入的姓名不对吧!", 2);
}
else {
$(this).stip(this, "", 3);
}
}
}
)
$("#identityCard").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "15或18位身份号码", 1);
} else {
$(this).stip(this, "15或18位身份号码", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkPCard();
if (identityCard == "OK") {
$(this).stip(this, "", 3);
} else {
if ($(this).val() != "") {
$(this).stip(this, identityCard, 2);
} else {
$(this).stip(this, "", 3);
}
}
}
)
$("#companyName").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "填写公司名或者网吧名称,尽量简短!", 1);
} else {
$(this).stip(this, "填写公司名或者网吧名称,尽量简短!", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
$(this).stip(this, "", 3);
}
)
$("#phone").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "号码格式为:021-88888888", 1);
} else {
$(this).stip(this, "号码格式为:021-88888888", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkPhone();
if (myPhone == "OK") {
$(this).stip(this, "", 3);
}
else {
if ($(this).val() != "") {
$(this).stip(this, myPhone, 2);
}
else {
$(this).stip(this, "", 3);
}
}
}
)
$("#email").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "以@相隔的电子邮件地址!", 1);
} else {
$(this).stip(this, "以@相隔的电子邮件地址!", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
checkEmail();
if (myEmail == "OK") {
$(this).stip(this, "", 3);
} else {
if ($(this).val() != "") {
$(this).stip(this, myEmail, 2);
}
else {
$(this).stip(this, "", 3);
}
}
}
)
$("#address").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请填写您的地址", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
$(this).stip(this, "", 3);
}
)
$.ajax({
type: "post",
url: "index.php?m=mod_b2b&c=Default&a=Save_black",
data: valuer,
success: function(Regsur)
{
if(Regsur=='1'){
alert('注册成功!请登录');
window.location.href='index.php';
}else if(Regsur=='2'){
alert('验证码输入错误!');
document.getElementById("RandCodeR").src="index.php?m=mod_b2b&a=randcode";
}else if(Regsur=='0'){
alert('注册失败,请稍后再试!');
document.getElementById("RandCodeR").src="index.php?m=mod_b2b&a=randcode";
}else{
alert('信息验证失败,请检查 ');
document.getElementById("RandCodeR").src="index.php?m=mod_b2b&a=randcode";
}
},
error: function (ex) {
alert('注册失败,请检查 ');
document.getElementById("RandCodeR").src="index.php?m=mod_b2b&a=randcode";
},
cache: false,
async: false
});
}
$("#checkCode").focus(function () {
$(this).addClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请填写验证码", 1);
} else {
$(this).stip(this, "您要重新填写吗?", 1);
}
}
).blur(
function () {
$(this).removeClass("inputactive");
if ($(this).val() == "") {
$(this).stip(this, "请填写验证码", 2);
checkCode = false;
}
else {
$(this).stip(this, "", 3);
checkCode = true;
}
}
)
})
function chkNameIsExist() {
var name = $("#customerName").attr("value");
var result = name.match(/^([a-z]|[A-Z]|[0-9]){6,30}$/);
if (result == "") {
customerName = "用户名不能为空";
return false;
} else if(result == null){
customerName = "必须是6-30位的数字或字母";
return false;
} else {
$.ajax({
type: "get",
url: "index.php?m=mod_b2b&c=home&a=CheckUser&ubzaname="+name,
success: function(sur)
{
if(sur=='1'){
customerName = "OK";
return true;
}else if(sur=='0'){
customerName = "该账户已被注册";
return false;
}else{
customerName = "验证信息失败";
return false;
}
},
error: function (ex) {
customerName = "验证信息失败";
return false;
},
cache: false,
async: false
});
}
}
//是否有上级 隐藏框
function ParentIDCheck() {
var a = document.getElementsByName("radios");
if (a[1].checked) {
document.getElementById("Span_ParentID").style.display = "none";
}
else {
document.getElementById("Span_ParentID").style.display = "block";
$("#parentIDTip").html("5位或5位以上数字");
}
}
//密码格式是否正确
function checkPwd() {
var pwd = $("#password").val();
var result = pwd.match(/^([a-z]|[A-Z]|[0-9]){6,30}$/);
if (result == null) {
password = "必须是6-30位的数字或字母";
return false;
} else {
password = "OK";
return true;
}
}
//两次输入密码是否相等
function pwdIsSame() {
var pwd = $("#password").val();
var conFirmPwd = $("#confirmPassword").val();
var result = conFirmPwd.match(/^([a-z]|[A-Z]|[0-9]){6,30}$/);
if (pwd == conFirmPwd && conFirmPwd != "" && result != null) {
confirmPassword = "OK";
return true;
}
else {
confirmPassword = "密码不一致或格式不正确";
return false;
}
}
//交易密码格式是否正确
function checkTradePwd() {
var pwd = $("#tradePassword").val();
var result = pwd.match(/^([a-z]|[A-Z]|[0-9]){6,30}$/);
if (result == null) {
tradePassword = "必须是6-30位的数字或字母";
return false;
} else {
tradePassword = "OK";
return true;
}
}
//两次输入交易密码是否相等
function TradePwdIsSame() {
var tradePwd = $("#tradePassword").val();
var tradeConFirmPwd = $("#confirmTradePassword").val();
var result = tradeConFirmPwd.match(/^([a-z]|[A-Z]|[0-9]){6,30}$/);
if (tradePwd == tradeConFirmPwd && tradeConFirmPwd != "" && result != null) {
tradePassword = "OK";
return true;
}
else {
tradePassword = "交易密码不一致或格式不正确";
return false;
}
}
//验证用户类型
function checkType() {
if ($("#listTxt1").val() == "请选择") {
$("#listTxt1").stip(this, "请选择用户类型", 2);
return false;
}
else {
$("#listTxt1").stip(this, "", 3);
return true;
}
}
//验证11位电话号码
function checkMobile() {
var mobile = $("#mobile").val();
var result = mobile.match(/^1(([3][456789])|([5][012789])|([8][2378]))[0-9]{8}$/);
result = result || mobile.match(/^1(([3][012])|([5][56])|([8][56]))[0-9]{8}$/);
result = result || mobile.match(/^1(([3][3])|([5][3])|([8][09]))[0-9]{8}$/);
if (result == null) {
myMobile = "手机号码格式不合法";
return false;
}
else {
myMobile = "OK";
return true;
}
}
//验证QQ
function checkQQ() {
var qq = $("#qq").val();
var result = qq.match(/^\d{5,}$/);
if (result == null) {
myQQ = "不是有效的QQ号码";
return false;
}
else {
myQQ = "OK";
return true;
}
}
//验证上级编号
function checkParentId() {
var parentID = $("#parentID").val();
var a = document.getElementsByName("radios");
if (a[0].checked) {
var result = parentID.match(/^\d{5,}$/);
if (result == null) {
myParentID = "格式不正确,必须是5或5位以上数字";
return false;
}
else {
$.ajax({
type: "get",
url: "index.php?m=mod_b2b&a=checkagentbyid&ubzaid="+parentID,
success: function(sur)
{
if(sur=='1'){
myParentID = "OK";
return true;
}else if(sur=='0'){
myParentID = "不存在该上级";
return false;
}else{
myParentID = "上级不可用";
return false;
}
},
error: function (ex) {
myParentID = "验证信息失败";
return false;
},
cache: false,
async: false
});
}
}
else {
return true;
}
}
//验证中文名字
function checkChiName() {
var chiName = $("#contactName").val();
if (chiName != "") {
var result = chiName.match(/^([\u4E00-\u9FA5]){2,4}$/);
if (result == null) {
contactName = "姓名格式不合法,必须是2-4个汉字";
return false;
}
else {
contactName = "OK";
return true;
}
}
else {
return true;
}
}
//验证身份证
function checkPCard() {
var pCard = $("#identityCard").val();
if (pCard != "") {
var result = pCard.match(/^(\d{14}|\d{17})(\d|[xX])$/);
if (result == null) {
identityCard = "身份证格式不合法,必须是15或18位数字";
return false;
}
else {
identityCard = "OK";
return true;
}
}
else {
return true;
}
}
//验证联系电话
function checkPhone() {
var phone = $("#phone").val();
if (phone != "") {
var result = phone.match(/0\d{2}-\d{8}/);
if (result == null) {
myPhone = " 号码格式必须为:021-88888888";
return false;
}
else {
myPhone = "OK";
return true;
}
}
else {
return true;
}
}
//验证电子邮件
function checkEmail() {
var email = $("#email").val();
if (email != "") {
var result = email.match(/^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/);
if (result == null) {
myEmail = "不是有效的邮箱地址";
return false;
}
else {
myEmail = "OK";
return true;
}
}
else {
return true;
}
}
//提交总验证
function checkAll() {
var radios = $('input:radio[name="radios"]:checked').val();
var chkParentIdFlag;
//判断是否启用 上级编号验证
if (radios == 0) {
chkParentIdFlag = checkParentId();
parendidvalue = $("#parentID").val();
}
else {
chkParentIdFlag = true;
parendidvalue = "0";
}
if (customerName == "OK" && checkPwd() && pwdIsSame() && checkTradePwd() && TradePwdIsSame() && checkType() && checkMobile() && checkChiName() && checkPCard() && checkPhone() && checkQQ() && checkEmail() && checkCode) {
return true;
Globalr = 'OK';
}
else {
return false;
}
}
//重新填写按钮触发
function regReset() {
window.location = window.location;
}
function Register(style) {
chkNameIsExist();
if (customerName != "OK")
$("#customerName").stip(this, customerName, 2);
checkPwd();
if (password != "OK")
$("#password").stip(this, password, 2);
pwdIsSame();
if (confirmPassword != "OK")
$("#confirmPassword").stip(this, confirmPassword, 2);
checkTradePwd();
if (tradePassword != "OK")
$("#tradePassword").stip(this, tradePassword, 2);
TradePwdIsSame();
if (tradePassword != "OK")
$("#confirmTradePassword").stip(this, tradePassword, 2);
checkType();
checkMobile();
if (myMobile != "OK")
$("#mobile").stip(this, myMobile, 2);
checkQQ();
if (myQQ != "OK")
$("#qq").stip(this, myQQ, 2);
checkParentId();
if (myParentID != "OK")
$("#parentID").stip(this, myParentID, 2);
checkChiName();
if (contactName != "OK" && $("#contactName").val() != "")
$("#contactName").stip(this, "您输入的姓名不对吧!", 2);
checkPCard();
if (identityCard != "OK" && $("#identityCard").val() != "")
$("#identityCard").stip(this, identityCard, 2);
checkPhone();
if (myPhone != "OK" && $("#phone").val() != "")
$("#phone").stip(this, myPhone, 2);
checkEmail();
if (myEmail != "OK" && $("#email").val() != "")
$("#email").stip(this, myEmail, 2);
if ($("#checkCode").val() == "") {
$("#checkCode").stip(this, "请填写验证码", 2);
checkCode = false;
} else {
checkCode = true;
}
if (checkAll() == false) {
return;
}
var valuer = "ubzcname="+encodeURIComponent($("#customerName").attr("value"))+"&ubzctrade="+$("#confirmTradePassword").attr("value")+"&ubzcpwd="+escape($("#password").attr("value"))+"&ubzcmail="+escape($("#email").attr("value"))+"&ubzcrealname="+encodeURIComponent($("#contactName").attr("value"))+"&ubzcqq="+escape($("#qq").attr("value"))+"&ubzcmobile="+escape($("#mobile").attr("value"))+"&ubzctel="+escape($("#phone").attr("value"))+"&ubzcaddr="+encodeURIComponent($("#address").attr("value"))+"&ubzrandcode="+encodeURIComponent($("#checkCode").attr("value"))+"&ubzcompany="+encodeURIComponent($("#companyName").attr("value"))+"&ubzprv="+encodeURIComponent($.trim($("#listTxt1").val()))+"&ubzcity="+encodeURIComponent("a")+"&ubzwebsetting="+encodeURIComponent($("#websetting").attr("value"))+"&ubzparentid="+parendidvalue+"&ubzeshop="+encodeURIComponent("")+"&ubzidcard="+encodeURIComponent($("#identityCard").attr("value"))+"&checkCode="+$("#checkCode").attr("value");;