majorlookhouse.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. $(function(){
  2. $('.Latitude_top a').on('click',function(){
  3. var DaName=$(this).attr('data-name');
  4. var cid=$(this).attr('data-id');
  5. var showH=$('.showbox_pulid').height();
  6. var titH=$('.title_h').height();
  7. $('.classify_m').css({'height':(showH-titH)+'px'});
  8. switch(DaName){
  9. case 'city':
  10. $('.showbox_'+DaName).animate({'bottom':'0'},300);
  11. $('.showbox_bg').fadeIn(80);
  12. city_f(DaName,{id:cid},'/public/getcity');
  13. break;
  14. case 'type':
  15. $('.showbox_'+DaName).animate({'bottom':'0'},300);
  16. $('.showbox_bg').fadeIn(80);
  17. city_f(DaName,'','/public/types');
  18. break;
  19. case 'pric':
  20. $('.showbox_'+DaName).animate({'bottom':'0'},300);
  21. $('.showbox_bg').fadeIn(80);
  22. city_f(DaName,'','/public/saleprice');
  23. break;
  24. }
  25. })
  26. $('.showbox_bg').on('click',function(){
  27. $('.showbox_pulid').animate({'bottom':'-100%'},300);
  28. $(this).fadeOut(80);
  29. })
  30. function city_f(name,cid,url){
  31. $.ajax({
  32. type: 'POST',
  33. url: url,
  34. data:cid,
  35. dataType: 'json',
  36. success: function(data){
  37. if(data.code == 200){
  38. var _list='';
  39. if (name=='city') {
  40. _list+='<a href="javascript:;" data-name="'+name+'" data-id="0" >不限</a>';
  41. $.each(data.data,function(k,v){
  42. _list+='<a href="javascript:;" data-name="'+name+'" data-id="'+v.id+'">'+v.city_name+'</a>';
  43. })
  44. $('.city_piue').html(_list);
  45. }else if (name=='type') {
  46. _list+='<a href="javascript:;" data-name="'+name+'" data-id="0" >不限</a>';
  47. $.each(data.data,function(k,v){
  48. _list+='<a href="javascript:;" data-name="'+name+'" data-id="'+v.id+'">'+v.huxing_name+'</a>';
  49. })
  50. $('.type_main').html(_list);
  51. }else if (name=='pric') {
  52. _list+='<a href="javascript:;" data-name="'+name+'" data-id="0" >不限</a>';
  53. $.each(data.data,function(k,v){
  54. _list+='<a href="javascript:;" data-name="'+name+'" data-id="'+v.id+'">'+v.price+'</a>';
  55. })
  56. $('.pric_main').html(_list);
  57. };
  58. }
  59. },
  60. error: function(){
  61. console.log('数据请求失败!');
  62. }
  63. })
  64. }
  65. $('.city_piue').on('click','a',function(){
  66. var idname=$(this).attr('data-name')
  67. var id=$(this).attr('data-id')
  68. $(this).addClass('on').siblings().removeClass('on');
  69. if (id=="0") {
  70. $('.Latitude_top a[data-name='+idname+']').find('span').html($(this).html())
  71. $('.Latitude_top a[data-name='+idname+']').find('span').attr('data-id',id);
  72. $('input.input-'+idname).val($(this).html());
  73. $('.showbox_pulid').animate({'bottom':'-100%'},300);
  74. $('.showbox_bg').fadeOut(80);
  75. $('.city_piue').css({'width':'100%'});
  76. $('.city_piue_m').animate({'right':'-100%'},300)
  77. }else{
  78. var txt=$(this).html()
  79. var txtid=$(this).attr('data-id')
  80. var txtname=$(this).attr('data-name')
  81. $('.city_piue').css({'width':'25%'});
  82. $('.city_piue_m').animate({'right':'0'},300)
  83. $.ajax({
  84. type: 'POST',
  85. url: '/public/getcity',
  86. data:{id:txtid},
  87. dataType: 'json',
  88. success: function(data){
  89. if(data.code == 200){
  90. var _list='';
  91. _list+='<a href="javascript:;" data-name="'+txtname+'" data-id="'+txtid+'" data-text="'+txt+'">不限</a>';
  92. $.each(data.data,function(k,v){
  93. _list+='<a href="javascript:;" data-name="city" data-id="'+v.id+'">'+v.city_name+'</a>';
  94. })
  95. $('.city_piue_m').html(_list);
  96. }
  97. },
  98. error: function(){
  99. console.log('数据请求失败!');
  100. }
  101. })
  102. };
  103. })
  104. $('.classify_m').on('click','a',function(){
  105. var idname=$(this).attr('data-name')
  106. var id=$(this).attr('data-id')
  107. $(this).addClass('on').siblings().removeClass('on');
  108. if ($(this).attr('data-text')) {
  109. $('.Latitude_top a[data-name='+idname+']').find('span').html($(this).attr('data-text'))
  110. }else{
  111. $('.Latitude_top a[data-name='+idname+']').find('span').html($(this).html())
  112. };
  113. $('.Latitude_top a[data-name='+idname+']').find('span').attr('data-id',id);
  114. $('input.input-'+idname).val($(this).html());
  115. $('.showbox_pulid').animate({'bottom':'-100%'},300);
  116. $('.showbox_bg').fadeOut(80);
  117. })
  118. //报名验证及提交的调用
  119. PublicAction.AjaxSend(
  120. {
  121. CORID:'button_box', /*操作ID*/
  122. }
  123. );
  124. $('.submit_area .apply_submit').on('click',function(){
  125. setTimeout(function(){
  126. var _html = $('.alert-container .alert-content').html();
  127. if(_html == '提交成功'){
  128. $('.boxform input[name="mobile"]').val('');
  129. $('.Latitude_top a[data-name="city"]').find('span').html('城市')
  130. $('.Latitude_top a[data-name="type"]').find('span').html('居室')
  131. $('.Latitude_top a[data-name="pric"]').find('span').html('预算')
  132. }
  133. // console.log(_html);
  134. },300)
  135. })
  136. })