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.
 
 
 
 
 
 

130 lines
3.9 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. if(js_type == 1) {
  28. //接机
  29. if(airprot_place == 'airprot') {
  30. //接机查机场
  31. } else {
  32. //接机查地点
  33. }
  34. } else {
  35. //送机
  36. if(airprot_place == 'airprot') {
  37. //送机查机场
  38. } else {
  39. //送机查地点
  40. }
  41. }
  42. //访问地址和参数
  43. // $.post(url,parm,function(res_data){
  44. // res_data=JSON.parse(res_data);
  45. // ZZLog(res_data);
  46. // if(res_data["code"]!="0"){
  47. // alert(res_data["info"]);
  48. // return;
  49. // }
  50. // //将下拉列表展示出来
  51. // $(".select_xiala").css('z-index','999');
  52. // var list=res_data['list'];
  53. // var HTML="";
  54. // for (var i=0,m=list.length;i<m;i++) {
  55. // var dict=list[i];
  56. // 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>'
  57. // }
  58. // $(".select_xiala").html(HTML);
  59. // });
  60. var res_data = {
  61. code: 0,
  62. info: "数据返回成功",
  63. list: [{
  64. area_id: 791,
  65. area_name: "上海市",
  66. type: "area"
  67. }, {
  68. area_id: 3240,
  69. area_name: "上海市迪士尼",
  70. type: "area"
  71. }, {
  72. area_id: "9258",
  73. area_name: "上海浦东临港开元大酒店",
  74. type: "res"
  75. }, {
  76. area_id: 9,
  77. area_name: "人民广场上车点",
  78. type: "res"
  79. }]
  80. }
  81. // function(res_data) {
  82. // res_data = JSON.parse(res_data);
  83. ZZLog(res_data);
  84. if(res_data["code"] != "0") {
  85. alert(res_data["info"]);
  86. return;
  87. }
  88. //将下拉列表展示出来
  89. $(".select_xiala").css('z-index', '999');
  90. var list = res_data['list'];
  91. var HTML = "";
  92. for(var i = 0, m = list.length; i < m; i++) {
  93. var dict = list[i];
  94. 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>'
  95. }
  96. $(".select_xiala").html(HTML);
  97. // }
  98. });
  99. //取消
  100. $('#btn_cancel').on('click', function(e) {
  101. $('#key_word').val('');
  102. $(".select_xiala").css('z-index', '-1');
  103. $(".select_xiala").html('');
  104. $("#btn_cancel").css("color", "#FFF");
  105. });
  106. }
  107. function click_select_area(self_id) {
  108. var self_obj = $('#' + self_id);
  109. var area_name = self_obj.attr('area_name');
  110. var area_id = self_obj.attr('area_id');
  111. var data = getStorJson('pick_drop'); //拿到缓存
  112. var type = getStorJson('type'); //接机还是送机
  113. var are_type = getPar('area_type'); //判断是查站点还是机场
  114. if(are_type == 'airport') {
  115. data.airprot_name = area_name;
  116. data.airprot_id = area_id;
  117. } else {
  118. data.place_name = area_name;
  119. data.place_id = area_id;
  120. }
  121. setStorJson('pick_drop', data);
  122. window.location.href = "pick_drop_person.html";
  123. }