//添加信息框 function reinitIframe(){ var iframe = document.getElementById("abccc"); try{ var bHeight = iframe.contentWindow.document.body.scrollHeight; var dHeight = iframe.contentWindow.document.documentElement.scrollHeight; var height = Math.max(bHeight, dHeight); iframe.height = height; //console.log(height); }catch (ex){} } $(".packing .exptj").click(function() { $(".addful .addwp").html(""); $( ".addwp" ).draggable({revert: true,iframeFix:true});// revert: true,axis: "x" window.setInterval("reinitIframe()", 200); $(".addful").show(); }); //查找信息单价 function price() { var f = ""; $(".exp .datalist .select").each(function() { if($(this).prop("name") != "hairtype") { f = f + $(this).children("option:selected").val() + "-"; } else { f = f + 0 + "-"; } }); $(".datalist .checkbox .ckrows input:checked").each(function(){ f = f + $(this).val() + "-"; }); $(".exp .post .select").each(function() { f = f + $(this).children("option:selected").val() + "-"; }); $.ajax({ url: "/fullorder/price/", data: "data="+f, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { var ma = $(".exp input[name='money']").val()*1; var mx = a.msg['salesprice']*1; var n = $(".exp .num font").text()*1; $(".exp input[name='money']").val(mx.toFixed(2)); $(".exp .tm font").html((mx*n).toFixed(2)); //$(".exp input[name='money']").val((ma+mx).toFixed(2));//多条数叠加计算价格 //$(".exp .tm font").html(((ma+mx)*n).toFixed(2));//多条数叠加计算价格 $(".zm").append(""+mx.toFixed(2)+""); $(".exp .purchase").text((a.msg['purchase']*1*n).toFixed(2)); $(".exp .cost").text((a.msg['cost']*1*n).toFixed(2)); } else { $('.exp .'+a.n).prop("checked",false); $(".ts p").html(a.msg); $(".ts").fadeIn(); setTimeout('$(".ts").fadeOut()', 600); } } }); /** 单选用不上,这个无成本计算 else { var cname = $(this).prop("className"); var ma = $(".exp input[name='money']").val()*1; var mx = $(".z"+cname).text()*1; var n = $(".exp .num font").text()*1; $(".exp input[name='money']").val((ma-mx).toFixed(2)); $(".exp .tm font").html(((ma-mx)*n).toFixed(2)); $(".z"+cname).remove(); } **/ }; //关闭添加信息框 function choicegb() { $(".addful",window.parent.document).hide(); /** var id; if (self != top && self.frameElement && self.frameElement.tagName == "IFRAME") { var layxWindow = $(self.frameElement).parents(".layx-window"); id = layxWindow.attr("id").substr(5); } parent.layx.destroy(id); **/ } //提交时tr增加data信息 $(".exp").on('click',".packingtj",function() { var f = ""; var index = $(".cike select").find("option:selected").index(); if(index == '4') { f = f + $(".cike select").children("option:selected").val() + "-"; } else { $(".exp .datalist .select").each(function() { if(!$(this).parent().is(":hidden")) { f = f + $(this).children("option:selected").val() + "-"; } }); } $(".datalist .checkbox .ckrows input:checked").each(function(){ f = f + $(this).val() + "-"; }); $(".exp .post .select").each(function() { f = f + $(this).children("option:selected").val() + "-"; }); $.ajax({ url: "/weight/cx/", data: "data="+f, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { packingtj(a.weight*1); } else { packingtj('0'); } } }); }); function packingtj(weight) { var f = "";var e = "";var o = "";var checkid = "";var reg = RegExp(/ - /); var index = $(".cike select").find("option:selected").index(); if(index == '4') { f = f + $(".cike select").children("option:selected").val() + "-"; if($(".cike select").children("option:selected").text().match(reg)) { var thistext = $(".cike select").children("option:selected").text().split(" - "); e = e + thistext[0] + " "; } } $(".exp .datalist .select").each(function() { if((($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') && index != '4') && !$(this).parent().is(":hidden")) { f = f + $(this).children("option:selected").val() + "-"; if($(this).children("option:selected").text().match(reg)) { var thistext = $(this).children("option:selected").text().split(" - "); e = e + thistext[0] + " "; } else { e = e + $(this).children("option:selected").text() + " "; } } }); $(".exp .post .select").each(function() { if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') { f = f + $(this).children("option:selected").val() + "-"; if($(this).children("option:selected").text().match(reg)) { var thistext = $(this).children("option:selected").text().split(" - "); e = e + thistext[0] + " "; } else { e = e + $(this).children("option:selected").text() + " "; } } }); var checkname = ""; $(".datalist .checkbox .ckrows input:checked").each(function(){ checkname = $(this).attr("name"); checkid = checkid + $(this).val()+","; o = o + $(this).next('font').text()+" "; }); if(checkname == "" && index != '4') { $(".ts p").text($(".datalist .checkbox").prevAll("em").text()+"为必填项"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 600); return false; } else { f = checkid + "-" + f; e = e + o; } var ab = 0; $(".datalist .must").each(function() { if ($.trim($(this).val()).length == 0) { $(this).css("border", "1px solid #F66"); ab = ab + 1; } }); if (ab > 0) { $(".ts p").text("红框为必填项"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 600); return false; } var x = 0 $(".datatext tr",window.parent.document).each(function() { if($(this).data("list") == f) { x++; } }); if(x > 0) { $(".ts p").text("已有相同信息!"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 700); return false; } else { var ts = $(".exp .num font").text()*1 var dj = $(".exp input[name='money']").val()*1; var purchasemy = $(".exp .purchase").text()*1; var costmy = $(".exp .cost").text()*1; var index = $(".cike select").find("option:selected").index(); var inch = $(".datalist .checkbox .ckrows input:checked").next("font").text();//针对单选尺寸,多选需要修改 //xyxg 删除这个 /** $(".datatext",window.parent.document).append(""+e+""+ts+""+(dj).toFixed(2)+""+(ts*dj).toFixed(2)+"CNY"+inch.replace("inch","")+""+(ts*purchasemy).toFixed(2)+""+(ts*costmy).toFixed(2)+""+(ts*weight)+"0");//xyxg 启用下面这个 **/ if($("input[name='mdedit']",window.parent.document).length > 0)//线下单操作界面 { $(".datatext",window.parent.document).append(""+e+""+ts+""+(dj).toFixed(2)+""+(ts*dj).toFixed(2)+"CNY"+inch.replace("inch","")+""+(ts*purchasemy).toFixed(2)+""+(ts*costmy).toFixed(2)+""+(ts*weight)+"0禁止占单"); } else { $(".datatext",window.parent.document).append(""+e+""+ts+""+(dj).toFixed(2)+""+(ts*dj).toFixed(2)+"CNY"+inch.replace("inch","")+""+(ts*purchasemy).toFixed(2)+""+(ts*costmy).toFixed(2)+""+(ts*weight)+"0禁止占单"); } } //$("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1+(sl*dj)).toFixed(2));//应收价格加上新增价格 //et(); cost();//计算成本价 window.parent.custom(); choicegb(); pptskc("a");//匹配特殊库存 }; //修改tr-data信息 $(".exp").on('click',".packingxg",function() { var f = ""; var index = $(".cike select").find("option:selected").index(); if(index == '4') { f = f + $(".cike select").children("option:selected").val() + "-"; } else { $(".exp .datalist .select").each(function() { if(!$(this).parent().is(":hidden")) { f = f + $(this).children("option:selected").val() + "-"; } }); } if(index!= '4') { $(".datalist .checkbox .ckrows input:checked").each(function(){ f = f + $(this).val() + "-"; }); } $(".exp .post .select").each(function() { f = f + $(this).children("option:selected").val() + "-"; }); $.ajax({ url: "/weight/cx/", data: "data="+f, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { packingxg(a.weight*1); } else { packingxg('0'); } } }); }); function packingxg(weight) { var f = "";var e = "";var o = "";var checkid = "";var reg = RegExp(/ - /); var index = $(".cike select").find("option:selected").index(); if(index == '4') { f = f + $(".cike select").children("option:selected").val() + "-"; if($(".cike select").children("option:selected").text().match(reg)) { var thistext = $(".cike select").children("option:selected").text().split(" - "); e = e + thistext[0] + " "; } } $(".exp .datalist .select").each(function() { if((($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') && index != '4') && !$(this).parent().is(":hidden")) { f = f + $(this).children("option:selected").val() + "-"; if($(this).children("option:selected").text().match(reg)) { var thistext = $(this).children("option:selected").text().split(" - "); e = e + thistext[0] + " "; } else { e = e + $(this).children("option:selected").text() + " "; } } }); $(".exp .post .select").each(function() { if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') { f = f + $(this).children("option:selected").val() + "-"; if($(this).children("option:selected").text().match(reg)) { var thistext = $(this).children("option:selected").text().split(" - "); e = e + thistext[0] + " "; } else { e = e + $(this).children("option:selected").text() + " "; } } }); var checkname = ""; if(index!= '4') { $(".datalist .checkbox .ckrows input:checked").each(function(){ checkname = $(this).attr("name"); checkid = checkid + $(this).val()+","; o = o + $(this).next('font').text()+" "; }); } if(checkname == "" && index != '4') { $(".ts p").text($(".datalist .checkbox").prevAll("em").text()+"为必填项"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 600); return false; } else { f = checkid + "-" + f; e = e + o; } var ab = 0; $(".datalist .must").each(function() { if ($.trim($(this).val()).length == 0) { $(this).css("border", "1px solid #F66"); ab = ab + 1; } }); if (ab > 0) { $(".ts p").text("红框为必填项"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 600); return false; } var x = 0 $(".datatext tr",window.parent.document).each(function() { if($(this).data("list") == f && !$(this).is(".on")) { x++; } }); if(x > 0) { $(".ts p").text("已有相同信息!"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 700); return false; } //var ts = $(".datalist .checkbox .ckrows input:checked").length*1; var ts = $(".exp .num font").text()*1 var dj = $(".exp input[name='money']").val()*1; var purchasemy = $(".exp .purchase").text()*1; var costmy = $(".exp .cost").text()*1; $(".datatext tr.on",window.parent.document).attr("data-list",f); //var xg = $(".datatext tr.on td:eq(8)").text()*1; // $("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1+((sl*dj)-xg)).toFixed(2)); // et(); var inch = $(".datalist .checkbox .ckrows input:checked").next("font").text();//针对单选尺寸,多选需要修改 //xyxg 删除这个 /** $(".datatext tr.on",window.parent.document).html(""+e+""+ts+""+(dj).toFixed(2)+""+(ts*dj).toFixed(2)+"CNY"+inch.replace("inch","")+""+(ts*purchasemy).toFixed(2)+""+(ts*costmy).toFixed(2)+""+(ts*weight)+"0");//xyxg 启用下面这个 **/ if($("input[name='mdedit']",window.parent.document).length > 0)//线下单操作界面 { $(".datatext tr.on",window.parent.document).html(""+e+""+ts+""+(dj).toFixed(2)+""+(ts*dj).toFixed(2)+"CNY"+inch.replace("inch","")+""+(ts*purchasemy).toFixed(2)+""+(ts*costmy).toFixed(2)+""+(ts*weight)+"0禁止占单"); } else { $(".datatext tr.on",window.parent.document).html(""+e+""+ts+""+(dj).toFixed(2)+""+(ts*dj).toFixed(2)+"CNY"+inch.replace("inch","")+""+(ts*purchasemy).toFixed(2)+""+(ts*costmy).toFixed(2)+""+(ts*weight)+"0禁止占单");//xyxg } cost();//计算成本价 window.parent.custom(); choicegb(); pptskc("a");//匹配特殊库存 }; //修改数量 $(".exp .lengththree .gz").click(function() { var num = $(".exp .num font").text()*1; var dj = $(".exp input[name='money']").val()*1; $(".exp .num font").text(num+1); if(dj > 0) { $(".exp .tm font").text((dj*(num+1)).toFixed(2)); } }); $(".exp .lengththree .gj").click(function() { var num = $(".exp .num font").text()*1; var dj = $(".exp input[name='money']").val()*1; if(num > 1) { $(".exp .num font").text(num-1)*1; if(dj > 0) { $(".exp .tm font").text((dj*(num-1)).toFixed(2)); } } }); //点击增加信息是增加标记 $(".datatext").on('click',"tr",function() { $(".datatext tr").removeClass("on"); $(this).addClass("on"); }); //删除信息 $(".packing .expsc").click(function() { var b = 0; $(".packing .datatext .on").each(function() { b = b+1; }); if (b>1) { $(".ts p").html("每次只可删除一条内容"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 1000); } else if(b<1) { $(".ts p").html("请选择需要删除的内容"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 1000); } else { // var xg = $(".datatext tr.on td:eq(8)").text()*1; //$("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1-xg).toFixed(2));et(); $(".packing .datatext .on").remove(); } costz();//计算成本价 window.parent.custom(); }); //统一修改币种 $("#currency").change(function(){ var index = $(this).find("option:selected").text(); var va = $(this).find("option:selected").val(); $(".currency").text(index); $(".datatext tr").each(function() { //$(this).find("td:eq(9)").text(index); }); }); //fullorder 数据库增加currency币种 考虑更改币种是否需要ajax获取美元汇率更改金额 $(".packing .expxg").click(function() { var b = 0; $(".packing .datatext .on").each(function() { b = b+1; }); if (b>1) { $(".ts p").html("每次只可修改一条内容"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 1000); } else if(b<1) { $(".ts p").html("请选择需要修改的内容"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 1000); } else { $(".addful .addwp").html(""); $( ".addwp" ).draggable({ revert: true,axis: "x" }); window.setInterval("reinitIframe()", 200); $(".addful").show(); } }); //自动显示option function option() { var index = $(".cike select").find("option:selected").index(); $(".pttab li").hide(); $(".pttab li").removeClass("post"); $("."+index).show();$(".none"+index).hide();$("."+index).addClass("post"); $('.pttab select option:eq(0)').prop('selected','selected'); if(index == 1) { $(".pttab .a1").show();$(".pttab .a2").hide(); } if(index == 4) { $(".Gift").hide(); $(".none"+index).hide(); } else { $(".Gift").show(); $(".none4").show(); } if(index == 5) { $(".Accessories").hide(); } else if(index == 2) { $(".ycwigs").hide(); } else if(index == 3) { $(".Extension").hide(); } else if(index == 6 || index == 7) { $(".synthetic").hide(); if(index == 7) { $(".synthetichair").show(); } } var indexb = $(".cikeb.post select").find("option:selected").val(); $(".pttab .a1").hide();$(".pttab .a2").hide();$(".pttab .a3").hide();$(".pttab .a4").hide();$(".pttab .a1").removeClass("post");$(".pttab .a2").removeClass("post");$(".pttab .a3").removeClass("post");$(".pttab .a4").removeClass("post"); if(indexb == 195) { $(".pttab .a1").show();$(".pttab .a1").addClass("post"); } else if(indexb == 197) { $(".pttab .a2").show();$(".pttab .a2").addClass("post"); } /** if(indexb == 0) { $(".pttab .a1").show();$(".pttab .a1").addClass("post"); } else if(indexb == 1) { $(".pttab .a4").show();$(".pttab .a4").addClass("post"); } else if(indexb == 2) { $(".pttab .a2").show();$(".pttab .a2").addClass("post"); } else if(indexb == 4) { $(".pttab .a3").show();$(".pttab .a3").addClass("post"); } **/ } $("select[name='ioss']").change(function() { var io = $(this).find("option:selected").val(); var gj =$("select[name='express']").find("option:selected").val(); if( (![66,67].includes(gj*1)) && io == 'IOSS243131124412071487821'){ layx.alert('提示','该物流方式不可选用IOSS号!',null,{dialogIcon:'error'}); $("select[name=ioss]").find("option[value='']").prop("selected","selected"); } }); $("select[name='country']").change(function() { $("select[name=productdescription]").html(""); $("input[name=customs]").val("0"); //express() 暂时固定运费为20USD 不在查找设置价格 dhl_r_tax_id(); printtype(); }); $("select[name='express']").change(function() { var gj = $(this).find("option:selected").val(); if(gj == 2) { $(".zzldw").html("oz"); } else { $("select[name=ioss]").find("option[value='']").prop("selected","selected"); $(".zzldw").html("kg"); } $("select[name=productdescription]").html(""); $("input[name=customs]").val("0"); eqm($(this).find("option:selected").val()); dhl_r_tax_id() //express() 暂时固定运费为20USD 不在查找设置价格 //printtype();暂时不用 //快递变动引发申报品名变动 let tmp_sbpm = $("select[name=express]").find("option:selected").data('sbpm'); if(tmp_sbpm){ if(tmp_sbpm.length > 0){ $("select[name=sbpm]").val(tmp_sbpm).trigger('change') } } var type = $(this).find("option:selected").data("type"); $("select[name=printtype]").find("option[value='"+type+"']").prop("selected","selected"); //type(); let xxts = $("select[name=express]").find("option:selected").data('ts'); if(xxts){ $("#show_express").css("display","inline-block") showExpressTiShi(xxts) } }); function eqm(id) { // if(id == '24' || id == '31' || id == '2')//联邦的话替换签名选项 // { // $("select[name='qm']").html(''); // } // else // { // $("select[name='qm']").html('');// // } if(id == '24' || id == '31' )//联邦的话替换签名选项 { $("select[name='qm']").html(''); } else if(id == '2'){ $("select[name='qm']").html(''); } else { $("select[name='qm']").html('');// } if(id == '2' || id == '64')//联邦的话替换签名选项 { $("select[name='js']").html(''); } else if(id == 1){ $("select[name='js']").html(''); } else { $("select[name='js']").html('');// } //在这里添加服务类型为 一个是ip 一个是ficp if(id == '24' || id == '31'){ $("select[name='js']").html( '' ); } } //dhl 是 巴西或者墨西哥的时候需要怼收件人税号 function dhl_r_tax_id(){ let express_id = $("select[name='express']").val(); let country = $("select[name='country']").val(); if((country == 119)){ if(express_id == 1){ $(".r_tax_id").removeClass('none') }else{ $(".r_tax_id").addClass('none') } }else{ $(".r_tax_id").addClass('none') } } $("select[name='printtype']").change(function() { $("select[name=productdescription]").html(""); $("input[name=customs]").val("0"); printtype(); }); //打印类型 function printtype() { var index = $("select[name='printtype']").find("option:selected").index(); if(index == 0) { var e = $("select[name=express]").find("option:selected").val(); var c = $("select[name=country]").find("option:selected").val(); var sjsz = 0; min = Math.ceil(10); max = Math.floor(50); sjsz = Math.floor(Math.random() * (max - min + 1)) + min; var ul = "http"; var protocol = window.location.protocol; if (protocol === 'https:') { ul = ul+"s://"+"1.wepolicy.cn"; } else { ul = ul+"://a"+sjsz+".wepolicy.cn";; } var customs = $.ajax({ url: ul+"/fullorder/customs/", data: "e="+e+"&c="+c, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { $("input[name=customs]").val(a.money); for(i=0;i"+a.msg[i]['title']+""); } $(".productdescription").show(); $(".customs").show(); } /** 无快递信息配置时提示框 else { $(".productdescription").hide(); $(".customs").hide(); $(".ts p").html(a.msg); $(".ts").fadeIn(); setTimeout('$(".ts").fadeOut()', 800); } **/ } }); } else { $(".productdescription").hide(); $(".customs").hide(); } } function pptskc(pptskccs) { if(pptskccs == "a") { var w = "";var number = $("input[name='number']",window.parent.document).val(); $(".datatext tr",window.parent.document).each(function() { var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); var cc = list.split(","); w = w + cc[1] + '|'; }); var wl = ''; $(".datatext tr",window.parent.document).each(function() { var cc = "";var listqc = "";var data = "";var t = "";var fpdg = ""; var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); cc = list.split(","); listqc = list.replace(/\d{1,3}\,/,''); listqc = listqc.substring(0,listqc.length-1); data = listqc.split("-"); var zrflx = 0;//是否有真人发类型 for(i=1;i 0) { if(cc[0] != list) { t = t +data[i] + cc[0]; fpdg = fpdg + '-' + data[i] + '-' + cc[0]; } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } wl = wl + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|'; }) var sjsz = 0; min = Math.ceil(10); max = Math.floor(50); sjsz = Math.floor(Math.random() * (max - min + 1)) + min; var ul = "http"; var protocol = window.location.protocol; if (protocol === 'https:') { ul = ul+"s://"+"1.wepolicy.cn"; } else { ul = ul+"://a"+sjsz+".wepolicy.cn";; } var ppkc = $.ajax({ url: ul+"/specialstock/ppkc/1", data: "data="+w+"&number="+number+"&whlabel=|"+wl, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { for(i=0;i已选择"+a.list[i][2]+"库存");//特殊库存 } else { $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)",window.parent.document).prepend("有可用"+a.list[i][2]+"库存");//特殊库存 $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)",window.parent.document).css("color","#C3C"); } } } } }); } else { var w = "";var c = "";var number = $("input[name='number']").val(); $(".datatext tr").each(function() { var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); var cc = list.split(","); w = w + cc[1] + '|'; c = c + list + '|'; }); var wl = ''; $(".datatext tr").each(function() { var cc = "";var listqc = "";var data = "";var t = "";var fpdg = ""; var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); cc = list.split(","); listqc = list.replace(/\d{1,3}\,/,''); listqc = listqc.substring(0,listqc.length-1); data = listqc.split("-"); var zrflx = 0;//是否有真人发类型 for(i=1;i 0) { if(cc[0] != list) { t = t +data[i] + cc[0]; fpdg = fpdg + '-' + data[i] + '-' + cc[0]; } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } wl = wl + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|'; }) var ppkc = $.ajax({ url: "/specialstock/ppkc/", data: "data="+w+"&number="+number+"&whlabel=|"+wl, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { for(i=0;i已选择"+a.list[i][2]+"库存");//特殊库存 } else { $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)").prepend("有可用"+a.list[i][2]+"库存");//特殊库存 $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)").css("color","#C3C"); } } } } }); var sjsz = 0; min = Math.ceil(10); max = Math.floor(50); sjsz = Math.floor(Math.random() * (max - min + 1)) + min; var ul = "http"; var protocol = window.location.protocol; if (protocol === 'https:') { ul = ul+"s://"+"1.wepolicy.cn"; } else { ul = ul+"://a"+sjsz+".wepolicy.cn";; } //预先判断库存仓 var kcpd = $.ajax({ url: ul+"/warehouse/kcpd/", data: "data="+c+"&shop="+$("input[name='shop']").val()+"&warehouse="+$("select[name=warehouse]").find("option:selected").val()+"&whlabel="+$("input[name='whlabel']").val()+"&number="+$("input[name='number']").val(), type: "POST", dataType: "json", success: function(a) { if (a && a.success) { $(".packing").append("

"+a.msg+"

"); } } }); } } $(".datatext").on('click',"tr span",function() { var btnTarget= document.getElementById($(this).attr("id")); var xzid = $(this).parents("tr").find("td:eq(9)").text(); var winform = layx.iframe('float-bottom','可选择的产品','/specialstock/list/'+$(this).data("id")+'/'+$("input[name=number]").val()+"/"+xzid,{ floatTarget:btnTarget, // 被吸附的DOM对象 特殊/现货产品窗口 shadable:true, escKey:false, control:false, icon:false, width:870, height:300, alwaysOnTop:true, floatDirection: 'bottom', // 设置方向 event:{ ondestroy: { before: function (layxWindow, winform, params, inside,escKey) { if(inside===false){ layx.visual(winform.id,false); // 隐藏窗口 layx.updateFloatWinPosition(winform.id); return false; } } }, onexist: function (layxWindow, winform) { layx.visual(winform.id,true); // 显示窗口 } } }); }); /** $("select[name='warehouse']").change(function() { type(); }); function express() { var e = $("select[name=express]").find("option:selected").val(); var c = $("select[name=country]").find("option:selected").val(); $.ajax({ url: "/fullorder/express/", data: "e="+e+"&c="+c, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { $("input[name=expressmoney]").val(a.money);//?这里或许需要根据币种美元转换 } else { $("input[name=expressmoney]").val("0.00"); } } }); } function type() { var t = $("select[name=express]").find("option:selected").val(); var c = $("select[name=warehouse]").find("option:selected").val(); $.ajax({ url: "/fullorder/expresstype/", data: "id="+t, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { $("select[name=printtype]").find("option[value='"+a.msg+"']").prop("selected","selected"); } } }); } **/ $(".lengththree input[name='money']").bind("change",function(){ var ma= $(this).val(); var n = $(".exp .num font").text()*1; $(".exp .tm font").html((ma*n).toFixed(2)); }); //整体提交数据 $(".fullorderdata").click(function() { $(".addful").hide(); var f = ""; var e = ""; var w = ""; var fpcount = ""; $(".need .select").each(function() { f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&"; }); $(".need input:text").each(function() { str2 = $(this).val().replace(/\/g,">"); str2 = str2.replace(/\+/g,"%2B"); str2 = str2.replace(/&/g,"%26"); f = f + $(this).attr("name") + "=" + str2 + "&"; }); $(".need input:hidden").each(function() { f = f + $(this).attr("name") + "=" + $(this).val() + "&"; }); $(".need textarea").each(function() { str2 = $(this).val().replace(/\/g,">"); str2 = str2.replace(/\+/g,"%2B"); str2 = str2.replace(/&/g,"%26"); f = f + $(this).attr("name") + "=" + encodeURI(str2) + "&"; }); var tdweight = 0; $(".datatext tr").each(function() { var cc = "";var listqc = "";var data = "";var t = "";var fpdg = ""; var td0 = $(this).find("td:eq(0)").text().replace(/\+/g,"%2B"); var td0 = td0.replace(/&/g,"%26"); var td8 = ''; if($(this).find("td:eq(8)").length > 0) { if($(this).find("td:eq(8)").text() == '') { td8 = '0'; } else { td8 = $(this).find("td:eq(8)").text(); } } else { td8 = '0'; } e = e + $(this).attr("data-list")+ "|" + td0 + "|" + $(this).find("td:eq(1)").text() + "|" + $(this).find("td:eq(2)").text() + "|" + $(this).find("td:eq(3)").text() + "|" + $(this).find("td:eq(5)").text() + "|" + $(this).find("td:eq(6)").text() + "|" + $(this).find("td:eq(7)").text() + "|" + td8 + "|" + $(this).find("td:eq(9)").text() + ";"; tdweight = tdweight + td8*1; var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); cc = list.split(","); listqc = list.replace(/\d{1,3}\,/,''); listqc = listqc.substring(0,listqc.length-1); data = listqc.split("-"); var zrflx = 0;//是否有真人发类型 for(i=1;i 0) { if(cc[0] != list) { t = t +data[i] + cc[0]; fpdg = fpdg + '-' + data[i] + '-' + cc[0]; } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } if(t == '') { $(".ts p").text("商品信息错误!"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 800); $.exit(); } if($(this).find("td:eq(1)").text() < 1) { $(".ts p").text("商品数量错误!"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 800); $.exit(); } w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|'; fpcount = fpcount + fpdg + '-|'; }); f = f + "jweight=" + tdweight + "&"; e = e.replace(/(有可用特殊库存|已选择特殊库存|有可用现货库存|已选择现货库存|已选择库存)/g,''); f = f + "whlabel=|" + w + "&fpdata=" + encodeURI(e) + "&"; f = f + "fpcount=" + fpcount + "&"; f = f + "budget=" + $(".budget").text() + "&"; var ab = 0; $(".need .must").each(function() { if ($.trim($(this).val()).length == 0) { $(this).css("border", "1px solid #F66"); ab = ab + 1; } }); if (ab > 0) { $(".ts p").text("红框为必填项"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 600); return false; } //限制必须提交产品详细列表 if (e == '') { $(".ts p").text("必须添加订单详细信息!"); $(".ts").show(); setTimeout('$(".ts").fadeOut()', 800); return false; } else { /** if($("select[name=warehouse]").find("option:selected").val() == "5" || $("select[name=warehouse]").find("option:selected").val() == "6") { var yzdata = { warehouse: $("select[name=warehouse]").find("option:selected").val(), shop: $("input[name=shop]").val(), id: $("input[name=id]").val(), whlabel: "|" + w }; $.ajax({ url: "/ck/kcyz/",//xyxg 修改为/ck/kcyz/ data: yzdata, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { zttj(f); } else { if(a.t == 1) { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); for(i=0;i确 定
"); $(".express").show(); } else { var old = a.oldwhlabel; //$("select[name=warehouse] option:eq(0)").prop('selected','selected'); if(a.t == 2) { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); for(i=0;i 0) { var n= $("input[name='et']").val(); $(".currencymoney").text(eval(ma+n).toFixed(2)); } else { $(".currencymoney").text(0); } } //计算成本金额,子页面用 function cost(){ var purchasemoney = 0;var costmoney = 0; $(".datatext tr",window.parent.document).each(function() { purchasemoney = purchasemoney+$(this).find("td:eq(6)").text()*1; costmoney = costmoney+$(this).find("td:eq(7)").text()*1; }); $("input[name='purchase']",window.parent.document).val(purchasemoney.toFixed(2)); $("input[name='cost']",window.parent.document).val(costmoney.toFixed(2)); //$("li b .zlr").html(($("li .budget").html()*1-money).toFixed(2));//总利润 } //计算成本金额,自页面用 function costz(){ var purchasemoney = 0;var costmoney = 0; $(".datatext tr").each(function() { purchasemoney = purchasemoney+$(this).find("td:eq(6)").text()*1; costmoney = costmoney+$(this).find("td:eq(7)").text()*1; }); $("input[name='purchase']").val(purchasemoney.toFixed(2)); $("input[name='cost']").val(costmoney.toFixed(2)); //$("li b .zlr").html(($("li .budget").html()*1-money).toFixed(2));//总利润 } $(".power").click(function() { layx.confirm('重置选择','确定重置此订单?',function(id){ $.ajax({ url: fh+"/power/", data: "id="+$("input[name='id']").val(), type: "POST", dataType: "json", success: function(a) { layx.destroy(id); if (a && a.success) { $(".express p:eq(0)").html(a.msg); $(".express p:eq(1)").html("确 定"); $(".express").show(); } else { $(".ts p").html(a.msg); $(".ts").fadeIn(); setTimeout('$(".ts").fadeOut()', 800); } } }); layx.destroy(id); },{shadable:0.6,dialogIcon:'help'}); }); //验证库存 $("select[name=warehouse]").change(function(){ var czw = $(this).find("option:selected").val(); cze = $(this).find("option:selected").data("e"); $.ajax({ url: "/warehouse/list/", data: "id="+czw, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { if(a.msg == "1") { var w = ""; $(".datatext tr").each(function() { var cc = "";var listqc = "";var data = "";var t = ""; var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); cc = list.split(","); listqc = list.replace(/\d{1,3}\,/,''); listqc = listqc.substring(0,listqc.length-1); data = listqc.split("-"); var zrflx = 0;//是否有真人发类型 for(i=1;i 0) { if(cc[0] != list) { t = t +data[i] + cc[0]; } else { t = t +data[i]; } } else { t = t +data[i]; } } w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|'; }); //alert(w) var yzdata = { warehouse: czw, shop: $("input[name=shop]").val(), id: $("input[name=id]").val(), number: $("input[name=number]").val(), state: $("select[name=state]").find("option:selected").val(), whlabel: "|" + w }; $.ajax({ url: "/ck/kcyz/",//xyxg 修改为/ck/kcyz/ data: yzdata, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { if(cze != 0)//更改为默认快递 { $('select[name=express]').find("option").each(function(){ if($(this).val() == cze){ $(this).prop('selected','selected'); } }); usps(); } } else { $("select[name=warehouse] option:eq(0)").prop('selected','selected'); var express = $("select[name=warehouse]").find("option:selected").data("e"); $("select[name=express]").find("option[value='"+express+"']").prop("selected","selected"); eqm(express); if(a.t == 1) { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); for(i=0;i允许发货:允许出库"); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } } }); layx.destroy(id); },{shadable:0.6,dialogIcon:'help'}); }); $(".bcbz").click(function() { var f = ""; var e = ""; var w = ""; var fpcount = ""; $(".need .select").each(function() { f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&"; }); $(".need input:text").each(function() { var str = $(this).val().replace(/\+/g,"%2B"); var str = str.replace(/&/g,"%26"); f = f + $(this).attr("name") + "=" + str + "&"; }); $(".need input:hidden").each(function() { f = f + $(this).attr("name") + "=" + $(this).val() + "&"; }); $(".need textarea").each(function() { var str2 = $(this).val().replace(/\+/g,"%2B"); f = f + $(this).attr("name") + "=" + str2 + "&"; }); var tdweight = 0; $(".datatext tr").each(function() { var cc = "";var listqc = "";var data = "";var t = "";var fpdg = ""; var td0 = $(this).find("td:eq(0)").text().replace(/\+/g,"%2B"); var td0 = td0.replace(/&/g,"%26"); var td8 = ''; if($(this).find("td:eq(8)").length > 0) { if($(this).find("td:eq(8)").text() == '') { td8 = '0'; } else { td8 = $(this).find("td:eq(8)").text(); } } else { td8 = '0'; } e = e + $(this).attr("data-list")+ "|" + td0 + "|" + $(this).find("td:eq(1)").text() + "|" + $(this).find("td:eq(2)").text() + "|" + $(this).find("td:eq(3)").text() + "|" + $(this).find("td:eq(5)").text() + "|" + $(this).find("td:eq(6)").text() + "|" + $(this).find("td:eq(7)").text() + "|" + td8 + "|" + $(this).find("td:eq(9)").text() + ";"; tdweight = tdweight + td8*1; var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); cc = list.split(","); listqc = list.replace(/\d{1,3}\,/,''); listqc = listqc.substring(0,listqc.length-1); data = listqc.split("-"); var zrflx = 0;//是否有真人发类型 for(i=1;i 0) { if(cc[0] != list) { t = t +data[i] + cc[0]; fpdg = fpdg + '-' + data[i] + '-' + cc[0]; } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|'; fpcount = fpcount + fpdg + '-|'; }); f = f + "jweight=" + tdweight + "&"; e = e.replace(/(有可用特殊库存|已选择特殊库存|有可用现货库存|已选择现货库存|已选择库存)/g,''); f = f + "whlabel=|" + w + "&fpdata=" + encodeURI(e) + "&"; f = f + "fpcount=" + fpcount + "&"; f = f + "budget=" + $(".budget").text() + "&"; /** if($("select[name=warehouse]").find("option:selected").val() == "5" || $("select[name=warehouse]").find("option:selected").val() == "6") { var yzdata = { warehouse: $("select[name=warehouse]").find("option:selected").val(), shop: $("input[name=shop]").val(), id: $("input[name=id]").val(), whlabel: "|" + w }; $.ajax({ url: "/ck/kcyz/",//xyxg 修改为/ck/kcyz/ data: yzdata, type: "POST", dataType: "json", success: function(a) { if (a && a.success) { bcbz(f); } else { if(a.t == 1) { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); for(i=0;i确 定"); $(".express").show(); } else { $("select[name=warehouse] option:eq(0)").prop('selected','selected'); if(a.t == 2) { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); for(i=0;i保存后生效'); }); $(".datatext .jzzd").click(function() { $(this).parent().siblings(".val9").html("DNOTO"); $(this).parent().html('已禁止占单
保存后生效'); }); $(".datatext .yxzd").click(function() { $(this).parent().siblings(".val9").html("0"); $(this).parent().html('已允许占单
保存后生效'); }); $(".epod").click(function() { layx.load('loadId','获取中,如果未弹出PDF,请检查浏览器拦截'); $.ajax({ url: fh+'/epod', data: 'number='+$("input[name='number']").val(), type: "POST", dataType: "json", success: function(a) { layx.destroy('loadId'); if (a && a.success) { window.open(a.msg); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } } }); }); $(".button .refund").click(function() { var f = $(this).data("f"); layx.confirm('申请退款','是否确定提交《退款》申请?',function(id){ layx.load('loadId','数据提交中,请稍后'); $.ajax({ url: "/returncw/return", data: "number="+$("input[name=number]").val()+"&f="+f, type: "POST", dataType: "json", success: function(a) { layx.destroy('loadId'); if (a && a.success) { layx.alert('完成',a.msg,function(id,button){ },{dialogIcon:'success'}); $("li .return").html(a.data); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } } }); layx.destroy(id); },{shadable:0.6,dialogIcon:'help'}); }); $(".button .ddcf").click(function() { var f = $(this).data("f"); layx.confirm('订单拆分','是否确定拆分 '+$("input[name=number]").val(),function(id){ layx.load('loadId','数据提交中,请稍后'); $.ajax({ url: "/"+f+"/ddcf", data: "number="+$("input[name=number]").val(), type: "POST", dataType: "json", success: function(a) { layx.destroy('loadId'); if (a && a.success) { layx.alert('完成',a.msg,function(id,button){ },{dialogIcon:'success'}); $("li .return").html(a.data); } else { layx.alert('错误',a.msg,function(id,button){ },{dialogIcon:'error'}); } } }); layx.destroy(id); },{shadable:0.6,dialogIcon:'help'}); }); /** * 提交订单的提示信息 */ function checkOrderShowNotice(f) { let country = $("select[name=country]").find("option:selected").val() let express = $("select[name='express']").find("option:selected").val(); let servioce_js = $("select[name='js']").find("option:selected").val(); // alert(country+"-"+express+"-"+servioce_js) //美国 dhl官方 如果没有选择发件方付税 会提醒 if(country == '192' && express == '1' && servioce_js!= '6'){ layx.confirm('提示',"请确认是否需要从发件方付税!",null,{ buttons:[ { label:'不用勾选、继续保存', callback:function(id, button, event){ zttj(f) layx.destroy(id); } }, { label:'去勾选', callback:function(id, button, event){ layx.destroy(id); } } ],dialogIcon:'help',shadable:0.6 }); }else{ zttj(f); } } function showExpressTiShi(msg){ $('#show_express').off(); $('#show_express').on('mouseenter', function(e) { //显示提示 mTips.c.x = 0; mTips.c.y = 0; mTips.s('

'+msg+'

', 'success'); }); $('#show_express').on('mouseleave', function(e) { mTips.h(); mTips.c.x = 0; mTips.c.y = 0; }); } $(".ly_mcth").on('click',function(){ // let warehouse = $("select[name='warehouse']").find("option:selected").val(); // if(warehouse != 5){ // layx.confirm('提示',"该仓库不支持此操作!",null,{ // buttons:[ // { // label:'确定', // callback:function(id, button, event){ // layx.destroy(id); // } // } // ],dialogIcon:'error',shadable:0.6 // }) // return false; // } let obj = getTrabltr(); layx.load('loadId','数据提交中,请稍后'); $.post("/ck/mcth",{ number:$("input[name='number']").val(), fpdata:obj.fpadta, },function(res){ layx.destroy('loadId'); if(res.code == 1){ doLymcth(res.data,res.shipmarks) }else{ layx.confirm('提示',res.msg,null,{ buttons:[ { label:'确定', callback:function(id, button, event){ layx.destroy(id); } } ],dialogIcon:'error',shadable:0.6 }) } },'json') }) //获取table表单的相关信息 function getTrabltr(){ let e = "",tdweight=0,w='',fpcount=''; $(".datatext tr").each(function() { var cc = "";var listqc = "";var data = "";var t = "";var fpdg = ""; var td0 = $(this).find("td:eq(0)").text().replace(/\+/g,"%2B"); var td0 = td0.replace(/&/g,"%26"); var td8 = ''; if($(this).find("td:eq(8)").length > 0) { if($(this).find("td:eq(8)").text() == '') { td8 = '0'; } else { td8 = $(this).find("td:eq(8)").text(); } } else { td8 = '0'; } e = e + $(this).attr("data-list")+ "|" + td0 + "|" + $(this).find("td:eq(1)").text() + "|" + $(this).find("td:eq(2)").text() + "|" + $(this).find("td:eq(3)").text() + "|" + $(this).find("td:eq(5)").text() + "|" + $(this).find("td:eq(6)").text() + "|" + $(this).find("td:eq(7)").text() + "|" + td8 + "|" + $(this).find("td:eq(9)").text() + ";"; tdweight = tdweight + td8*1; var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-'); cc = list.split(","); listqc = list.replace(/\d{1,3}\,/,''); listqc = listqc.substring(0,listqc.length-1); data = listqc.split("-"); var zrflx = 0;//是否有真人发类型 for(i=1;i 0) { if(cc[0] != list) { t = t +data[i] + cc[0]; fpdg = fpdg + '-' + data[i] + '-' + cc[0]; } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } else { t = t +data[i]; fpdg = fpdg + '-' + data[i]; } } w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|'; fpcount = fpcount + fpdg + '-|'; }); e = e.replace(/(有可用特殊库存|已选择特殊库存|有可用现货库存|已选择现货库存|已选择库存)/g,''); return { fpadta:e, whlabel:w, }; } //执行上边的返回结果拼接 以及界面操作 function doLymcth(fpdata,shipmarks){ let table_tr = ""; let good_list = fpdata.split(";"); let detail_str = ""; let detail_arr = []; let tmp_str = ""; for(var i in good_list){ tmp_str = ""; if(good_list[i].length > 0){ detail_arr = good_list[i].split("|"); tmp_str += ""+detail_arr[1]+""+detail_arr[2]+""+detail_arr[3]+""+detail_arr[4]+""+detail_arr[5]+""+detail_arr[6]+""+detail_arr[7]+""+detail_arr[8]+""+detail_arr[9]+"0禁止占单"; } table_tr += tmp_str; } $(".datatext ").html(table_tr); $("textarea[name='shipremarks']").text(shipmarks); $("select[name=warehouse]").val(5).change() //checkKcyz() custom(); } function checkKcyz(){ let obj = getTrabltr(); var yzdata = { warehouse: $("select[name=warehouse]").find("option:selected").val(), shop: $("input[name=shop]").val(), id: $("input[name=id]").val(), number: $("input[name=number]").val(), state: $("select[name=state]").find("option:selected").val(), whlabel: "|" + obj.whlabel, }; $.post("/ck/kcyz/", yzdata,function(a){ console.log(a); if (a && a.success) { } else { if(a.t == 1) { layx.alert('错误',a.msg,function(id,button){},{dialogIcon:'error'}); } else { layx.alert('错误',a.msg,function(id,button){},{dialogIcon:'error'}); for(i=0;i