You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

357 lines
11 KiB

  1. //Author:fuhc
  2. //Date:20160825
  3. $("#loading_html").show();
  4. //Description:热门城市
  5. var key_word = "";
  6. var area_type = "all";
  7. var type_null = "";
  8. //线路类型
  9. var line_type = getPar("line_type");
  10. var poi_type = getPar("poi_type");
  11. var poi_name = "";
  12. var inout_type = getPar("op_type");
  13. var station_id = getPar("station_id");
  14. var from = getPar("from");
  15. //页面加载
  16. window.onload = function() {
  17. var param1 = {
  18. line_type: line_type,
  19. poi_type: poi_type,
  20. poi_name: poi_name,
  21. inout_type: inout_type,
  22. station_id: station_id
  23. }
  24. ZZLog(base_api + "base/getStation&" + JSON.stringify(param1));
  25. $.ajax({
  26. type: "post",
  27. url: base_api + "base/getStation",
  28. data: param1,
  29. async: false,
  30. dataType: 'json',
  31. success: function(res_data) {
  32. ZZLog(res_data);
  33. if(res_data.flag == true) {
  34. base_html(res_data.data);
  35. } else {
  36. alert(res_data.mag);
  37. }
  38. },
  39. error: function(e) {
  40. ZZLog(e);
  41. }
  42. });
  43. // eg:打字太快 如黄
  44. // 黄的数据先出来,拼音的后出来就没有显示
  45. function base_html(data) {
  46. var temp = "";
  47. if(data.length == 1) {
  48. $("#shaixuan").html("");
  49. $(".remove_height").css("height","0.6rem");
  50. $("#shaixuan").removeClass("outer_line_down_color");
  51. poi_type = data[0].type_id;
  52. } else {
  53. for(var i = 0; i < data.length; i++) {
  54. if(i == 0) {
  55. poi_type = data[i].type_id;
  56. temp += '<div select_type="' + data[i].type_id + '" style="width: 1%;" class="selected ub-f1 ub-pc">' +
  57. '<div class="select_color ulev1 ui_p_b10 ui_p_t10 select_div">' + data[i].type_name + '</div>' +
  58. '<span class="ub select_span select_border" style="width: 0.35rem;margin: 0 auto;"></span>' +
  59. '</div>'
  60. } else {
  61. temp += '<div select_type="' + data[i].type_id + '" style="width: 1%;" class="selected ub-f1 ub-pc">' +
  62. '<div class="unselect_color ulev1 ui_p_b10 ui_p_t10 select_div">' + data[i].type_name + '</div>' +
  63. '<span class="ub select_span unselect_border" style="width: 0.35rem;margin: 0 auto;"></span>' +
  64. '</div>'
  65. }
  66. }
  67. $("#shaixuan").html(temp);
  68. }
  69. if(inout_type=="in"&&poi_type=="0"){
  70. $("#hot1").show();
  71. $("#hot2").show();
  72. }else{
  73. $("#hot1").hide();
  74. $("#hot2").hide();
  75. }
  76. //头部切换
  77. $(".selected").click(function() {
  78. poi_type = $(this).attr("select_type");
  79. console.log(poi_type);
  80. $("#shaixuan").find(".select_div").removeClass("select_color");
  81. $("#shaixuan").find(".select_div").addClass("unselect_color");
  82. $("#shaixuan").find(".select_span").removeClass("select_border");
  83. $("#shaixuan").find(".select_span").addClass("unselect_border");
  84. $(this).find(".select_div").removeClass("unselect_color");
  85. $(this).find(".select_div").addClass("select_color");
  86. $(this).find(".select_span").removeClass("unselect_border");
  87. $(this).find(".select_span").addClass("select_border");
  88. if(poi_type=="0"&&inout_type=="in"){
  89. $("#hot1").show();
  90. $("#hot2").show();
  91. }else{
  92. $("#hot1").hide();
  93. $("#hot2").hide();
  94. }
  95. var param2 = {
  96. line_type: line_type,
  97. poi_type: poi_type,
  98. poi_name: poi_name,
  99. inout_type: inout_type,
  100. station_id: station_id
  101. }
  102. ZZLog(JSON.stringify(param2));
  103. $.post(base_api + "base/getStation", param2, function(res_data) {
  104. res_data = JSON.parse(res_data);
  105. ZZLog(res_data);
  106. //将下拉列表展示出来
  107. $(".select_content").css('z-index', '5');
  108. var list = res_data['data'];
  109. var letter_text = "";
  110. var all_html = "";
  111. var right_html = "";
  112. var HTML = "";
  113. var LetterBox=$('#letter');
  114. var Initials=$('.initials');
  115. for(var key in list){
  116. letter_text = '<div id="'+key+'" class="sort_letter">'+key+'</div>';
  117. right_html += '<li style="width: 100%;height: 0.2rem;">'+key+'</li>'
  118. HTML = "";
  119. for(var i=0;i<list[key].length;i++){
  120. HTML += '<div class="sort_list" onclick="click_select_area(' + list[key][i].area_id + ')" id=' + list[key][i].area_id + ' type="' + list[key][i].type + '" area_id="' + list[key][i].area_id + '" area_name="' + list[key][i].area_name + '">' +
  121. '<div class="num_name">' + list[key][i].area_name + '</div>' +
  122. '</div>'
  123. }
  124. all_html += letter_text + HTML;
  125. }
  126. $(".select_content").html(all_html);
  127. $("#right_letter").html(right_html);
  128. $(".initials ul li").on("mouseover",function(){
  129. var _this=$(this);
  130. var LetterHtml=_this.html();
  131. LetterBox.html(LetterHtml).fadeIn();
  132. // Initials.css('background','rgba(145,145,145,0.6)');
  133. setTimeout(function(){
  134. // Initials.css('background','rgba(145,145,145,0)');
  135. LetterBox.fadeOut();
  136. },1000);
  137. var _index = _this.index()
  138. if(_index==0){
  139. $('html,body').animate({scrollTop: '0px'}, 300);//点击第一个滚到顶部
  140. }else{
  141. var letter = _this.text();
  142. if($('#'+letter).length>0){
  143. var LetterTop = $('#'+letter).position().top;
  144. $('html,body').animate({scrollTop: parseInt(LetterTop+80)+'px'}, 300);
  145. }
  146. }
  147. })
  148. });
  149. })
  150. var param2 = {
  151. line_type: line_type,
  152. poi_type: poi_type,
  153. poi_name: poi_name,
  154. inout_type: inout_type,
  155. station_id: station_id
  156. }
  157. ZZLog(JSON.stringify(param2));
  158. $.post(base_api + "base/getStation", param2, function(res_data) {
  159. res_data = JSON.parse(res_data);
  160. ZZLog(res_data);
  161. //将下拉列表展示出来
  162. $(".select_content").css('z-index', '5');
  163. var list = res_data['data'];
  164. var HTML = "";
  165. var right_html = "";
  166. var letter_text = "";
  167. var all_html = "";
  168. var LetterBox=$('#letter');
  169. var Initials=$('.initials');
  170. for(var key in list){
  171. letter_text = '<div id="'+key+'" class="sort_letter">'+key+'</div>';
  172. right_html += '<li style="width: 100%;height: 0.2rem;">'+key+'</li>'
  173. HTML = "";
  174. for(var i=0;i<list[key].length;i++){
  175. HTML += '<div class="sort_list" onclick="click_select_area(' + list[key][i].area_id + ')" id=' + list[key][i].area_id + ' type="' + list[key][i].type + '" area_id="' + list[key][i].area_id + '" area_name="' + list[key][i].area_name + '">' +
  176. '<div class="num_name">' + list[key][i].area_name + '</div>' +
  177. '</div>'
  178. }
  179. all_html += letter_text + HTML;
  180. }
  181. $(".select_content").html(all_html);
  182. $("#right_letter").html(right_html);
  183. $(".initials ul li").on("mouseover",function(){
  184. var _this=$(this);
  185. var LetterHtml=_this.html();
  186. LetterBox.html(LetterHtml).fadeIn();
  187. // Initials.css('background','rgba(145,145,145,0.6)');
  188. setTimeout(function(){
  189. // Initials.css('background','rgba(145,145,145,0)');
  190. LetterBox.fadeOut();
  191. },1000);
  192. var _index = _this.index()
  193. if(_index==0){
  194. $('html,body').animate({scrollTop: '0px'}, 300);//点击第一个滚到顶部
  195. }else{
  196. var letter = _this.text();
  197. if($('#'+letter).length>0){
  198. var LetterTop = $('#'+letter).position().top;
  199. $('html,body').animate({scrollTop: parseInt(LetterTop+80)+'px'}, 300);
  200. }
  201. }
  202. })
  203. });
  204. }
  205. $('#key_word').on('input', function(e) {
  206. $("#btn_cancel").css("color", "#0076ff");
  207. key_word = $(this).val();
  208. var url = base_api + "base/getStation";
  209. if(getPar('poi_type')=='7+') {
  210. var parm = {
  211. line_type: line_type,
  212. poi_type: 7,
  213. poi_name: key_word,
  214. inout_type: inout_type,
  215. station_id: station_id
  216. };
  217. } else {
  218. var parm = {
  219. line_type: line_type,
  220. poi_type: 0,
  221. poi_name: key_word,
  222. inout_type: inout_type,
  223. station_id: station_id
  224. };
  225. }
  226. ZZLog(url + JSON.stringify(parm));
  227. $.post(url, parm, function(res_data) {
  228. res_data = JSON.parse(res_data);
  229. ZZLog(res_data);
  230. if(res_data.flag != true) {
  231. alert(res_data["msg"]);
  232. return;
  233. }
  234. //将下拉列表展示出来
  235. $(".select_xiala").css('z-index', '999');
  236. var list = res_data['data'];
  237. var HTML = "";
  238. for(var key in list){
  239. for(var i=0;i<list[key].length;i++){
  240. HTML += '<div style="color: #999;font-size: 0.16rem;margin-right: 0rem;padding-left:0.32rem;background-color:#fff;" class="content_xiala ui_p_t15 ui_p_b15 ui_line_b line_color_b bc-border" onclick="click_select_area(' + list[key][i].area_id + ')" id=' + list[key][i].area_id + ' type="' + list[key][i].type + '" area_id="' + list[key][i].area_id + '" area_name="' + list[key][i].area_name + '">' + list[key][i].area_name + '</div>'
  241. }
  242. }
  243. $(".select_xiala").html(HTML);
  244. $(".select_content").hide();
  245. });
  246. });
  247. //取消
  248. $('#btn_cancel').on('click', function(e) {
  249. $('#key_word').val('');
  250. $(".select_xiala").css('z-index', '-1');
  251. $(".select_xiala").html('');
  252. $("#btn_cancel").css("color", "#FFF");
  253. $(".select_content").show();
  254. });
  255. }
  256. function click_select_area(self_id) {
  257. if(from == "disney_tranship") {
  258. var self_obj = $('#' + self_id);
  259. var area_name = self_obj.attr('area_name');
  260. var area_id = self_obj.attr('area_id');
  261. var type = self_obj.attr('type');
  262. var temp_data = getStorJson('disney_tranship');
  263. if(temp_data.where_disney == 1) {
  264. //迪士尼在下面
  265. temp_data.up_name = area_name;
  266. temp_data.up_id = area_id;
  267. setStorJson("disney_tranship", temp_data);
  268. window.location.href = "disney_tranship.html";
  269. } else {
  270. //迪士尼在上面
  271. temp_data.down_name = area_name;
  272. temp_data.down_id = area_id;
  273. setStorJson("disney_tranship", temp_data);
  274. window.location.href = "disney_tranship.html";
  275. }
  276. } else if(from == "pick_drop_person") {
  277. var self_obj = $('#' + self_id);
  278. var area_name = self_obj.attr('area_name');
  279. var area_id = self_obj.attr('area_id');
  280. var data = getStorJson('pick_drop'); //拿到缓存
  281. var type = getStorJson('type'); //接机还是送机
  282. var are_type = getPar('area_type'); //判断是查站点还是机场
  283. if(are_type == 'airport') {
  284. data.airprot_name = area_name;
  285. data.airprot_id = area_id;
  286. } else {
  287. data.place_name = area_name;
  288. data.place_id = area_id;
  289. }
  290. setStorJson('pick_drop', data);
  291. window.location.href = "pick_drop_person.html";
  292. } else {
  293. var self_obj = $('#' + self_id);
  294. var area_name = self_obj.attr('area_name');
  295. var area_id = self_obj.attr('area_id');
  296. var type = self_obj.attr('type');
  297. var op_type = getPar('op_type'); //判断是选择出发地-还是目的地
  298. var data = {
  299. op_type: op_type,
  300. area_id: area_id,
  301. area_name: area_name
  302. };
  303. if(op_type == "in") {
  304. setStorJson('f_wx_start_hot_city20160826', data);
  305. }
  306. if(op_type == "out") {
  307. setStorJson('f_wx_end_hot_city20160826', data);
  308. }
  309. var tt = getDateTime(4);
  310. var listURL = 'travel_book.html?tt=' + tt;
  311. window.location.href = listURL;
  312. }
  313. }