$(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 +='