9099c0d2a4f0004a2f191612304d60be6e40c6ae.svn-base 37 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  1. var path = "/ratfw";//此处替换项目名称
  2. (function() {
  3. $(".proCitySelAll").click(function(event) {
  4. if ($("body").data("CitysAll") == null) {
  5. sendAllCitiesAjax();
  6. }
  7. $(this).select();
  8. $(".provinceCity").hide();
  9. $(".provinceCityAll").hide();
  10. $("#dimCityQuery").hide();
  11. var o2 = $(this).offset();
  12. var l2 = o2.left;
  13. var t2 = o2.top;
  14. var h2 = $(this).height();
  15. $(".provinceCityAll").css("top", t2 + h2 - 1).css("left", l2).toggle();
  16. $(".provinceCityAll").click(function(event) {
  17. event.stopPropagation();
  18. });
  19. event.stopPropagation();
  20. $("html").click(function() {
  21. $(".provinceCityAll").hide();
  22. });
  23. $("input.proCitySelAll").removeClass("current2");
  24. $(this).addClass("current2");
  25. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  26. $(".provinceCityAll").find(".tabs").find("a[tb=hotCityAll]").addClass("current");
  27. $(".provinceCityAll").find(".con").children().hide();
  28. $(".provinceCityAll").find(".con").find(".hotCityAll").show();
  29. if ($("body").data("allProvinces") == null) {
  30. sendAllProvinceAjax();
  31. }
  32. if ($("body").data("allCountys") == null) {
  33. sendAllCountiesAjax();
  34. }
  35. $(".provinceCityAll").find(".tabs").find("a").click(function() {
  36. if ($(this).attr("tb") == "cityAll" && $(".provinceAll .list .current").val() == null) {
  37. return;
  38. };
  39. if ($(this).attr("tb") == "countyAll" && $(".cityAll .list .current").val() == null && $(".hotCityAll .list .current").val() == null) {
  40. return;
  41. };
  42. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  43. $(this).addClass("current");
  44. var tb = $(this).attr("tb");
  45. $(".provinceCityAll").find(".con").children().hide();
  46. $(".provinceCityAll").find(".con").find("." + tb).show();
  47. });
  48. });
  49. })();
  50. (function() {
  51. $(".proCitySelAll_Img").click(function(event) {
  52. event.stopPropagation();
  53. $(this).prev().trigger("click");
  54. });
  55. })();
  56. function wrongMsg(object, msg) {
  57. $(".wrongMsg").text(msg);
  58. object.addClass("wrong");
  59. }
  60. (function() {
  61. var picNum = $("div.flashPic img").size();
  62. var isNum = 0;
  63. var str = [];
  64. var imgDiv = $("div.flashPic");
  65. var $div = $("div.picNum");
  66. imgDiv.find("img").hide().eq(0).show();
  67. for (var i = 0; i < picNum; i++) {
  68. str[i] = "<a href='javascript:'>" + (i + 1) + "</a>";
  69. }
  70. $div.html(str.join(""));
  71. $div.find("a:eq(0)").addClass("on");
  72. function MovePic() {
  73. if ((isNum + 1) >= picNum) {
  74. isNum = 0;
  75. }
  76. else {
  77. isNum = isNum + 1;
  78. }
  79. imgDiv.find("img").hide().eq(isNum).fadeIn(500);
  80. $div.find("a").removeClass("on").eq(isNum).addClass("on");
  81. }
  82. var setFn = setInterval(MovePic, 4000);
  83. $div.find("a").click(function() {
  84. clearInterval(setFn);
  85. var j = $(this).index();
  86. $div.find("a").removeClass("on").siblings().eq(j).addClass("on");
  87. imgDiv.find("img").hide();
  88. imgDiv.find("img").eq(j).fadeIn(500);
  89. isNum = j;
  90. setFn = setInterval(MovePic, 4000);
  91. });
  92. })();
  93. (function() {
  94. var clkIndex;
  95. var currentClass;
  96. var allCitys;
  97. var allProvinces;
  98. var allCountys;
  99. var thisObj;
  100. var dimCityDiv = "<div id='dimCityQuery'><ul></ul></div>";
  101. $("body").append(dimCityDiv);
  102. $("body").delegate(".proCityQuery,.proCityQueryAll", ($.browser.opera ? "keypress": "keyup"),
  103. function(event) {
  104. if ($("#dimCityQuery:visible").size() == 0) {
  105. $(".backifname").hide();
  106. }
  107. $(".provinceCity").hide();
  108. $(".provinceCityAll").hide();
  109. if ($(this).hasClass("proCityQueryAll"))
  110. {
  111. if ($("body").data("allProvinces") == null) {
  112. sendAllProvinceAjax();
  113. }
  114. if ($("body").data("CitysAll") == null) {
  115. sendAllCitiesAjax();
  116. }
  117. if ($("body").data("allCountys") == null) {
  118. sendAllCountiesAjax();
  119. }
  120. currentClass = "proCityQueryAll";
  121. clkIndex = $("body").find(".proCityQueryAll").index(this);
  122. allCitys = $("body").data("CitysAll");
  123. allProvinces = $("body").data("allProvinces");
  124. allCountys = $("body").data("allCountys");
  125. thisObj = $(this);
  126. }
  127. if ($(this).hasClass("proCityQuery"))
  128. {
  129. if ($("body").data("allExistProvinces") == null) {
  130. sendProvinceAjax();
  131. }
  132. if ($("body").data("allExistCitys") == null) {
  133. sendCitiesAjax();
  134. }
  135. if ($("body").data("allExistCountys") == null) {
  136. sendCountiesAjax();
  137. }
  138. currentClass = "proCityQuery";
  139. clkIndex = $("body").find(".proCityQuery").index(this);
  140. allCitys = $("body").data("allExistCitys");
  141. allProvinces = $("body").data("allExistProvinces");
  142. allCountys = $("body").data("allExistCountys");
  143. thisObj = $(this);
  144. }
  145. lastKeyPressCode = event.keyCode;
  146. switch (lastKeyPressCode) {
  147. case 40:
  148. $("#dimCityQuery").trigger("selNext");
  149. return false;
  150. break;
  151. case 38:
  152. $("#dimCityQuery").trigger("selPrev");
  153. return false;
  154. break;
  155. case 13:
  156. $("#dimCityQuery").trigger("enter");
  157. return false;
  158. break;
  159. }
  160. v = $.trim($(this).val());
  161. if (v == "" || v == null) {
  162. return false;
  163. }
  164. $(".provinceCity").hide();
  165. var o = $(this).offset();
  166. var l = o.left;
  167. var t = o.top;
  168. var w = $(this).width();
  169. var h = $(this).height();
  170. var htmlArr = [];
  171. var autoWidth;
  172. for (i = 0; i < allCountys.length; i++) {
  173. if (v.toUpperCase() === allCountys[i].pinYinChar.substring(0, v.length)) {
  174. htmlArr[htmlArr.length] = "<li><a class='allcityClass' href='javascript:' provinceId=" + allCountys[i].provinceId + " cityId=" + allCountys[i].cityId + " countyId=" + allCountys[i].id + ">" + allCountys[i].cityName + "-" + allCountys[i].areaName + " (<span style='color:red'>" + v.toUpperCase() + "</span>" + allCountys[i].pinYinChar.substring(v.length, allCountys[i].pinYinChar.length) + ")</a></li>";
  175. if (htmlArr.length > 9) {
  176. break;
  177. return false;
  178. }
  179. autoWidth = autoWidth < (allCountys[i].cityName + allCountys[i].areaName + allCountys[i].pinYinChar).length ? (allCountys[i].cityName + allCountys[i].areaName + allCountys[i].pinYinChar).length: autoWidth;
  180. continue;
  181. };
  182. if (v === allCountys[i].areaName.substring(0, v.length)) {
  183. htmlArr[htmlArr.length] = "<li><a class='allcityClass' href='javascript:' provinceId=" + allCountys[i].provinceId + " cityId=" + allCountys[i].cityId + " countyId=" + allCountys[i].id + ">" + allCountys[i].cityName + "-" + "<span style='color:red'>" + v + "</span>" + allCountys[i].areaName.substring(v.length, allCountys[i].areaName.length) + " (" + allCountys[i].pinYinChar + ")</a></li>";
  184. if (htmlArr.length > 9) {
  185. break;
  186. return false;
  187. }
  188. autoWidth = autoWidth < (allCountys[i].cityName + allCountys[i].areaName + allCountys[i].pinYinChar).length ? (allCountys[i].cityName + allCountys[i].areaName + allCountys[i].pinYinChar).length: autoWidth;
  189. continue;
  190. };
  191. if (v.toLowerCase() === allCountys[i].pinYin.substring(0, v.length)) {
  192. htmlArr[htmlArr.length] = "<li><a class='allcityClass' href='javascript:' provinceId=" + allCountys[i].provinceId + " cityId=" + allCountys[i].cityId + " countyId=" + allCountys[i].id + ">" + allCountys[i].cityName + "-" + allCountys[i].areaName + " (<span style='color:red'>" + v.toLowerCase() + "</span>" + allCountys[i].pinYin.substring(v.length, allCountys[i].pinYin.length) + ")</a></li>"
  193. if (htmlArr.length > 9) {
  194. break;
  195. return false;
  196. }
  197. autoWidth = autoWidth < (allCountys[i].cityName + allCountys[i].areaName + allCountys[i].pinYin).length ? (allCountys[i].cityName + allCountys[i].areaName + allCountys[i].pinYin).length: autoWidth;
  198. continue;
  199. };
  200. }
  201. for (i = 0; i < allCitys.cities.length; i++) {
  202. if (v.toUpperCase() === allCitys.cities[i].cityShortPY.substring(0, v.length)) {
  203. htmlArr[htmlArr.length] = "<li><a class='allcityClass' href='javascript:' provinceId=" + allCitys.cities[i].provinceId + " cityId=" + allCitys.cities[i].id + ">" + allCitys.cities[i].name + " (<span style='color:red'>" + v.toUpperCase() + "</span>" + allCitys.cities[i].cityShortPY.substring(v.length, allCitys.cities[i].cityShortPY.length) + ")</a></li>";
  204. if (htmlArr.length > 9) {
  205. break;
  206. return false;
  207. }
  208. autoWidth = autoWidth < (allCitys.cities[i].name + allCitys.cities[i].cityShortPY).length ? (allCitys.cities[i].name + allCitys.cities[i].cityShortPY).length: autoWidth;
  209. continue;
  210. };
  211. if (v === allCitys.cities[i].name.substring(0, v.length)) {
  212. htmlArr[htmlArr.length] = "<li><a class='allcityClass' href='javascript:' provinceId=" + allCitys.cities[i].provinceId + " cityId=" + allCitys.cities[i].id + "><span style='color:red'>" + v + "</span>" + allCitys.cities[i].name.substring(v.length, allCitys.cities[i].name.length) + " (" + allCitys.cities[i].cityShortPY + ")</a></li>";
  213. if (htmlArr.length > 9) {
  214. break;
  215. return false;
  216. }
  217. autoWidth = autoWidth < (allCitys.cities[i].name + allCitys.cities[i].cityShortPY).length ? (allCitys.cities[i].name + allCitys.cities[i].cityShortPY).length: autoWidth;
  218. continue;
  219. };
  220. if (v.toLowerCase() === allCitys.cities[i].cityPinyin.substring(0, v.length)) {
  221. htmlArr[htmlArr.length] = "<li><a class='allcityClass' href='javascript:' provinceId=" + allCitys.cities[i].provinceId + " cityId=" + allCitys.cities[i].id + ">" + allCitys.cities[i].name + " (<span style='color:red'>" + v.toLowerCase() + "</span>" + allCitys.cities[i].cityPinyin.substring(v.length, allCitys.cities[i].cityPinyin.length) + ")</a></li>"
  222. if (htmlArr.length > 9) {
  223. break;
  224. return false;
  225. }
  226. autoWidth = autoWidth < (allCitys.cities[i].name + allCitys.cities[i].cityPinyin).length ? (allCitys.cities[i].name + allCitys.cities[i].cityPinyin).length: autoWidth;
  227. continue;
  228. };
  229. };
  230. if (htmlArr == "" || htmlArr == null) {
  231. $("#dimCityQuery ul").html("<li class='none'>对不起,没有找到该城市</li>");
  232. return false;
  233. } else {
  234. $("#dimCityQuery ul").html(htmlArr.join("")).find("li:first").addClass("current");
  235. };
  236. if (autoWidth < 200) {
  237. autoWidth = 200;
  238. }
  239. $("#dimCityQuery").css("width", autoWidth).css("top", t + h - 1).css("left", l).show();
  240. $(".backifname").show();
  241. $("html").click(function() {
  242. $("#dimCityQuery").hide();
  243. $(".backifname").hide();
  244. });
  245. });
  246. $("body").delegate("#dimCityQuery li", "hover",
  247. function() {
  248. $(this).addClass("current").siblings().removeClass("current");
  249. },
  250. function() {
  251. $(this).removeClass("current");
  252. });
  253. $("#dimCityQuery").delegate("", "selNext",
  254. function() {
  255. var next = $(this).find("li.current").next();
  256. if (next.size() > 0) {
  257. next.addClass("current").siblings().removeClass("current");
  258. }
  259. else {
  260. $("#dimCityQuery li").removeClass("current").first().addClass("current");
  261. };
  262. });
  263. $("#dimCityQuery").delegate("", "selPrev",
  264. function() {
  265. var prev = $(this).find("li.current").prev();
  266. if (prev.size() > 0) {
  267. prev.addClass("current").siblings().removeClass("current");
  268. }
  269. else {
  270. $("#dimCityQuery li").removeClass("current").last().addClass("current");
  271. };
  272. });
  273. $("#dimCityQuery").delegate("", "enter",
  274. function(event) {
  275. var cur = $(this).find("li.current");
  276. if (cur.size() > 0) {
  277. cur.find("a").trigger("click");
  278. };
  279. });
  280. $("body").delegate("#dimCityQuery li a.allcityClass", "click",
  281. function() {
  282. var vm = $(this).text();
  283. var provinceId = $(this).attr("provinceId");
  284. var cityId = $(this).attr("cityId");
  285. var countyId = $(this).attr("countyId");
  286. var provinceName;
  287. var cityName;
  288. var rtn;
  289. for (i = 0; i < allProvinces.length; i++) {
  290. if (allProvinces[i].id == provinceId) {
  291. provinceName = allProvinces[i].provinceName;
  292. };
  293. }
  294. for (i = 0; i < allCitys.cities.length; i++) {
  295. if (allCitys.cities[i].id == cityId) {
  296. cityName = allCitys.cities[i].name;
  297. }
  298. }
  299. if (currentClass == "proCityQueryAll") {
  300. $("body").data("pAllId", provinceId);
  301. $("body").data("cAllId", cityId);
  302. $("body").data("aAllId", countyId);
  303. $("body").data("pAllName", provinceName);
  304. $("body").data("nameOfCityAll", cityName);
  305. }
  306. if (currentClass == "proCityQuery") {
  307. $("body").data("pId", provinceId);
  308. $("body").data("cId", cityId);
  309. $("body").data("aId", countyId);
  310. $("body").data("pName", provinceName);
  311. $("body").data("nameOfCity", cityName);
  312. }
  313. vm = vm.split("(");
  314. countyName = $.trim(vm[0]);
  315. if (countyId == null || countyName == cityName)
  316. {
  317. if (currentClass == "proCityQuery")
  318. {
  319. thisObj.trigger("click");
  320. counties = [];
  321. var j = 0;
  322. $.each(allCountys,
  323. function(i, county) {
  324. if (county.cityId == cityId) {
  325. counties[j++] = county;
  326. }
  327. });
  328. countyTotalPage = Math.ceil(counties.length / p_pageSize);
  329. $(".provinceCity").find(".tabs").find("a").removeClass("current");
  330. $(".provinceCity .tabs").find("#county").addClass("current");
  331. $(".con .city .list a").removeClass("current");
  332. $(".provinceCity").find(".con").children().hide();
  333. $(".provinceCity").find(".con").find(".county").show();
  334. $(".con .provinceAll .list a").removeClass("current");
  335. countyPage(1);
  336. }
  337. else if (currentClass == "proCityQueryAll")
  338. {
  339. thisObj.trigger("click");
  340. countiesAll = [];
  341. var j = 0;
  342. $.each(allCountys,
  343. function(i, county) {
  344. if (county.cityId == cityId && county.areaName != cityName) {
  345. countiesAll[j++] = county;
  346. }
  347. });
  348. countyTotalPageAll = Math.ceil(countiesAll.length / p_pageSize);
  349. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  350. $(".provinceCityAll .tabs").find("#countyAll").addClass("current");
  351. $(".con .cityAll .list a").removeClass("current");
  352. $(".provinceCityAll").find(".con").children().hide();
  353. $(".provinceCityAll").find(".con").find(".countyAll").show();
  354. $(".con .provinceAll .list a").removeClass("current");
  355. allCountyPage(1);
  356. }
  357. }
  358. else
  359. {
  360. rtn = provinceName + "-" + countyName;
  361. if (currentClass == "proCityQueryAll")
  362. {
  363. $("body").find(".proCityQueryAll").eq(clkIndex).val(rtn);
  364. $("body").find(".proCityQueryAll").eq(clkIndex).trigger("change");
  365. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  366. $(".provinceCityAll").find(".tabs").find("a[tb=hotCityAll]").addClass("current");
  367. $(".provinceCityAll .con .list a").removeClass("current");
  368. $(".provinceCityAll .con .list a input").removeClass("current");
  369. }
  370. if (currentClass == "proCityQuery")
  371. {
  372. $("body").find(".proCityQuery").eq(clkIndex).val(rtn);
  373. $("body").find(".proCityQuery").eq(clkIndex).trigger("change", [cityId, countyId]);
  374. $(".provinceCity").find(".tabs").find("a").removeClass("current");
  375. $(".provinceCity").find(".tabs").find("a[tb=hotCity]").addClass("current");
  376. $(".provinceCity .con .list a").removeClass("current");
  377. $(".provinceCity .con .list a input").removeClass("current");
  378. }
  379. }
  380. $("#dimCityQuery").hide();
  381. $(".backifname").hide();
  382. return false;
  383. });
  384. $(".nomarl").live("focus",
  385. function() {
  386. var ov = $.trim($(this).attr("ov"));
  387. var val = $.trim($(this).val());
  388. $(this).css({
  389. "color": "#000"
  390. });
  391. if (val == ov) {
  392. $(this).val("");
  393. }
  394. });
  395. $(".nomarl").live("blur",
  396. function() {
  397. var ov = $.trim($(this).attr("ov"));
  398. var val = $.trim($(this).val());
  399. if (val == "" || val == ov) {
  400. $(this).val(ov).css({
  401. "color": "#aaa"
  402. });
  403. }
  404. });
  405. })();
  406. function addFavorite()
  407. {
  408. var sURL = "http://www.jiancat.com";
  409. var sTitle = "猫小贱商城";
  410. try
  411. {
  412. window.external.addFavorite(sURL, sTitle);
  413. }
  414. catch(e)
  415. {
  416. try
  417. {
  418. window.sidebar.addPanel(sTitle, sURL, "");
  419. }
  420. catch(e)
  421. {
  422. alert("加入收藏失败,请使用Ctrl+D进行添加");
  423. }
  424. }
  425. }
  426. function queryData() {
  427. var obj1 = $(".ts-usermessage").find("#transOrder");
  428. var obj2 = $(".ts-usermessage").find("#payOrder");
  429. var obj3 = $("#unreadMessages");
  430. $.ajax({
  431. type: "post",
  432. url: "/user/queryPayOderTranOder.action",
  433. dataType: "json",
  434. beforeSend: function(XMLHttpRequest) {
  435. obj1.html("<img src='../theme/default/images/loading.gif' height=20 width=20/>");
  436. obj2.html("<img src='../theme/default/images/loading.gif' height=20 width=20/>");
  437. obj3.html("<img src='../theme/default/images/loading.gif' height=20 width=20/>");
  438. },
  439. success: function(msg) {
  440. if (msg.user != null) {
  441. obj1.html("(" + msg.user.transportingOrder + ")");
  442. obj2.html("(" + msg.user.refundPaymentOrder + ")");
  443. obj3.html("(" + msg.user.siteMessage + ")");
  444. }
  445. },
  446. error: function(XMLHttpRequest, textStatus, errorThrown)
  447. {
  448. obj1.html("");
  449. obj2.html("");
  450. obj3.html("");
  451. }
  452. });
  453. }
  454. function sendCitiesAjax() {
  455. $.ajax({
  456. type: "get",
  457. url: path + '/common/other/city/js/queryAllCities.js',
  458. async: false,
  459. dataType: "json",
  460. success: function(data) {
  461. cities = data.cities;
  462. $("body").data("allExistCitys", data);
  463. viewHotCities();
  464. },
  465. error: function(XMLHttpRequest, textStatus, errorThrown)
  466. {
  467. //alert("网络繁忙,请稍后再试!");
  468. }
  469. });
  470. }
  471. function viewHotCities() {
  472. $.each(cities,
  473. function(i, city) {
  474. if (city.hotCity) {
  475. $(".hotCity .list ul").append("<li><a><input type='button' style='background:none;border:0px;cursor: pointer;' onclick=hotCityAddrInput(\'" + city.provinceId + "," + city.id + "," + city.name + "\') id='" + city.id + "' value='" + city.name + "'></a></li>");
  476. }
  477. });
  478. }
  479. $(".province .pre a").bind('click',
  480. function() {
  481. var provincePage = parseInt($('#provincePage').html());
  482. if (provincePage == 1) {
  483. return;
  484. }
  485. viewProvince(provincePage - 1);
  486. });
  487. $(".city .pre a").bind('click',
  488. function() {
  489. var cityPages = parseInt($('#cityPage').html());
  490. if (cityPages == 1) {
  491. return;
  492. }
  493. cityPage(cityPages - 1);
  494. });
  495. $(".county .pre a").bind('click',
  496. function() {
  497. var countyPages = parseInt($('#countyPage').html());
  498. if (countyPages == 1) {
  499. return;
  500. }
  501. countyPage(countyPages - 1);
  502. });
  503. $(".province .next a").bind('click',
  504. function() {
  505. var provincePage = parseInt($('#provincePage').html());
  506. provinceTotalPage = countProvincePages();
  507. if (provincePage == provinceTotalPage) {
  508. return;
  509. }
  510. viewProvince(provincePage + 1);
  511. });
  512. $(".city .next a").bind('click',
  513. function() {
  514. if ($(this).hasClass("can")) {
  515. var cityPages = parseInt($('#cityPage').html());
  516. cityPage(cityPages + 1);
  517. }
  518. });
  519. $(".county .next a").bind('click',
  520. function() {
  521. if ($(this).hasClass("can")) {
  522. var countyPages = parseInt($('#countyPage').html());
  523. countyPage(countyPages + 1);
  524. }
  525. });
  526. function json2str(o) {
  527. var arr = [];
  528. var fmt = function(s) {
  529. if (typeof s == 'object' && s != null) return json2str(s);
  530. return /^(string|number)$/.test(typeof s) ? "'" + s + "'": s;
  531. };
  532. for (var i in o) arr.push("'" + i + "':" + fmt(o[i]));
  533. return '{' + arr.join(',') + '}';
  534. }
  535. function countProvincePages() {
  536. provinceTotalPage = Math.ceil(provinces.length / p_pageSize);
  537. return provinceTotalPage;
  538. }
  539. function viewProvince(page) {
  540. $(".province .list ul li").remove();
  541. if (page == 1) {
  542. $(".province .pre a").removeClass("can");
  543. $(".province .next a").addClass("can");
  544. } else {
  545. $(".province .pre a").addClass("can");
  546. $(".province .next a").addClass("can");
  547. }
  548. var end;
  549. var start;
  550. if (page == provinceTotalPage) {
  551. start = (page - 1) * p_pageSize;
  552. end = provinces.length;
  553. $(".province .next a").removeClass("can");
  554. } else {
  555. start = (page - 1) * p_pageSize;
  556. end = start + p_pageSize;
  557. }
  558. for (var i = start; i < end; i++) {
  559. var p_id = provinces[i].id;
  560. var p_name = provinces[i].provinceName;
  561. if (provinces[i].provinceName == '内蒙古自治区') {
  562. p_name = '内蒙古';
  563. } else if (provinces[i].provinceName == '黑龙江省') {
  564. p_name = '黑龙江';
  565. } else {
  566. p_name = provinces[i].provinceName.substr(0, 2);
  567. }
  568. var li = $('<li><a style="background: none repeat scroll 0% 0% transparent; border: 0px none;" href="javascript:onclick=viewCities(' + i + ');" id="' + p_id + '">' + p_name + '</a></li>');
  569. $(".province .list ul").append(li);
  570. }
  571. $(".province .list #provincePage").remove();
  572. $(".province .list").append("<label id='provincePage' style='display:none;'>" + page + "</label>");
  573. }
  574. function viewCities(i) {
  575. proId = provinces[i].id;
  576. $("body").data("pName", provinces[i].provinceName);
  577. $("body").data("pId", proId);
  578. citys = [];
  579. var j = 0;
  580. $.each(cities,
  581. function(i, city) {
  582. if (city.provinceId == proId) {
  583. citys[j++] = city;
  584. }
  585. });
  586. cityTotalPage = Math.ceil(citys.length / p_pageSize);
  587. $(".provinceCity").find(".tabs").find("a").removeClass("current");
  588. $(".provinceCity .tabs").find("#city").addClass("current");
  589. $(".con .province .list a").removeClass("current");
  590. $(".con .province .list a[id='" + proId + "']").addClass("current");
  591. $(".provinceCity").find(".con").children().hide();
  592. $(".provinceCity").find(".con").find(".city").show();
  593. cityPage(1);
  594. }
  595. function cityPage(page) {
  596. $(".city .list ul li").remove();
  597. $(".cityAll .list ul li").remove();
  598. if (page == 1) {
  599. $(".city .pre a").removeClass("can");
  600. } else {
  601. $(".city .pre a").addClass("can");
  602. }
  603. var start;
  604. var end;
  605. if (page <= 1) {
  606. page = 1;
  607. $(".city .pre a").removeClass("can");
  608. $(".city .next a").addClass("can");
  609. }
  610. if (cityTotalPage == 1) {
  611. $(".city .next a").removeClass("can");
  612. $(".city .pre a").removeClass("can");
  613. }
  614. if (page >= cityTotalPage) {
  615. page = cityTotalPage;
  616. $(".city .next a").removeClass("can");
  617. start = (page - 1) * p_pageSize;
  618. end = citys.length;
  619. } else if (page == 1) {
  620. start = (page - 1) * p_pageSize;
  621. end = start + p_pageSize;
  622. $(".city .pre a").removeClass("can");
  623. $(".city .next a").addClass("can");
  624. } else {
  625. start = (page - 1) * p_pageSize;
  626. end = start + p_pageSize;
  627. $(".city .next a").addClass("can");
  628. $(".city .pre a").addClass("can");
  629. }
  630. for (var i = start; i < end; i++) {
  631. var c_id = citys[i].id;
  632. var cityName = citys[i].name.substr(0, 4);
  633. var li = $('<li><a href="javascript:onclick=viewCounties(' + i + ')" id="' + c_id + '">' + cityName + '</a></li>');
  634. $(".city .list ul").append(li);
  635. }
  636. $(".city .list #cityPage").remove();
  637. $(".city .list").append("<label id='cityPage' style='display:none;'>" + page + "</label>");
  638. }
  639. function viewCounties(i) {
  640. cityId = citys[i].id;
  641. $("body").data("cId", cityId);
  642. var nameOfCity = $.trim(citys[i].name);
  643. $("body").data("nameOfCity", nameOfCity);
  644. counties = [];
  645. var j = 0;
  646. $.each(areas,
  647. function(i, county) {
  648. if (county.cityId == cityId) {
  649. counties[j++] = county;
  650. }
  651. });
  652. countyTotalPage = Math.ceil(counties.length / p_pageSize);
  653. $(".provinceCity").find(".tabs").find("a").removeClass("current");
  654. $(".provinceCity .tabs").find("#county").addClass("current");
  655. $(".con .city .list a").removeClass("current");
  656. $(".con .city .list a[id='" + cityId + "']").addClass("current");
  657. $(".provinceCity").find(".con").children().hide();
  658. $(".provinceCity").find(".con").find(".county").show();
  659. countyPage(1);
  660. }
  661. function countyPage(page) {
  662. var nameValue = $("input.current1").attr("name");
  663. var nameOfProvince = $("body").data("pName");
  664. var cityCurName = $("body").data("nameOfCity");
  665. $("input.current1").removeClass("iGrays");
  666. $("input.current1").val(nameOfProvince + "-" + cityCurName);
  667. $(".county .list ul li").remove();
  668. if (page == 1) {
  669. $(".county .pre a").removeClass("can");
  670. } else {
  671. $(".county .pre a").addClass("can");
  672. }
  673. var start;
  674. var end;
  675. if (page <= 1) {
  676. page = 1;
  677. $(".county .pre a").removeClass("can");
  678. $(".county .next a").addClass("can");
  679. }
  680. if (countyTotalPage == 1) {
  681. $(".county .next a").removeClass("can");
  682. $(".county .pre a").removeClass("can");
  683. }
  684. if (page >= countyTotalPage) {
  685. page = countyTotalPage;
  686. $(".county .next a").removeClass("can");
  687. start = (page - 1) * p_pageSize;
  688. end = counties.length;
  689. } else if (page == 1) {
  690. start = (page - 1) * p_pageSize;
  691. end = start + p_pageSize;
  692. $(".county .pre a").removeClass("can");
  693. $(".county .next a").addClass("can");
  694. } else {
  695. start = (page - 1) * p_pageSize;
  696. end = start + p_pageSize;
  697. $(".county .next a").addClass("can");
  698. $(".county .pre a").addClass("can");
  699. }
  700. for (var i = start; i < end; i++) {
  701. var c_id = counties[i].id;
  702. var countyName = counties[i].areaName.substr(0, 4);;
  703. var li = $('<li><a href="javascript:onclick=addrInput(' + i + ')" id="' + c_id + '">' + countyName + '</a></li>');
  704. $(".county .list ul").append(li);
  705. }
  706. $(".county .list #countyPage").remove();
  707. $(".county .list").append("<label id='countyPage' style='display:none;'>" + page + "</label>");
  708. }
  709. function addrInput(i) {
  710. var countyId = $.trim(counties[i].id);
  711. $(".con .hotCity .list a input").removeClass("current");
  712. $(".con .hotCity .list a input[id='" + cityId + "']").addClass("current");
  713. $(".con .county .list a").removeClass("current");
  714. $(".con .county .list a[id='" + countyId + "']").addClass("current");
  715. proId = $("body").data("pId");
  716. cityId = $("body").data("cId");
  717. var p = null;
  718. $.each(provinces,
  719. function(i, province) {
  720. if (province.id == proId) {
  721. p = province.provinceName;
  722. return false;
  723. }
  724. });
  725. var c = null;
  726. $.each(cities,
  727. function(i, city) {
  728. if (city.id == cityId) {
  729. c = city.name;
  730. return false;
  731. }
  732. });
  733. var a = null;
  734. $.each(counties,
  735. function(i, county) {
  736. if (county.id == countyId) {
  737. a = county.areaName;
  738. return false;
  739. }
  740. });
  741. $("input.current1").removeClass("iGrays");
  742. $(".provinceCity").hide();
  743. var rtn = p + "-" + c + "-" + a;
  744. $("input.current1").val(rtn);
  745. $(".backifname").hide();
  746. var nameValue = $("input.current1").attr("name");
  747. if (nameValue == 'order.sdeptProCity')
  748. {
  749. $("#deptCityId").val(cityId);
  750. $("input[name='order.sdeptProCity']").trigger("change", [cityId, countyId]);
  751. }
  752. if (nameValue == 'consignor.deptProCity')
  753. {
  754. $("input[name='consignor.deptProCity']").trigger("change", [cityId, countyId]);
  755. }
  756. if (nameValue == 'template.sdeptProCity')
  757. {
  758. $("input[name='template.sdeptProCity']").trigger("change", [cityId, countyId]);
  759. }
  760. }
  761. function hotCityAddrInput(proCityId) {
  762. proId = proCityId.split(",")[0];
  763. cityId = proCityId.split(",")[1];
  764. var cityCurName = proCityId.split(",")[2];
  765. $("body").data("nameOfCity", cityCurName);
  766. $("body").data("pId", proId);
  767. $("body").data("cId", cityId);
  768. $.each(provinces,
  769. function(i, pro) {
  770. if (pro.id == proId) {
  771. $("body").data("pName", pro.provinceName);
  772. }
  773. });
  774. counties = [];
  775. var j = 0;
  776. $.each(areas,
  777. function(i, county) {
  778. if (county.cityId == cityId) {
  779. counties[j++] = county;
  780. }
  781. });
  782. countyTotalPage = Math.ceil(counties.length / p_pageSize);
  783. $(".provinceCity").find(".tabs").find("a").removeClass("current");
  784. $(".provinceCity .tabs").find("#county").addClass("current");
  785. $(".con .city .list a").removeClass("current");
  786. $(".con .city .list a[id='" + cityId + "']").addClass("current");
  787. $(".provinceCity").find(".con").children().hide();
  788. $(".provinceCity").find(".con").find(".county").show();
  789. $(".con .provinceAll .list a").removeClass("current");
  790. countyPage(1);
  791. }
  792. var allProvinces = null;
  793. var allCities = null;
  794. var allAreas = null;
  795. var allProId = null;
  796. var cityIdAll = null;
  797. var provinceAllTotalPage = null;
  798. var pa_pageSize = 12;
  799. var pa_currentPage = 1;
  800. function sendAllProvinceAjax() {
  801. $.ajax({
  802. type: "get",
  803. url: path + '/common/other/city/js/queryAllProvinces.js',
  804. async: false,
  805. dataType: "json",
  806. success: function(data) {
  807. allProvinces = data.provinces;
  808. $("body").data("allProvinces", allProvinces);
  809. viewAllProvince(1);
  810. },
  811. error: function(XMLHttpRequest, textStatus, errorThrown)
  812. {
  813. //alert(textStatus);
  814. }
  815. });
  816. }
  817. function sendAllCitiesAjax() {
  818. $.ajax({
  819. type: "get",
  820. url: path + '/common/other/city/js/queryCities.js',
  821. async: false,
  822. dataType: "json",
  823. success: function(data) {
  824. //alert("万一成功了呢");
  825. allCities = data.cities;
  826. $("body").data("CitysAll", data);
  827. viewAllHotCities();
  828. },
  829. error: function(XMLHttpRequest, textStatus, errorThrown)
  830. {
  831. alert("网络有误!");
  832. }
  833. });
  834. }
  835. function sendAllCountiesAjax()
  836. {
  837. $.ajax({
  838. type: "get",
  839. url: path + '/common/other/city/js/queryAllAreas.js',
  840. async: false,
  841. dataType: "json",
  842. success: function(data) {
  843. allAreas = data.areas;
  844. $("body").data("allCountys", data.areas);
  845. },
  846. error: function(XMLHttpRequest, textStatus, errorThrown)
  847. {
  848. //alert("网络繁忙,请稍后再试!");
  849. }
  850. });
  851. }
  852. function viewAllHotCities() {
  853. $.each(allCities,
  854. function(i, city) {
  855. if (city.hotCity) {
  856. $(".hotCityAll .list ul").append("<li><a><input type='button' style='background:none;border:0px;cursor: pointer;' onclick=hotCityAddrInputAll(\'" + city.provinceId + "," + city.id + "," + city.name + "\') id='" + city.id + "' value='" + city.name + "'></a></li>");
  857. }
  858. });
  859. }
  860. $(".provinceAll .pre a").bind('click',
  861. function() {
  862. var provincePage1 = parseInt($('#provincePage1').html());
  863. if (provincePage1 == 1) {
  864. return;
  865. }
  866. viewAllProvince(provincePage1 - 1);
  867. });
  868. $(".cityAll .pre a").bind('click',
  869. function() {
  870. var cityPages1 = parseInt($('#cityPage1').html());
  871. if (cityPages1 == 1) {
  872. return;
  873. }
  874. allCityPage(cityPages1 - 1);
  875. });
  876. $(".countyAll .pre a").bind('click',
  877. function() {
  878. var countyPages = parseInt($('#countyPage1').html());
  879. if (countyPages == 1) {
  880. return;
  881. }
  882. allCountyPage(countyPages - 1);
  883. });
  884. $(".provinceAll .next a").bind('click',
  885. function() {
  886. var provincePage1 = parseInt($('#provincePage1').html());
  887. provinceAllTotalPage = countAllProvincePages();
  888. if (provincePage1 >= provinceAllTotalPage) {
  889. return;
  890. }
  891. viewAllProvince(provincePage1 + 1);
  892. });
  893. $(".cityAll .next a").bind('click',
  894. function() {
  895. if ($(this).hasClass("can")) {
  896. var cityPages1 = parseInt($('#cityPage1').html());
  897. allCityPage(cityPages1 + 1);
  898. }
  899. });
  900. $(".countyAll .next a").bind('click',
  901. function() {
  902. if ($(this).hasClass("can")) {
  903. var countyPages = parseInt($('#countyPage1').html());
  904. allCountyPage(countyPages + 1);
  905. }
  906. });
  907. function json2str(o) {
  908. var arr = [];
  909. var fmt = function(s) {
  910. if (typeof s == 'object' && s != null) return json2str(s);
  911. return /^(string|number)$/.test(typeof s) ? "'" + s + "'": s;
  912. };
  913. for (var i in o) arr.push("'" + i + "':" + fmt(o[i]));
  914. return '{' + arr.join(',') + '}';
  915. }
  916. function countAllProvincePages() {
  917. provinceAllTotalPage = Math.ceil(allProvinces.length / pa_pageSize);
  918. return provinceAllTotalPage;
  919. }
  920. function viewAllProvince(page) {
  921. $(".provinceAll .list ul li").remove();
  922. if (page == 1) {
  923. $(".provinceAll .pre a").removeClass("can");
  924. $(".provinceAll .next a").addClass("can");
  925. } else {
  926. $(".provinceAll .pre a").addClass("can");
  927. $(".provinceAll .next a").addClass("can");
  928. }
  929. var end;
  930. var start;
  931. if (page == provinceAllTotalPage) {
  932. start = (page - 1) * pa_pageSize;
  933. end = allProvinces.length;
  934. $(".provinceAll .next a").removeClass("can");
  935. } else {
  936. start = (page - 1) * pa_pageSize;
  937. end = start + pa_pageSize;
  938. }
  939. for (var i = start; i < end; i++) {
  940. var p_id = allProvinces[i].id;
  941. var p_name = allProvinces[i].provinceName;
  942. if (allProvinces[i].provinceName == '内蒙古自治区') {
  943. p_name = '内蒙古';
  944. } else if (allProvinces[i].provinceName == '黑龙江省') {
  945. p_name = '黑龙江';
  946. } else {
  947. p_name = allProvinces[i].provinceName.substr(0, 2);
  948. }
  949. var li = $('<li><a style="background: none repeat scroll 0% 0% transparent; border: 0px none;" href="javascript:onclick=viewAllCities(' + i + ');" id="' + p_id + '">' + p_name + '</a></li>');
  950. $(".provinceAll .list ul").append(li);
  951. }
  952. $(".provinceAll .list #provincePage1").remove();
  953. $(".provinceAll .list").append("<label id='provincePage1' style='display:none;'>" + page + "</label>");
  954. }
  955. function viewAllCities(i) {
  956. allProId = allProvinces[i].id;
  957. $("body").data("pAllName", allProvinces[i].provinceName);
  958. $("body").data("pAllId", allProId);
  959. allCitys = [];
  960. var j = 0;
  961. $.each(allCities,
  962. function(i, city) {
  963. if (city.provinceId == allProId) {
  964. allCitys[j++] = city;
  965. }
  966. });
  967. allCityTotalPage = Math.ceil(allCitys.length / pa_pageSize);
  968. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  969. $(".provinceCityAll .tabs").find("#cityAll").addClass("current");
  970. $(".con .provinceAll .list a").removeClass("current");
  971. $(".con .provinceAll .list a[id='" + allProId + "']").addClass("current");
  972. $(".provinceCityAll").find(".con").children().hide();
  973. $(".provinceCityAll").find(".con").find(".cityAll").show();
  974. allCityPage(1);
  975. }
  976. function allCityPage(page) {
  977. $(".cityAll .list ul li").empty();
  978. $(".cityAll .list ul li").remove();
  979. if (page == 1) {
  980. $(".cityAll .pre a").removeClass("can");
  981. } else {
  982. $(".cityAll .pre a").addClass("can");
  983. }
  984. var start;
  985. var end;
  986. if (page <= 1) {
  987. page = 1;
  988. $(".cityAll .pre a").removeClass("can");
  989. $(".cityAll .next a").addClass("can");
  990. }
  991. if (allCityTotalPage == 1) {
  992. $(".cityAll .next a").removeClass("can");
  993. $(".cityAll .pre a").removeClass("can");
  994. }
  995. if (page >= allCityTotalPage) {
  996. page = allCityTotalPage;
  997. $(".cityAll .next a").removeClass("can");
  998. start = (page - 1) * pa_pageSize;
  999. end = allCitys.length;
  1000. } else if (page == 1) {
  1001. start = (page - 1) * pa_pageSize;
  1002. end = start + pa_pageSize;
  1003. $(".cityAll .pre a").removeClass("can");
  1004. $(".cityAll .next a").addClass("can");
  1005. } else {
  1006. start = (page - 1) * pa_pageSize;
  1007. end = start + pa_pageSize;
  1008. $(".cityAll .next a").addClass("can");
  1009. $(".cityAll .pre a").addClass("can");
  1010. }
  1011. for (var i = start; i < end; i++) {
  1012. var c_id = allCitys[i].id;
  1013. var cityName = allCitys[i].name.substr(0, 4);
  1014. var li = $('<li><a href="javascript:onclick=viewAllCounties(' + i + ')" id="' + c_id + '">' + cityName + '</a></li>');
  1015. $(".cityAll .list ul").append(li);
  1016. }
  1017. $(".cityAll .list #cityPage1").remove();
  1018. $(".cityAll .list").append("<label id='cityPage1' style='display:none;'>" + page + "</label>");
  1019. }
  1020. function viewAllCounties(i) {
  1021. cityIdAll = allCitys[i].id;
  1022. $("body").data("cAllId", cityIdAll);
  1023. var cityname = $.trim(allCitys[i].name);
  1024. $("body").data("nameOfCityAll", cityname);
  1025. countiesAll = [];
  1026. var j = 0;
  1027. $.each(allAreas,
  1028. function(i, countys) {
  1029. if (countys.cityId == cityIdAll) {
  1030. countiesAll[j++] = countys;
  1031. }
  1032. });
  1033. countyTotalPageAll = Math.ceil(countiesAll.length / pa_pageSize);
  1034. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  1035. $(".provinceCityAll .tabs").find("#countyAll").addClass("current");
  1036. $(".con .cityAll .list a").removeClass("current");
  1037. $(".con .cityAll .list a[id='" + cityIdAll + "']").addClass("current");
  1038. $(".provinceCityAll").find(".con").children().hide();
  1039. $(".provinceCityAll").find(".con").find(".countyAll").show();
  1040. allCountyPage(1);
  1041. }
  1042. function allCountyPage(page) {
  1043. var nameOfProvince = $("body").data("pAllName");
  1044. var cityCurrentName = $("body").data("nameOfCityAll");
  1045. $("input.current2").removeClass("iGrays");
  1046. $("input.current2").val(nameOfProvince + "-" + cityCurrentName);
  1047. $(".countyAll .list ul li").remove();
  1048. if (page == 1) {
  1049. $(".countyAll .pre a").removeClass("can");
  1050. } else {
  1051. $(".countyAll .pre a").addClass("can");
  1052. }
  1053. var start;
  1054. var end;
  1055. if (page <= 1) {
  1056. page = 1;
  1057. $(".countyAll .pre a").removeClass("can");
  1058. $(".countyAll .next a").addClass("can");
  1059. }
  1060. if (countyTotalPageAll == 1) {
  1061. $(".countyAll .next a").removeClass("can");
  1062. $(".countyAll .pre a").removeClass("can");
  1063. }
  1064. if (page >= countyTotalPageAll) {
  1065. page = countyTotalPageAll;
  1066. $(".countyAll .next a").removeClass("can");
  1067. start = (page - 1) * pa_pageSize;
  1068. end = countiesAll.length;
  1069. } else if (page == 1) {
  1070. start = (page - 1) * pa_pageSize;
  1071. end = start + pa_pageSize;
  1072. $(".countyAll .pre a").removeClass("can");
  1073. $(".countyAll .next a").addClass("can");
  1074. } else {
  1075. start = (page - 1) * pa_pageSize;
  1076. end = start + pa_pageSize;
  1077. $(".countyAll .next a").addClass("can");
  1078. $(".countyAll .pre a").addClass("can");
  1079. }
  1080. for (var i = start; i < end; i++) {
  1081. var c_id = countiesAll[i].id;
  1082. var countyName = countiesAll[i].areaName.substr(0, 4);;
  1083. var li = $('<li><a href="javascript:onclick=addrInputAll(' + i + ')" id="' + c_id + '">' + countyName + '</a></li>');
  1084. $(".countyAll .list ul").append(li);
  1085. }
  1086. $(".countyAll .list #countyPage1").remove();
  1087. $(".countyAll .list").append("<label id='countyPage1' style='display:none;'>" + page + "</label>");
  1088. }
  1089. function addrInputAll(i) {
  1090. var countyId = $.trim(countiesAll[i].id);
  1091. $(".con .hotCityAll .list a input").removeClass("current");
  1092. $(".con .hotCityAll .list a input[id='" + cityIdAll + "']").addClass("current");
  1093. $(".con .countyAll .list a").removeClass("current");
  1094. $(".con .countyAll .list a[id='" + countyId + "']").addClass("current");
  1095. allProId = $("body").data("pAllId");
  1096. cityIdAll = $("body").data("cAllId");
  1097. var p = null;
  1098. $.each(allProvinces,
  1099. function(i, province) {
  1100. if (province.id == allProId) {
  1101. p = province.provinceName;
  1102. return false;
  1103. }
  1104. });
  1105. var c = null;
  1106. $.each(allCities,
  1107. function(i, city) {
  1108. if (city.id == cityIdAll) {
  1109. c = city.name;
  1110. return false;
  1111. }
  1112. });
  1113. var a = null;
  1114. $.each(countiesAll,
  1115. function(i, county) {
  1116. if (county.id == countyId) {
  1117. a = county.areaName;
  1118. return false;
  1119. }
  1120. });
  1121. var nameValue = $("input.current2");
  1122. nameValue.removeClass("iGrays");
  1123. $(".provinceCityAll").hide();
  1124. var rtn = p + "-" + c + "-" + a;
  1125. $("input.current2").val(rtn);
  1126. $(".backifname").hide();
  1127. var nameValue = $("input.current2").attr("name");
  1128. if (nameValue == "consignor.addrProCity") {
  1129. $("#provinceId").val(allProId);
  1130. $("#cityId").val(cityIdAll);
  1131. }
  1132. if (nameValue == "order.caddrProCity")
  1133. {
  1134. $("input[name='order.caddrProCity']").trigger("change");
  1135. }
  1136. if (nameValue == "consigneeInfo.addrProCity")
  1137. {
  1138. $("input[name='consigneeInfo.addrProCity']").trigger("change");
  1139. }
  1140. if (nameValue == 'template.caddrProCity')
  1141. {
  1142. $("input[name='template.caddrProCity']").trigger("change");
  1143. }
  1144. }
  1145. function hotCityAddrInputAll(proCityId) {
  1146. allProId = proCityId.split(",")[0];
  1147. cityIdAll = proCityId.split(",")[1];
  1148. var cityCurName = proCityId.split(",")[2];
  1149. $("body").data("nameOfCityAll", cityCurName);
  1150. $("body").data("pAllId", allProId);
  1151. $("body").data("cAllId", cityIdAll);
  1152. $.each(allProvinces,
  1153. function(i, pro) {
  1154. if (pro.id == allProId) {
  1155. $("body").data("pAllName", pro.provinceName);
  1156. }
  1157. });
  1158. countiesAll = [];
  1159. var j = 0;
  1160. $.each(allAreas,
  1161. function(i, county) {
  1162. if (county.cityId == cityIdAll) {
  1163. countiesAll[j++] = county;
  1164. }
  1165. });
  1166. countyTotalPageAll = Math.ceil(countiesAll.length / pa_pageSize);
  1167. $(".provinceCityAll").find(".tabs").find("a").removeClass("current");
  1168. $(".provinceCityAll .tabs").find("#countyAll").addClass("current");
  1169. $(".con .cityAll .list a").removeClass("current");
  1170. $(".con .cityAll .list a[id='" + cityIdAll + "']").addClass("current");
  1171. $(".provinceCityAll").find(".con").children().hide();
  1172. $(".provinceCityAll").find(".con").find(".countyAll").show();
  1173. $(".con .provinceAll .list a").removeClass("current");
  1174. allCountyPage(1);
  1175. }