fullorder-addedit.js 61 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072
  1. //添加信息框
  2. function reinitIframe(){
  3. var iframe = document.getElementById("abccc");
  4. try{
  5. var bHeight = iframe.contentWindow.document.body.scrollHeight;
  6. var dHeight = iframe.contentWindow.document.documentElement.scrollHeight;
  7. var height = Math.max(bHeight, dHeight);
  8. iframe.height = height;
  9. //console.log(height);
  10. }catch (ex){}
  11. }
  12. $(".packing .exptj").click(function() {
  13. $(".addful .addwp").html("<iframe id='abccc' allowtransparency='true' frameborder='0' scrolling='auto' allowfullscreen='' mozallowfullscreen='' webkitallowfullscreen='' src='/choice/1' data-focus='true'></iframe>");
  14. $( ".addwp" ).draggable({revert: true,iframeFix:true});// revert: true,axis: "x"
  15. window.setInterval("reinitIframe()", 200);
  16. $(".addful").show();
  17. });
  18. //查找信息单价
  19. function price() {
  20. var f = "";
  21. $(".exp .datalist .select").each(function() {
  22. if($(this).prop("name") != "hairtype")
  23. {
  24. f = f + $(this).children("option:selected").val() + "-";
  25. }
  26. else
  27. {
  28. f = f + 0 + "-";
  29. }
  30. });
  31. $(".datalist .checkbox .ckrows input:checked").each(function(){
  32. f = f + $(this).val() + "-";
  33. });
  34. $(".exp .post .select").each(function() {
  35. f = f + $(this).children("option:selected").val() + "-";
  36. });
  37. $.ajax({
  38. url: "/fullorder/price/",
  39. data: "data="+f,
  40. type: "POST",
  41. dataType: "json",
  42. success: function(a) {
  43. if (a && a.success) {
  44. var ma = $(".exp input[name='money']").val()*1;
  45. var mx = a.msg['salesprice']*1;
  46. var n = $(".exp .num font").text()*1;
  47. $(".exp input[name='money']").val(mx.toFixed(2));
  48. $(".exp .tm font").html((mx*n).toFixed(2));
  49. //$(".exp input[name='money']").val((ma+mx).toFixed(2));//多条数叠加计算价格
  50. //$(".exp .tm font").html(((ma+mx)*n).toFixed(2));//多条数叠加计算价格
  51. $(".zm").append("<font class='z"+a.n+"'>"+mx.toFixed(2)+"</span>");
  52. $(".exp .purchase").text((a.msg['purchase']*1*n).toFixed(2));
  53. $(".exp .cost").text((a.msg['cost']*1*n).toFixed(2));
  54. } else {
  55. $('.exp .'+a.n).prop("checked",false);
  56. $(".ts p").html(a.msg);
  57. $(".ts").fadeIn();
  58. setTimeout('$(".ts").fadeOut()', 600);
  59. }
  60. }
  61. });
  62. /** 单选用不上,这个无成本计算
  63. else
  64. {
  65. var cname = $(this).prop("className");
  66. var ma = $(".exp input[name='money']").val()*1;
  67. var mx = $(".z"+cname).text()*1;
  68. var n = $(".exp .num font").text()*1;
  69. $(".exp input[name='money']").val((ma-mx).toFixed(2));
  70. $(".exp .tm font").html(((ma-mx)*n).toFixed(2));
  71. $(".z"+cname).remove();
  72. }
  73. **/
  74. };
  75. //关闭添加信息框
  76. function choicegb() {
  77. $(".addful",window.parent.document).hide();
  78. /**
  79. var id;
  80. if (self != top && self.frameElement && self.frameElement.tagName == "IFRAME") {
  81. var layxWindow = $(self.frameElement).parents(".layx-window");
  82. id = layxWindow.attr("id").substr(5);
  83. }
  84. parent.layx.destroy(id);
  85. **/
  86. }
  87. //提交时tr增加data信息
  88. $(".exp").on('click',".packingtj",function() {
  89. var f = "";
  90. var index = $(".cike select").find("option:selected").index();
  91. if(index == '4')
  92. {
  93. f = f + $(".cike select").children("option:selected").val() + "-";
  94. }
  95. else
  96. {
  97. $(".exp .datalist .select").each(function() {
  98. if(!$(this).parent().is(":hidden"))
  99. {
  100. f = f + $(this).children("option:selected").val() + "-";
  101. }
  102. });
  103. }
  104. $(".datalist .checkbox .ckrows input:checked").each(function(){
  105. f = f + $(this).val() + "-";
  106. });
  107. $(".exp .post .select").each(function() {
  108. f = f + $(this).children("option:selected").val() + "-";
  109. });
  110. $.ajax({
  111. url: "/weight/cx/",
  112. data: "data="+f,
  113. type: "POST",
  114. dataType: "json",
  115. success: function(a) {
  116. if (a && a.success) {
  117. packingtj(a.weight*1);
  118. }
  119. else
  120. {
  121. packingtj('0');
  122. }
  123. }
  124. });
  125. });
  126. function packingtj(weight) {
  127. var f = "";var e = "";var o = "";var checkid = "";var reg = RegExp(/ - /);
  128. var index = $(".cike select").find("option:selected").index();
  129. if(index == '4')
  130. {
  131. f = f + $(".cike select").children("option:selected").val() + "-";
  132. if($(".cike select").children("option:selected").text().match(reg))
  133. {
  134. var thistext = $(".cike select").children("option:selected").text().split(" - ");
  135. e = e + thistext[0] + " ";
  136. }
  137. }
  138. $(".exp .datalist .select").each(function() {
  139. if((($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') && index != '4') && !$(this).parent().is(":hidden"))
  140. {
  141. f = f + $(this).children("option:selected").val() + "-";
  142. if($(this).children("option:selected").text().match(reg))
  143. {
  144. var thistext = $(this).children("option:selected").text().split(" - ");
  145. e = e + thistext[0] + " ";
  146. }
  147. else
  148. {
  149. e = e + $(this).children("option:selected").text() + " ";
  150. }
  151. }
  152. });
  153. $(".exp .post .select").each(function() {
  154. if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '')
  155. {
  156. f = f + $(this).children("option:selected").val() + "-";
  157. if($(this).children("option:selected").text().match(reg))
  158. {
  159. var thistext = $(this).children("option:selected").text().split(" - ");
  160. e = e + thistext[0] + " ";
  161. }
  162. else
  163. {
  164. e = e + $(this).children("option:selected").text() + " ";
  165. }
  166. }
  167. });
  168. var checkname = "";
  169. $(".datalist .checkbox .ckrows input:checked").each(function(){
  170. checkname = $(this).attr("name");
  171. checkid = checkid + $(this).val()+",";
  172. o = o + $(this).next('font').text()+" ";
  173. });
  174. if(checkname == "" && index != '4')
  175. {
  176. $(".ts p").text($(".datalist .checkbox").prevAll("em").text()+"为必填项");
  177. $(".ts").show();
  178. setTimeout('$(".ts").fadeOut()', 600);
  179. return false;
  180. }
  181. else
  182. {
  183. f = checkid + "-" + f;
  184. e = e + o;
  185. }
  186. var ab = 0;
  187. $(".datalist .must").each(function() {
  188. if ($.trim($(this).val()).length == 0) {
  189. $(this).css("border", "1px solid #F66");
  190. ab = ab + 1;
  191. }
  192. });
  193. if (ab > 0) {
  194. $(".ts p").text("红框为必填项");
  195. $(".ts").show();
  196. setTimeout('$(".ts").fadeOut()', 600);
  197. return false;
  198. }
  199. var x = 0
  200. $(".datatext tr",window.parent.document).each(function() {
  201. if($(this).data("list") == f)
  202. {
  203. x++;
  204. }
  205. });
  206. if(x > 0)
  207. {
  208. $(".ts p").text("已有相同信息!");
  209. $(".ts").show();
  210. setTimeout('$(".ts").fadeOut()', 700);
  211. return false;
  212. }
  213. else
  214. {
  215. var ts = $(".exp .num font").text()*1
  216. var dj = $(".exp input[name='money']").val()*1;
  217. var purchasemy = $(".exp .purchase").text()*1;
  218. var costmy = $(".exp .cost").text()*1;
  219. var index = $(".cike select").find("option:selected").index();
  220. var inch = $(".datalist .checkbox .ckrows input:checked").next("font").text();//针对单选尺寸,多选需要修改
  221. //xyxg 删除这个
  222. /**
  223. $(".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 启用下面这个
  224. **/
  225. if($("input[name='mdedit']",window.parent.document).length > 0)//线下单操作界面
  226. {
  227. $(".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>");
  228. }
  229. else
  230. {
  231. $(".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>");
  232. }
  233. }
  234. //$("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1+(sl*dj)).toFixed(2));//应收价格加上新增价格
  235. //et();
  236. cost();//计算成本价
  237. window.parent.custom();
  238. choicegb();
  239. pptskc("a");//匹配特殊库存
  240. };
  241. //修改tr-data信息
  242. $(".exp").on('click',".packingxg",function() {
  243. var f = "";
  244. var index = $(".cike select").find("option:selected").index();
  245. if(index == '4')
  246. {
  247. f = f + $(".cike select").children("option:selected").val() + "-";
  248. }
  249. else
  250. {
  251. $(".exp .datalist .select").each(function() {
  252. if(!$(this).parent().is(":hidden"))
  253. {
  254. f = f + $(this).children("option:selected").val() + "-";
  255. }
  256. });
  257. }
  258. if(index!= '4')
  259. {
  260. $(".datalist .checkbox .ckrows input:checked").each(function(){
  261. f = f + $(this).val() + "-";
  262. });
  263. }
  264. $(".exp .post .select").each(function() {
  265. f = f + $(this).children("option:selected").val() + "-";
  266. });
  267. $.ajax({
  268. url: "/weight/cx/",
  269. data: "data="+f,
  270. type: "POST",
  271. dataType: "json",
  272. success: function(a) {
  273. if (a && a.success) {
  274. packingxg(a.weight*1);
  275. }
  276. else
  277. {
  278. packingxg('0');
  279. }
  280. }
  281. });
  282. });
  283. function packingxg(weight) {
  284. var f = "";var e = "";var o = "";var checkid = "";var reg = RegExp(/ - /);
  285. var index = $(".cike select").find("option:selected").index();
  286. if(index == '4')
  287. {
  288. f = f + $(".cike select").children("option:selected").val() + "-";
  289. if($(".cike select").children("option:selected").text().match(reg))
  290. {
  291. var thistext = $(".cike select").children("option:selected").text().split(" - ");
  292. e = e + thistext[0] + " ";
  293. }
  294. }
  295. $(".exp .datalist .select").each(function() {
  296. if((($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '') && index != '4') && !$(this).parent().is(":hidden"))
  297. {
  298. f = f + $(this).children("option:selected").val() + "-";
  299. if($(this).children("option:selected").text().match(reg))
  300. {
  301. var thistext = $(this).children("option:selected").text().split(" - ");
  302. e = e + thistext[0] + " ";
  303. }
  304. else
  305. {
  306. e = e + $(this).children("option:selected").text() + " ";
  307. }
  308. }
  309. });
  310. $(".exp .post .select").each(function() {
  311. if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '')
  312. {
  313. f = f + $(this).children("option:selected").val() + "-";
  314. if($(this).children("option:selected").text().match(reg))
  315. {
  316. var thistext = $(this).children("option:selected").text().split(" - ");
  317. e = e + thistext[0] + " ";
  318. }
  319. else
  320. {
  321. e = e + $(this).children("option:selected").text() + " ";
  322. }
  323. }
  324. });
  325. var checkname = "";
  326. if(index!= '4')
  327. {
  328. $(".datalist .checkbox .ckrows input:checked").each(function(){
  329. checkname = $(this).attr("name");
  330. checkid = checkid + $(this).val()+",";
  331. o = o + $(this).next('font').text()+" ";
  332. });
  333. }
  334. if(checkname == "" && index != '4')
  335. {
  336. $(".ts p").text($(".datalist .checkbox").prevAll("em").text()+"为必填项");
  337. $(".ts").show();
  338. setTimeout('$(".ts").fadeOut()', 600);
  339. return false;
  340. }
  341. else
  342. {
  343. f = checkid + "-" + f;
  344. e = e + o;
  345. }
  346. var ab = 0;
  347. $(".datalist .must").each(function() {
  348. if ($.trim($(this).val()).length == 0) {
  349. $(this).css("border", "1px solid #F66");
  350. ab = ab + 1;
  351. }
  352. });
  353. if (ab > 0) {
  354. $(".ts p").text("红框为必填项");
  355. $(".ts").show();
  356. setTimeout('$(".ts").fadeOut()', 600);
  357. return false;
  358. }
  359. var x = 0
  360. $(".datatext tr",window.parent.document).each(function() {
  361. if($(this).data("list") == f && !$(this).is(".on"))
  362. {
  363. x++;
  364. }
  365. });
  366. if(x > 0)
  367. {
  368. $(".ts p").text("已有相同信息!");
  369. $(".ts").show();
  370. setTimeout('$(".ts").fadeOut()', 700);
  371. return false;
  372. }
  373. //var ts = $(".datalist .checkbox .ckrows input:checked").length*1;
  374. var ts = $(".exp .num font").text()*1
  375. var dj = $(".exp input[name='money']").val()*1;
  376. var purchasemy = $(".exp .purchase").text()*1;
  377. var costmy = $(".exp .cost").text()*1;
  378. $(".datatext tr.on",window.parent.document).attr("data-list",f);
  379. //var xg = $(".datatext tr.on td:eq(8)").text()*1;
  380. // $("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1+((sl*dj)-xg)).toFixed(2));
  381. // et();
  382. var inch = $(".datalist .checkbox .ckrows input:checked").next("font").text();//针对单选尺寸,多选需要修改
  383. //xyxg 删除这个
  384. /**
  385. $(".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 启用下面这个
  386. **/
  387. if($("input[name='mdedit']",window.parent.document).length > 0)//线下单操作界面
  388. {
  389. $(".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>");
  390. }
  391. else
  392. {
  393. $(".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
  394. }
  395. cost();//计算成本价
  396. window.parent.custom();
  397. choicegb();
  398. pptskc("a");//匹配特殊库存
  399. };
  400. //修改数量
  401. $(".exp .lengththree .gz").click(function() {
  402. var num = $(".exp .num font").text()*1;
  403. var dj = $(".exp input[name='money']").val()*1;
  404. $(".exp .num font").text(num+1);
  405. if(dj > 0)
  406. {
  407. $(".exp .tm font").text((dj*(num+1)).toFixed(2));
  408. }
  409. });
  410. $(".exp .lengththree .gj").click(function() {
  411. var num = $(".exp .num font").text()*1;
  412. var dj = $(".exp input[name='money']").val()*1;
  413. if(num > 1)
  414. {
  415. $(".exp .num font").text(num-1)*1;
  416. if(dj > 0)
  417. {
  418. $(".exp .tm font").text((dj*(num-1)).toFixed(2));
  419. }
  420. }
  421. });
  422. //点击增加信息是增加标记
  423. $(".datatext").on('click',"tr",function() {
  424. $(".datatext tr").removeClass("on");
  425. $(this).addClass("on");
  426. });
  427. //删除信息
  428. $(".packing .expsc").click(function() {
  429. var b = 0;
  430. $(".packing .datatext .on").each(function() {
  431. b = b+1;
  432. });
  433. if (b>1)
  434. {
  435. $(".ts p").html("每次只可删除一条内容");
  436. $(".ts").show();
  437. setTimeout('$(".ts").fadeOut()', 1000);
  438. }
  439. else if(b<1)
  440. {
  441. $(".ts p").html("请选择需要删除的内容");
  442. $(".ts").show();
  443. setTimeout('$(".ts").fadeOut()', 1000);
  444. }
  445. else
  446. {
  447. // var xg = $(".datatext tr.on td:eq(8)").text()*1;
  448. //$("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1-xg).toFixed(2));et();
  449. $(".packing .datatext .on").remove();
  450. }
  451. costz();//计算成本价
  452. window.parent.custom();
  453. });
  454. //统一修改币种
  455. $("#currency").change(function(){
  456. var index = $(this).find("option:selected").text();
  457. var va = $(this).find("option:selected").val();
  458. $(".currency").text(index);
  459. $(".datatext tr").each(function() {
  460. //$(this).find("td:eq(9)").text(index);
  461. });
  462. });
  463. //fullorder 数据库增加currency币种 考虑更改币种是否需要ajax获取美元汇率更改金额
  464. $(".packing .expxg").click(function() {
  465. var b = 0;
  466. $(".packing .datatext .on").each(function() {
  467. b = b+1;
  468. });
  469. if (b>1)
  470. {
  471. $(".ts p").html("每次只可修改一条内容");
  472. $(".ts").show();
  473. setTimeout('$(".ts").fadeOut()', 1000);
  474. }
  475. else if(b<1)
  476. {
  477. $(".ts p").html("请选择需要修改的内容");
  478. $(".ts").show();
  479. setTimeout('$(".ts").fadeOut()', 1000);
  480. }
  481. else
  482. {
  483. $(".addful .addwp").html("<iframe id='abccc' allowtransparency='true' frameborder='0' scrolling='auto' allowfullscreen='' mozallowfullscreen='' webkitallowfullscreen='' src='/choice/2' data-focus='true'></iframe>");
  484. $( ".addwp" ).draggable({ revert: true,axis: "x" });
  485. window.setInterval("reinitIframe()", 200);
  486. $(".addful").show();
  487. }
  488. });
  489. //自动显示option
  490. function option() {
  491. var index = $(".cike select").find("option:selected").index();
  492. $(".pttab li").hide(); $(".pttab li").removeClass("post");
  493. $("."+index).show();$(".none"+index).hide();$("."+index).addClass("post");
  494. $('.pttab select option:eq(0)').prop('selected','selected');
  495. if(index == 1)
  496. {
  497. $(".pttab .a1").show();$(".pttab .a2").hide();
  498. }
  499. if(index == 4)
  500. {
  501. $(".Gift").hide();
  502. $(".none"+index).hide();
  503. }
  504. else
  505. {
  506. $(".Gift").show();
  507. $(".none4").show();
  508. }
  509. if(index == 5)
  510. {
  511. $(".Accessories").hide();
  512. }
  513. else if(index == 2)
  514. {
  515. $(".ycwigs").hide();
  516. }
  517. else if(index == 3)
  518. {
  519. $(".Extension").hide();
  520. }
  521. else if(index == 6 || index == 7)
  522. {
  523. $(".synthetic").hide();
  524. if(index == 7)
  525. {
  526. $(".synthetichair").show();
  527. }
  528. }
  529. var indexb = $(".cikeb.post select").find("option:selected").val();
  530. $(".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");
  531. if(indexb == 195)
  532. {
  533. $(".pttab .a1").show();$(".pttab .a1").addClass("post");
  534. }
  535. else if(indexb == 197)
  536. {
  537. $(".pttab .a2").show();$(".pttab .a2").addClass("post");
  538. }
  539. /**
  540. if(indexb == 0)
  541. {
  542. $(".pttab .a1").show();$(".pttab .a1").addClass("post");
  543. }
  544. else if(indexb == 1)
  545. {
  546. $(".pttab .a4").show();$(".pttab .a4").addClass("post");
  547. }
  548. else if(indexb == 2)
  549. {
  550. $(".pttab .a2").show();$(".pttab .a2").addClass("post");
  551. }
  552. else if(indexb == 4)
  553. {
  554. $(".pttab .a3").show();$(".pttab .a3").addClass("post");
  555. }
  556. **/
  557. }
  558. $("select[name='ioss']").change(function() {
  559. var io = $(this).find("option:selected").val();
  560. var gj =$("select[name='express']").find("option:selected").val();
  561. if( (![66,67].includes(gj*1)) && io == 'IOSS243131124412071487821'){
  562. layx.alert('提示','该物流方式不可选用IOSS号!',null,{dialogIcon:'error'});
  563. $("select[name=ioss]").find("option[value='']").prop("selected","selected");
  564. }
  565. });
  566. $("select[name='country']").change(function() {
  567. $("select[name=productdescription]").html("");
  568. $("input[name=customs]").val("0");
  569. //express() 暂时固定运费为20USD 不在查找设置价格
  570. dhl_r_tax_id();
  571. printtype();
  572. });
  573. $("select[name='express']").change(function() {
  574. var gj = $(this).find("option:selected").val();
  575. if(gj == 2)
  576. {
  577. $(".zzldw").html("oz");
  578. }
  579. else
  580. {
  581. $("select[name=ioss]").find("option[value='']").prop("selected","selected");
  582. $(".zzldw").html("kg");
  583. }
  584. $("select[name=productdescription]").html("");
  585. $("input[name=customs]").val("0");
  586. eqm($(this).find("option:selected").val());
  587. dhl_r_tax_id()
  588. //express() 暂时固定运费为20USD 不在查找设置价格
  589. //printtype();暂时不用
  590. //快递变动引发申报品名变动
  591. let tmp_sbpm = $("select[name=express]").find("option:selected").data('sbpm');
  592. if(tmp_sbpm){
  593. if(tmp_sbpm.length > 0){
  594. $("select[name=sbpm]").val(tmp_sbpm).trigger('change')
  595. }
  596. }
  597. var type = $(this).find("option:selected").data("type");
  598. $("select[name=printtype]").find("option[value='"+type+"']").prop("selected","selected");
  599. //type();
  600. let xxts = $("select[name=express]").find("option:selected").data('ts');
  601. if(xxts){
  602. $("#show_express").css("display","inline-block")
  603. showExpressTiShi(xxts)
  604. }
  605. });
  606. function eqm(id) {
  607. // if(id == '24' || id == '31' || id == '2')//联邦的话替换签名选项
  608. // {
  609. // $("select[name='qm']").html('<option value="0" selected="selected">默认</option><option value="1">成人签名</option>');
  610. // }
  611. // else
  612. // {
  613. // $("select[name='qm']").html('<option value="0" selected="selected">无</option>');//<option value="1">需要</option>
  614. // }
  615. if(id == '24' || id == '31' )//联邦的话替换签名选项
  616. {
  617. $("select[name='qm']").html('<option value="0" selected="selected">默认</option><option value="1">成人签名</option>');
  618. }
  619. else if(id == '2'){
  620. $("select[name='qm']").html('<option value="0" selected="selected">默认</option><option value="1">签名</option>');
  621. }
  622. else
  623. {
  624. $("select[name='qm']").html('<option value="0" selected="selected">无</option>');//<option value="1">需要</option>
  625. }
  626. if(id == '2' || id == '64')//联邦的话替换签名选项
  627. {
  628. $("select[name='js']").html('<option value="0">Ground Advantage</option><option value="1">PRIORITY</option><option value="2">EXPRESS</option>');
  629. }
  630. else if(id == 1){
  631. $("select[name='js']").html('<option value="5">无</option><option value="6">从发件方付税</option>');
  632. }
  633. else
  634. {
  635. $("select[name='js']").html('<option value="0" selected="selected">无</option>');//<option value="1">需要</option>
  636. }
  637. //在这里添加服务类型为 一个是ip 一个是ficp
  638. if(id == '24' || id == '31'){
  639. $("select[name='js']").html(
  640. '<option selected="selected" value="4">FICP</option><option value="3" hidden>IP</option>'
  641. );
  642. }
  643. }
  644. //dhl 是 巴西或者墨西哥的时候需要怼收件人税号
  645. function dhl_r_tax_id(){
  646. let express_id = $("select[name='express']").val();
  647. let country = $("select[name='country']").val();
  648. if((country == 119)){
  649. if(express_id == 1){
  650. $(".r_tax_id").removeClass('none')
  651. }else{
  652. $(".r_tax_id").addClass('none')
  653. }
  654. }else{
  655. $(".r_tax_id").addClass('none')
  656. }
  657. }
  658. $("select[name='printtype']").change(function() {
  659. $("select[name=productdescription]").html("");
  660. $("input[name=customs]").val("0");
  661. printtype();
  662. });
  663. //打印类型
  664. function printtype() {
  665. var index = $("select[name='printtype']").find("option:selected").index();
  666. if(index == 0)
  667. {
  668. var e = $("select[name=express]").find("option:selected").val();
  669. var c = $("select[name=country]").find("option:selected").val();
  670. var sjsz = 0;
  671. min = Math.ceil(10);
  672. max = Math.floor(50);
  673. sjsz = Math.floor(Math.random() * (max - min + 1)) + min;
  674. var ul = "http";
  675. var protocol = window.location.protocol;
  676. if (protocol === 'https:') {
  677. ul = ul+"s://"+"1.wepolicy.cn";
  678. } else {
  679. ul = ul+"://a"+sjsz+".wepolicy.cn";;
  680. }
  681. var customs = $.ajax({
  682. url: ul+"/fullorder/customs/",
  683. data: "e="+e+"&c="+c,
  684. type: "POST",
  685. dataType: "json",
  686. success: function(a) {
  687. if (a && a.success) {
  688. $("input[name=customs]").val(a.money);
  689. for(i=0;i<a.msg.length;i++)
  690. {
  691. $("select[name=productdescription]").append("<option value='"+a.msg[i]['id']+"'>"+a.msg[i]['title']+"</option>");
  692. }
  693. $(".productdescription").show();
  694. $(".customs").show();
  695. }
  696. /** 无快递信息配置时提示框
  697. else {
  698. $(".productdescription").hide();
  699. $(".customs").hide();
  700. $(".ts p").html(a.msg);
  701. $(".ts").fadeIn();
  702. setTimeout('$(".ts").fadeOut()', 800);
  703. }
  704. **/
  705. }
  706. });
  707. }
  708. else
  709. {
  710. $(".productdescription").hide();
  711. $(".customs").hide();
  712. }
  713. }
  714. function pptskc(pptskccs) {
  715. if(pptskccs == "a")
  716. {
  717. var w = "";var number = $("input[name='number']",window.parent.document).val();
  718. $(".datatext tr",window.parent.document).each(function() {
  719. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  720. var cc = list.split(",");
  721. w = w + cc[1] + '|';
  722. });
  723. var wl = '';
  724. $(".datatext tr",window.parent.document).each(function()
  725. {
  726. var cc = "";var listqc = "";var data = "";var t = "";var fpdg = "";
  727. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  728. cc = list.split(",");
  729. listqc = list.replace(/\d{1,3}\,/,'');
  730. listqc = listqc.substring(0,listqc.length-1);
  731. data = listqc.split("-");
  732. var zrflx = 0;//是否有真人发类型
  733. for(i=1;i<data.length;i++)
  734. {
  735. if(i == 2)
  736. {
  737. //if(data[i] == 2090)
  738. if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
  739. {
  740. zrflx++;
  741. t = t +data[i];
  742. fpdg = fpdg + '-' + data[i];
  743. }
  744. else
  745. {
  746. if(cc[0] != list)
  747. {
  748. t = t +data[i] + cc[0];
  749. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  750. }
  751. else
  752. {
  753. t = t +data[i];
  754. fpdg = fpdg + '-' + data[i];
  755. }
  756. }
  757. }
  758. else if(i == 3 && zrflx > 0)
  759. {
  760. if(cc[0] != list)
  761. {
  762. t = t +data[i] + cc[0];
  763. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  764. }
  765. else
  766. {
  767. t = t +data[i];
  768. fpdg = fpdg + '-' + data[i];
  769. }
  770. }
  771. else
  772. {
  773. t = t +data[i];
  774. fpdg = fpdg + '-' + data[i];
  775. }
  776. }
  777. wl = wl + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|';
  778. })
  779. var sjsz = 0;
  780. min = Math.ceil(10);
  781. max = Math.floor(50);
  782. sjsz = Math.floor(Math.random() * (max - min + 1)) + min;
  783. var ul = "http";
  784. var protocol = window.location.protocol;
  785. if (protocol === 'https:') {
  786. ul = ul+"s://"+"1.wepolicy.cn";
  787. } else {
  788. ul = ul+"://a"+sjsz+".wepolicy.cn";;
  789. }
  790. var ppkc = $.ajax({
  791. url: ul+"/specialstock/ppkc/1",
  792. data: "data="+w+"&number="+number+"&whlabel=|"+wl,
  793. type: "POST",
  794. dataType: "json",
  795. success: function(a) {
  796. if (a && a.success)
  797. {
  798. for(i=0;i<a.list.length;i++)
  799. {
  800. $(".datatext tr:eq("+a.list[i][0]+") td:eq(0) span",window.parent.document).remove();
  801. console.log($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)",window.parent.document).text());
  802. if($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)",window.parent.document).text().indexOf("z") != -1)
  803. {
  804. $(".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>");//特殊库存
  805. }
  806. else
  807. {
  808. $(".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>");//特殊库存
  809. $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)",window.parent.document).css("color","#C3C");
  810. }
  811. }
  812. }
  813. }
  814. });
  815. }
  816. else
  817. {
  818. var w = "";var c = "";var number = $("input[name='number']").val();
  819. $(".datatext tr").each(function() {
  820. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  821. var cc = list.split(",");
  822. w = w + cc[1] + '|';
  823. c = c + list + '|';
  824. });
  825. var wl = '';
  826. $(".datatext tr").each(function() {
  827. var cc = "";var listqc = "";var data = "";var t = "";var fpdg = "";
  828. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  829. cc = list.split(",");
  830. listqc = list.replace(/\d{1,3}\,/,'');
  831. listqc = listqc.substring(0,listqc.length-1);
  832. data = listqc.split("-");
  833. var zrflx = 0;//是否有真人发类型
  834. for(i=1;i<data.length;i++)
  835. {
  836. if(i == 2)
  837. {
  838. //if(data[i] == 2090)
  839. if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
  840. {
  841. zrflx++;
  842. t = t +data[i];
  843. fpdg = fpdg + '-' + data[i];
  844. }
  845. else
  846. {
  847. if(cc[0] != list)
  848. {
  849. t = t +data[i] + cc[0];
  850. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  851. }
  852. else
  853. {
  854. t = t +data[i];
  855. fpdg = fpdg + '-' + data[i];
  856. }
  857. }
  858. }
  859. else if(i == 3 && zrflx > 0)
  860. {
  861. if(cc[0] != list)
  862. {
  863. t = t +data[i] + cc[0];
  864. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  865. }
  866. else
  867. {
  868. t = t +data[i];
  869. fpdg = fpdg + '-' + data[i];
  870. }
  871. }
  872. else
  873. {
  874. t = t +data[i];
  875. fpdg = fpdg + '-' + data[i];
  876. }
  877. }
  878. wl = wl + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|';
  879. })
  880. var ppkc = $.ajax({
  881. url: "/specialstock/ppkc/",
  882. data: "data="+w+"&number="+number+"&whlabel=|"+wl,
  883. type: "POST",
  884. dataType: "json",
  885. success: function(a) {
  886. if (a && a.success)
  887. {
  888. for(i=0;i<a.list.length;i++)
  889. {
  890. if($(".datatext tr:eq("+a.list[i][0]+") td:eq(9)").text().indexOf("z") != -1)
  891. {
  892. $(".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>");//特殊库存
  893. }
  894. else
  895. {
  896. $(".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>");//特殊库存
  897. $(".datatext tr:eq("+a.list[i][0]+") td:eq(0)").css("color","#C3C");
  898. }
  899. }
  900. }
  901. }
  902. });
  903. var sjsz = 0;
  904. min = Math.ceil(10);
  905. max = Math.floor(50);
  906. sjsz = Math.floor(Math.random() * (max - min + 1)) + min;
  907. var ul = "http";
  908. var protocol = window.location.protocol;
  909. if (protocol === 'https:') {
  910. ul = ul+"s://"+"1.wepolicy.cn";
  911. } else {
  912. ul = ul+"://a"+sjsz+".wepolicy.cn";;
  913. }
  914. //预先判断库存仓
  915. var kcpd = $.ajax({
  916. url: ul+"/warehouse/kcpd/",
  917. 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(),
  918. type: "POST",
  919. dataType: "json",
  920. success: function(a) {
  921. if (a && a.success)
  922. {
  923. $(".packing").append("<p style='padding-top:10px;text-align: center;color:#F00'>"+a.msg+"</p>");
  924. }
  925. }
  926. });
  927. }
  928. }
  929. $(".datatext").on('click',"tr span",function() {
  930. var btnTarget= document.getElementById($(this).attr("id"));
  931. var xzid = $(this).parents("tr").find("td:eq(9)").text();
  932. var winform = layx.iframe('float-bottom','可选择的产品','/specialstock/list/'+$(this).data("id")+'/'+$("input[name=number]").val()+"/"+xzid,{
  933. floatTarget:btnTarget, // 被吸附的DOM对象 特殊/现货产品窗口
  934. shadable:true,
  935. escKey:false,
  936. control:false,
  937. icon:false,
  938. width:870,
  939. height:300,
  940. alwaysOnTop:true,
  941. floatDirection: 'bottom', // 设置方向
  942. event:{
  943. ondestroy: {
  944. before: function (layxWindow, winform, params, inside,escKey) {
  945. if(inside===false){
  946. layx.visual(winform.id,false); // 隐藏窗口
  947. layx.updateFloatWinPosition(winform.id);
  948. return false;
  949. }
  950. }
  951. },
  952. onexist: function (layxWindow, winform) {
  953. layx.visual(winform.id,true); // 显示窗口
  954. }
  955. }
  956. });
  957. });
  958. /**
  959. $("select[name='warehouse']").change(function() {
  960. type();
  961. });
  962. function express() {
  963. var e = $("select[name=express]").find("option:selected").val();
  964. var c = $("select[name=country]").find("option:selected").val();
  965. $.ajax({
  966. url: "/fullorder/express/",
  967. data: "e="+e+"&c="+c,
  968. type: "POST",
  969. dataType: "json",
  970. success: function(a) {
  971. if (a && a.success) {
  972. $("input[name=expressmoney]").val(a.money);//?这里或许需要根据币种美元转换
  973. } else {
  974. $("input[name=expressmoney]").val("0.00");
  975. }
  976. }
  977. });
  978. }
  979. function type() {
  980. var t = $("select[name=express]").find("option:selected").val();
  981. var c = $("select[name=warehouse]").find("option:selected").val();
  982. $.ajax({
  983. url: "/fullorder/expresstype/",
  984. data: "id="+t,
  985. type: "POST",
  986. dataType: "json",
  987. success: function(a) {
  988. if (a && a.success) {
  989. $("select[name=printtype]").find("option[value='"+a.msg+"']").prop("selected","selected");
  990. }
  991. }
  992. });
  993. }
  994. **/
  995. $(".lengththree input[name='money']").bind("change",function(){
  996. var ma= $(this).val();
  997. var n = $(".exp .num font").text()*1;
  998. $(".exp .tm font").html((ma*n).toFixed(2));
  999. });
  1000. //整体提交数据
  1001. $(".fullorderdata").click(function() {
  1002. $(".addful").hide();
  1003. var f = "";
  1004. var e = "";
  1005. var w = "";
  1006. var fpcount = "";
  1007. $(".need .select").each(function() {
  1008. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1009. });
  1010. $(".need input:text").each(function() {
  1011. str2 = $(this).val().replace(/\</g,"&lt;");
  1012. str2 = str2.replace(/\>/g,"&gt;");
  1013. str2 = str2.replace(/\+/g,"%2B");
  1014. str2 = str2.replace(/&/g,"%26");
  1015. f = f + $(this).attr("name") + "=" + str2 + "&";
  1016. });
  1017. $(".need input:hidden").each(function() {
  1018. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1019. });
  1020. $(".need textarea").each(function() {
  1021. str2 = $(this).val().replace(/\</g,"&lt;");
  1022. str2 = str2.replace(/\>/g,"&gt;");
  1023. str2 = str2.replace(/\+/g,"%2B");
  1024. str2 = str2.replace(/&/g,"%26");
  1025. f = f + $(this).attr("name") + "=" + encodeURI(str2) + "&";
  1026. });
  1027. var tdweight = 0;
  1028. $(".datatext tr").each(function() {
  1029. var cc = "";var listqc = "";var data = "";var t = "";var fpdg = "";
  1030. var td0 = $(this).find("td:eq(0)").text().replace(/\+/g,"%2B");
  1031. var td0 = td0.replace(/&/g,"%26");
  1032. var td8 = '';
  1033. if($(this).find("td:eq(8)").length > 0)
  1034. {
  1035. if($(this).find("td:eq(8)").text() == '')
  1036. {
  1037. td8 = '0';
  1038. }
  1039. else
  1040. {
  1041. td8 = $(this).find("td:eq(8)").text();
  1042. }
  1043. }
  1044. else
  1045. {
  1046. td8 = '0';
  1047. }
  1048. 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() + ";";
  1049. tdweight = tdweight + td8*1;
  1050. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  1051. cc = list.split(",");
  1052. listqc = list.replace(/\d{1,3}\,/,'');
  1053. listqc = listqc.substring(0,listqc.length-1);
  1054. data = listqc.split("-");
  1055. var zrflx = 0;//是否有真人发类型
  1056. for(i=1;i<data.length;i++)
  1057. {
  1058. if(i == 2)
  1059. {
  1060. //if(data[i] == 2090)
  1061. if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) ||(data[i] == 2469))
  1062. {
  1063. zrflx++;
  1064. t = t +data[i];
  1065. fpdg = fpdg + '-' + data[i];
  1066. }
  1067. else
  1068. {
  1069. if(cc[0] != list)
  1070. {
  1071. t = t +data[i] + cc[0];
  1072. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  1073. }
  1074. else
  1075. {
  1076. t = t +data[i];
  1077. fpdg = fpdg + '-' + data[i];
  1078. }
  1079. }
  1080. }
  1081. else if(i == 3 && zrflx > 0)
  1082. {
  1083. if(cc[0] != list)
  1084. {
  1085. t = t +data[i] + cc[0];
  1086. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  1087. }
  1088. else
  1089. {
  1090. t = t +data[i];
  1091. fpdg = fpdg + '-' + data[i];
  1092. }
  1093. }
  1094. else
  1095. {
  1096. t = t +data[i];
  1097. fpdg = fpdg + '-' + data[i];
  1098. }
  1099. }
  1100. if(t == '')
  1101. {
  1102. $(".ts p").text("商品信息错误!");
  1103. $(".ts").show();
  1104. setTimeout('$(".ts").fadeOut()', 800);
  1105. $.exit();
  1106. }
  1107. if($(this).find("td:eq(1)").text() < 1)
  1108. {
  1109. $(".ts p").text("商品数量错误!");
  1110. $(".ts").show();
  1111. setTimeout('$(".ts").fadeOut()', 800);
  1112. $.exit();
  1113. }
  1114. w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|';
  1115. fpcount = fpcount + fpdg + '-|';
  1116. });
  1117. f = f + "jweight=" + tdweight + "&";
  1118. e = e.replace(/(有可用特殊库存|已选择特殊库存|有可用现货库存|已选择现货库存|已选择库存)/g,'');
  1119. f = f + "whlabel=|" + w + "&fpdata=" + encodeURI(e) + "&";
  1120. f = f + "fpcount=" + fpcount + "&";
  1121. f = f + "budget=" + $(".budget").text() + "&";
  1122. var ab = 0;
  1123. $(".need .must").each(function() {
  1124. if ($.trim($(this).val()).length == 0) {
  1125. $(this).css("border", "1px solid #F66");
  1126. ab = ab + 1;
  1127. }
  1128. });
  1129. if (ab > 0) {
  1130. $(".ts p").text("红框为必填项");
  1131. $(".ts").show();
  1132. setTimeout('$(".ts").fadeOut()', 600);
  1133. return false;
  1134. }
  1135. //限制必须提交产品详细列表
  1136. if (e == '') {
  1137. $(".ts p").text("必须添加订单详细信息!");
  1138. $(".ts").show();
  1139. setTimeout('$(".ts").fadeOut()', 800);
  1140. return false;
  1141. }
  1142. else
  1143. {
  1144. /**
  1145. if($("select[name=warehouse]").find("option:selected").val() == "5" || $("select[name=warehouse]").find("option:selected").val() == "6")
  1146. {
  1147. var yzdata = {
  1148. warehouse: $("select[name=warehouse]").find("option:selected").val(),
  1149. shop: $("input[name=shop]").val(),
  1150. id: $("input[name=id]").val(),
  1151. whlabel: "|" + w
  1152. };
  1153. $.ajax({
  1154. url: "/ck/kcyz/",//xyxg 修改为/ck/kcyz/
  1155. data: yzdata,
  1156. type: "POST",
  1157. dataType: "json",
  1158. success: function(a) {
  1159. if (a && a.success) {
  1160. zttj(f);
  1161. } else {
  1162. if(a.t == 1)
  1163. {
  1164. layx.alert('错误',a.msg,function(id,button){
  1165. },{dialogIcon:'error'});
  1166. }
  1167. else
  1168. {
  1169. layx.alert('错误',a.msg,function(id,button){
  1170. },{dialogIcon:'error'});
  1171. for(i=0;i<a.error.length;i++)
  1172. {
  1173. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  1174. }
  1175. }
  1176. }
  1177. }
  1178. });
  1179. }
  1180. else
  1181. {
  1182. zttj(f);
  1183. }
  1184. **/
  1185. //zttj(f);
  1186. //根据实际需求先将 执行判断 后期提交 其实可以直接写再这里 但是这个方法 太长了 所以另开一个方法写
  1187. checkOrderShowNotice(f);
  1188. }
  1189. });
  1190. function zttj(f){
  1191. layx.load('loadId','数据提交中,请稍后');
  1192. $.ajax({
  1193. url: addedit,
  1194. data: f,
  1195. type: "POST",
  1196. dataType: "json",
  1197. timeout: 30000,
  1198. success: function(a) {
  1199. layx.destroy('loadId');
  1200. if (a && a.success) {
  1201. $(".express p:eq(0)").html(a.msg);
  1202. $(".express p:eq(1)").html("<font class='fh' data-id='"+a.id+"'>确 定</font>");
  1203. $(".express").show();
  1204. } else {
  1205. var old = a.oldwhlabel;
  1206. //$("select[name=warehouse] option:eq(0)").prop('selected','selected');
  1207. if(a.t == 2)
  1208. {
  1209. layx.alert('错误',a.msg,function(id,button){
  1210. },{dialogIcon:'error'});
  1211. for(i=0;i<a.error.length;i++)
  1212. {
  1213. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  1214. }
  1215. }
  1216. else
  1217. {
  1218. layx.destroy('loadId');
  1219. $(".ts p").html(a.msg);
  1220. $(".ts").fadeIn();
  1221. setTimeout('$(".ts").fadeOut()', 2000);
  1222. }
  1223. }
  1224. },
  1225. error: function(textStatus) {
  1226. layx.destroy('loadId');
  1227. layx.alert('错误', '提交超时,请重试', function(id, button) {
  1228. $(".search span").click();
  1229. }, { dialogIcon: 'error' });
  1230. },
  1231. });
  1232. }
  1233. //关联总金额换算穿预计到帐金额
  1234. $("input[name='shouldmoney']").bind("change",function(){
  1235. et();
  1236. });
  1237. function et(){
  1238. var ma= $("input[name='shouldmoney']").val();
  1239. if(ma > 0)
  1240. {
  1241. var n= $("input[name='et']").val();
  1242. $(".currencymoney").text(eval(ma+n).toFixed(2));
  1243. }
  1244. else
  1245. {
  1246. $(".currencymoney").text(0);
  1247. }
  1248. }
  1249. //计算成本金额,子页面用
  1250. function cost(){
  1251. var purchasemoney = 0;var costmoney = 0;
  1252. $(".datatext tr",window.parent.document).each(function() {
  1253. purchasemoney = purchasemoney+$(this).find("td:eq(6)").text()*1;
  1254. costmoney = costmoney+$(this).find("td:eq(7)").text()*1;
  1255. });
  1256. $("input[name='purchase']",window.parent.document).val(purchasemoney.toFixed(2));
  1257. $("input[name='cost']",window.parent.document).val(costmoney.toFixed(2));
  1258. //$("li b .zlr").html(($("li .budget").html()*1-money).toFixed(2));//总利润
  1259. }
  1260. //计算成本金额,自页面用
  1261. function costz(){
  1262. var purchasemoney = 0;var costmoney = 0;
  1263. $(".datatext tr").each(function() {
  1264. purchasemoney = purchasemoney+$(this).find("td:eq(6)").text()*1;
  1265. costmoney = costmoney+$(this).find("td:eq(7)").text()*1;
  1266. });
  1267. $("input[name='purchase']").val(purchasemoney.toFixed(2));
  1268. $("input[name='cost']").val(costmoney.toFixed(2));
  1269. //$("li b .zlr").html(($("li .budget").html()*1-money).toFixed(2));//总利润
  1270. }
  1271. $(".power").click(function() {
  1272. layx.confirm('重置选择','确定重置此订单?',function(id){
  1273. $.ajax({
  1274. url: fh+"/power/",
  1275. data: "id="+$("input[name='id']").val(),
  1276. type: "POST",
  1277. dataType: "json",
  1278. success: function(a) {
  1279. layx.destroy(id);
  1280. if (a && a.success) {
  1281. $(".express p:eq(0)").html(a.msg);
  1282. $(".express p:eq(1)").html("<font class='fh'>确 定</font>");
  1283. $(".express").show();
  1284. } else {
  1285. $(".ts p").html(a.msg);
  1286. $(".ts").fadeIn();
  1287. setTimeout('$(".ts").fadeOut()', 800);
  1288. }
  1289. }
  1290. });
  1291. layx.destroy(id);
  1292. },{shadable:0.6,dialogIcon:'help'});
  1293. });
  1294. //验证库存
  1295. $("select[name=warehouse]").change(function(){
  1296. var czw = $(this).find("option:selected").val();
  1297. cze = $(this).find("option:selected").data("e");
  1298. $.ajax({
  1299. url: "/warehouse/list/",
  1300. data: "id="+czw,
  1301. type: "POST",
  1302. dataType: "json",
  1303. success: function(a) {
  1304. if (a && a.success) {
  1305. if(a.msg == "1")
  1306. {
  1307. var w = "";
  1308. $(".datatext tr").each(function() {
  1309. var cc = "";var listqc = "";var data = "";var t = "";
  1310. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  1311. cc = list.split(",");
  1312. listqc = list.replace(/\d{1,3}\,/,'');
  1313. listqc = listqc.substring(0,listqc.length-1);
  1314. data = listqc.split("-");
  1315. var zrflx = 0;//是否有真人发类型
  1316. for(i=1;i<data.length;i++)
  1317. {
  1318. if(i == 2)
  1319. {
  1320. if((data[i] == 2090)||(data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
  1321. {
  1322. zrflx++;
  1323. t = t +data[i];
  1324. }
  1325. else
  1326. {
  1327. if(cc[0] != list)
  1328. {
  1329. t = t +data[i] + cc[0];
  1330. }
  1331. else
  1332. {
  1333. t = t +data[i];
  1334. }
  1335. }
  1336. }
  1337. else if(i == 3 && zrflx > 0)
  1338. {
  1339. if(cc[0] != list)
  1340. {
  1341. t = t +data[i] + cc[0];
  1342. }
  1343. else
  1344. {
  1345. t = t +data[i];
  1346. }
  1347. }
  1348. else
  1349. {
  1350. t = t +data[i];
  1351. }
  1352. }
  1353. w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|';
  1354. });
  1355. //alert(w)
  1356. var yzdata = {
  1357. warehouse: czw,
  1358. shop: $("input[name=shop]").val(),
  1359. id: $("input[name=id]").val(),
  1360. number: $("input[name=number]").val(),
  1361. state: $("select[name=state]").find("option:selected").val(),
  1362. whlabel: "|" + w
  1363. };
  1364. $.ajax({
  1365. url: "/ck/kcyz/",//xyxg 修改为/ck/kcyz/
  1366. data: yzdata,
  1367. type: "POST",
  1368. dataType: "json",
  1369. success: function(a) {
  1370. if (a && a.success) {
  1371. if(cze != 0)//更改为默认快递
  1372. {
  1373. $('select[name=express]').find("option").each(function(){
  1374. if($(this).val() == cze){
  1375. $(this).prop('selected','selected');
  1376. }
  1377. });
  1378. usps();
  1379. }
  1380. } else {
  1381. $("select[name=warehouse] option:eq(0)").prop('selected','selected');
  1382. var express = $("select[name=warehouse]").find("option:selected").data("e");
  1383. $("select[name=express]").find("option[value='"+express+"']").prop("selected","selected");
  1384. eqm(express);
  1385. if(a.t == 1)
  1386. {
  1387. layx.alert('错误',a.msg,function(id,button){
  1388. },{dialogIcon:'error'});
  1389. }
  1390. else
  1391. {
  1392. layx.alert('错误',a.msg,function(id,button){
  1393. },{dialogIcon:'error'});
  1394. for(i=0;i<a.error.length;i++)
  1395. {
  1396. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  1397. }
  1398. }
  1399. }
  1400. }
  1401. });
  1402. }
  1403. else
  1404. {
  1405. if(cze != 0)//更改为默认快递
  1406. {
  1407. $('select[name=express]').find("option").each(function(){
  1408. if($(this).val() == cze){
  1409. $(this).prop('selected','selected');
  1410. }
  1411. });
  1412. usps();
  1413. }
  1414. }
  1415. } else {
  1416. $(".ts p").html(a.msg);
  1417. $(".ts").fadeIn();
  1418. setTimeout('$(".ts").fadeOut()', 800);
  1419. }
  1420. }
  1421. });
  1422. });
  1423. $("select[name='express']").change(function() { //usps 显示 签名和服务类型
  1424. usps()
  1425. })
  1426. function usps() {
  1427. var nr = $("select[name='express']").find("option:selected").val();
  1428. console.log(nr)
  1429. if(nr == "2")
  1430. {
  1431. $(".usps").show();
  1432. $(".qm").show();
  1433. }
  1434. else if((nr == '24') || (nr == '31')){
  1435. $(".usps").show();
  1436. $(".qm").show();
  1437. }
  1438. else
  1439. {
  1440. $(".usps").hide();
  1441. $(".qm").hide();
  1442. }
  1443. if(nr == "24")
  1444. {
  1445. $(".qm").show();
  1446. }
  1447. else
  1448. {
  1449. $(".qm").hide();
  1450. }
  1451. }
  1452. $(".button .return").click(function() {
  1453. layx.confirm('操作退货','确定生成《退货》信息?',function(id){
  1454. layx.load('loadId','数据提交中,请稍后');
  1455. $.ajax({
  1456. url: fh+"/return/",
  1457. data: "orderinfo="+$(".orderinfo").text(),
  1458. type: "POST",
  1459. dataType: "json",
  1460. success: function(a) {
  1461. layx.destroy('loadId');
  1462. if (a && a.success) {
  1463. layx.alert('完成',a.msg,function(id,button){
  1464. },{dialogIcon:'success'});
  1465. $("li .return").html(a.data);
  1466. } else {
  1467. layx.alert('错误',a.msg,function(id,button){
  1468. },{dialogIcon:'error'});
  1469. }
  1470. }
  1471. });
  1472. layx.destroy(id);
  1473. },{shadable:0.6,dialogIcon:'help'});
  1474. });
  1475. $(".button .clearreturn").click(function() {
  1476. layx.confirm('清除记录','确定清除此单退货记录?',function(id){
  1477. $.ajax({
  1478. url: fh+"/clearreturn/",
  1479. data: "orderinfo="+$(".orderinfo").text(),
  1480. type: "POST",
  1481. dataType: "json",
  1482. success: function(a) {
  1483. layx.destroy(id);
  1484. if (a && a.success) {
  1485. layx.alert('完成',a.msg,function(id,button){
  1486. },{dialogIcon:'success'});
  1487. $(".clearreturnedit1").html("已出库");
  1488. $(".clearreturnedit2").html("<em>允许发货:</em><b>允许出库</b>");
  1489. } else {
  1490. layx.alert('错误',a.msg,function(id,button){
  1491. },{dialogIcon:'error'});
  1492. }
  1493. }
  1494. });
  1495. layx.destroy(id);
  1496. },{shadable:0.6,dialogIcon:'help'});
  1497. });
  1498. $(".bcbz").click(function() {
  1499. var f = "";
  1500. var e = "";
  1501. var w = "";
  1502. var fpcount = "";
  1503. $(".need .select").each(function() {
  1504. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  1505. });
  1506. $(".need input:text").each(function() {
  1507. var str = $(this).val().replace(/\+/g,"%2B");
  1508. var str = str.replace(/&/g,"%26");
  1509. f = f + $(this).attr("name") + "=" + str + "&";
  1510. });
  1511. $(".need input:hidden").each(function() {
  1512. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  1513. });
  1514. $(".need textarea").each(function() {
  1515. var str2 = $(this).val().replace(/\+/g,"%2B");
  1516. f = f + $(this).attr("name") + "=" + str2 + "&";
  1517. });
  1518. var tdweight = 0;
  1519. $(".datatext tr").each(function() {
  1520. var cc = "";var listqc = "";var data = "";var t = "";var fpdg = "";
  1521. var td0 = $(this).find("td:eq(0)").text().replace(/\+/g,"%2B");
  1522. var td0 = td0.replace(/&/g,"%26");
  1523. var td8 = '';
  1524. if($(this).find("td:eq(8)").length > 0)
  1525. {
  1526. if($(this).find("td:eq(8)").text() == '')
  1527. {
  1528. td8 = '0';
  1529. }
  1530. else
  1531. {
  1532. td8 = $(this).find("td:eq(8)").text();
  1533. }
  1534. }
  1535. else
  1536. {
  1537. td8 = '0';
  1538. }
  1539. 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() + ";";
  1540. tdweight = tdweight + td8*1;
  1541. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  1542. cc = list.split(",");
  1543. listqc = list.replace(/\d{1,3}\,/,'');
  1544. listqc = listqc.substring(0,listqc.length-1);
  1545. data = listqc.split("-");
  1546. var zrflx = 0;//是否有真人发类型
  1547. for(i=1;i<data.length;i++)
  1548. {
  1549. if(i == 2)
  1550. {
  1551. //if(data[i] == 2090)
  1552. if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
  1553. {
  1554. zrflx++;
  1555. t = t +data[i];
  1556. fpdg = fpdg + '-' + data[i];
  1557. }
  1558. else
  1559. {
  1560. if(cc[0] != list)
  1561. {
  1562. t = t +data[i] + cc[0];
  1563. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  1564. }
  1565. else
  1566. {
  1567. t = t +data[i];
  1568. fpdg = fpdg + '-' + data[i];
  1569. }
  1570. }
  1571. }
  1572. else if(i == 3 && zrflx > 0)
  1573. {
  1574. if(cc[0] != list)
  1575. {
  1576. t = t +data[i] + cc[0];
  1577. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  1578. }
  1579. else
  1580. {
  1581. t = t +data[i];
  1582. fpdg = fpdg + '-' + data[i];
  1583. }
  1584. }
  1585. else
  1586. {
  1587. t = t +data[i];
  1588. fpdg = fpdg + '-' + data[i];
  1589. }
  1590. }
  1591. w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|';
  1592. fpcount = fpcount + fpdg + '-|';
  1593. });
  1594. f = f + "jweight=" + tdweight + "&";
  1595. e = e.replace(/(有可用特殊库存|已选择特殊库存|有可用现货库存|已选择现货库存|已选择库存)/g,'');
  1596. f = f + "whlabel=|" + w + "&fpdata=" + encodeURI(e) + "&";
  1597. f = f + "fpcount=" + fpcount + "&";
  1598. f = f + "budget=" + $(".budget").text() + "&";
  1599. /**
  1600. if($("select[name=warehouse]").find("option:selected").val() == "5" || $("select[name=warehouse]").find("option:selected").val() == "6")
  1601. {
  1602. var yzdata = {
  1603. warehouse: $("select[name=warehouse]").find("option:selected").val(),
  1604. shop: $("input[name=shop]").val(),
  1605. id: $("input[name=id]").val(),
  1606. whlabel: "|" + w
  1607. };
  1608. $.ajax({
  1609. url: "/ck/kcyz/",//xyxg 修改为/ck/kcyz/
  1610. data: yzdata,
  1611. type: "POST",
  1612. dataType: "json",
  1613. success: function(a) {
  1614. if (a && a.success) {
  1615. bcbz(f);
  1616. } else {
  1617. if(a.t == 1)
  1618. {
  1619. layx.alert('错误',a.msg,function(id,button){
  1620. },{dialogIcon:'error'});
  1621. }
  1622. else
  1623. {
  1624. layx.alert('错误',a.msg,function(id,button){
  1625. },{dialogIcon:'error'});
  1626. for(i=0;i<a.error.length;i++)
  1627. {
  1628. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  1629. }
  1630. }
  1631. }
  1632. }
  1633. });
  1634. }
  1635. else
  1636. {
  1637. bcbz(f);
  1638. }
  1639. **/
  1640. bcbz(f);
  1641. });
  1642. function bcbz(f) {
  1643. layx.load('loadId','数据提交中,请稍后');
  1644. $.ajax({
  1645. url: fh+"/bcbz/",
  1646. data: f,
  1647. type: "POST",
  1648. dataType: "json",
  1649. timeout: 9000,
  1650. success: function(a) {
  1651. layx.destroy('loadId');
  1652. if (a && a.success) {
  1653. $(".express p:eq(0)").html(a.msg);
  1654. $(".express p:eq(1)").html("<font class='fh' data-id='"+a.id+"'>确 定</font>");
  1655. $(".express").show();
  1656. } else {
  1657. $("select[name=warehouse] option:eq(0)").prop('selected','selected');
  1658. if(a.t == 2)
  1659. {
  1660. layx.alert('错误',a.msg,function(id,button){
  1661. },{dialogIcon:'error'});
  1662. for(i=0;i<a.error.length;i++)
  1663. {
  1664. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  1665. }
  1666. }
  1667. else
  1668. {
  1669. layx.destroy('loadId');
  1670. $(".ts p").html(a.msg);
  1671. $(".ts").fadeIn();
  1672. setTimeout('$(".ts").fadeOut()', 600);
  1673. }
  1674. }
  1675. },
  1676. error: function(textStatus) {
  1677. layx.destroy('loadId');
  1678. layx.alert('错误', '请检查数据再重试', function(id, button) {
  1679. $(".search span").click();
  1680. }, { dialogIcon: 'error' });
  1681. },
  1682. });
  1683. };
  1684. $(".datatext").on('click',".jzzd",function() {
  1685. $(this).parent().siblings(".val9").html("DNOTO");
  1686. $(this).parent().html('已禁止占单<br>保存后生效');
  1687. });
  1688. $(".datatext .jzzd").click(function() {
  1689. $(this).parent().siblings(".val9").html("DNOTO");
  1690. $(this).parent().html('已禁止占单<br>保存后生效');
  1691. });
  1692. $(".datatext .yxzd").click(function() {
  1693. $(this).parent().siblings(".val9").html("0");
  1694. $(this).parent().html('已允许占单<br>保存后生效');
  1695. });
  1696. $(".epod").click(function() {
  1697. layx.load('loadId','获取中,如果未弹出PDF,请检查浏览器拦截');
  1698. $.ajax({
  1699. url: fh+'/epod',
  1700. data: 'number='+$("input[name='number']").val(),
  1701. type: "POST",
  1702. dataType: "json",
  1703. success: function(a) {
  1704. layx.destroy('loadId');
  1705. if (a && a.success) {
  1706. window.open(a.msg);
  1707. } else {
  1708. layx.alert('错误',a.msg,function(id,button){
  1709. },{dialogIcon:'error'});
  1710. }
  1711. }
  1712. });
  1713. });
  1714. $(".button .refund").click(function() {
  1715. var f = $(this).data("f");
  1716. layx.confirm('申请退款','是否确定提交《退款》申请?',function(id){
  1717. layx.load('loadId','数据提交中,请稍后');
  1718. $.ajax({
  1719. url: "/returncw/return",
  1720. data: "number="+$("input[name=number]").val()+"&f="+f,
  1721. type: "POST",
  1722. dataType: "json",
  1723. success: function(a) {
  1724. layx.destroy('loadId');
  1725. if (a && a.success) {
  1726. layx.alert('完成',a.msg,function(id,button){
  1727. },{dialogIcon:'success'});
  1728. $("li .return").html(a.data);
  1729. } else {
  1730. layx.alert('错误',a.msg,function(id,button){
  1731. },{dialogIcon:'error'});
  1732. }
  1733. }
  1734. });
  1735. layx.destroy(id);
  1736. },{shadable:0.6,dialogIcon:'help'});
  1737. });
  1738. $(".button .ddcf").click(function() {
  1739. var f = $(this).data("f");
  1740. layx.confirm('订单拆分','是否确定拆分 '+$("input[name=number]").val(),function(id){
  1741. layx.load('loadId','数据提交中,请稍后');
  1742. $.ajax({
  1743. url: "/"+f+"/ddcf",
  1744. data: "number="+$("input[name=number]").val(),
  1745. type: "POST",
  1746. dataType: "json",
  1747. success: function(a) {
  1748. layx.destroy('loadId');
  1749. if (a && a.success) {
  1750. layx.alert('完成',a.msg,function(id,button){
  1751. },{dialogIcon:'success'});
  1752. $("li .return").html(a.data);
  1753. } else {
  1754. layx.alert('错误',a.msg,function(id,button){
  1755. },{dialogIcon:'error'});
  1756. }
  1757. }
  1758. });
  1759. layx.destroy(id);
  1760. },{shadable:0.6,dialogIcon:'help'});
  1761. });
  1762. /**
  1763. * 提交订单的提示信息
  1764. */
  1765. function checkOrderShowNotice(f) {
  1766. let country = $("select[name=country]").find("option:selected").val()
  1767. let express = $("select[name='express']").find("option:selected").val();
  1768. let servioce_js = $("select[name='js']").find("option:selected").val();
  1769. // alert(country+"-"+express+"-"+servioce_js)
  1770. //美国 dhl官方 如果没有选择发件方付税 会提醒
  1771. if(country == '192' && express == '1' && servioce_js!= '6'){
  1772. layx.confirm('提示',"请确认是否需要从发件方付税!",null,{
  1773. buttons:[
  1774. {
  1775. label:'不用勾选、继续保存',
  1776. callback:function(id, button, event){
  1777. zttj(f)
  1778. layx.destroy(id);
  1779. }
  1780. },
  1781. {
  1782. label:'去勾选',
  1783. callback:function(id, button, event){
  1784. layx.destroy(id);
  1785. }
  1786. }
  1787. ],dialogIcon:'help',shadable:0.6
  1788. });
  1789. }else{
  1790. zttj(f);
  1791. }
  1792. }
  1793. function showExpressTiShi(msg){
  1794. $('#show_express').off();
  1795. $('#show_express').on('mouseenter', function(e) {
  1796. //显示提示
  1797. mTips.c.x = 0;
  1798. mTips.c.y = 0;
  1799. mTips.s('<h1>'+msg+'</h1>', 'success');
  1800. });
  1801. $('#show_express').on('mouseleave', function(e) {
  1802. mTips.h();
  1803. mTips.c.x = 0;
  1804. mTips.c.y = 0;
  1805. });
  1806. }
  1807. $(".ly_mcth").on('click',function(){
  1808. let warehouse = $("select[name='warehouse']").find("option:selected").val();
  1809. if(warehouse != 5){
  1810. layx.confirm('提示',"该仓库不支持此操作!",null,{
  1811. buttons:[
  1812. {
  1813. label:'确定',
  1814. callback:function(id, button, event){
  1815. layx.destroy(id);
  1816. }
  1817. }
  1818. ],dialogIcon:'error',shadable:0.6
  1819. })
  1820. return false;
  1821. }
  1822. let obj = getTrabltr();
  1823. $.post("/ck/mcth",{
  1824. number:$("input[name='number']").val(),
  1825. fpdata:obj.fpadta,
  1826. },function(res){
  1827. if(res.code == 1){
  1828. doLymcth(res.data,res.shipmarks)
  1829. }else{
  1830. layx.confirm('提示',res.msg,null,{
  1831. buttons:[
  1832. {
  1833. label:'确定',
  1834. callback:function(id, button, event){
  1835. layx.destroy(id);
  1836. }
  1837. }
  1838. ],dialogIcon:'error',shadable:0.6
  1839. })
  1840. }
  1841. },'json')
  1842. })
  1843. //获取table表单的相关信息
  1844. function getTrabltr(){
  1845. let e = "",tdweight=0,w='',fpcount='';
  1846. $(".datatext tr").each(function() {
  1847. var cc = "";var listqc = "";var data = "";var t = "";var fpdg = "";
  1848. var td0 = $(this).find("td:eq(0)").text().replace(/\+/g,"%2B");
  1849. var td0 = td0.replace(/&/g,"%26");
  1850. var td8 = '';
  1851. if($(this).find("td:eq(8)").length > 0)
  1852. {
  1853. if($(this).find("td:eq(8)").text() == '')
  1854. {
  1855. td8 = '0';
  1856. }
  1857. else
  1858. {
  1859. td8 = $(this).find("td:eq(8)").text();
  1860. }
  1861. }
  1862. else
  1863. {
  1864. td8 = '0';
  1865. }
  1866. 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() + ";";
  1867. tdweight = tdweight + td8*1;
  1868. var list = $(this).attr("data-list").replace(/\-(0|163|164|165|166)\-/,'-');
  1869. cc = list.split(",");
  1870. listqc = list.replace(/\d{1,3}\,/,'');
  1871. listqc = listqc.substring(0,listqc.length-1);
  1872. data = listqc.split("-");
  1873. var zrflx = 0;//是否有真人发类型
  1874. for(i=1;i<data.length;i++)
  1875. {
  1876. if(i == 2)
  1877. {
  1878. //if(data[i] == 2090)
  1879. if ((data[i] == 2090) || (data[i] == 1620) || (data[i] == 2480) || (data[i] == 2469))
  1880. {
  1881. zrflx++;
  1882. t = t +data[i];
  1883. fpdg = fpdg + '-' + data[i];
  1884. }
  1885. else
  1886. {
  1887. if(cc[0] != list)
  1888. {
  1889. t = t +data[i] + cc[0];
  1890. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  1891. }
  1892. else
  1893. {
  1894. t = t +data[i];
  1895. fpdg = fpdg + '-' + data[i];
  1896. }
  1897. }
  1898. }
  1899. else if(i == 3 && zrflx > 0)
  1900. {
  1901. if(cc[0] != list)
  1902. {
  1903. t = t +data[i] + cc[0];
  1904. fpdg = fpdg + '-' + data[i] + '-' + cc[0];
  1905. }
  1906. else
  1907. {
  1908. t = t +data[i];
  1909. fpdg = fpdg + '-' + data[i];
  1910. }
  1911. }
  1912. else
  1913. {
  1914. t = t +data[i];
  1915. fpdg = fpdg + '-' + data[i];
  1916. }
  1917. }
  1918. w = w + t + '-' + $(this).find("td:eq(1)").text() + '-' + $(this).find("td:eq(9)").text() + '|';
  1919. fpcount = fpcount + fpdg + '-|';
  1920. });
  1921. e = e.replace(/(有可用特殊库存|已选择特殊库存|有可用现货库存|已选择现货库存|已选择库存)/g,'');
  1922. return {
  1923. fpadta:e,
  1924. whlabel:w,
  1925. };
  1926. }
  1927. //执行上边的返回结果拼接 以及界面操作
  1928. function doLymcth(fpdata,shipmarks){
  1929. let table_tr = "";
  1930. let good_list = fpdata.split(";");
  1931. let detail_str = "";
  1932. let detail_arr = [];
  1933. let tmp_str = "";
  1934. for(var i in good_list){
  1935. tmp_str = "";
  1936. if(good_list[i].length > 0){
  1937. detail_arr = good_list[i].split("|");
  1938. 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>";
  1939. }
  1940. table_tr += tmp_str;
  1941. }
  1942. $(".datatext ").html(table_tr);
  1943. $("textarea[name='shipremarks']").text(shipmarks);
  1944. checkKcyz()
  1945. custom();
  1946. }
  1947. function checkKcyz(){
  1948. let obj = getTrabltr();
  1949. var yzdata = {
  1950. warehouse: $("select[name=warehouse]").find("option:selected").val(),
  1951. shop: $("input[name=shop]").val(),
  1952. id: $("input[name=id]").val(),
  1953. number: $("input[name=number]").val(),
  1954. state: $("select[name=state]").find("option:selected").val(),
  1955. whlabel: "|" + obj.whlabel,
  1956. };
  1957. $.post("/ck/kcyz/", yzdata,function(a){
  1958. console.log(a);
  1959. if (a && a.success) {
  1960. }
  1961. else {
  1962. if(a.t == 1)
  1963. {
  1964. layx.alert('错误',a.msg,function(id,button){},{dialogIcon:'error'});
  1965. }
  1966. else
  1967. {
  1968. layx.alert('错误',a.msg,function(id,button){},{dialogIcon:'error'});
  1969. for(i=0;i<a.error.length;i++)
  1970. {
  1971. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  1972. }
  1973. }
  1974. }
  1975. },'json')
  1976. }