123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154 |
- $(function(){
- $('.Latitude_top a').on('click',function(){
- var DaName=$(this).attr('data-name');
- var cid=$(this).attr('data-id');
- var showH=$('.showbox_pulid').height();
- var titH=$('.title_h').height();
- $('.classify_m').css({'height':(showH-titH)+'px'});
- switch(DaName){
- case 'city':
- $('.showbox_'+DaName).animate({'bottom':'0'},300);
- $('.showbox_bg').fadeIn(80);
- city_f(DaName,{id:cid},'/public/getcity');
- break;
- case 'type':
- $('.showbox_'+DaName).animate({'bottom':'0'},300);
- $('.showbox_bg').fadeIn(80);
- city_f(DaName,'','/public/types');
- break;
- case 'pric':
- $('.showbox_'+DaName).animate({'bottom':'0'},300);
- $('.showbox_bg').fadeIn(80);
- city_f(DaName,'','/public/saleprice');
- break;
- }
- })
- $('.showbox_bg').on('click',function(){
- $('.showbox_pulid').animate({'bottom':'-100%'},300);
- $(this).fadeOut(80);
- })
- function city_f(name,cid,url){
- $.ajax({
- type: 'POST',
- url: url,
- data:cid,
- dataType: 'json',
- success: function(data){
- if(data.code == 200){
- var _list='';
- if (name=='city') {
- _list+='<a href="javascript:;" data-name="'+name+'" data-id="0" >不限</a>';
- $.each(data.data,function(k,v){
- _list+='<a href="javascript:;" data-name="'+name+'" data-id="'+v.id+'">'+v.city_name+'</a>';
- })
- $('.city_piue').html(_list);
- }else if (name=='type') {
- _list+='<a href="javascript:;" data-name="'+name+'" data-id="0" >不限</a>';
- $.each(data.data,function(k,v){
- _list+='<a href="javascript:;" data-name="'+name+'" data-id="'+v.id+'">'+v.huxing_name+'</a>';
- })
- $('.type_main').html(_list);
- }else if (name=='pric') {
- _list+='<a href="javascript:;" data-name="'+name+'" data-id="0" >不限</a>';
- $.each(data.data,function(k,v){
- _list+='<a href="javascript:;" data-name="'+name+'" data-id="'+v.id+'">'+v.price+'</a>';
- })
- $('.pric_main').html(_list);
- };
- }
- },
- error: function(){
- console.log('数据请求失败!');
- }
- })
- }
- $('.city_piue').on('click','a',function(){
- var idname=$(this).attr('data-name')
- var id=$(this).attr('data-id')
- $(this).addClass('on').siblings().removeClass('on');
- if (id=="0") {
- $('.Latitude_top a[data-name='+idname+']').find('span').html($(this).html())
- $('.Latitude_top a[data-name='+idname+']').find('span').attr('data-id',id);
- $('input.input-'+idname).val($(this).html());
- $('.showbox_pulid').animate({'bottom':'-100%'},300);
- $('.showbox_bg').fadeOut(80);
- $('.city_piue').css({'width':'100%'});
- $('.city_piue_m').animate({'right':'-100%'},300)
- }else{
- var txt=$(this).html()
- var txtid=$(this).attr('data-id')
- var txtname=$(this).attr('data-name')
- $('.city_piue').css({'width':'25%'});
- $('.city_piue_m').animate({'right':'0'},300)
- $.ajax({
- type: 'POST',
- url: '/public/getcity',
- data:{id:txtid},
- dataType: 'json',
- success: function(data){
- if(data.code == 200){
- var _list='';
- _list+='<a href="javascript:;" data-name="'+txtname+'" data-id="'+txtid+'" data-text="'+txt+'">不限</a>';
- $.each(data.data,function(k,v){
- _list+='<a href="javascript:;" data-name="city" data-id="'+v.id+'">'+v.city_name+'</a>';
- })
- $('.city_piue_m').html(_list);
- }
- },
- error: function(){
- console.log('数据请求失败!');
- }
- })
- };
- })
- $('.classify_m').on('click','a',function(){
- var idname=$(this).attr('data-name')
- var id=$(this).attr('data-id')
- $(this).addClass('on').siblings().removeClass('on');
- if ($(this).attr('data-text')) {
- $('.Latitude_top a[data-name='+idname+']').find('span').html($(this).attr('data-text'))
- }else{
- $('.Latitude_top a[data-name='+idname+']').find('span').html($(this).html())
- };
- $('.Latitude_top a[data-name='+idname+']').find('span').attr('data-id',id);
- $('input.input-'+idname).val($(this).html());
- $('.showbox_pulid').animate({'bottom':'-100%'},300);
- $('.showbox_bg').fadeOut(80);
- })
- //报名验证及提交的调用
- PublicAction.AjaxSend(
- {
- CORID:'button_box', /*操作ID*/
- }
- );
- $('.submit_area .apply_submit').on('click',function(){
- setTimeout(function(){
- var _html = $('.alert-container .alert-content').html();
- if(_html == '提交成功'){
- $('.boxform input[name="mobile"]').val('');
- $('.Latitude_top a[data-name="city"]').find('span').html('城市')
- $('.Latitude_top a[data-name="type"]').find('span').html('居室')
- $('.Latitude_top a[data-name="pric"]').find('span').html('预算')
- }
- // console.log(_html);
- },300)
-
- })
- })
|