12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075 |
- //添加信息框
- 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() + "-";
- }
- 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("<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><td class='none'></td></tr>");//xyxg 启用下面这个
- **/
- if($("input[name='mdedit']",window.parent.document).length > 0)//线下单操作界面
- {
- $(".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 val9'>0</td><td><font class='jzzd'>禁止占单</font></td></tr>");
- }
- else
- {
- $(".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 val9'>0</td><td></td><td><font class='jzzd'>禁止占单</font></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() + "-";
- }
- 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("<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><td class='none'></td>");//xyxg 启用下面这个
- **/
- if($("input[name='mdedit']",window.parent.document).length > 0)//线下单操作界面
- {
- $(".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 val9'>0</td><td><font class='jzzd'>禁止占单</font></td>");
- }
- else
- {
- $(".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 val9'>0</td><td></td><td><font class='jzzd'>禁止占单</font></td>");//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("<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();
- $(".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('<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>
- // }
- if(id == '24' || id == '31' )//联邦的话替换签名选项
- {
- $("select[name='qm']").html('<option value="0" selected="selected">默认</option><option value="1">成人签名</option>');
- }
- else if(id == '2'){
- $("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>
- }
-
- if(id == '2' || id == '64')//联邦的话替换签名选项
- {
- $("select[name='js']").html('<option value="0">Ground Advantage</option><option value="1">PRIORITY</option><option value="2">EXPRESS</option>');
- }
- else if(id == 1){
- $("select[name='js']").html('<option value="5">无</option><option value="6">从发件方付税</option>');
- }
- else
- {
- $("select[name='js']").html('<option value="0" selected="selected">无</option>');//<option value="1">需要</option>
- }
- //在这里添加服务类型为 一个是ip 一个是ficp
- if(id == '24' || id == '31'){
- $("select[name='js']").html(
- '<option selected="selected" value="4">FICP</option><option value="3" hidden>IP</option>'
- );
- }
-
- }
- //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.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 = "";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<data.length;i++)
- {
- if(i == 2)
- {
- //if(data[i] == 2090)
- if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
- {
- zrflx++;
- t = t +data[i];
- fpdg = fpdg + '-' + data[i];
- }
- else
- {
- 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 if(i == 3 && zrflx > 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.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().indexOf("z") != -1)
- {
- $(".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]+"'>已选择"+a.list[i][2]+"库存</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]+"'>有可用"+a.list[i][2]+"库存</span>");//特殊库存
- $(".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<data.length;i++)
- {
- if(i == 2)
- {
- //if(data[i] == 2090)
- if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
- {
- zrflx++;
- t = t +data[i];
- fpdg = fpdg + '-' + data[i];
- }
- else
- {
- 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 if(i == 3 && zrflx > 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.length;i++)
- {
- if($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)").text().indexOf("z") != -1)
- {
- $(".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]+"'>已选择"+a.list[i][2]+"库存</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]+"'>有可用"+a.list[i][2]+"库存</span>");//特殊库存
- $(".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("<p style='padding-top:10px;text-align: center;color:#F00'>"+a.msg+"</p>");
- }
-
- }
- });
- }
- }
- $(".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,">");
- 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,">");
- 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<data.length;i++)
- {
- if(i == 2)
- {
- //if(data[i] == 2090)
- if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) ||(data[i] == 2469))
- {
- zrflx++;
- t = t +data[i];
- fpdg = fpdg + '-' + data[i];
- }
- else
- {
- 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 if(i == 3 && zrflx > 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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- }
- }
- });
- }
- else
- {
- zttj(f);
- }
- **/
- //zttj(f);
- //根据实际需求先将 执行判断 后期提交 其实可以直接写再这里 但是这个方法 太长了 所以另开一个方法写
- checkOrderShowNotice(f);
- }
- });
- function zttj(f){
- layx.load('loadId','数据提交中,请稍后');
- $.ajax({
- url: addedit,
- data: f,
- type: "POST",
- dataType: "json",
- timeout: 30000,
- 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()', 2000);
- }
- }
- },
- error: function(textStatus) {
- layx.destroy('loadId');
- layx.alert('错误', '提交超时,请重试', function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- },
- });
- }
- //关联总金额换算穿预计到帐金额
- $("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();
- 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<data.length;i++)
- {
- if(i == 2)
- {
- if((data[i] == 2090)||(data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
- {
- zrflx++;
- t = t +data[i];
- }
- else
- {
- if(cc[0] != list)
- {
- t = t +data[i] + cc[0];
- }
- else
- {
- t = t +data[i];
- }
- }
- }
- else if(i == 3 && zrflx > 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<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();
- console.log(nr)
- if(nr == "2")
- {
- $(".usps").show();
- $(".qm").show();
- }
- else if((nr == '24') || (nr == '31')){
- $(".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 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<data.length;i++)
- {
- if(i == 2)
- {
- //if(data[i] == 2090)
- if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
- {
- zrflx++;
- t = t +data[i];
- fpdg = fpdg + '-' + data[i];
- }
- else
- {
- 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 if(i == 3 && zrflx > 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<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",
- timeout: 9000,
- 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);
- }
- }
- },
- error: function(textStatus) {
- layx.destroy('loadId');
- layx.alert('错误', '请检查数据再重试', function(id, button) {
- $(".search span").click();
- }, { dialogIcon: 'error' });
- },
- });
-
-
- };
- $(".datatext").on('click',".jzzd",function() {
- $(this).parent().siblings(".val9").html("DNOTO");
- $(this).parent().html('已禁止占单<br>保存后生效');
- });
- $(".datatext .jzzd").click(function() {
- $(this).parent().siblings(".val9").html("DNOTO");
- $(this).parent().html('已禁止占单<br>保存后生效');
- });
-
- $(".datatext .yxzd").click(function() {
- $(this).parent().siblings(".val9").html("0");
- $(this).parent().html('已允许占单<br>保存后生效');
- });
- $(".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('<h1>'+msg+'</h1>', '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<data.length;i++)
- {
- if(i == 2)
- {
- //if(data[i] == 2090)
- if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
- {
- zrflx++;
- t = t +data[i];
- fpdg = fpdg + '-' + data[i];
- }
- else
- {
- 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 if(i == 3 && zrflx > 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 += "<tr data-list='"+detail_arr[0]+"'><td>"+detail_arr[1]+"</td><td>"+detail_arr[2]+"</td><td class='none'>"+detail_arr[3]+"</td><td class='none'>"+detail_arr[4]+"</td><td class='none'>"+detail_arr[5]+"</td><td class='none'>"+detail_arr[6]+"</td><td class='none'>"+detail_arr[7]+"</td><td class='none'>"+detail_arr[8]+"</td><td class='none'>"+detail_arr[9]+"</td><td class='none val9'>0</td><td></td><td><font class='jzzd'>禁止占单</font></td></tr>";
- }
- 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<a.error.length;i++)
- {
- $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
- }
- }
- }
- },'json')
- }
|