1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267 |
- //添加信息框
- 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("<iframe id='abccc' allowtransparency='true' frameborder='0' scrolling='auto' allowfullscreen='' mozallowfullscreen='' webkitallowfullscreen='' src='/choice/1' data-focus='true'></iframe>");
- $( ".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("<font class='z"+a.n+"'>"+mx.toFixed(2)+"</span>");
- $(".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() + "-";
- }
- $(".exp .datalist .select").each(function() {
- if($(this).prop("name") != "hairtype" && index != '4')
- {
- 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 index = $(".cike select").find("option:selected").index();
- if(index == '4')
- {
- f = f + $(".cike select").children("option:selected").val() + "-";
- e = e + $(".cike select").children("option:selected").text() + " ";
- }
- $(".exp .datalist .select").each(function() {
- if(($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') && index != '4')
- {
- f = f + $(this).children("option:selected").val() + "-";
- 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() + "-";
- 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();//针对单选尺寸,多选需要修改
-
- $(".datatext",window.parent.document).append("<tr data-list='"+f+"'><td>"+e+"</td><td>"+ts+"</td><td class='none'>"+(dj).toFixed(2)+"</td><td class='none'>"+(ts*dj).toFixed(2)+"</td><td class='none'>CNY</td><td class='none'>"+inch.replace("inch","")+"</td><td class='none'>"+(ts*purchasemy).toFixed(2)+"</td><td class='none'>"+(ts*costmy).toFixed(2)+"</td><td class='none'>"+(ts*weight)+"</td><td class='none'>0</td></tr>");
- }
- //$("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() + "-";
- }
- $(".exp .datalist .select").each(function() {
- if($(this).prop("name") != "hairtype" && index != '4')
- {
- 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 index = $(".cike select").find("option:selected").index();
- if(index == '4')
- {
- f = f + $(".cike select").children("option:selected").val() + "-";
- e = e + $(".cike select").children("option:selected").text() + " ";
- }
- $(".exp .datalist .select").each(function() {
- if(($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') && index != '4')
- {
- f = f + $(this).children("option:selected").val() + "-";
- 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() + "-";
- 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 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();//针对单选尺寸,多选需要修改
-
- $(".datatext tr.on",window.parent.document).html("<td>"+e+"</td><td>"+ts+"</td><td class='none'>"+(dj).toFixed(2)+"</td><td class='none'>"+(ts*dj).toFixed(2)+"</td><td class='none'>CNY</td><td class='none'>"+inch.replace("inch","")+"</td><td class='none'>"+(ts*purchasemy).toFixed(2)+"</td><td class='none'>"+(ts*costmy).toFixed(2)+"</td><td class='none'>"+(ts*weight)+"</td><td class='none'>0</td>");
- 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("<iframe id='abccc' allowtransparency='true' frameborder='0' scrolling='auto' allowfullscreen='' mozallowfullscreen='' webkitallowfullscreen='' src='/choice/2' data-focus='true'></iframe>");
- $( ".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();
- }
- else
- {
- $(".Gift").show();
- }
- var indexb = $(".cikeb.post select").find("option:selected").index();
- $(".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 == 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='country']").change(function() {
- $("select[name=productdescription]").html("");
- $("input[name=customs]").val("0");
- //express() 暂时固定运费为20USD 不在查找设置价格
- printtype();
- });
- $("select[name='express']").change(function() {
- $("select[name=productdescription]").html("");
- $("input[name=customs]").val("0");
- if($(this).find("option:selected").val() == '24' || $(this).find("option:selected").val() == '31')//联邦的话替换签名选项
- {
- $("select[name='qm']").html('<option value="0" selected="selected">默认</option><option value="1">成人签名</option>');
- }
- else
- {
- $("select[name='qm']").html('<option value="0" selected="selected">不需要</option><option value="1">需要</option>');
- }
- //express() 暂时固定运费为20USD 不在查找设置价格
- printtype();
- type();
- });
- $("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();
- $.ajax({
- url: "/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.length;i++)
- {
- $("select[name=productdescription]").append("<option value='"+a.msg[i]['id']+"'>"+a.msg[i]['title']+"</option>");
- }
- $(".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 = "";
- $(".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] + '|';
- });
- $.ajax({
- url: "/specialstock/ppkc/1",
- data: "data="+w,
- type: "POST",
- dataType: "json",
- success: function(a) {
- if (a && a.success)
- {
- for(i=0;i<a.list.length;i++)
- {
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0) span",window.parent.document).remove();
- console.log($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)",window.parent.document).text());
- if($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)",window.parent.document).text() == 'z')
- {
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)",window.parent.document).prepend("<span class='l' id='xf"+i+"' style='padding:0px 15px;background:#2ca8a1;' data-id='"+a.list[i][1]+"'>已选择特殊库存</span>");
- }
- else
- {
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)",window.parent.document).prepend("<span class='l' id='xf"+i+"' style='padding:0px 15px' data-id='"+a.list[i][1]+"'>有可用特殊库存</span>");
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)",window.parent.document).css("color","#C3C");
- }
- }
- }
-
- }
- });
- }
- else
- {
- var w = "";
- $(".datatext tr").each(function() {
- var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
- var cc = list.split(",");
- w = w + cc[1] + '|';
- });
- $.ajax({
- url: "/specialstock/ppkc/",
- data: "data="+w,
- type: "POST",
- dataType: "json",
- success: function(a) {
- if (a && a.success)
- {
- for(i=0;i<a.list.length;i++)
- {
- if($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)").text() == 'z')
- {
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)").prepend("<span class='l' id='xf"+i+"' style='padding:0px 15px;background:#2ca8a1;' data-id='"+a.list[i][1]+"'>已选择特殊库存</span>");
- }
- else
- {
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)").prepend("<span class='l' id='xf"+i+"' style='padding:0px 15px' data-id='"+a.list[i][1]+"'>有可用特殊库存</span>");
- $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)").css("color","#C3C");
- }
- }
- }
-
- }
- });
- }
- //判断是匹配特殊库存
-
- }
- $(".datatext").on('click',"tr span",function() {
- var btnTarget= document.getElementById($(this).attr("id"));
- var winform = layx.iframe('float-bottom','可选择的特殊产品','/specialstock/list/'+$(this).data("id"),{
- 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();
- /** 如果仓库不是1的话,执行不打印操作
- if(c!=1)
- {
- $("select[name=printtype]").find("option[value='3']").prop("selected","selected");return false;
- }
- **/
- $.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() {
- 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");
- var str2 = str2.replace(/&/g,"%26");
- 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("-");
- for(i=1;i<data.length;i++)
- {
- if(i == 2)
- {
- 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() + "&";
- 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: "/whlabel/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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- }
- }
- });
- }
- else
- {
- zttj(f);
- }
- **/
- zttj(f);
- }
- });
- function zttj(f){
- layx.load('loadId','数据提交中,请稍后');
- $.ajax({
- url: addedit,
- data: f,
- type: "POST",
- dataType: "json",
- success: function(a) {
- layx.destroy('loadId');
- if (a && a.success) {
- $(".express p:eq(0)").html(a.msg);
- $(".express p:eq(1)").html("<font class='fh' data-id='"+a.id+"'>确 定</font>");
- $(".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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- else
- {
- layx.destroy('loadId');
- $(".ts p").html(a.msg);
- $(".ts").fadeIn();
- setTimeout('$(".ts").fadeOut()', 600);
- }
- }
- }
- });
- }
- //关联总金额换算穿预计到帐金额
- $("input[name='shouldmoney']").bind("change",function(){
- et();
- });
- function et(){
- var ma= $("input[name='shouldmoney']").val();
- if(ma > 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("<font class='fh'>确 定</font>");
- $(".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();
- var 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("-");
- for(i=1;i<data.length;i++)
- {
- if(i == 2)
- {
- 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() + '|';
- });
- var yzdata = {
- warehouse: czw,
- shop: $("input[name=shop]").val(),
- id: $("input[name=id]").val(),
- number: $("input[name=number]").val(),
- whlabel: "|" + w
-
- };
- $.ajax({
- url: "/whlabel/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');
- 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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- }
- }
- });
- }
- else
- {
- if(cze != 0)//更改为默认快递
- {
- $('select[name=express]').find("option").each(function(){
- if($(this).val() == cze){
- $(this).prop('selected','selected');
-
- }
- });
- usps();
- }
- }
- } else {
- $(".ts p").html(a.msg);
- $(".ts").fadeIn();
- setTimeout('$(".ts").fadeOut()', 800);
- }
- }
- });
-
- });
- $("select[name='express']").change(function() { //usps 显示 签名和服务类型
- usps()
- })
- function usps() {
- var nr = $("select[name='express']").find("option:selected").val();
- if(nr == "2")
- {
- $(".usps").show();
- $(".qm").show();
- }
- else
- {
- $(".usps").hide();
- $(".qm").hide();
- }
- if(nr == "24")
- {
- $(".qm").show();
- }
- else
- {
- $(".qm").hide();
- }
- }
- $(".button .return").click(function() {
- layx.confirm('操作退货','确定生成《退货》信息?',function(id){
- layx.load('loadId','数据提交中,请稍后');
- $.ajax({
- url: fh+"/return/",
- data: "orderinfo="+$(".orderinfo").text(),
- 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 .clearreturn").click(function() {
- layx.confirm('清除记录','确定清除此单退货记录?',function(id){
- $.ajax({
- url: fh+"/clearreturn/",
- data: "orderinfo="+$(".orderinfo").text(),
- type: "POST",
- dataType: "json",
- success: function(a) {
- layx.destroy(id);
- if (a && a.success) {
- layx.alert('完成',a.msg,function(id,button){
- },{dialogIcon:'success'});
- $(".clearreturnedit1").html("已出库");
- $(".clearreturnedit2").html("<em>允许发货:</em><b>允许出库</b>");
- } 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 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")+ "|" + $(this).find("td:eq(0)").text() + "|" + $(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 + ";";
- 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("-");
- for(i=1;i<data.length;i++)
- {
- if(i == 2)
- {
- 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() + '|';
- fpcount = fpcount + fpdg + '-|';
- });
- f = f + "jweight=" + tdweight + "&";
- 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: "/whlabel/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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- }
- }
- });
- }
- else
- {
- bcbz(f);
- }
- **/
- bcbz(f);
- });
- function bcbz(f) {
- layx.load('loadId','数据提交中,请稍后');
- $.ajax({
- url: fh+"/bcbz/",
- data: f,
- type: "POST",
- dataType: "json",
- success: function(a) {
- layx.destroy('loadId');
- if (a && a.success) {
- $(".express p:eq(0)").html(a.msg);
- $(".express p:eq(1)").html("<font class='fh' data-id='"+a.id+"'>确 定</font>");
- $(".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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- else
- {
- layx.destroy('loadId');
- $(".ts p").html(a.msg);
- $(".ts").fadeIn();
- setTimeout('$(".ts").fadeOut()', 600);
- }
- }
- }
- });
-
-
- };
|