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.
 
 
 
 
 
 

97 lines
3.1 KiB

  1. var key_word = "";
  2. var area_type = "all";
  3. var type_null = "";
  4. //页面加载
  5. window.onload = function() {
  6. // eg:打字太快 如黄
  7. // 黄的数据先出来,拼音的后出来就没有显示
  8. $('#key_word').on('input', function(e) {
  9. $("#btn_cancel").css("color", "#0076ff");
  10. key_word = $(this).val();
  11. //var url=test_api+"zz_wxsct/control.php";
  12. var url = "./weixin2t_test/jiekou_test.php";
  13. var parm = {
  14. type: "bus_area_list",
  15. area: key_word,
  16. area_type: type_null
  17. }
  18. ZZLog(url + JSON.stringify(parm));
  19. // $.post(url,parm,function(res_data){
  20. // res_data=JSON.parse(res_data);
  21. // ZZLog(res_data);
  22. // if(res_data["code"]!="0"){
  23. // alert(res_data["info"]);
  24. // return;
  25. // }
  26. // //将下拉列表展示出来
  27. // $(".select_xiala").css('z-index','999');
  28. // var list=res_data['list'];
  29. // var HTML="";
  30. // for (var i=0,m=list.length;i<m;i++) {
  31. // var dict=list[i];
  32. // 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>'
  33. // }
  34. // $(".select_xiala").html(HTML);
  35. // });
  36. var res_data = {
  37. code: 0,
  38. info: "数据返回成功",
  39. list: [{
  40. area_id: 791,
  41. area_name: "上海市",
  42. type: "area"
  43. }, {
  44. area_id: 3240,
  45. area_name: "上海市迪士尼",
  46. type: "area"
  47. }, {
  48. area_id: "9258",
  49. area_name: "上海浦东临港开元大酒店",
  50. type: "res"
  51. }, {
  52. area_id: 9,
  53. area_name: "人民广场上车点",
  54. type: "res"
  55. }]
  56. }
  57. // function(res_data) {
  58. // res_data = JSON.parse(res_data);
  59. ZZLog(res_data);
  60. if(res_data["code"] != "0") {
  61. alert(res_data["info"]);
  62. return;
  63. }
  64. //将下拉列表展示出来
  65. $(".select_xiala").css('z-index', '999');
  66. var list = res_data['list'];
  67. var HTML = "";
  68. for(var i = 0, m = list.length; i < m; i++) {
  69. var dict = list[i];
  70. 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>'
  71. }
  72. $(".select_xiala").html(HTML);
  73. // }
  74. });
  75. //取消
  76. $('#btn_cancel').on('click', function(e) {
  77. $('#key_word').val('');
  78. $(".select_xiala").css('z-index', '-1');
  79. $(".select_xiala").html('');
  80. $("#btn_cancel").css("color", "#FFF");
  81. });
  82. }
  83. function click_select_area(self_id) {
  84. var self_obj = $('#' + self_id);
  85. var area_name = self_obj.attr('area_name');
  86. var area_id = self_obj.attr('area_id');
  87. var data = getStorJson('pick_drop'); //拿到缓存
  88. var type = getStorJson('type'); //接机还是送机
  89. var are_type = getPar('area_type'); //判断是查站点还是机场
  90. window.location.href = listURL;
  91. }