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.
 
 
 
 
 
 

128 lines
3.4 KiB

  1. //Created by HBuilder.
  2. //User: Miracle~
  3. //Date: 2016/11/15
  4. //Time: 17:00
  5. //切换出发地
  6. //页面加载
  7. var pro_id = getPar("pro_id");
  8. window.onload = function() {
  9. if(pro_id == '') {
  10. alert("未获取产品ID!");
  11. return;
  12. }
  13. baseInfo(pro_id);
  14. $(document).ready(function() {
  15. var navHeight = $("#navHeight").offset().top;
  16. var navFix = $("#nav-wrap");
  17. $(window).scroll(function() {
  18. if($(this).scrollTop() > navHeight) {
  19. navFix.addClass("navFix");
  20. } else {
  21. navFix.removeClass("navFix");
  22. }
  23. })
  24. })
  25. //
  26. // $('.nav-wrap').navScroll({
  27. // mobileDropdown: true,
  28. // mobileBreakpoint: 768,
  29. // scrollSpy: true
  30. // });
  31. $('.click-me').navScroll({
  32. navHeight: 0
  33. });
  34. $('.nav-wrap').on('click', '.nav-mobile', function(e) {
  35. e.preventDefault();
  36. $('.nav-wrap ul').slideToggle('fast');
  37. });
  38. }
  39. function baseInfo(pro_id) {
  40. if(pro_id == '') {
  41. alert("未获取产品ID!");
  42. return;
  43. }
  44. var param = {
  45. pro_id: pro_id, //产品id
  46. }
  47. ZZLog(base_api + "around/getDetaile&" + JSON.stringify(param));
  48. $.ajax({
  49. type: "post",
  50. url: base_api + "around/getDetaile",
  51. data: param,
  52. async:false,
  53. dataType: 'json',
  54. success: function(res_data) {
  55. ZZLog(res_data);
  56. if(res_data.flag == true) {
  57. base_html(res_data.data);
  58. } else {
  59. alert(res_data.mag);
  60. }
  61. },
  62. error: function(e) {
  63. ZZLog(e);
  64. }
  65. });
  66. }
  67. function base_html(data) {
  68. //加载轮播
  69. var temp_swiper = '';
  70. $("#loading_html").show();
  71. for(var i = 0, j = data.topimg.length; i < j; i++) {
  72. temp_swiper += '<div class="swiper-slide"><img style="width: 100%; height: 1.4rem;" src="' + data.topimg[i] + '" /></div>';
  73. }
  74. $("#swiper").html(temp_swiper);
  75. var swiper = new Swiper('.swiper-container', {
  76. loop: true,
  77. paginationClickable: true,
  78. centeredSlides: true,
  79. autoplay: 2500,
  80. pagination: '.swiper-pagination',
  81. paginationType: 'fraction',
  82. });
  83. $("#zname").text(data.zname); //加载产品名字
  84. $("#tickdes").text(data.tickdes); //加载产品信息
  85. $("#price").text(data.price); //加载产品价格
  86. var temp_section1 = '';
  87. var temp_section2 = '';
  88. for(var i = 0; i < data.otherimg.length; i++) {
  89. temp_section1 += '<img id="img_0' + i + '" style="width: 3.75rem;display: block;" src= "' + data.otherimg[i] + '"/>';
  90. }
  91. // var temp_section1 = '<img id="img_01" style="width: 3.75rem;display: block;" src= "' + data.otherimg[0] + '"/>' +
  92. // '<img id="img_02" style="width: 3.75rem;display: block;" src= "' + data.otherimg[1] + '"/>' +
  93. // '<img id="img_03" style="width: 3.75rem;display: block;" src= "' + data.otherimg[2] + '"/>' +
  94. // '<img id="img_04" style="width: 3.75rem;display: block;" src= "' + data.otherimg[3] + '"/>' +
  95. // '<img id="img_05" style="width: 3.75rem;display: block;" src= "' + data.otherimg[4] + '"/>';
  96. $("#section1").html(temp_section1);
  97. for(var i = 0; i < data.notice.length; i++) {
  98. temp_section2 += '<img id="img_0' + i + '" style="width: 3.75rem;display: block;" src= "' + data.notice[i] + '"/>';
  99. }
  100. // var temp_section2 = '<img id="img_06" style="width: 3.75rem;display: block;" src= "' + data.otherimg[5] + '"/>' +
  101. // '<img id="img_07" style="width: 3.75rem;display: block;" src= "' + data.otherimg[6] + '"/>';
  102. $("#section2").html(temp_section2);
  103. }
  104. //预订
  105. function reserve_pro() {
  106. var temp_id = getPar("pro_id");
  107. if(temp_id == '') {
  108. alert("未获取产品ID!");
  109. return;
  110. }
  111. window.location.href = 'calendar_side.html?pro_id=' + temp_id; //日期选择
  112. }