|
- //Author:fuhc
- //Date:20160825
- //Description:热门城市
- var key_word ="";
- var area_type = "all";
- var type_null = "";
-
-
-
- //页面加载
- window.onload=function(){
-
- var url=base_api+"./zz_wxsct/control.php";
- var parm={
- type:"bus_area_list",
- area:key_word,
- area_type:area_type
- }
- ZZLog(url+JSON.stringify(parm));
-
- $.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_content").css('z-index','5');
- var list=res_data['list'];
- var HTML="";
- for (var i=0,m=list.length;i<m;i++) {
- var dict=list[i];
- HTML += '<div class="sort_list" onclick="click_select_area('+dict['area_id']+')" id='+dict['area_id']+' type="'+dict['type']+'" area_id="'+dict['area_id']+'" area_name="'+dict['area_name']+'">'
- + '<div class="num_name">'+dict['area_name']+'</div>'
- + '</div>'
- }
- $(".select_content").html(HTML);
-
- $.getScript("js/sort.js");
-
- });
-
- // eg:打字太快 如黄
- // 黄的数据先出来,拼音的后出来就没有显示
-
- //将选中的地点设置为选中状态
- var his_area_id=getPar('his_area_id');
- if(his_area_id!="" && his_area_id!="791" && his_area_id!="850"){
- $('#'+his_area_id).addClass('city_info_selected');
- }
-
- $(".selected").click(function(){
- area_type = $(this).attr("select_type");
- console.log(area_type);
- $("#shaixuan").children().removeClass("select_color");
- $(this).addClass("select_color");
- if(area_type=="all"){
- $("#hot1").show();
- $("#hot2").show();
- }else{
- $("#hot1").hide();
- $("#hot2").hide();
- }
- var url=base_api+"./zz_wxsct/control.php";
- var parm={
- type:"bus_area_list",
- area:key_word,
- area_type:area_type
- }
- ZZLog(url+JSON.stringify(parm));
-
- $.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_content").css('z-index','5');
- var list=res_data['list'];
- var HTML="";
- for (var i=0,m=list.length;i<m;i++) {
- var dict=list[i];
- HTML += '<div class="sort_list" onclick="click_select_area('+dict['area_id']+')" id='+dict['area_id']+' type="'+dict['type']+'" area_id="'+dict['area_id']+'" area_name="'+dict['area_name']+'">'
- + '<div class="num_name">'+dict['area_name']+'</div>'
- + '</div>'
- }
- $(".select_content").html(HTML);
- $.getScript("js/sort.js")
- });
- })
-
-
- $('#key_word').on('input',function(e){
- $("#btn_cancel").css("color","#0076ff");
- key_word=$(this).val();
-
- var url=base_api+"./zz_wxsct/control.php";
- var parm={
- type:"bus_area_list",
- area:key_word,
- area_type:type_null
- }
- ZZLog(url+JSON.stringify(parm));
-
- $.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);
- });
- });
- //取消
- $('#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 type=self_obj.attr('type');
-
- var op_type=getPar('op_type'); //判断是选择出发地-还是目的地
-
- var data={
- op_type:op_type,
- area_id:area_id,
- area_name:area_name,
- area_type:type
- };
- if(op_type=="start"){
- setStorJson('f_wx_start_hot_city20160826',data);
- }
- if(op_type=="end"){
- setStorJson('f_wx_end_hot_city20160826',data);
- }
- var tt=getDateTime(4);
- var listURL='travel_book.html?tt='+tt;
- window.location.href=listURL;
- }
|