fullorder-addedit_layx.js 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647
  1. //添加信息框
  2. $(".packing .exptj").click(function() {
  3. layx.iframe('resize-ct','添加产品信息','/choice/1',{skin:'default',icon:false,border:false,minMenu:false,maxMenu:false,maxwidth:840,maxheight:375,closeMenu:false,shadable:true,shadable:0.1});
  4. layx.restore('layx');
  5. });
  6. //查找信息单价
  7. $(".exp .ckrows input").click(function() {
  8. var num = $(this).index();
  9. if ($(this).is(":checked"))
  10. {
  11. var f = "";
  12. $(".exp .datalist .select").each(function() {
  13. if($(this).prop("name") != "hairtype")
  14. {
  15. f = f + $(this).children("option:selected").val() + "-";
  16. }
  17. else
  18. {
  19. f = f + 0 + "-";
  20. }
  21. });
  22. $(".exp .post .select").each(function() {
  23. f = f + $(this).children("option:selected").val() + "-";
  24. });
  25. f = f + $(this).val();
  26. $.ajax({
  27. url: "/fullorder/price/",
  28. data: "data="+f,
  29. type: "POST",
  30. dataType: "json",
  31. success: function(a) {
  32. if (a && a.success) {
  33. var ma = $(".exp input[name='money']").val()*1;
  34. var mx = a.msg['salesprice']*1;
  35. var n = $(".exp .num font").text()*1;
  36. $(".exp input[name='money']").val(mx.toFixed(2));
  37. $(".exp .tm font").html((mx*n).toFixed(2));
  38. //$(".exp input[name='money']").val((ma+mx).toFixed(2));//多条数叠加计算价格
  39. //$(".exp .tm font").html(((ma+mx)*n).toFixed(2));//多条数叠加计算价格
  40. $(".zm").append("<font class='z"+a.n+"'>"+mx.toFixed(2)+"</span>");
  41. $(".exp .purchase").text((a.msg['purchase']*1*n).toFixed(2));
  42. $(".exp .cost").text((a.msg['cost']*1*n).toFixed(2));
  43. } else {
  44. $('.exp .'+a.n).prop("checked",false);
  45. $(".ts p").html(a.msg);
  46. $(".ts").fadeIn();
  47. setTimeout('$(".ts").fadeOut()', 600);
  48. }
  49. }
  50. });
  51. }
  52. /** 单选用不上,这个无成本计算
  53. else
  54. {
  55. var cname = $(this).prop("className");
  56. var ma = $(".exp input[name='money']").val()*1;
  57. var mx = $(".z"+cname).text()*1;
  58. var n = $(".exp .num font").text()*1;
  59. $(".exp input[name='money']").val((ma-mx).toFixed(2));
  60. $(".exp .tm font").html(((ma-mx)*n).toFixed(2));
  61. $(".z"+cname).remove();
  62. }
  63. **/
  64. });
  65. //关闭添加信息框
  66. function choicegb() {
  67. var id;
  68. if (self != top && self.frameElement && self.frameElement.tagName == "IFRAME") {
  69. var layxWindow = $(self.frameElement).parents(".layx-window");
  70. id = layxWindow.attr("id").substr(5);
  71. }
  72. parent.layx.destroy(id);
  73. }
  74. //提交时tr增加data信息
  75. $(".exp").on('click',".packingtj",function() {
  76. var f = "";var e = "";var o = "";var checkid = "";
  77. $(".exp .datalist .select").each(function() {
  78. if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '')
  79. {
  80. f = f + $(this).children("option:selected").val() + "-";
  81. e = e + $(this).children("option:selected").text() + " ";
  82. }
  83. });
  84. $(".exp .post .select").each(function() {
  85. if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '')
  86. {
  87. f = f + $(this).children("option:selected").val() + "-";
  88. e = e + $(this).children("option:selected").text() + " ";
  89. }
  90. });
  91. var checkname = "";
  92. $(".datalist .checkbox .ckrows input:checked").each(function(){
  93. checkname = $(this).attr("name");
  94. checkid = checkid + $(this).val()+",";
  95. o = o + $(this).next('font').text()+" ";
  96. });
  97. if(checkname == "")
  98. {
  99. $(".ts p").text($(".datalist .checkbox").prevAll("em").text()+"为必填项");
  100. $(".ts").show();
  101. setTimeout('$(".ts").fadeOut()', 600);
  102. return false;
  103. }
  104. else
  105. {
  106. f = checkid + "-" + f;
  107. e = e + o;
  108. }
  109. var ab = 0;
  110. $(".datalist .must").each(function() {
  111. if ($.trim($(this).val()).length == 0) {
  112. $(this).css("border", "1px solid #F66");
  113. ab = ab + 1;
  114. }
  115. });
  116. if (ab > 0) {
  117. $(".ts p").text("红框为必填项");
  118. $(".ts").show();
  119. setTimeout('$(".ts").fadeOut()', 600);
  120. return false;
  121. }
  122. var x = 0
  123. $(".datatext tr",window.parent.document).each(function() {
  124. if($(this).data("list") == f)
  125. {
  126. x++;
  127. }
  128. });
  129. if(x > 0)
  130. {
  131. $(".ts p").text("已有相同信息!");
  132. $(".ts").show();
  133. setTimeout('$(".ts").fadeOut()', 700);
  134. return false;
  135. }
  136. else
  137. {
  138. var ts = $(".exp .num font").text()*1
  139. var dj = $(".exp input[name='money']").val()*1;
  140. var purchasemy = $(".exp .purchase").text()*1;
  141. var costmy = $(".exp .cost").text()*1;
  142. var inch = $(".datalist .checkbox .ckrows input:checked").next("font").text();//针对单选尺寸,多选需要修改
  143. $(".datatext",window.parent.document).append("<tr data-list='"+f+"'><td>"+e+"</td><td>"+ts+"</td><td>"+(dj).toFixed(2)+"</td><td>"+(ts*dj).toFixed(2)+"</td><td>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></tr>");
  144. }
  145. //$("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1+(sl*dj)).toFixed(2));//应收价格加上新增价格
  146. //et();
  147. cost();//计算成本价
  148. window.parent.custom();
  149. choicegb();
  150. });
  151. //修改tr-data信息
  152. $(".exp").on('click',".packingxg",function() {
  153. var f = "";var e = "";var o = "";var checkid = "";
  154. $(".exp .datalist .select").each(function() {
  155. if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '')
  156. {
  157. f = f + $(this).children("option:selected").val() + "-";
  158. e = e + $(this).children("option:selected").text() + " ";
  159. }
  160. });
  161. $(".exp .post .select").each(function() {
  162. if($(this).children("option:selected").val() != 0 || $(this).children("option:selected").val() != '')
  163. {
  164. f = f + $(this).children("option:selected").val() + "-";
  165. e = e + $(this).children("option:selected").text() + " ";
  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 == "")
  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 ts = $(".datalist .checkbox .ckrows input:checked").length*1;
  200. var ts = $(".exp .num font").text()*1
  201. var dj = $(".exp input[name='money']").val()*1;
  202. var purchasemy = $(".exp .purchase").text()*1;
  203. var costmy = $(".exp .cost").text()*1;
  204. $(".datatext tr.on",window.parent.document).attr("data-list",f);
  205. //var xg = $(".datatext tr.on td:eq(8)").text()*1;
  206. // $("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1+((sl*dj)-xg)).toFixed(2));
  207. // et();
  208. var inch = $(".datalist .checkbox .ckrows input:checked").next("font").text();//针对单选尺寸,多选需要修改
  209. $(".datatext tr.on",window.parent.document).html("<td>"+e+"</td><td>"+ts+"</td><td>"+(dj).toFixed(2)+"</td><td>"+(ts*dj).toFixed(2)+"</td><td>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>");
  210. cost();//计算成本价
  211. window.parent.custom();
  212. choicegb();
  213. });
  214. //修改数量
  215. $(".exp .lengththree .gz").click(function() {
  216. var num = $(".exp .num font").text()*1;
  217. var dj = $(".exp input[name='money']").val()*1;
  218. $(".exp .num font").text(num+1);
  219. if(dj > 0)
  220. {
  221. $(".exp .tm font").text((dj*(num+1)).toFixed(2));
  222. }
  223. });
  224. $(".exp .lengththree .gj").click(function() {
  225. var num = $(".exp .num font").text()*1;
  226. var dj = $(".exp input[name='money']").val()*1;
  227. if(num > 1)
  228. {
  229. $(".exp .num font").text(num-1)*1;
  230. if(dj > 0)
  231. {
  232. $(".exp .tm font").text((dj*(num-1)).toFixed(2));
  233. }
  234. }
  235. });
  236. //点击增加信息是增加标记
  237. $(".datatext").on('click',"tr",function() {
  238. $(".datatext tr").removeClass("on");
  239. $(this).addClass("on");
  240. });
  241. //删除信息
  242. $(".packing .expsc").click(function() {
  243. var b = 0;
  244. $(".packing .datatext .on").each(function() {
  245. b = b+1;
  246. });
  247. if (b>1)
  248. {
  249. $(".ts p").html("每次只可删除一条内容");
  250. $(".ts").show();
  251. setTimeout('$(".ts").fadeOut()', 1000);
  252. }
  253. else if(b<1)
  254. {
  255. $(".ts p").html("请选择需要删除的内容");
  256. $(".ts").show();
  257. setTimeout('$(".ts").fadeOut()', 1000);
  258. }
  259. else
  260. {
  261. // var xg = $(".datatext tr.on td:eq(8)").text()*1;
  262. //$("input[name='shouldmoney']").val(($("input[name='shouldmoney']").val()*1-xg).toFixed(2));et();
  263. $(".packing .datatext .on").remove();
  264. }
  265. costz();//计算成本价
  266. window.parent.custom();
  267. });
  268. //统一修改币种
  269. $("#currency").change(function(){
  270. var index = $(this).find("option:selected").text();
  271. var va = $(this).find("option:selected").val();
  272. $(".currency").text(index);
  273. $(".datatext tr").each(function() {
  274. //$(this).find("td:eq(9)").text(index);
  275. });
  276. });
  277. //fullorder 数据库增加currency币种 考虑更改币种是否需要ajax获取美元汇率更改金额
  278. $(".packing .expxg").click(function() {
  279. var b = 0;
  280. $(".packing .datatext .on").each(function() {
  281. b = b+1;
  282. });
  283. if (b>1)
  284. {
  285. $(".ts p").html("每次只可修改一条内容");
  286. $(".ts").show();
  287. setTimeout('$(".ts").fadeOut()', 1000);
  288. }
  289. else if(b<1)
  290. {
  291. $(".ts p").html("请选择需要修改的内容");
  292. $(".ts").show();
  293. setTimeout('$(".ts").fadeOut()', 1000);
  294. }
  295. else
  296. {
  297. layx.iframe('topiframe','修改产品信息','/choice/2',{skin:'default',icon:false,border:false,minMenu:false,maxMenu:false,width:840,minheight:375,closeMenu:false,shadable:true,shadable:0.1});
  298. layx.restore('layx');
  299. }
  300. });
  301. //自动显示option
  302. function option() {
  303. var index = $(".cike select").find("option:selected").index();
  304. $(".pttab li").hide(); $(".pttab li").removeClass("post");
  305. $("."+index).show();$("."+index).addClass("post");
  306. $('.pttab select option:eq(0)').prop('selected','selected');
  307. if(index == 1)
  308. {
  309. $(".pttab .a1").show();$(".pttab .a2").hide();
  310. }
  311. var indexb = $(".cikeb.post select").find("option:selected").index();
  312. $(".pttab .a1").hide();$(".pttab .a2").hide();$(".pttab .a1").removeClass("post");$(".pttab .a2").removeClass("post");
  313. if(indexb == 0 || indexb == 4)
  314. {
  315. $(".pttab .a1").show();$(".pttab .a1").addClass("post");
  316. }
  317. else if(indexb == 2)
  318. {
  319. $(".pttab .a2").show();$(".pttab .a2").addClass("post");
  320. }
  321. }
  322. $("select[name='country']").change(function() {
  323. $("select[name=productdescription]").html("");
  324. $("input[name=customs]").val("0");
  325. //express() 暂时固定运费为20USD 不在查找设置价格
  326. printtype();
  327. });
  328. $("select[name='express']").change(function() {
  329. $("select[name=productdescription]").html("");
  330. $("input[name=customs]").val("0");
  331. //express() 暂时固定运费为20USD 不在查找设置价格
  332. printtype();
  333. type();
  334. });
  335. $("select[name='printtype']").change(function() {
  336. $("select[name=productdescription]").html("");
  337. $("input[name=customs]").val("0");
  338. printtype();
  339. });
  340. //打印类型
  341. function printtype() {
  342. var index = $("select[name='printtype']").find("option:selected").index();
  343. if(index == 0)
  344. {
  345. var e = $("select[name=express]").find("option:selected").val();
  346. var c = $("select[name=country]").find("option:selected").val();
  347. $.ajax({
  348. url: "/fullorder/customs/",
  349. data: "e="+e+"&c="+c,
  350. type: "POST",
  351. dataType: "json",
  352. success: function(a) {
  353. if (a && a.success) {
  354. $("input[name=customs]").val(a.money);
  355. for(i=0;i<a.msg.length;i++)
  356. {
  357. $("select[name=productdescription]").append("<option value='"+a.msg[i]['id']+"'>"+a.msg[i]['title']+"</option>");
  358. }
  359. $(".productdescription").show();
  360. $(".customs").show();
  361. } else {
  362. $(".productdescription").hide();
  363. $(".customs").hide();
  364. $(".ts p").html(a.msg);
  365. $(".ts").fadeIn();
  366. setTimeout('$(".ts").fadeOut()', 800);
  367. }
  368. }
  369. });
  370. }else
  371. {
  372. $(".productdescription").hide();
  373. $(".customs").hide();
  374. }
  375. }
  376. $("select[name='warehouse']").change(function() {
  377. type()
  378. });
  379. function express() {
  380. var e = $("select[name=express]").find("option:selected").val();
  381. var c = $("select[name=country]").find("option:selected").val();
  382. $.ajax({
  383. url: "/fullorder/express/",
  384. data: "e="+e+"&c="+c,
  385. type: "POST",
  386. dataType: "json",
  387. success: function(a) {
  388. if (a && a.success) {
  389. $("input[name=expressmoney]").val(a.money);//?这里或许需要根据币种美元转换
  390. } else {
  391. $("input[name=expressmoney]").val("0.00");
  392. }
  393. }
  394. });
  395. }
  396. function type() {
  397. var t = $("select[name=express]").find("option:selected").val();
  398. var c = $("select[name=warehouse]").find("option:selected").val();
  399. /** 如果仓库不是1的话,执行不打印操作
  400. if(c!=1)
  401. {
  402. $("select[name=printtype]").find("option[value='3']").prop("selected","selected");return false;
  403. }
  404. **/
  405. $.ajax({
  406. url: "/fullorder/expresstype/",
  407. data: "id="+t,
  408. type: "POST",
  409. dataType: "json",
  410. success: function(a) {
  411. if (a && a.success) {
  412. $("select[name=printtype]").find("option[value='"+a.msg+"']").prop("selected","selected");
  413. }
  414. }
  415. });
  416. }
  417. $(".lengththree input[name='money']").bind("change",function(){
  418. var ma= $(this).val();
  419. var n = $(".exp .num font").text()*1;
  420. $(".exp .tm font").html((ma*n).toFixed(2));
  421. });
  422. //整体提交数据
  423. $(".fullorderdata").click(function() {
  424. var f = "";
  425. var e = "";
  426. var w = "";
  427. $(".need .select").each(function() {
  428. f = f + $(this).attr("name") + "=" + $(this).children("option:selected").val() + "&";
  429. });
  430. $(".need input:text").each(function() {
  431. var str = $(this).val().replace(/\+/g,"%2B");
  432. var str = str.replace(/&/g,"%26");
  433. f = f + $(this).attr("name") + "=" + str + "&";
  434. });
  435. $(".need input:hidden").each(function() {
  436. f = f + $(this).attr("name") + "=" + $(this).val() + "&";
  437. });
  438. $(".need textarea").each(function() {
  439. var str2 = $(this).val().replace(/\+/g,"%2B");
  440. f = f + $(this).attr("name") + "=" + str2 + "&";
  441. });
  442. $(".datatext tr").each(function() {
  443. var cc = "";var listqc = "";var data = "";var t = "";
  444. e = e + $(this).data("list")+ "|" + $(this).find("td:eq(0)").text() + "|" + $(this).find("td:eq(1)").text() + "|" + $(this).find("td:eq(2)").text() + "|" + $(this).find("td:eq(3)").text() + "|" + $(this).find("td:eq(5)").text() + "|" + $(this).find("td:eq(6)").text() + "|" + $(this).find("td:eq(7)").text() + ";";
  445. var list = $(this).data("list").replace(/\-(0|163|164|165|166)\-/,'-');
  446. cc = list.split(",");
  447. listqc = list.replace(/\d{1,3}\,/,'');
  448. listqc = listqc.substring(0,listqc.length-1);
  449. data = listqc.split("-");
  450. for(i=1;i<data.length;i++)
  451. {
  452. if(i == 2)
  453. {
  454. t = t +data[i] + cc[0]
  455. }
  456. else
  457. {
  458. t = t +data[i]
  459. }
  460. }
  461. w = w + t + '-' + $(this).find("td:eq(1)").text() + '|';
  462. });
  463. f = f + "whlabel=|" + w + "&fpdata=" + encodeURI(e) + "&";
  464. f = f + "budget=" + $(".budget").text() + "&";
  465. var ab = 0;
  466. $(".need .must").each(function() {
  467. if ($.trim($(this).val()).length == 0) {
  468. $(this).css("border", "1px solid #F66");
  469. ab = ab + 1;
  470. }
  471. });
  472. if (ab > 0) {
  473. $(".ts p").text("红框为必填项");
  474. $(".ts").show();
  475. setTimeout('$(".ts").fadeOut()', 600);
  476. return false;
  477. }
  478. //限制必须提交产品详细列表
  479. if (e == '') {
  480. $(".ts p").text("必须添加订单详细信息!");
  481. $(".ts").show();
  482. setTimeout('$(".ts").fadeOut()', 800);
  483. return false;
  484. }
  485. layx.load('loadId','数据提交中,请稍后');
  486. $.ajax({
  487. url: addedit,
  488. data: f,
  489. type: "POST",
  490. dataType: "json",
  491. success: function(a) {
  492. if (a && a.success) {
  493. layx.destroy('loadId');
  494. $(".express p:eq(0)").html(a.msg);
  495. $(".express p:eq(1)").html("<font class='fh'>确 定</font>");
  496. $(".express").show();
  497. } else {
  498. layx.destroy('loadId');
  499. $(".ts p").html(a.msg);
  500. $(".ts").fadeIn();
  501. setTimeout('$(".ts").fadeOut()', 600);
  502. }
  503. }
  504. });
  505. });
  506. //关联总金额换算穿预计到帐金额
  507. $("input[name='shouldmoney']").bind("change",function(){
  508. et();
  509. });
  510. function et(){
  511. var ma= $("input[name='shouldmoney']").val();
  512. if(ma > 0)
  513. {
  514. var n= $("input[name='et']").val();
  515. $(".currencymoney").text(eval(ma+n).toFixed(2));
  516. }
  517. else
  518. {
  519. $(".currencymoney").text(0);
  520. }
  521. }
  522. //计算成本金额,子页面用
  523. function cost(){
  524. var purchasemoney = 0;var costmoney = 0;
  525. $(".datatext tr",window.parent.document).each(function() {
  526. purchasemoney = purchasemoney+$(this).find("td:eq(6)").text()*1;
  527. costmoney = costmoney+$(this).find("td:eq(7)").text()*1;
  528. });
  529. $("input[name='purchase']",window.parent.document).val(purchasemoney.toFixed(2));
  530. $("input[name='cost']",window.parent.document).val(costmoney.toFixed(2));
  531. //$("li b .zlr").html(($("li .budget").html()*1-money).toFixed(2));//总利润
  532. }
  533. //计算成本金额,自页面用
  534. function costz(){
  535. var purchasemoney = 0;var costmoney = 0;
  536. $(".datatext tr").each(function() {
  537. purchasemoney = purchasemoney+$(this).find("td:eq(6)").text()*1;
  538. costmoney = costmoney+$(this).find("td:eq(7)").text()*1;
  539. });
  540. $("input[name='purchase']").val(purchasemoney.toFixed(2));
  541. $("input[name='cost']").val(costmoney.toFixed(2));
  542. //$("li b .zlr").html(($("li .budget").html()*1-money).toFixed(2));//总利润
  543. }
  544. $(".power").click(function() {
  545. layx.confirm('重置选择','确定重置此订单?',function(id){
  546. $.ajax({
  547. url: "/fullorder/power/",
  548. data: "id="+$("input[name='id']").val(),
  549. type: "POST",
  550. dataType: "json",
  551. success: function(a) {
  552. layx.destroy(id);
  553. if (a && a.success) {
  554. $(".express p:eq(0)").html(a.msg);
  555. $(".express p:eq(1)").html("<font class='fh'>确 定</font>");
  556. $(".express").show();
  557. } else {
  558. $(".ts p").html(a.msg);
  559. $(".ts").fadeIn();
  560. setTimeout('$(".ts").fadeOut()', 800);
  561. }
  562. }
  563. });
  564. layx.destroy(id);
  565. },{shadable:0.6,dialogIcon:'help'});
  566. });
  567. //验证库存
  568. $("select[name=warehouse]").change(function(){
  569. if($(this).find("option:selected").val() == "5")
  570. {
  571. var w = "";
  572. $(".datatext tr").each(function() {
  573. var cc = "";var listqc = "";var data = "";var t = "";
  574. var list = $(this).data("list").replace(/\-(0|163|164|165|166)\-/,'-');
  575. cc = list.split(",");
  576. listqc = list.replace(/\d{1,3}\,/,'');
  577. listqc = listqc.substring(0,listqc.length-1);
  578. data = listqc.split("-");
  579. for(i=1;i<data.length;i++)
  580. {
  581. if(i == 2)
  582. {
  583. t = t +data[i] + cc[0]
  584. }
  585. else
  586. {
  587. t = t +data[i]
  588. }
  589. }
  590. w = w + t + '-' + $(this).find("td:eq(1)").text() + '|';
  591. });
  592. var yzdata = {
  593. warehouse: $(this).find("option:selected").val(),
  594. whlabel: "|" + w
  595. };
  596. $.ajax({
  597. url: "/whlabel/kcyz/",
  598. data: yzdata,
  599. type: "POST",
  600. dataType: "json",
  601. success: function(a) {
  602. if (a && a.success) {
  603. } else {
  604. $("select[name=warehouse] option:eq(0)").prop('selected','selected');
  605. if(a.t == 1)
  606. {
  607. layx.alert('错误',a.msg,function(id,button){
  608. },{dialogIcon:'error'});
  609. }
  610. else
  611. {
  612. layx.alert('错误',a.msg,function(id,button){
  613. },{dialogIcon:'error'});
  614. for(i=0;i<a.error.length;i++)
  615. {
  616. $(".datatext tr:eq("+a.error[i]+") td:eq(0)").css("color","red");
  617. }
  618. }
  619. }
  620. }
  621. });
  622. }
  623. });