|
- //
- //Created by HBuilder.
- //User: Miracle~
- //Date: 2016/11/14
- //Time: 9:00
- //接机有联动,送机没有联动
- var key_word = "";
- var area_type = "all";
- $("#loading_html").show();
-
- //页面加载
- window.onload = function() {
- // eg:打字太快 如黄
- // 黄的数据先出来,拼音的后出来就没有显示
- var js_type = getPar('type'); //接送类型
- var airprot_place = getPar('area_type'); //查机场还是查地点
- var airprot_name = getPar('airprot_name'); //接机机场名称
- var airprot_id = getPar('airprot_id'); //接机机场id
-
- $('#key_word').on('input', function(e) {
- $("#btn_cancel").css("color", "#0076ff");
- key_word = $(this).val();
- //访问地址和参数
- // var url = "./weixin2t_test/jiekou_test.php";
- // var parm = {
- // type: "bus_area_list",
- // area: key_word,
- // }
- if(js_type == 1) {
- //接机
- if(airprot_place == 'airprot') {
- //接机查机场
- } else {
- //接机查地点
- }
- } else {
- //送机
- if(airprot_place == 'airprot') {
- //送机查机场
- } else {
- //送机查地点
- }
- }
- //访问地址和参数
-
- // $.post(url,parm,function(res_data){
- // res_data=JSON.parse(res_data);
- // ZZLog(res_data);
- // if(res_data["code"]!="0"){
- // alert(res_data["info"]);
- // return;
- // }
- // //将下拉列表展示出来
- // $(".select_xiala").css('z-index','999');
- // var list=res_data['list'];
- // var HTML="";
- // for (var i=0,m=list.length;i<m;i++) {
- // var dict=list[i];
- // 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>'
- // }
- // $(".select_xiala").html(HTML);
- // });
- var res_data = {
- code: 0,
- info: "数据返回成功",
- list: [{
- area_id: 791,
- area_name: "上海市",
- type: "area"
- }, {
- area_id: 3240,
- area_name: "上海市迪士尼",
- type: "area"
- }, {
- area_id: "9258",
- area_name: "上海浦东临港开元大酒店",
- type: "res"
- }, {
- area_id: 9,
- area_name: "人民广场上车点",
- type: "res"
- }]
- }
- // function(res_data) {
- // res_data = JSON.parse(res_data);
- ZZLog(res_data);
- if(res_data["code"] != "0") {
- alert(res_data["info"]);
- return;
- }
- //将下拉列表展示出来
- $(".select_xiala").css('z-index', '999');
- var list = res_data['list'];
- var HTML = "";
- for(var i = 0, m = list.length; i < m; i++) {
- var dict = list[i];
- 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>'
- }
- $(".select_xiala").html(HTML);
- // }
-
- });
-
- //取消
- $('#btn_cancel').on('click', function(e) {
- $('#key_word').val('');
- $(".select_xiala").css('z-index', '-1');
- $(".select_xiala").html('');
- $("#btn_cancel").css("color", "#FFF");
- });
-
- }
-
- function click_select_area(self_id) {
- var self_obj = $('#' + self_id);
- var area_name = self_obj.attr('area_name');
- var area_id = self_obj.attr('area_id');
- var data = getStorJson('pick_drop'); //拿到缓存
- var type = getStorJson('type'); //接机还是送机
- var are_type = getPar('area_type'); //判断是查站点还是机场
- if(are_type == 'airport') {
- data.airprot_name = area_name;
- data.airprot_id = area_id;
- } else {
- data.place_name = area_name;
- data.place_id = area_id;
- }
- setStorJson('pick_drop', data);
- window.location.href = "pick_drop_person.html";
- }
|