var user_error = new Array(true); $(function(){ register_verification(); $('#goods_quantity').keyup(function (){ var goods_quantity = $('#goods_quantity').val(); var old_quantity = $('#old_quantity').val(); if(goods_quantity) { var leng = goods_quantity>old_quantity?goods_quantity-old_quantity:old_quantity-goods_quantity; for(var i = 0;i < leng;i++) { if(goods_quantity>old_quantity) { add_product(); }else{ $('#product_detail tr:last').remove(); var quantity =$('#old_quantity').val(); $('#goods_quantity').val(quantity-1); $('#old_quantity').val($('#goods_quantity').val()); } } } }); $('#quantity').keyup(function (){ var quantity = $('#quantity').val(); var old_volume_quantity = $('#old_volume_quantity').val(); if(quantity) { var leng = quantity>old_volume_quantity?quantity-old_volume_quantity:old_volume_quantity-quantity; for(var i = 0;i < leng;i++) { if(quantity>old_volume_quantity) { add_volume(); }else{ $('#order_volume tr:last').remove(); var quantity =$('#old_quantity').val(); $('#goods_quantity').val(quantity-1); $('#old_volume_quantity').val($('#quantity').val()); } } } }); }); easyloader.locale = "zh_CN"; function register_verification() { $("#username").focusin(function(){ show_register_info('username',1); }); $("#username").focusout(function(){ var username = $('#username').val(); if(username == ""){ show_register_error('username',language('input the usernmae')); return; } if(len(username) < 6) { show_register_error('username','用户名长度不得少于6位'); return; }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'username','username':username}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { show_register_error('username','用户名已存在'); return; }else{ show_register_correct('username'); return; } } }); } }); $("#password").focusin(function(){ show_register_info('password',1); }); $("#password").focusout(function(){ var password = $("#password").val(); if(password == ""){ show_register_error('password',language('please input the password')); return; }else{ if(password.length < 4) { show_register_error('password','密码长度不得少于4位'); return; }else{ show_register_correct('password'); } } }); $("#confirm_password").focusin(function(){ show_register_info('confirm_password',1); }); $("#confirm_password").focusout(function(){ var password = $("#password").val(); var confirm_password = $("#confirm_password").val(); if(confirm_password == "") { show_register_error('confirm_password',language('make sure the password')); return; }else if(confirm_password != password){ show_register_error('confirm_password',language('twice the input password is inconsistent')); return; }else{ show_register_correct('confirm_password'); } }); $("#displayName").focusin(function(){ show_register_info('displayName',1); }); $("#displayName").focusout(function(){ var displayName = $("#displayName").val(); if(displayName == ""){ show_register_error('displayName',language('please enter a contact')); return; }else{ if(len(displayName) < 4) { show_register_error('displayName','联系人长度不得小于四位字符'); return; }else{ show_register_correct('displayName'); } } }); $("#email").focusin(function(){ show_register_info('email',1); }); $("#email").focusout(function(){ var email = $("#email").val(); if(email == ""){ show_register_error('email',language('please enter a email')); return; }else if(!(/^[a-zA-Z0-9_.-]+\@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]{2,3}){1,2}$/.test(email))){ show_register_error('email',language('please enter a valid email address')); return; }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'email','email':email}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { show_register_error('email','邮箱已存在'); return; }else{ show_register_correct('email'); } } }); } }); $("#mobile").focusin(function(){ show_register_info('mobile',1); $("#info_tel").hide(); $("#error_tel").hide(); $('#correct_tel').hide(); }); $("#tel").focusin(function(){ show_register_info('tel',1); }); $("#mobile").focusout(function(){ var mobile = $("#mobile").val(); if(mobile == ""){ $("#info_mobile").hide(); $("#error_mobile").hide(); $('#correct_mobile').hide(); }else{ if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(mobile))){ show_register_error('mobile',language('please enter the correct phone number')); return; }else{ if(mobile.length == 11) { show_register_correct('mobile'); }else{ show_register_error('mobile','手机号码为11位(数字)'); return; } } } }); $("#tel").focusout(function(){ var mobile = $("#mobile").val(); var tel = $("#tel").val(); if(mobile == '') { if(tel == ""){ show_register_error('tel',language('please enter a phone number')); return; }else{ if(!(/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(tel))){ show_register_error('tel',language('please the enter a phone number')); return; }else{ show_register_correct('tel'); } } }else if(tel != '') { if(!(/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(tel))){ show_register_error('tel',language('please the enter a phone number')); return; }else{ show_register_correct('tel'); } } }); $("#address").focusin(function(){ show_register_info('address',1); }); $("#address").focusout(function(){ var address = $("#address").val(); if(address == ""){ show_register_error('address',language('please enter an address')); return; }else{ show_register_correct('address'); } }); $("#old_password").focusin(function(){ show_register_info('old_password',1); }); $("#old_password").focusout(function(){ var old_password = $("#old_password").val(); if(old_password == ""){ user_error[0] = false; show_register_error('old_password',language('please enter the original password')); return; }else{ if(old_password.length < 4) { user_error[0] = false; show_register_error('old_password','密码长度不得少于4位'); return; }else{ user_error[0] = true; show_register_correct('old_password'); } } }); $("#new_password").focusin(function(){ show_register_info('new_password',1); }); $("#new_password").focusout(function(){ var new_password = $("#new_password").val(); if(new_password == ""){ user_error[0] = false; show_register_error('new_password',language('please enter a new password')); return; }else{ if(new_password.length < 4) { user_error[0] = false; show_register_error('new_password','密码名长度不得少于4位'); return; }else{ user_error[0] = true; show_register_correct('new_password'); } } }); $("#recommende").focusin(function(){ show_register_info('recommende',1); }); $("#recommende").focusout(function(){ var recommende = $("#recommende").val(); var recommende_value = recommende.indexOf('@'); if(recommende != '') { if(recommende.length<5) { show_register_error('recommende','用户名或ID不得少于5位'); return; }else if(recommende.length == 5){ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'userID','userID':recommende}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { show_register_error('recommende',data); return; }else{ show_register_correct('recommende'); } } }); }else if(recommende.length >= 6){ if(recommende_value != -1) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'email','email':recommende}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { show_register_error('recommende',data); return; }else{ show_register_correct('recommende'); } } }); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'username','username':recommende}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { user_error[0] = false; show_register_error('recommende',data); return; }else{ user_error[0] = true; show_register_correct('recommende'); } } }); } }else{ $("#info_recommende").hide(); $("#error_recommende").hide(); $('#correct_recommende').hide(); } } }); $("#new_confirm_password").focusin(function(){ show_register_info('new_confirm_password',1); }); $("#new_confirm_password").focusout(function(){ var new_password = $("#new_password").val(); var new_confirm_password = $("#new_confirm_password").val(); if(new_confirm_password == "") { user_error[0] = false; show_register_error('new_confirm_password',language('make sure the password')); return; }else if(new_confirm_password != new_password){ show_register_error('new_confirm_password',language('twice the input password is inconsistent')); return; }else{ user_error[0] = true; show_register_correct('new_confirm_password'); } }); } function register_submit() { var username = $('#username').val(); var password = $("#password").val(); var confirm_password = $("#confirm_password").val(); var displayName = $("#displayName").val(); var email = $("#email").val(); var mobile = $("#mobile").val(); var tel = $("#tel").val(); var address = $("#address").val(); var recommende = $("#recommende").val(); var recommende_value = recommende.indexOf('@'); if(username == ""){ show_register_error('username',language('input the usernmae')); //$("#username").focus(); return false; }else if(len(username) < 6) { show_register_error('username','用户名长度不得少于6位'); //$("#username").focus(); return false; }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'username','username':username}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { show_register_error('username','用户名已存在'); //$("#username").focus(); return false; }else{ show_register_correct('username'); } } }); } if(password == ""){ show_register_error('password',language('please input the password')); //$("#password").focus(); return false; }else{ if(password.length < 4) { show_register_error('password','密码长度不得少于4位'); //$("#password").focus(); return false; }else{ show_register_correct('password'); } } if(confirm_password == "") { show_register_error('confirm_password',language('make sure the password')); //$("#confirm_password").focus(); return false; }else if(confirm_password != password){ show_register_error('confirm_password',language('twice the input password is inconsistent')); return false; }else{ show_register_correct('confirm_password'); } if(displayName == ""){ show_register_error('displayName',language('please enter a contact')); return false; }else{ if(len(displayName) < 4) { show_register_error('displayName','联系人长度不得小于四位字符'); return false; }else{ show_register_correct('displayName'); } } if(email == ""){ show_register_error('email',language('please enter a email')); return false; }else if(!(/^[a-zA-Z0-9_.-]+\@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]{2,3}){1,2}$/.test(email))) { user_error[0] =false; show_register_error('email',language('please enter a valid email address')); return false;; }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'email','email':email}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { show_register_error('email','邮箱已存在'); return false;; }else{ show_register_correct('email'); } } }); } if(mobile == ""){ $("#info_mobile").hide(); $("#error_mobile").hide(); $('#correct_mobile').hide(); }else{ if(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(mobile))){ show_register_error('mobile',language('please enter the correct phone number')); return false;; }else{ if(mobile.length == 11) { show_register_correct('mobile'); }else{ show_register_error('mobile','手机号码为11位(数字)'); return false; } } } if(mobile == '') { if(tel == ""){ show_register_error('tel',language('please enter a phone number')); return false; }else{ if(!(/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(tel))){ show_register_error('tel',language('please the enter a phone number')); return false; }else{ show_register_correct('tel'); } } }else if(tel != '') { if(!(/(^[0-9]{3,4}\-[0-9]{3,8}$)|(^[0-9]{3,8}$)|(^\([0-9]{3,4}\)[0-9]{3,8}$)|(^0{0,1}13[0-9]{9}$)/.test(tel))){ show_register_error('tel',language('please the enter a phone number')); //$("#tel").focus(); return false; }else{ show_register_correct('tel'); } } if(address == ""){ show_register_error('address',language('please enter an address')); //$("#address").focus(); return false; }else{ show_register_correct('address'); } if(recommende != '') { if(recommende.length<5) { show_register_error('recommende','用户名或ID不得少于5位'); //$("#recommende").focus(); return false; }else if(recommende.length == 5){ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'userID','userID':recommende}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { show_register_error('recommende',data); //$("#recommende").focus(); return false;; }else{ show_register_correct('recommende'); } } }); }else if(recommende.length >= 6){ if(recommende_value != -1) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'email','email':recommende}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { show_register_error('recommende',data); //$("#recommende").focus(); return false;; }else{ show_register_correct('recommende'); } } }); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'username','username':recommende}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { user_error[0] = false; show_register_error('recommende',data); //$("#recommende").focus(); return false;; }else{ user_error[0] = true; show_register_correct('recommende'); } } }); } } }else{ $("#info_recommende").hide(); $("#error_recommende").hide(); $('#correct_recommende').hide(); } } function show_register_error(id,prompt) { $('#error_'+id).css({'display':'block'}); $('#error_'+id).html(prompt); $('#info_'+id).css({'display':'none'}); $('#correct_'+id).css({'display':'none'}); } function show_register_info(id,show) { $('#info_'+id).css({'display':'block'}); $('#error_'+id).css({'display':'none'}); $("#correct_"+id).css({'display':'none'}); } function show_register_correct(id) { $('#info_'+id).css({'display':'none'}); $('#error_'+id).css({'display':'none'}); $("#correct_"+id).css({'display':'block'}); } function change_order_status(id,rows) { $(id,window.parent.document).empty(); $(id,window.parent.document).append(rows); } function showError(val){ $("#error_info").empty(); $("#error_info").addClass('info'); $("#error_info").append(val); $("#error_info").show(); } function show_remote_prompt(val){ $("#remote_prompt").empty(); $("#remote_prompt").append(val); $("#remote_prompt").show(); } function loginCheck(form_name) { var username = $("#username").val(); var password = $("#password").val(); if(username == ""){ //showError(language('input the usernmae')); $('#login_info').text(language('input the usernmae')); $('#login_info').css({'background':'#FFE45C','color':'red'}); return false; } if(password == ""){ //showError(language('please input the password')); $('#login_info').text(language('please input the password')); $('#login_info').css({'background':'#FFE45C','color':'red'}); return false; } $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/login", data:{'Login':'Login','username':username,'password':password}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1){ //window.document.location.reload(); window.location = 'http://old.lsd-express.com/start'; }else{ $('#login_info').text(data); $('#login_info').css({'background':'#FFE45C','color':'red'}); } } }); return false; } function len(s) { var l = 0; var a = s.split(""); for (var i=0;i < a.length;i++) { if ( a[i].charCodeAt(0) < 299) { l++; } else { l+=2; } } return l; } function registerCheck() { return register_submit(); } function user_update() { return user_error[0]; } function modifyPassword() { var old_password = $("#old_password").val(); var new_password = $("#new_password").val(); var confirm_password = $("#new_confirm_password").val(); if(old_password !='' && new_password !='' && confirm_password !='') { $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/user_modify_password", data:{'new_password':new_password,'confirm_password':confirm_password,'old_password':old_password}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { location.href = "http://old.lsd-express.com/user/user_information"; }else if(data == 'old'){ showError('原密码输入错误') }else{ showError(data) } } }); } } function add_addre() { var country = $("#country").val(); var province = $("#province").val(); var city = $("#city").val(); var sender_name = $("#sender_name").val(); var address_zip = $("#address_zip").val(); var tel = $("#tel").val(); var address = $("#address").val(); var status = $("#status").attr('checked'); //alert(status); if(sender_name == ""){ showError(language('input the usernmae')) $("#sender_name").focus(); return false; } if(address_zip == ""){ showError(language('please enter the zip code')); $("#address_zip").focus(); return false; } if(tel == ""){ showError(language('please enter a phone number')); $("#tel").focus(); return false; } if(address == ""){ showError(language('please enter an address')); $("#address").focus(); return false; } $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/add_address", data:{'city':city,'country':country,'province':province,'sender_name':sender_name,'tel':tel,'address_zip':address_zip,'address':address,'status':status}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { location.href = "http://old.lsd-express.com/user/user_return_address"; }else { showError(data) } } }); } function deleted_address(address_id) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/delete_address", data:{'address_id':address_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { location.href = "http://old.lsd-express.com/user/user_return_address"; }else { showError(data) } } }); } function update_address(address_id) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/update_address", data:{'address_id':address_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); $('#content').html(data); } }); } function update_addre(address_id) { var country = $("#country").val(); var province = $("#province").val(); var city = $("#city").val(); var first_name = $("#first_name").val(); var laster_name = $("#laster_name").val(); var address1 = $("#address1").val(); var address2 = $("#address2").val(); var zip = $("#zip").val(); var cellphone = $("#cellphone").val(); var status = $("#status").attr('checked'); if(first_name == ""){ showError(language('input the usernmae')) $("#sender_name").focus(); return false; } if(zip == ""){ showError(language('please enter the zip code')); $("#address_zip").focus(); return false; } if(cellphone == ""){ showError(language('please enter a phone number')); $("#tel").focus(); return false; } if(address1 == ""){ showError(language('please enter an address')); $("#address1").focus(); return false; } $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/update_address", data:{'address_id':address_id,'country':country,'province':province,'city':city,'first_name':first_name,'laster_name':laster_name,'address1':address1,'address2':address2,'zip':zip,'cellphone':cellphone,'status':status}, beforeSend: showLoading(), success: function(data){ hideLoading(); $('#content').html(data); } }); } function address() { $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/add_address", data:{'Add':'Add'}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { location.href = "http://old.lsd-express.com/user/add_address"; }else { showError(data) } } }); } function order_entry(order) { $(order).submit(); } function add_volume(length,width,height,weight,id) { var length = length?length:1; var width = width?width:1; var height = height?height:1; var weight = weight?weight:0.0002; var mydate = new Date(); var tmp_id = Math.ceil(Math.random()*100000); var new_product ='<'; new_product += 'tr id="'+tmp_id+'">'; new_product +='<'; new_product +='input value="'+length+'" name="length[]" id="length_'+tmp_id+'" onkeyup="num_input(this,'+tmp_id+');" style="width:80px;ime-mode:Disabled;"/>cm'; new_product +='<'; new_product +='input value="'+width+'" name="width[]" id="width_'+tmp_id+'" onkeyup="num_input(this,'+tmp_id+');" style="width:80px;ime-mode:Disabled;"/>cm'; new_product +='<'; new_product +='input value="'+height+'" name="height[]" id="height_'+tmp_id+'" onkeyup="num_input(this,'+tmp_id+');" style="width:80px;ime-mode:Disabled;"/>cm'; new_product +='<'; new_product +='input value="'+weight+'" name="volume_weight[]" id="weight_'+tmp_id+'" class="volume_weight" readonly style="width:80px;ime-mode:Disabled;"/>kg'; new_product +='<'; new_product += 'a id="undefined" href="javascript:void(0)" onclick="del_order_volume('+tmp_id+')" class="easyui-linkbutton l-btn l-btn-plain" plain="true" iconcls="icon-cancel" title="删除">'; new_product += ' '; if(id) { new_product +='<'; new_product +='input type="hidden" name="product_id[]" value="'+id+'">'; } new_product += ''; $('#order_volume tr:last').after(new_product); var quantity =$('#old_volume_quantity').val(); $('#quantity').val(parseInt(quantity)+1); $('#old_volume_quantity').val($('#quantity').val()); totalVolume(tmp_id); } function totalVolume(weight_id) { var length = $('#length_'+weight_id).val(); var width = $('#width_'+weight_id).val(); var height = $('#height_'+weight_id).val(); var product_code = $('#shipping_service').val(); if(!isNaN(product_code)) { product_code = $('#product_code').val(); } var total_volume = 0; if(product_code!=''&&product_code!='0'&&product_code!='0') { $("#error_info").hide(); $.ajax({ type:"POST", url:"http://old.lsd-express.com/order/get_metric_factors", data:{'length':length,'width':width,'height':height,'product_code':product_code}, success:function(msg) { if(!isNaN(msg)) { total_volume = msg; $('#weight_'+weight_id).val(Fractional(total_volume)); var weight = new Array(); $('.volume_weight').each(function(){ weight.push($(this).val()); }); var volume_weight = 0; for(var i=0;i < weight.length;i++) { volume_weight =parseFloat(weight[i])+parseFloat(volume_weight); } $('#volume_weight').val(Fractional(volume_weight)); } } }); }else { showError('请先选择产品'); } } function del_order_volume(tr_id){ var weight_volume = $('#weight_'+tr_id).val(); var volume_weight = $('#volume_weight').val(); var total_volume = accSubtr(volume_weight,weight_volume); $('#volume_weight').val(Fractional(total_volume)); var quantity =$('#old_volume_quantity').val(); $('#quantity').val(quantity-1); $('#old_volume_quantity').val($('#quantity').val()); $('#'+tr_id).remove(); } function accSubtr(arg1,arg2){ var r1,r2,m,n; try{r1=arg1.toString().split(".")[1].length}catch(e){r1=0} try{r2=arg2.toString().split(".")[1].length}catch(e){r2=0} m=Math.pow(10,Math.max(r1,r2)); //动态控制精度长度 n=(r1>=r2)?r1:r2; return ((arg1*m-arg2*m)/m).toFixed(n); } function add_product(){ var mydate = new Date(); var tmp_id = Math.ceil(Math.random()*100000); var shipping_service = $('#shipping_service').val(); var new_product ='<'; new_product += 'tr id="'+tmp_id+'">'; new_product +=''; if(shipping_service.toLowerCase().indexOf('fedex')>0) { var display='block'; }else{ var display='none'; } new_product +='材质为必填例:棉80%'; new_product +=''; new_product +=''; new_product +='USD($)'; new_product +=''; new_product +='<'; new_product += 'a id="undefined" href="javascript:void(0)" onclick="del_product('+tmp_id+')" class="easyui-linkbutton l-btn l-btn-plain" plain="true" iconcls="icon-cancel" title="删除">'; new_product += ' '; new_product += ''; $('#product_detail tr:last').after(new_product); var quantity =$('#old_quantity').val(); $('#goods_quantity').val(parseInt(quantity)+1); $('#old_quantity').val($('#goods_quantity').val()); } function del_product(tr_id){ var quantity =$('#old_quantity').val(); $('#goods_quantity').val(quantity-1); $('#old_quantity').val($('#goods_quantity').val()); $('#'+tr_id).remove(); } function submitBatch(datafrom) { var checked = false; $('.checked').each(function(){ if($(this).is(':checked')){ checked = true; } }) if(checked == false){ alert('请选择要操作的订单'); //showError(language('please select the orders to be operating')); //$("#addre").focus(); return false; } $('#datafrom').submit(); } function checkAll1() { if($('#checkAll').is(':checked')){ $('.checked').attr('checked',true) $('.shipping_service').attr('checked',true) }else{ $('.shipping_service').attr('checked',false) $('.checked').attr('checked',false) } } function len(s) { var l = 0; var a = s.split(""); for (var i=0;i < a.length;i++) { if (a[i].charCodeAt(0)<299) { l++; } else { l+=2; } } return l; } function productCreate(form_name){ var product_name = $("#product_name").val(); var product_en_name = $("#product_en_name").val(); var product_code = $("#product_code").val(); if(product_name == ""){ $("#product_name").focus(); }else if(product_en_name == ""){ $("#product_en_name").focus(); }else if(product_code == ""){ $("#product_code").focus(); }else{ $(form_name).submit(); } } function showMessage(msg_title,msg_body){ $.messager.show({ title:msg_title, msg:msg_body }); } function operating_date_verification(form_name) { var operating_date_start = $('input[name=operating_date_start]').val(); var operating_date_end = $('input[name=operating_date_end]').val(); var start_arr = operating_date_start.split('-'); //转换后的UNIX时间戳 var start_datum = new Date(Date.UTC(start_arr[0],start_arr[1]-1,start_arr[2])); start_datum = start_datum.getTime()/1000; var end_arr = operating_date_end.split('-'); //转换后的UNIX时间戳 var end_datum = new Date(Date.UTC(end_arr[0],end_arr[1]-1,end_arr[2])); end_datum = end_datum.getTime()/1000; if(start_datum > end_datum) { $('input[name=operating_date_start]').val(operating_date_end); } } function order_search_date_verification() { var create_start_date = $('input[name=create_date_start]').val(); var create_end_date = $('input[name=create_date_end]').val(); var create_start_arr = create_start_date.split('-'); //转换后的UNIX时间戳 var create_start_datum = new Date(Date.UTC(create_start_arr[0],create_start_arr[1]-1,create_start_arr[2])); create_start_datum = create_start_datum.getTime()/1000; var create_end_arr = create_end_date.split('-'); //转换后的UNIX时间戳 var create_end_datum = new Date(Date.UTC(create_end_arr[0],create_end_arr[1]-1,create_end_arr[2])); create_end_datum = create_end_datum.getTime()/1000; if(create_start_datum > create_end_datum) { $('input[name=create_date_start]').val(create_end_date); } var delivery_date_start = $('input[name=delivery_date_start]').val(); var delivery_date_end = $('input[name=delivery_date_end]').val(); var delivery_start_arr = delivery_date_start.split('-'); //转换后的UNIX时间戳 var delivery_start_datum = new Date(Date.UTC(delivery_start_arr[0],delivery_start_arr[1]-1,delivery_start_arr[2])); delivery_start_datum = delivery_start_datum.getTime()/1000; var delivery_end_arr = delivery_date_end.split('-'); //转换后的UNIX时间戳 var delivery_end_datum = new Date(Date.UTC(delivery_end_arr[0],delivery_end_arr[1]-1,delivery_end_arr[2])); delivery_end_datum = delivery_end_datum.getTime()/1000; if(delivery_start_datum > delivery_end_datum) { $('input[name=delivery_date_start]').val(delivery_date_end); } $('#order_search_form').submit(); } function order_thorough_deleted() { $('#select').submit(); } function close_dialog(dialog) { using('dialog', function () { $('#'+dialog).dialog('close'); }); } function deleted_order(c_order_id,order_id,status) { $('#'+order_id).attr("checked", true); $('#order_id').val(order_id); $('#c_order_id').val(c_order_id); $('#status').val(status); if(status == 7) { $('#already_deleted').hide(); }else{ $('#already_deleted').show(); } $('#deleted_order_prompt').text(c_order_id); var location = getLocation(300,100); $('#deleted_order').show(); using('dialog', function () { $('#deleted_order').dialog({ //title:order_print_address_delivery_list, title:'删除提示', width:300, height:100, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function deleted_order_prompt(operating_type) { var c_order_id = $('#c_order_id').val(); var order_id = $('#order_id').val(); var status = $('#status').val(); if(status) { var operating_status = $('#status_'+status,window.parent.document).text(); var operating_status_num = operating_status.replace('(',''); var operating_status_quantity = operating_status_num.replace(')',''); var deleted = $('#status_7',window.parent.document).text(); var deleted_num = deleted.replace('(',''); var deleted_quantity = deleted_num.replace(')',''); if(operating_type == 1) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/deleted/"+order_id, data:'', beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_order'); $('#'+c_order_id).fadeOut(1000); change_order_status('#status_'+status,'('+(parseInt(operating_status_quantity)-1)+')'); }else{ alert(data); } } }); }else if(operating_type == 0) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/into_deleted/"+order_id, data:'', beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_order'); $('#'+c_order_id).fadeOut(1000); change_order_status('#status_'+status,'('+(parseInt(operating_status_quantity)-1)+')'); if(deleted_quantity) { change_order_status('#status_7','('+(parseInt(deleted_quantity)+1)+')'); }else{ change_order_status('#status_7','('+1+')'); } }else{ alert(data); } } }); } } } function print_address(order_id) { $('#'+order_id).attr("checked", true); $('#batch_processing').val('printLabel'); form_submit(); } function form_submit() { var select =[]; $('input[name="operating_order[]"]:checked').each(function(){ select.push($(this).val()); }); if(select.length == 0) { alert('请选择要操作的订单'); }else{ if($('#batch_processing').val() =='') { $('#batch_processing').val($('#batch').val()); } if(isNaN($('#batch_processing').val())) { $('#select_order').val(select); $('#select_print_order').val(select); if($('#batch_processing').val() == 'please_select') { alert('请选择要进行的操作'); }else{ if($('#batch_processing').val() =='printLabel') { var shipping_service_type = 0; if($("input").hasClass("shipping_service")){ if($('.shipping_service').is(':checked')) { shipping_service_type =1; $('#print_singapore').show(); }else{ $('#print_singapore').hide(); } }else{ $('.print_prompt').hide(); } if($("input").hasClass("checked")) { $('.print_prompt').hide(); if($('.checked').is(':checked')) { if(shipping_service_type == 1) { $('.print_prompt').show(); } $('#dialog_print').show(); $('#singapore_print').hide(); $('#print_other').show(); }else{ $('#dialog_print').hide(); $('#singapore_print').show(); $('#print_other').hide(); } }else{ $('.print_prompt').hide(); } var location = getLocation(510,500); $('#dialog').show(); using('dialog', function () { $('#dialog').dialog({ //title:order_print_address_delivery_list, title:'打印地址标签与送货清单', width:510, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } } if($('#batch_processing').val() =='export_delivery_list') { $("#select").submit(); } if($('#batch_processing').val() =='exportExcel') { $("#select").submit(); } if($('#batch_processing').val() == 'thorough_deleted') { var location = getLocation(220,100); $('#thorough_deleted').show(); using('dialog', function () { $('#thorough_deleted').dialog({ //title:order_print_address_delivery_list, title:'删除提示', width:220, height:100, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } if($('#batch_processing').val() == 'changeproduct') { var location = getLocation(400,150); $('#changeproduct').show(); using('dialog', function () { $('#changeproduct').dialog({ //title:order_print_address_delivery_list, title:'批量修改运输方式', width:400, height:150, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } }else{ $("#select").submit(); } } } function order_problem(order_problem_id,reply) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/order_problem", data:{'order_problem_id':order_problem_id,'content':reply}, beforeSend: showLoading(), success: function(data){ hideLoading(); $('#problem_dialog').html(data); } }); var location = getLocation(550,400); $('#problem_dialog').show(); using('dialog', function () { $('#problem_dialog').dialog({ title:'回复问题件', width:550, height:400, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function recharge_prompt(recharge_prompt) { var location = getLocation(400,100); $('#recharge_prompt').show(); using('dialog', function () { $('#recharge_prompt').dialog({ title:'提示', width:400, modal:true, shadow:false, height:100, position:'relative', left:location.left, top:location.top }); }); } function accordion(obj,box_id) { var li = document.getElementById(box_id); li.id = ''; obj.id = box_id; } $(document).ready(function(){ //重要公告 $("#cur_news1").mouseover(function(){ $("#cur_news1").css({cursor: "hand"}); $("#cur_news2").css({cursor: "hand"}); $("#cur_news1").removeClass("cur_news"); $("#cur_news2").removeClass("cur_news"); $("#cur_news1").addClass("cur_news"); $("#company_note_list").css({display:"block"}); $("#company_news_list").css({display:"none"}); $("#company_note_more").css({display:"block"}); $("#company_news_more").css({display:"none"}); }); //公司新闻 $("#cur_news2").mouseover(function(){ $("#cur_news1").css({cursor: "hand"}); $("#cur_news2").css({cursor: "hand"}); $("#cur_news2").removeClass("cur_news"); $("#cur_news1").removeClass("cur_news"); $("#cur_news2").addClass("cur_news"); $("#company_news_list").css({display:"block"}); $("#company_note_list").css({display:"none"}); $("#company_note_more").css({display:"none"}); $("#company_news_more").css({display:"block"}); }); //行业新闻 $("#cur_information1").mouseover(function(){ $("#cur_information1").css({cursor: "hand"}); $("#cur_information2").css({cursor: "hand"}); $("#cur_information1").removeClass("cur_information"); $("#cur_information2").removeClass("cur_information"); $("#cur_information1").addClass("cur_information"); $("#industry_news_list").css({display:"block"}); $("#industry_knowledge_list").css({display:"none"}); $("#industry_news_more").css({display:"block"}); $("#industry_knowledge_more").css({display:"none"}); }); //行业知识 $("#cur_information2").mouseover(function(){ $("#cur_information1").css({cursor: "hand"}); $("#cur_information2").css({cursor: "hand"}); $("#cur_information1").removeClass("cur_information"); $("#cur_information2").removeClass("cur_information"); $("#cur_information2").addClass("cur_information"); $("#industry_knowledge_list").css({display:"block"}); $("#industry_news_list").css({display:"none"}); $("#industry_knowledge_more").css({display:"block"}); $("#industry_news_more").css({display:"none"}); }); //取货点 $("#pick_up1").mouseover(function(){ $("#pick_up1").css({curson:"hand"}); $("#4px_information_list").css({display:"block"}); $("#query_tool_list").css({display:"none"}); $("#download_area_list").css({display:"none"}); $("#pick_up1").removeClass("pick_up"); $("#pick_up2").removeClass("pick_up"); $("#pick_up3").removeClass("pick_up"); $("#pick_up1").addClass("pick_up"); }); //查询工具 $("#pick_up2").mouseover(function(){ $("#pick_up2").css({curson:"hand"}); $("#4px_information_list").css({display:"none"}); $("#query_tool_list").css({display:"block"}); $("#download_area_list").css({display:"none"}); $("#pick_up1").removeClass("pick_up"); $("#pick_up2").removeClass("pick_up"); $("#pick_up3").removeClass("pick_up"); $("#pick_up2").addClass("pick_up"); }); //下载专区 $("#pick_up3").mouseover(function(){ $("#pick_up3").css({curson:"hand"}); $("#4px_information_list").css({display:"none"}); $("#query_tool_list").css({display:"none"}); $("#download_area_list").css({display:"block"}); $("#pick_up1").removeClass("pick_up"); $("#pick_up2").removeClass("pick_up"); $("#pick_up3").removeClass("pick_up"); $("#pick_up3").addClass("pick_up"); }); //查询 $("#dispaly1").mouseover(function(){ $("#dispaly1").css({cursor: "hand"}); $("#dispaly1").removeClass("dispaly"); $("#dispaly2").removeClass("dispaly"); $("#dispaly1").addClass("dispaly"); $("#track1").css({display:"block"}); $("#track2").css({display:"none"}); }); //登录 $("#dispaly2").mouseover(function(){ $("#dispaly2").css({cursor: "hand"}); $("#dispaly1").removeClass("dispaly"); $("#dispaly2").removeClass("dispaly"); $("#dispaly2").addClass("dispaly"); $("#track2").css({display:"block"}); $("#track1").css({display:"none"}); }); }); function checkvalue(obj){ var cvalue = $(obj).val(); if(cvalue==null || cvalue==""){ alert("追踪号不能为空!"); return false; }else{ return true; } } //加入收藏夹 function AddFavorite(sURL, sTitle) { try{window.external.addFavorite(sURL, sTitle);} catch (e) { try{window.sidebar.addPanel(sTitle, sURL, "");} catch (e){alert("加入收藏失败,请使用Ctrl+D进行添加");} } } function getTotalHeight(){ if($.browser.msie){ return document.compatMode == "CSS1Compat"? document.documentElement.clientHeight : document.body.clientHeight; }else{ return self.innerHeight; } } function getTotalWidth (){ if($.browser.msie){ return document.compatMode == "CSS1Compat"? document.documentElement.clientWidth : document.body.clientWidth; }else{ return self.innerWidth; } } function getLocation(width,height) { var scrollHeight = $(document).scrollTop()?$(document).scrollTop():0; var scrollWeight = $(document).scrollLeft()?$(document).scrollLeft():0; var windowHeight = getTotalHeight(); var windowWidth = getTotalWidth(); var left = (windowWidth-width)/2+scrollWeight; var top = (windowHeight-height)/2+scrollHeight; return {left:left,top:top}; } function showLoading(){ $('#load').fadeIn('fast'); } function hideLoading(){ $('#load').fadeOut('slow'); } function totalValue(){ var value = new Array(); $('input[name="product_value[]"]').each(function(){ value.push($(this).val()); }); var quantity = new Array(); $('input[name="product_qty[]"]').each(function(){ quantity.push($(this).val()); }); var total_value = 0; for(var i = 0;i < value.length;i++) { if( value[i] != '' && quantity[i] !='' && quantity[i] != 0) { total_value +=(parseFloat(value[i]*quantity[i])*10000)/10000; } } if(total_value > 99) { $('#tariff_prompt').show(); }else{ $('#tariff_prompt').hide(); } $('#declared_value').val(Fractional(total_value)); } function Fractional(n) { //小数保留位数 var bit = 4; //加上小数点后要扩充1位 bit++; //数字转为字符串 n = n.toString(); //获取小数点位置 var point = n.indexOf('.'); //n的长度大于保留位数长度 if (n.length > point + 6) { //保留小数后一位是否大于4,大于4进位 if (parseInt(n.substring(point + bit, point + bit + 1)) > 4) { return n.substring(0, point) + "." + (n.substring(point + 1, point + bit)) + (parseInt(n.substring(point + bit,point+bit+1))+1); }else { return n.substring(0, point) + n.substring(point, point + bit); } } return n; } function get_is_remote() { $('#remote_prompt').hide(); var shipping_service = $('#shipping_service').val(); var buyer_country = $('#buyer_country').val(); var buyer_zip = $('#buyer_zip').val(); var buyer_city = $('#buyer_city').val(); if(buyer_city == '') { showError('请输入城市'); $("#buyer_city").focus(); return false; }else{ $("#error_info").hide(); } if(buyer_zip == '') { showError(language('please enter the zip code')); $("#buyer_zip").focus(); return false; }else{ $("#error_info").hide(); } $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/get_is_remote", data:{'shipping_service':shipping_service,'buyer_country':buyer_country,'buyer_zip':buyer_zip,'buyer_city':buyer_city}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(!isNaN(data)) { if(data == 0) { show_remote_prompt('是偏远 '); $('#show_remote').empty(''); $('#confirm').show(); $('#show_remote').append('是偏远'); $('#remote').val(2); } if(data == 1) { show_remote_prompt('不是偏远或者不是个有效的选择'); $('#remote_prompt').css({color:'green'}); $('#remote').val(1); $('#show_remote').empty(''); $('#show_remote').append('已查询'); }else{ $('#remote_prompt').css({color:'red'}); $('#remote').val(1); $('#show_remote').empty(''); $('#show_remote').append('已查询'); } if(data == 2) { show_remote_prompt('城市是偏远但邮编不存在 '); $('#remote').val(2); $('#confirm').show(); $('#show_remote').empty(''); $('#show_remote').append('是偏远'); } if(data == 3) { show_remote_prompt('城市是偏远'); $('#remote').val(2); $('#confirm').show(); $('#show_remote').empty(''); $('#show_remote').append('是偏远'); } if(data == 4) { show_remote_prompt('邮编是偏远但不存在城市 '); $('#remote').val(2); $('#confirm').show(); $('#show_remote').empty(''); $('#show_remote').append('是偏远'); } if(data == 5) { show_remote_prompt('是偏远,但是邮编与城市不匹配'); $('#remote').val(2); $('#confirm').show(); $('#show_remote').empty(''); $('#show_remote').append('是偏远'); } if(data == 6) { show_remote_prompt('邮编是偏远'); $('#remote').val(2); $('#confirm').show(); $('#show_remote').empty(''); $('#show_remote').append('是偏远'); } if(data == 7) { show_remote_prompt('FEDEX暂时没有加拿大的偏远数据请到官网查询。'); } if(data == 8) { show_remote_prompt('数据有误,请重新提交数据'); } }else{ showError(data); } } }); } function order_submit(form) { var shipping_service = $('#shipping_service').val(); var buyer_address_1 = $('#buyer_address_1').val(); var buyer_fullname = $('#buyer_fullname').val(); var buyer_state = $('#buyer_state').val(); var buyer_city = $('#buyer_city').val(); var buyer_zip = $('#buyer_zip').val(); var buyer_phone_number = $('#buyer_phone_number').val(); var quantity = $('#quantity').val(); var buyer_state = $('#buyer_state').val(); var shipping_service = $('#shipping_service').val(); var product_type = $('#product_type').val(); var quantity = $('#quantity').val(); var buyer_country = $('#buyer_country').val(); if(shipping_service == '' || shipping_service == 0) { showError('运输方式不能为空'); $("#shipping_service").focus(); return; }else if(buyer_country == '') { showError('国家不能为空'); $("#buyer_country").focus(); return; }else if(buyer_address_1 == '') { showError('请输入地址1'); $("#buyer_address_1").focus(); return; }else if(buyer_fullname == '') { showError('请输入收件人姓名'); $("#buyer_fullname").focus(); return; }else if(quantity == '') { showError('件数不能为空'); $("#quantity").focus(); return; }else if(buyer_state == '') { showError('请输入收件人所在州'); $("#buyer_state").focus(); return; }else if(quantity == 0 || quantity == '') { showError('请填写件数'); $("#quantity").focus(); return; }else if(product_type == 1) { if(buyer_city == '') { showError('请输入城市'); $("#buyer_city").focus(); return; }else if(buyer_zip == '') { showError(language('please enter the zip code')); $("#buyer_zip").focus(); return; }else if(buyer_phone_number == '') { showError(language('please enter a phone number')); $("#buyer_phone_number").focus(); return; }else{ var product_name = 1; $('input[name="product_name[]"]').each(function(){ if($(this).val() == 0 || $(this).val() == '') { product_name = 0; showError('产品描述为必填'); $(this).focus(); return; }else { if(shipping_service.toLowerCase().indexOf('fedex')>0) { if($(this).val().indexOf('%')<=0) { product_name = 0; showError('产品描述必须含有%'); $(this).focus(); return ; } } } }); if(product_name == 1) { var product_val = 1; $('input[name="product_value[]"]').each(function(){ if($(this).val() == 0 || $(this).val() == '') { product_val = 0; showError('产品申报价值为必填'); $(this).focus(); return; } }); if(product_val == 1) { $('#'+form).submit(); $("#error_info").hide(); } } } }else{ $('#'+form).submit(); } } function num_input(obj,weight_id) { //先把非数字的都替换掉,除了数字和. obj.value = obj.value.replace(/[^\d.]/g,""); //必须保证第一个为数字而不是. obj.value = obj.value.replace(/^\./g,""); //保证只有出现一个.而没有多个. obj.value = obj.value.replace(/\.{2,}/g,"."); //保证.只出现一次,而不能出现两次以上 obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$","."); if(weight_id == 0 || weight_id == '' || weight_id == undefined) { totalValue(); }else{ totalVolume(weight_id); } } function pty_num(obj) { obj.value = obj.value.replace(/[^\d]/g,""); totalValue(); } function get_country_code(){ var country_code = $("#country_code").val(); $.ajax({ type:"POST", url:"http://old.lsd-express.com/order/get_country_en", data: "country_code="+country_code, beforeSend: showLoading(), success:function(msg){ hideLoading(); if($.trim(msg) == '0'){ showError('该国家简写不存在!'); }else{ $('#buyer_country').val($.trim(msg)); var buyer_country = $('#buyer_country').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/get_qualified_product", data:{'buyer_country':buyer_country}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data !==0 && data !== '') { $('#product_code').html(data); } } }); } } }); } function shipping_service_change() { var shipping_service = $('#shipping_service').val(); if(shipping_service.toLowerCase().indexOf('fedex')>0) { $(".product_text").each(function() { $(this).css('display','block'); }); }else { $(".product_text").each(function() { $(this).css('display','none'); }); } $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/get_product_type", data:{'shipping_service':shipping_service}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(!isNaN(data)) { $('#product_type').val(data); if(data == 1) { $('#is_remote').show(); $('#phone_number').show(); $('#zip').show(); $('#city').show(); }else if(data == 2){ $('#is_remote').hide(); $('#phone_number').hide(); $('#zip').hide(); $('#city').hide(); }else{ $('#is_remote').hide(); $('#phone_number').hide(); $('#zip').hide(); $('#city').hide(); } }else{ alert(data); } } }); //$.ajax({ // type: "POST", // url: "", //data:{'shipping_service':shipping_service}, //beforeSend: showLoading(), //success: function(data){ //hideLoading(); //if(!isNaN(data)) //{ //if(data == 1) //{ //$("#insurance_value").attr("disabled",false); //}else{ //var html='RMB0.00'; //$("#insurance_value").attr("value",''); //$("#insurance_value").attr("disabled",true); //$("#insurance_value").text(html); //} //}else{ //alert(data); //} //} //}); } function calInsuranceFee(){ shiptype = $('[name="shipping_service"]').val(); evaluate = $('[name="insurance_value"]').val(); if(shiptype==""||evaluate==""){ $('#guranteeFee').text("RMB0.00"); return false; }else{ //$.ajax({ //type: "POST", //url: "", //data:{'evaluate':evaluate}, //success: function(data){ // html = "RMB"+data; //$('#guranteeFee').text(html); //} //}); } } function buyer_country_change() { var buyer_country = $('#buyer_country').val(); var shipping_service = $('#shipping_service').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/order/get_qualified_product", data:{'buyer_country':buyer_country,'shipping_service':shipping_service}, success: function(data){ hideLoading(); if(data != 0 && data != '') { $('#product_code').html(data); var new_shipping_service = $('#shipping_service').val(); if( shipping_service != new_shipping_service) { showError('你所选择的国家与产品不匹配,请重新选择'); $("#buyer_country").focus(); return; }else{ $("#error_info").hide(); } shipping_service_change(); }else{ showError('你所选择的国家暂时没有产品支持,请重新选择'); $("#buyer_country").focus(); return; } } }); } function find_password_verification() { $("#user_email").focusin(function(){ show_register_info('user_email',1); }); $("#user_email").focusout(function(){ var email = $("#user_email").val(); if(email == ""){ show_register_error('email',language('please enter a email')); return; }else if(!(/^[a-zA-Z0-9_.-]+\@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]{2,3}){1,2}$/.test(email))){ show_register_error('email',language('please enter a valid email address')); return; }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/register_verification", data:{'name':'email','email':email}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { show_register_correct('user_email'); }else{ show_register_error('user_email','邮箱不存在,请输入正确的邮箱'); return; } } }); } }); } function find_password() { var success1 = 0; var email = $('#user_email').val(); if(email == ""){ show_register_error('user_email',language('please enter a email')); success1 = 1; }else if(!(/^[a-zA-Z0-9_.-]+\@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]{2,3}){1,2}$/.test(email))) { show_register_error('user_email',language('please enter a valid email address')); success1 = 1; }else{ $.ajax({ type: "POST", async:false, // 设置同步方式 cache:false, url: "http://old.lsd-express.com/user/register_verification", data:{'name':'email','email':email}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { success1 = 0; }else{ show_register_error('user_email','邮箱不存在,请输入正确的邮箱'); success1 = 1; } } }); } if(success1 == 1) { return false; }else{ return true; } } function sub_account_check(sub_user_id) { var username = $('#sub_username').val(); var password = $('#sub_password').val(); if(username =='') { showError('用户名不能为空'); }else{ $.ajax({ type: "POST", async:false, // 设置同步方式 cache:false, url: "http://old.lsd-express.com/user/register_verification", data:{'name':'sub_name','username':username,'sub_user_id':sub_user_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { if(password ==''){ showError('密码不能为空'); }else{ $('#create_sub_account_form').submit(); } }else{ showError(data); } } }); } } function deleted_sub_account(id,username) { $('#deleted_username').text(username); $('#sub_account_id').val(id); var location = getLocation(300,100); $('#deleted_sub_account_dialog').show(); using('dialog', function () { $('#deleted_sub_account_dialog').dialog({ title:'删除提示', width:300, height:100, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function deleted_sub_account_confirm() { var id=$('#sub_account_id').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/user/deleted_sub_account", data:{'id':id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_sub_account_dialog'); $('#'+id).fadeOut(1000); }else{ alert(data); } } }); } function sub_account_login() { var username = $('#sub_username').val(); var password = $('#sub_password').val(); var parent_name = $('#parent_name').val(); if(username =='') { showError('用户名不能为空'); }else if(password ==''){ showError('密码不能为空'); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/subaccount/login", data:{'username':username,'password':password,'parent_name':parent_name}, beforeSend: showLoading(), success: function(data){ hideLoading(); //alert(data); if(data == 1) { window.location = 'http://old.lsd-express.com/start'; }else if(data =='error'){ showError('用户名或密码错误'); }else if(data =='status_error'){ showError('用户名已被禁用'); }else if(data =='parent_error'){ showError('主账号错误'); }else{ showError('登录错误,请联系管理员'); } } }); } } function sub_login() { var username = $('#sub_username').val(); var password = $('#sub_password').val(); var parent_name = $('#parent_name').val(); if(username =='') { showError('用户名不能为空'); }else if(password ==''){ showError('密码不能为空'); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/sub/login", data:{'username':username,'password':password,'parent_name':parent_name}, beforeSend: showLoading(), success: function(data){ hideLoading(); //alert(data); if(data == 1) { window.location = 'http://old.lsd-express.com/start'; }else if(data =='error'){ showError('用户名或密码错误'); }else if(data =='status_error'){ showError('用户名已被禁用'); }else if(data =='parent_error'){ showError('主账号错误'); }else{ showError('登录错误,请联系管理员'); } } }); } }