$(function(){ $('.table tr').mousemove(function(){ $(this).addClass('current'); }); $('.table .title').mousemove(function(){ $(this).removeClass('current'); }); $('.table tr').mouseleave(function(){ $(this).removeClass('current'); }); $('#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) { var operating_type = $('#operating_type').val(); add_product(operating_type); }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 showError(val){ $("#error_info").empty(); $("#error_info").addClass('info'); $("#error_info").append(val); $("#error_info").show(); } function hideError(){ $("#error_info").hide(); } function language(msg_code){ var return_message=""; switch(msg_code){ case 'input the usernmae': return_message = "请输入用户名"; break; case 'please input the password': return_message = "请输入密码"; break; case 'make sure the password': return_message = '请确认密码'; break; case 'twice the input password is inconsistent': return_message = '两次输入密码不一致'; break; case 'please enter a contact': return_message = '请输入联系人'; break; case 'please enter a email': return_message = '请输入邮箱'; break; case 'please enter a valid email address': return_message = '请输入正确邮箱地址'; break; case 'please enter the phone number': return_message = '请输入手机号码'; break; case 'please enter the correct phone number': return_message = '请输入正确的手机号码'; break; case 'please enter a phone number': return_message = '请输入电话号码'; break; case 'please the enter a phone number': return_message = '请输入正确的电话号码'; break; case 'please enter an address': return_message = '请输入地址'; break; case 'please enter the original password': return_message = '请输入原来的密码'; break; case 'please enter a new password': return_message = '请输入新的密码'; break; case 'please enter the zip code': return_message = '请输入邮编'; break; case 'please enter the recipient\'s name': return_message = '请输入收件人姓名'; break; case 'please select the orders to be operating': return_message = '请选择需要操作的订单'; break; } if(return_message == ""){ return msg_code; }else{ return return_message; } } function loginCheck(form_name) { var username = $("#username").val(); var password = $("#password").val(); if(username == ""){ showError(language('input the usernmae')); $("#username").focus(); return false; } if(password == ""){ showError(language('please input the password')); $("#password").focus(); return false; } $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/user/login", data:{'Login':'Login','username':username,'password':password}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == "http://old.lsd-express.com/logistics_admin/user/index"){ //$('#is_login').val("1"); //$('#'+form_name).submit(); window.document.location.reload() }else{ showError(data); } } }); return false; } function companyCheck() { //alert(1); var company_name = $("#company_name").val(); var company_code = $("#company_code").val(); var company_address = $("#company_address").val(); if(company_name == ""){ showError(language('input the company name')) $("#company_name").focus(); return false; } if(company_code == ""){ showError(language('please input the company code')); $("#company_code").focus(); return false; } if(company_address == "") { showError(language('make sure the company address')); $("#company_address").focus(); return false; } $("#register_form").submit(); } function registerCheck(form_name) { //alert(1); 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(); if(username == ""){ showError(language('input the usernmae')) $("#username").focus(); return false; } if(password == ""){ showError(language('please input the password')); $("#password").focus(); return false; } if(confirm_password == "") { showError(language('make sure the password')); $("#confirm_password").focus(); return false; }else if(confirm_password != password){ showError(language('twice the input password is inconsistent')) $("#confirm_password").focus(); return false; } if(displayName == ""){ showError(language('please enter a contact')); $("#displayName").focus(); return false; } if(mobile == ""){ showError(language('input the mobile')) $("#mobile").focus(); return false; } $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/member/add", data:{'register':'register','username':username,'password':password,'confirm_password':confirm_password,'displayName':displayName,'email':email,'mobile':mobile,'tel':tel,'address':address}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1){ showError('添加成功'); $("#username").val(''); $("#password").val(''); $("#confirm_password").val(''); $("#displayName").val(''); $("#email").val(''); $("#mobile").val(''); $("#tel").val(''); $("#address").val(''); }else{ showError(data) } } }); return false; } function modifyPassword() { var old_password = $("#old_password").val(); var new_password = $("#new_password").val(); var confirm_password = $("#confirm_password").val(); if(old_password == ""){ showError(language('please enter the original password')); $("#old_password").focus(); return false; } if(new_password == ""){ showError(language('please enter a new password')); $("#new_password").focus(); return false; } if(confirm_password == "") { showError(language('make sure the password')); $("#confirm_password").focus(); return false; }else if(confirm_password != new_password){ showError(language('twice the input password is inconsistent')) $("#confirm_password").focus(); return false; } $.post( "http://old.lsd-express.com/logistics_admin/user/user_modify_password", {'old_password':old_password,'new_password':new_password,'confirm_password':confirm_password}, function(data){ if(data == 1) { location.href = "http://old.lsd-express.com/logistics_admin/user/index"; }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(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(tel))){ showError(language('please the enter a phone number')); $("#tel").focus(); return false; } if(address == ""){ showError(language('please enter an address')); $("#address").focus(); return false; } $.post("/user/add_address", {'city':city,'country':country,'province':province,'sender_name':sender_name,'tel':tel,'address_zip':address_zip,'address':address,'status':status}, function(data){ //alert(data); if(data == 1) { location.href = '/user/user_return_address'; }else { showError(data) } }); } function deleted_address(address_id) { $.post("/user/delete_address", {'address_id':address_id}, function(data){ //alert(data); if(data == 1) { location.href = '/user/user_return_address'; }else { showError(data) } }); } function update_address(address_id) { //alert(1); $.post("/user/update_address", {'address_id':address_id}, function(data){ //alert(data); //location.href = '/user/update_address'; $('#content').html(data); }); } function update_addre(address_id) { //alert(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(); //alert(cellphone); var status = $("#status").attr('checked'); //alert(status); 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(!(/^1[3|4|5|8][0-9]\d{4,8}$/.test(cellphone))){ showError(language('please the enter a phone number')); $("#cellphone").focus(); return false; } if(address1 == ""){ showError(language('please enter an address')); $("#address1").focus(); return false; } $.post("/user/update_address", {'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}, function(data){ //alert(data); $('#content').html(data); }); } function address() { //alert(1); $.post("/user/add_address", {'Add':'Add'}, function(data){ //alert(data); if(data == 1) { location.href = '/user/add_address'; }else { showError(data) } }); } function select_address(address) { if(address == 'dialog') { using(['dialog', 'messager'], function () { $("#dialog").css('display','block'); $('#dialog').dialog({ title: '地址本', draggable:true, overflow:'scroll', width: 500, height: 320 }); }); }else{ //alert(address); $.post("/order/create", {'address':address}, function(data){ alert(data); $('#dialog').dialog( "close" ); $('#content').html(data); }); } } 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 authority_menu_add(){ $('#add_menu').window({ title: '添加菜单', width: 350, height: 'auto', modal: true, shadow: false, closed: false }); } function member_add_grade(){ $('#add_rade').window({ title: '', width: 350, height: 'auto', modal: true, shadow: false, closed: false }); } function authority_role_add(){ $('#add_role').window({ title: '添加角色', width: 300, height: 'auto', modal: true, shadow: false, closed: false }); } function authority_model_add(){ $('#add_model').window({ title: '添加模块', width: 500, height: 300, modal: true, shadow: false, closed: false }); } function deleted_product_prompt(product_id,product_code) { $('#product_id').val(product_id); $('#delete_product_code').val(product_code); $('#deleted_product_code').text(product_code); var location = getLocation(300,100); $('#deleted_product').show(); using('dialog', function () { $('#deleted_product').dialog({ title:'提示', width:300, height:100, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function deleted_product() { var product_id = $('#product_id').val(); var product_code = $('#delete_product_code').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/delete", data:{'product_id':product_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_product'); $('#'+product_code).fadeOut(1000); }else{ alert(data); } } }); } //add by sky 2012-04-10 function cms_column_add(){ $('#add_column').window({ title: '添加栏目', width: 320, height: 'auto', modal: true, shadow: false, closed: false }); } function showDailog(dialog_id,title_body,width){ $('#'+dialog_id).window({ title: title_body, width: width, height: 'auto', modal: true, shadow: false, closed: false }); } function productCreate(form_name){ if(!$('#product_name').val()){ $('#product_name').focus(); }else if(!$('#product_en_name').val()){ $('#product_en_name').focus(); }else{ form_name.submit(); } } 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); } $("input[name='hidden']").attr("value",'2'); } function checkAllBox(self_id,checkBoxClass) { if($('#'+self_id).is(':checked')){ $('.'+checkBoxClass).attr('checked',true) $('.shipping_service').attr('checked',true) }else{ $('.'+checkBoxClass).attr('checked',false) $('.shipping_service').attr('checked',false) } } function checkParent(cur,par){ if($('#'+cur).is(':checked')){ $('#'+par).attr('checked',true); }else{ $('#'+par).attr('checked',false); } } function authority_staff_add(){ $('#add_staff').window({ title: '添加员工', width: 480, height: 'auto', modal: true, shadow: false, closed: false }); } function check_all(this_id,className){ var flag=($("#"+this_id).attr('value')); if(flag=="0" || flag=="on"){ $("."+className+" :checkbox").attr("checked",'true'); $("#"+this_id).attr('value','1'); }else{ $("."+className+" :checkbox").removeAttr("checked"); $("#"+this_id).attr('value','0'); } } function order_entry(order) { $(order).submit(); } 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); } $("input[name='hidden']").attr("value",'2'); } function order_problem_content(order_problem_id,reply) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/reply_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:'回复问题件', modal:true, width:550, height:400, shadow:false, position:'relative', left:location.left, top:location.top }); }); } 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); } var receiv_date_start = $('#receiv_date_start').val(); var receiv_date_end = $('#receiv_date_end').val(); var receiv_start_arr = receiv_date_start.split('-'); //转换后的UNIX时间戳 var receiv_start_datum = new Date(Date.UTC(receiv_start_arr[0],receiv_start_arr[1]-1,receiv_start_arr[2])); receiv_start_datum = receiv_start_datum.getTime()/1000; var receiv_end_arr = receiv_date_end.split('-'); //转换后的UNIX时间戳 var receiv_end_datum = new Date(Date.UTC(receiv_end_arr[0],receiv_end_arr[1]-1,receiv_end_arr[2])); receiv_end_datum = receiv_end_datum.getTime()/1000; if(receiv_start_datum > receiv_end_datum) { $('#receiv_date_start').val(receiv_date_end); } var deductions_date_start = $('#deductions_date_start').val(); var deductions_date_end = $('#deductions_date_end').val(); var deductions_start_arr = deductions_date_start.split('-'); //转换后的UNIX时间戳 var deductions_start_datum = new Date(Date.UTC(deductions_start_arr[0],deductions_start_arr[1]-1,deductions_start_arr[2])); deductions_start_datum = deductions_start_datum.getTime()/1000; var deductions_end_arr = deductions_date_end.split('-'); //转换后的UNIX时间戳 var deductions_end_datum = new Date(Date.UTC(deductions_end_arr[0],deductions_end_arr[1]-1,deductions_end_arr[2])); deductions_end_datum = deductions_end_datum.getTime()/1000; if(deductions_start_datum > deductions_end_datum) { $('#deductions_date_start').val(deductions_date_end); } $('#order_search_form').submit(); } function choose_value(id_name,user_id,id,username,balance){ $('#'+id_name,opener.document).val(user_id); $('#userid',opener.document).val(id); $('#username',opener.document).val(username); if(balance>0){ $('#balance',opener.document).css({color:'green'}); }else{ $('#balance',opener.document).css({color:'red'}); } $('#balance',opener.document).text('余额: '+balance+'元'); window.close(); } function add_rule() { var credits_name = $('#credits_name').val(); var formula = $('#formula').val(); var credits_value = $('#credits_value').val(); var calcu_type = $('#calcu_type').val(); if(credits_name == '') { $("#credits_name_prompt").text('规则名称不能为空'); $("#credits_name_prompt").css({'display':'block','color':'red'}); return false; } if(calcu_type == 0) { if(formula == '') { $("#formula_prompt").text('公式不能为空'); $("#formula_prompt").css({'display':'block','color':'red'}); return false; } } if(calcu_type == 1) { if(credits_value == '') { $("#credits_value_prompt").text('积分值不能为空'); $("#credits_value_prompt").css({'display':'block','color':'red'}); return false; } } } 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 showTrackLoading(obj){ var img=''; $('#'+obj).html(img); } function hideLoading(){ $('#load').fadeOut('slow'); } function close_dialog(dialog) { using('dialog', function () { $('#'+dialog).dialog('close'); }); } function add_zone() { var location = getLocation(300,100); $('#add_zone').show(); using('dialog', function () { $('#add_zone').dialog({ title:'添加分区', width:350, height:100, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function add_zone_verification(product_code) { var zone_id = $('#zone_id').val(); if(zone_id == '') { alert('分区名称不能为空'); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/verification", data:{'add_zone':'add_zone','zone_id':zone_id,'product_code':product_code}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('add_zone'); $('#add_zone_form').submit(); }else{ alert(data); } } }); } } function add_channel_zone() { var location = getLocation(300,100); $('#add_zone').show(); using('dialog', function () { $('#add_zone').dialog({ title:'添加分区', width:350, height:100, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function add_channel_zone_verification(channel_id) { var zone_id = $('#zone_id').val(); if(zone_id == '') { alert('分区名称不能为空'); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/verification", data:{'add_channel_zone':'add_channel_zone','zone_id':zone_id,'channel_id':channel_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('add_zone'); $('#add_zone_form').submit(); }else{ alert(data); } } }); } } function deleted_zone_prompt(product_code,zone_id) { $('#zone').text(zone_id); $('#deleted_product_code').text(product_code); $('#product_code').val(product_code); $('#deleted_zone').val(zone_id); var location = getLocation(250,100); $('#deleted_zone_prompt').show(); using('dialog', function () { $('#deleted_zone_prompt').dialog({ title:'提示', width:250, height:100, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function deleted_channel_zone_prompt(channel_id,zone_id) { $('#zone').text(zone_id); $('#channel_id').val(channel_id); $('#deleted_zone').val(zone_id); var location = getLocation(150,100); $('#deleted_zone_prompt').show(); using('dialog', function () { $('#deleted_zone_prompt').dialog({ title:'提示', width:250, height:100, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function deleted_channel_zone() { var channel_id = $('#channel_id').val(); var zone_id = $('#deleted_zone').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/deleted_channel_zone", data:{'channel_id':channel_id,'zone_id':zone_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1){ close_dialog('deleted_zone_prompt'); $('#'+zone_id).fadeOut(1000); }else{ alert(data); } } }); } function deleted_zone() { var product_code = $('#product_code').val(); var zone_id = $('#deleted_zone').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/deleted_zone", data:{'product_code':product_code,'zone_id':zone_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_zone_prompt'); $('#'+zone_id).fadeOut(1000); }else{ alert(data); } } }); } function add_price_submit(product_code) { var weight = $('#weight').val(); if(weight == '') { alert('重量区间不能为空'); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/verification", data:{'add_price':'add_price','weight':weight,'product_code':product_code}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { alert(data); }else{ $('#add_product_price_form').submit(); } } }); } } function productPrice(form_id,zone_leng,product_code) { var product_price = $('#product_price').val(); var product_price_leng = product_price.split(','); if(product_price_leng == 0) { alert('重量与价格不能为空不能为空'); }else{ $('#'+form_id).submit(); } } function deleted_price_prompt(weight) { $('#deleted_weight').val(weight); $('#weight_segment').text(weight); var location = getLocation(300,100); $('#deleted_price').show(); using('dialog', function () { $('#deleted_price').dialog({ title:'提示', width:300, height:100, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function deleted_price(product_code) { var deleted_weight = $('#deleted_weight').val(); var zone_id = $('#deleted_zone').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/deleted_price", data:{'product_code':product_code,'weight':deleted_weight}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_price'); $('.'+(deleted_weight*10000)).fadeOut(1000); }else{ alert(data); } } }); } function deleted_channel_prompt(channel_id,channel_code) { $('#channel_id').val(channel_id); $('#channel_code').val(channel_code); $('#deleted_channel_code').text(channel_code); var location = getLocation(248,100); $('#deleted_channel').show(); using('dialog', function () { $('#deleted_channel').dialog({ title:'删除价格', width:248, height:100, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function deleted_channel() { var channel_id = $('#channel_id').val(); var channel_code = $('#channel_code').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/channel_delete/"+channel_id, data:{'channel_id':channel_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_channel'); $('#'+channel_id).fadeOut(1000); }else{ alert(data); } } }); } function productCreate(form_name,db_channel_code){ var channel_name = $('#channel_name').val(); var channel_en_name = $('#channel_en_name').val(); var channel_code = $('#channel_code').val(); var delivery_time = $('#delivery_time').val(); var other_fee = $('#other_fee').val(); if(channel_name == '') { alert('渠道名称不能为空'); }else if(channel_en_name == '') { alert('渠道英文名不能为空'); }else if(channel_code == '') { alert('渠道简称不能为空'); }else{ if(db_channel_code != channel_code) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/verification", data:{'add_channel':'add_channel','channel_code':channel_code}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { alert(data); }else{ if(delivery_time == '') { alert('时效不能为空'); }else if(other_fee == '') { alert('其他费用不能为空'); }else{ $(form_name).submit(); } } } }); }else{ if(delivery_time == '') { alert('时效不能为空'); }else if(other_fee == '') { alert('其他费用不能为空'); }else{ $(form_name).submit(); } } } } function channelPrice(form_id,zone_leng,channel_code) { var channel_price = $('#channel_price').val(); var channel_price_leng = channel_price.split(','); if(channel_price_leng == 0) { alert('重量与价格不能为空'); }else{ $('#'+form_id).submit(); } } function add_channel_price_submit(channel_id) { var weight = $('#weight').val(); if(weight == '') { alert('重量区间不能为空'); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/verification", data:{'add_channel_price':'add_channel_price','weight':weight,'channel_id':channel_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 1) { alert(data); }else{ $('#add_channel_price_form').submit(); } } }); } } function deleted_channel_price_prompt(weight) { $('#deleted_weight').val(weight); $('#weight_segment').text(weight); var location = getLocation(300,100); $('#deleted_channel_price').show(); using('dialog', function () { $('#deleted_channel_price').dialog({ title:'提示', width:300, height:100, modal:true, shadow:false, position:'relative', left:location.left, top:location.top }); }); } function deleted_channel_price(channel_id) { var deleted_weight = $('#deleted_weight').val(); var zone_id = $('#deleted_zone').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/product/deleted_channel_price", data:{'channel_id':channel_id,'weight':deleted_weight}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_channel_price'); $('.'+(deleted_weight*10000)).fadeOut(1000); }else{ alert(data); } } }); } function submitBatch(datafrom) { var checked = false; $('.checkbox').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 trim(str){ return str.replace(/(^\s*)|(\s*$)/g,""); } 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:打印地址标签及送货清单, 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) { if(operating_type == 1) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/deleted/"+order_id, data:'', beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_order'); $('#'+c_order_id).fadeOut(1000); }else{ alert(data); } } }); }else if(operating_type == 0) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/into_deleted/"+order_id, data:'', beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { close_dialog('deleted_order'); $('#'+c_order_id).fadeOut(1000); }else{ alert(data); } } }); } } } function select_address(address) { if(address == 'dispaly') { $('#selection_interface').css('display','block'); $('#select_addre').css('display','none'); }else { $('#selection_interface').css('display','none'); $(address).submit(); } return false; } function update_order(formname) { 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(buyer_country == '') { showError('国家不能为空'); $("#buyer_country").focus(); return; }else if(shipping_service == '' || shipping_service ==0) { showError('运输方式不能为空'); $("#shipping_service").focus(); return; }else if(quantity == '') { showError('件数不能为空'); $("#quantity").focus(); return; }else if(quantity == 0 || quantity == '') { showError('请填写件数'); $("#quantity").focus(); return; }else{ $(formname).submit(); } } function order_thorough_deleted() { $('#select').submit(); } function upload_success(){ $.messager.show({ title:'提示', msg:'文件上传成功,请点击 查看 查看详情', timeout:5000, showType:'slide' }); } function print_address(order_id) { $('#'+order_id).attr("checked", true); $('#batch_processing').val('printLabel'); form_submit(order_id); } function form_submit(order_id) { var select =[]; if(order_id) { select.push(order_id); }else{ $('input[name="operating_order[]"]:checked').each(function(){ select.push($(this).val()); }); } if(select.length == 0) { alert('请选择要操作的订单'); }else{ $('#batch').val($('#batch_processing').val()); if(isNaN($('#batch_processing').val())) { if($('#batch_processing').val() == 'please_select') { alert('请选择要进行的操作'); }else if($('#batch_processing').val() == 'track_list') { $('input[name="operating_order[]"]:checked').each(function(){ var obj='track_'+$(this).val(); var order_id=$(this).val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/order_track", beforeSend: showTrackLoading(obj), data:{'order_id':$(this).val()}, success:function(data){ if(data!=0) { var html=''; if(data==1) { html+='未上网'; }else if(data==2) { html+='运输中'; }else if(data==3) { html+='已签收'; } html+=''; }else { var html ='--'; } $('#'+obj).html(html); } }); }); }else{ if(isNaN($('#batch_processing').val())) { $('#select_order').val(select); $('#select_print_order').val(select); 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:打印地址标签及送货清单, title:'打印地址标签与送货清单', width:510, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); }else if($('#batch_processing').val() == 'thorough_delectd') { var location = getLocation(220,100); $('#thorough_deleted').show(); using('dialog', function () { $('#thorough_deleted').dialog({ title:'删除提示', width:220, hegiht:100, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); }else{ $("#select").submit(); } } } }else{ if($('#batch_processing').val() == 5) { var location = getLocation(400,150); $('#deductions_rollback').show(); using('dialog', function () { $('#deductions_rollback').dialog({ title:'操作提示', width:400, hegiht:150, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); }else{ $("#select").submit(); } } } } function deductions_rollback_confirm() { $("#select").submit(); } function add_volume(single_weight,length,width,height,weight,id) { var single_weight = single_weight?single_weight:0; var length = length?length:''; var width = width?width:''; var height = height?height:''; var weight = weight?weight:0; 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="'+single_weight+'" name="single_weight[]" id="single_weight_'+tmp_id+'" onkeyup="num_input(this,'+tmp_id+');" style="width:80px;ime-mode:Disabled;"/>KG'; 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;"/>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 single_weight_value = new Array(); $('input[name="single_weight[]"]').each(function(){ single_weight_value.push($(this).val()); }); var single_weight = 0; for(var i=0;i < single_weight_value.length;i++) { single_weight += parseFloat(single_weight_value[i]); } $('#re_weight').val(Fractional(single_weight)); 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/logistics_admin/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(parame){ 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 +=''; 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 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(); } total_value = Fractional(total_value); $('#declared_value').val(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 round(v,e){ var t=1; for(;e>0;t*=10,e--); for(;e<0;t/=10,e++); return Math.round(v*t)/t; } function show_remote_prompt(val){ $("#remote_prompt").empty(); $("#remote_prompt").append(val); $("#remote_prompt").show(); } 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/logistics_admin/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(''); $('#show_remote').append('是偏远'); $('#confirm').show(); $('#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 get_country_code(){ var country_code = $("#country_code").val(); $.ajax({ type:"POST", url:"http://old.lsd-express.com/logistics_admin/order/get_country_en", data: "country_code="+country_code, beforeSend: showLoading(), success:function(msg){ hideLoading(); if($.trim(msg) == '0'){ showError('该国家简写不存在!'); }else{ hideError(); $('#buyer_country').val($.trim(msg)); } } }); } function channel_invoice_type__submit() { var product_code = $('#product_code').val(); var name = $('#name').val(); var page_name = $('#page_name').val(); if(product_code == '' || product_code == 0) { alert('产品简码不能为空'); $('#product_code').focus(); return false; }else if(name == '') { alert('名称不能为空'); $('#name').focus(); return false; }else if(page_name == '' || page_name == 0){ alert('页面名称不能为空'); $('#page_name').focus(); return false; }else{ return true; } } function shipping_service_change() { $('#shipping_service').change( function (){ var shipping_service = $('#shipping_service').val(); var channel_id = $('#channel_id').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/get_product_type", data:{'shipping_service':shipping_service}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(!isNaN(data)) { $('#product_type').val(data); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/get_channel_html", data:{'product_code':shipping_service,'channel_id':channel_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data) { $('#channel_html').html(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); } } }); }); } function channel_id_change() { var channel_id = $('#channel_id').val(); var order_id = $('#order_id').val(); if(channel_id == 10000) { temp_channel_prompt(); }else{ $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/get_channel", data:{'channel_id':channel_id,'order_id':order_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != '' && data != 0) { $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/order/get_channel_invoice_type_id", data:{'channel_id':channel_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data != 0) { $('#print_invoice').show(); }else{ $('#print_invoice').hide(); } } }); }else{ $('#print_invoice').hide(); } } }); } } 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/logistics_admin/order/get_qualified_product", data:{'buyer_country':buyer_country,'shipping_service':shipping_service}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data !=0 && data != '') { $('#product_code').html(data); shipping_service_change(); var new_shipping_service = $('#shipping_service').val(); if( shipping_service != new_shipping_service) { showError('你所选择的国家与产品不匹配,请重新选择'); $("#buyer_country").focus(); return; }else{ $("#error_info").hide(); } }else{ showError('你所选择的国家暂时没有产品支持,请重新选择'); $("#buyer_country").focus(); return; } } }); } function user_channel_submit(user_id) { var success1 = 0; var product_code = $('#product_code').val(); var channel_id = $('#channel_id').val(); if(product_code == 0) { showError('请选择产品'); $("#product_code").focus(); success1 = 1; }else if(user_id){ $.ajax({ type: "POST", async:false, // 设置同步方式 cache:false, url: "http://old.lsd-express.com/logistics_admin/member/get_channel", data:{'product_code':product_code,'user_id':user_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { showError('同一产品只能指定一个渠道,若想重新指定渠道请进入修改界面操作。'); $("#product_code").focus(); success1 = 1;; }else if(channel_id == 0) { showError('渠道不能为空'); $("#channel_id").focus(); success1 = 1; }else{ success1 = 0; } } }); }else if(channel_id == 0) { showError('渠道不能为空'); $("#channel_id").focus(); success1 = 1; }else{ success1 = 0; } if(success1 == 1) { return false; }else{ return true; } } function order_submit(form) { var user_id = $('#userid').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(user_id == '') { showError('用户ID为必填项'); $("#user_id").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{ $('input[name="product_name[]"]').each(function(){ if($(this).val() == 0 || $(this).val() == '') { showError('产品描述为必填'); $(this).focus(); return; }else{ $('input[name="product_value[]"]').each(function(){ if($(this).val() == 0 || $(this).val() == '') { showError('产品申报价值为必填'); $(this).focus(); return; }else{ $('#'+form).submit(); $("#error_info").hide(); } }); } }); } }else{ $('#'+form).submit(); } } function update_order_address(form) { var buyer_address_1 = $('#buyer_address_1').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 quantity = $('#quantity').val(); var buyer_country = $('#buyer_country').val(); var las_weight = $('#las_weight').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(quantity == '') { showError('件数不能为空'); $("#quantity").focus(); return; }else if(buyer_state == '') { showError('请输入收件人所在州'); $("#buyer_state").focus(); return; }else if(buyer_city == '') { showError('请输入收件人所在城市'); $("#buyer_city").focus(); return; }else if(las_weight == '') { showError('出货重量不能为空'); $("#buyer_country").focus(); return; }else{ $('#'+form).submit(); } } function scanning_prompt(content){ $.messager.show({ title:'提示', msg:content, timeout:3000, showType:'slide' }); } function getData () { var objComport; objComport = new ActiveXObject("ActiveXperts.ComPort"); objComport.Device = 'COM1'; objComport.Baudrate = 1200; objComport.ComTimeout = 500; objComport.LogFile = "ComLog.txt"; objComport.HardwareFlowControl = objComport.asFLOWCONTROL_DEFAULT; objComport.Open(); var str=""; str=objComport.ReadString(); objComport.Close (); return str; } function readScale(){ var i = 1; var num = 0; while(i == 1){ num++; var data = getData(); var tmp_result=new Array() tmp_result = data.split('='); if(data != "" && tmp_result.length > 2){ i = 0; return ruleWeight(data);; break; } if(num > 20) return 0; } } function ruleWeight(weight){ var tmp_result=new Array(); var result=new Array(); var return_weight = '';; tmp_result = weight.split('='); result = tmp_result[1].split(''); for(var i= (result.length - 1);i>=0;i--){ return_weight += result[i];; } weight = parseFloat(return_weight); return weight; } function errorVoice(){ $('#voice').attr('src','http://old.lsd-express.com/logistics_admin/images/voice/error.wav'); } function noticeVoice(){ $('#voice').attr('src','http://old.lsd-express.com/logistics_admin/images/voice/notice.wav'); } function show_price(id) { $('#'+id).show(); $('#'+id).focus(); $('#'+id+'_show').hide(); } function show_r_price(id) { $('#'+id+'_r_price').show(); $('#'+id+'_r_price').focus(); $('#'+id+'_show_r_price').hide(); } function update_product_price(id) { var price = $('#'+id).val(); var r_price = $('#'+id+'_r_price').val(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/product/update_product_price", data:{'id':id,'price':price,'r_price':r_price}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $('#'+id+'_show').text(price); $('#'+id+'_show_r_price').text(r_price); $("#error_info").hide(); }else{ showError('更新不成功,请联系管理员'); } } }); $('#'+id).hide(); $('#'+id+'_show').show(); $('#'+id+'_r_price').hide(); $('#'+id+'_show_r_price').show(); } function update_zone_price(id,product_code) { var price = $('#zone_price_'+id).val(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/product/update_zone_price", data:{'id':id,'price':price,'product_code':product_code}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $("#error_info").hide(); }else{ showError('更新不成功,请联系管理员'); } } }); } function update_channel_zone_price(id,channel_id) { var price = $('#zone_price_'+id).val(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/product/update_channel_zone_price", data:{'id':id,'price':price,'channel_id':channel_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $("#error_info").hide(); }else{ showError('更新不成功,请联系管理员'); } } }); } function update_channel_price(id) { var price = $('#'+id).val(); var r_price = $('#'+id+'_r_price').val(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/product/ajax_update_channel_price", data:{'id':id,'price':price,'r_price':r_price}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $('#'+id+'_show').text(price); $('#'+id+'_show_r_price').text(r_price); $("#error_info").hide(); }else{ showError('更新不成功,请联系管理员'); } } }); $('#'+id).hide(); $('#'+id+'_show').show(); $('#'+id+'_r_price').hide(); $('#'+id+'_show_r_price').show(); } function temp_channel_prompt() { var location = getLocation(600,200); $('#temp_channel').show(); using('dialog', function () { $('#temp_channel').dialog({ title:'临时渠道', width:600, height:200, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function temp_channel_confirm() { var decided_people = $('#decided_people').val(); var rece_company = $('#rece_company').val(); var channel_temp = $('#channel_temp').val(); var year = $('#year').val(); var month = $('#month').val(); var day = $('#day').val(); var contact = $('#contact').val(); if(decided_people == '') { $('#temp_channel_prompt').text('决定人不能为空'); $('#decided_people').focus(); return; }else if(rece_company == '') { $('#temp_channel_prompt').text('公司名不能为空'); $('#rece_company').focus(); return; }else if(channel_temp == '') { $('#temp_channel_prompt').text('渠道不能为空'); $('#channel_temp').focus(); return; }else if(year == '' || year == 0) { $('#temp_channel_prompt').text('年份不能为空'); $('#year').focus(); return; }else if(month == '' || month == 0) { $('#temp_channel_prompt').text('月份不能为空'); $('#month').focus(); return; }else if(day == '' || day == 0) { $('#temp_channel_prompt').text('日期不能为空'); $('#day').focus(); return; }else if(contact == '') { $('#temp_channel_prompt').text('联系人不能为空'); $('#contact').focus(); return; }else{ $('#add_temp_channel').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 input_volume() { var location = getLocation(600,400); $('#input_volume').show(); using('dialog', function () { $('#input_volume').dialog({ title:'输入材积', width:600, height:400, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function input_volume_submit(form) { var quantity = $('#quantity').val(); if(quantity == 0 || quantity == '') { $('#quantity_prompt').text('件数不能为空'); $('#quantity').focus(); }else{ var params = $(form).serialize(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/order/input_volume", data:params, beforeSend: showLoading(), success: function(data){ hideLoading(); var obj = eval ("(" + data + ")"); if(obj.add == 1) { scanning_prompt('材积输入成功'); close_dialog('input_volume'); $('#order_volume_weight').val(obj.volume_weight); }else{ scanning_prompt('材积输入失败'); } } }); } return false; } function get_user_info(user_id,sender_id) { $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/member/get_user_info", data:{'user_id':user_id,'sender_id':sender_id}, beforeSend: showLoading(), success: function(data){ hideLoading(); var location = getLocation(520,350); $('#user_dialog').html(data); $('#user_dialog').show(); using('dialog', function () { $('#user_dialog').dialog({ title:'输入材积', width:520, height:350, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } }); } function update_member_price(id) { var price = $('#'+id).val(); var d_price = $('#price_'+id).val(); var percentage = $('#percentage_'+id).val(); var type = $('#user_type').val(); $.ajax({ type: "POST", url: "http://old.lsd-express.com/logistics_admin/member/update_member_price", data:{'id':id,'price':price,'d_price':d_price,'percentage':percentage,'type':type}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $('#'+id+'_show').text(price); $("#error_info").hide(); }else{ showError('更新不成功,请联系管理员'); } } }); $('#'+id).hide(); $('#'+id+'_show').show(); } function update_member_r_price(id) { var r_price = $('#'+id+'_r_price').val(); var d_r_price = $('#r_price_'+id).val(); var percentage = $('#percentage_'+id).val(); var type = $('#user_type').val(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/member/update_member_price", data:{'id':id,'r_price':r_price,'d_r_price':d_r_price,'percentage':percentage,'type':type}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $('#'+id+'_show_r_price').text(r_price); $("#error_info").hide(); }else{ showError('更新不成功,请联系管理员'); } } }); $('#'+id+'_r_price').hide(); $('#'+id+'_show_r_price').show(); } function update_user_zone_price(id,type) { var price = $('#user_price_'+id).val(); $.ajax({ type: "POST", //async:false, // 设置同步方式 //cache:false, url: "http://old.lsd-express.com/logistics_admin/member/update_zone_price", data:{'id':id,'price':price,'type':type}, beforeSend: showLoading(), success: function(data){ hideLoading(); if(data == 1) { $("#error_info").hide(); scanning_prompt('更新挂号费成功'); }else{ scanning_prompt('更新不成功,请联系管理员'); } } }); } function select_product(id){ var location = getLocation(510,500); $('#'+id).show(); using(id, function () { $('#'+id).dialog({ //title:打印地址标签及送货清单, title:'选择产品', width:510, height:500, shadow:false, modal:true, position:'relative', left:location.left, top:location.top }); }); } function select_product_input(id){ var str = ''; $('input[name="product_val[]"]:checked').each(function(){ if(str !=''){ str += ','+$(this).val(); }else{ str = $(this).val(); } }); $('#'+id).val(str); close_dialog('select_product'); }