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.
 
 
 
 
 
 

157 lines
4.5 KiB

  1. //
  2. //Created by HBuilder.
  3. //User: Miracle~
  4. //Date: 2016/11/14
  5. //Time: 9:00
  6. //接机有联动,送机没有联动
  7. var key_word = "";
  8. var area_type = "all";
  9. $("#loading_html").show();
  10. //页面加载
  11. window.onload = function() {
  12. // eg:打字太快 如黄
  13. // 黄的数据先出来,拼音的后出来就没有显示
  14. var js_type = getPar('type'); //接送类型
  15. var airprot_place = getPar('area_type'); //查机场还是查地点
  16. var airprot_name = getPar('airprot_name'); //接机机场名称
  17. var airprot_id = getPar('airprot_id'); //接机机场id
  18. $('#key_word').on('input', function(e) {
  19. $("#btn_cancel").css("color", "#0076ff");
  20. key_word = $(this).val();
  21. //访问地址和参数
  22. // var url = "./weixin2t_test/jiekou_test.php";
  23. // var parm = {
  24. // type: "bus_area_list",
  25. // area: key_word,
  26. // }
  27. var url;
  28. var parm = {
  29. line_type: '',
  30. poi_type: '',
  31. poi_name: '',
  32. inout_type: '',
  33. station_id: '',
  34. };
  35. if(js_type == 1) {
  36. //接机
  37. if(airprot_place == 'airprot') {
  38. //接机查机场
  39. parm.line_type=380;
  40. parm.poi_type=7;
  41. parm.poi_name=key_word;
  42. parm.inout_type='in';
  43. station_id='';
  44. } else {
  45. //接机查地点
  46. parm.line_type=380;
  47. parm.poi_type='';
  48. parm.poi_name=key_word;
  49. parm.inout_type='out';
  50. station_id=airprot_id;
  51. }
  52. } else {
  53. //送机
  54. if(airprot_place == 'airprot') {
  55. //送机查机场
  56. parm.line_type=380;
  57. parm.poi_type=7;
  58. parm.poi_name=key_word;
  59. parm.inout_type='out';
  60. station_id='';
  61. } else {
  62. //送机查地点
  63. parm.line_type=380;
  64. parm.poi_type="";
  65. parm.poi_name=key_word;
  66. parm.inout_type='in';
  67. station_id='';
  68. }
  69. }
  70. //访问地址和参数
  71. // $.post(url,parm,function(res_data){
  72. // res_data=JSON.parse(res_data);
  73. // ZZLog(res_data);
  74. // if(res_data["code"]!="0"){
  75. // alert(res_data["info"]);
  76. // return;
  77. // }
  78. // //将下拉列表展示出来
  79. // $(".select_xiala").css('z-index','999');
  80. // var list=res_data['list'];
  81. // var HTML="";
  82. // for (var i=0,m=list.length;i<m;i++) {
  83. // var dict=list[i];
  84. // HTML += '<div style="margin-left: 0.38rem;color: #999;font-size: 0.16rem;margin-right: 0rem;" class="content_xiala ui_p_t15 ui_p_b15 ui_m_l15 ui_m_r15 ui_line_b line_color_b bc-border" onclick="click_select_area('+dict['area_id']+')" id='+dict['area_id']+' type="'+dict['type']+'" area_id="'+dict['area_id']+'" area_name="'+dict['area_name']+'">'+dict['area_name']+'</div>'
  85. // }
  86. // $(".select_xiala").html(HTML);
  87. // });
  88. var res_data = {
  89. code: 0,
  90. info: "数据返回成功",
  91. list: [{
  92. area_id: 791,
  93. area_name: "上海市",
  94. type: "area"
  95. }, {
  96. area_id: 3240,
  97. area_name: "上海市迪士尼",
  98. type: "area"
  99. }, {
  100. area_id: "9258",
  101. area_name: "上海浦东临港开元大酒店",
  102. type: "res"
  103. }, {
  104. area_id: 9,
  105. area_name: "人民广场上车点",
  106. type: "res"
  107. }]
  108. }
  109. // function(res_data) {
  110. // res_data = JSON.parse(res_data);
  111. ZZLog(res_data);
  112. if(res_data["code"] != "0") {
  113. alert(res_data["info"]);
  114. return;
  115. }
  116. //将下拉列表展示出来
  117. $(".select_xiala").css('z-index', '999');
  118. var list = res_data['list'];
  119. var HTML = "";
  120. for(var i = 0, m = list.length; i < m; i++) {
  121. var dict = list[i];
  122. HTML += '<div style="margin-left: 0.38rem;color: #999;font-size: 0.16rem;margin-right: 0rem;" class="content_xiala ui_p_t15 ui_p_b15 ui_m_l15 ui_m_r15 ui_line_b line_color_b bc-border" onclick="click_select_area(' + dict['area_id'] + ')" id=' + dict['area_id'] + ' type="' + dict['type'] + '" area_id="' + dict['area_id'] + '" area_name="' + dict['area_name'] + '">' + dict['area_name'] + '</div>'
  123. }
  124. $(".select_xiala").html(HTML);
  125. // }
  126. });
  127. //取消
  128. $('#btn_cancel').on('click', function(e) {
  129. $('#key_word').val('');
  130. $(".select_xiala").css('z-index', '-1');
  131. $(".select_xiala").html('');
  132. $("#btn_cancel").css("color", "#FFF");
  133. });
  134. }
  135. function click_select_area(self_id) {
  136. var self_obj = $('#' + self_id);
  137. var area_name = self_obj.attr('area_name');
  138. var area_id = self_obj.attr('area_id');
  139. var data = getStorJson('pick_drop'); //拿到缓存
  140. var type = getStorJson('type'); //接机还是送机
  141. var are_type = getPar('area_type'); //判断是查站点还是机场
  142. if(are_type == 'airport') {
  143. data.airprot_name = area_name;
  144. data.airprot_id = area_id;
  145. } else {
  146. data.place_name = area_name;
  147. data.place_id = area_id;
  148. }
  149. setStorJson('pick_drop', data);
  150. window.location.href = "pick_drop_person.html";
  151. }