福田皮卡火星7+火星9
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. window.foton = window.foton || {};
  2. (function(){
  3. function pk(){
  4. this.baseUrl = window.location.origin
  5. this.init();
  6. }
  7. p = pk.prototype;
  8. p.init = function(){
  9. this.bindEvent();
  10. this.listenTopBar();
  11. this.yysjLink();
  12. this.qjzs();
  13. this.qjgc();
  14. this.jctj();
  15. this.yysj();
  16. // 模块动画
  17. var wow = new WOW({
  18. boxClass: 'wow',
  19. animateClass: 'animated',
  20. offset: 100,
  21. mobile: false,
  22. live: true
  23. });
  24. wow.init();
  25. }
  26. p.bindEvent = function(){
  27. const _this= this
  28. // 预约试驾
  29. $(".submit").click(e=>{
  30. var flag = true;
  31. var msg = "";
  32. if(!$("#name").val()) {
  33. msg = "姓名不能为空!";
  34. flag = false;
  35. alertMsg(msg);
  36. return false;
  37. }
  38. p.checkPhoneNum($("#realPhone")).then( result => {
  39. if(!result){
  40. }else{
  41. $(".yysj select").each(function() {
  42. var select = $(this).find("option:selected");
  43. if(select.val() == -1) {
  44. flag = false;
  45. msg = select.html();
  46. return false;
  47. }
  48. });
  49. flag=true
  50. if(!flag) {
  51. alertMsg(msg);
  52. return false;
  53. }
  54. if (flag) {
  55. var params = {
  56. BrandId: $("#brand").val(),
  57. SeriesId: $("#carSeries").val(),
  58. ProvinceId: $("#province").val(),
  59. CityId: $("#city").val(),
  60. DealerId: $("#Dealer").val(),
  61. Name: $("#name").val(),
  62. Phone: $("#realPhone").val(),
  63. Remark: $("#Remark").val()
  64. };
  65. _this.getData('post', _this.baseUrl+"/tunland/clue/PostLeads", params).then(resp => {
  66. if(resp.status == 0){
  67. alertMsg("提交成功");
  68. }
  69. })
  70. p.LzInfo();
  71. } else {
  72. alertMsg(msg);
  73. }
  74. }
  75. })
  76. })
  77. //关闭弹窗按钮
  78. $(".modalfooter button").on("click", function() {
  79. $(".alertbox").hide()
  80. });
  81. }
  82. // 导航栏吸附
  83. p.listenTopBar = function(){
  84. $(document).scroll(e=>{
  85. let bannerH = $(".topImg").height() - 75;
  86. let top = $(document).scrollTop();
  87. if(top >= bannerH){
  88. console.log('ssss')
  89. $(".titleBox").addClass("fixed");
  90. }else{
  91. $(".titleBox").removeClass("fixed");
  92. }
  93. })
  94. // 锚点
  95. let ary = ["cpld", "qjzs", "jctj", "cspz"];
  96. let flag = false
  97. let oldIndex = 0;
  98. $(".titleBox .tab").click(e=>{
  99. let index = $(e.currentTarget).index();
  100. if(index>=4){
  101. return
  102. }
  103. let section = $(`.${ary[index]}`);
  104. let top
  105. if(oldIndex === 0){
  106. top = section.offset().top-176;
  107. }else{
  108. top = section.offset().top-126;
  109. }
  110. console.log('index',index,top);
  111. window.scrollTo({
  112. top: top,
  113. behavior: "smooth"
  114. })
  115. flag = true
  116. $(".titleBox .tab").removeClass("active");
  117. $(e.currentTarget).addClass("active");
  118. oldIndex=index
  119. })
  120. let topList = []
  121. ary.forEach((item) => {
  122. let section = $(`.${item}`);
  123. topList.push(section.offset().top-256)
  124. })
  125. function scroll() {
  126. flag=false
  127. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  128. for (let i = 1; i < 4; i++) {
  129. if (scrollTop < topList[0]) {
  130. $(".titleBox .tab").removeClass("active");
  131. $(".titleBox .tab")[0].className += ' active';
  132. }
  133. else if (scrollTop > topList[i - 1] && scrollTop < topList[i]) {
  134. $(".titleBox .tab").removeClass("active");
  135. $(".titleBox .tab")[i - 1].className += ' active'
  136. } else if (scrollTop > topList[3]) {
  137. $(".titleBox .tab").removeClass("active");
  138. $(".titleBox .tab")[3].className += ' active'
  139. }
  140. }
  141. }
  142. $(window).scroll(() => {
  143. if (flag) {
  144. setTimeout(scroll, 2000)
  145. } else {
  146. scroll()
  147. }
  148. })
  149. }
  150. //预约跳转
  151. p.yysjLink = function(){
  152. $('.tab.radio').click(()=>{
  153. window.location.href="https://pickup.foton.com.cn/activity/testdrive/m/"
  154. })
  155. }
  156. // 全景展示滚动
  157. p.qjzs = function(){
  158. new Swiper(".qjzs .swiper-container", {
  159. prevButton:'.qjzs .wg',
  160. nextButton:'.qjzs .ns',
  161. onSlideChangeStart: function(swiper){
  162. // alert(swiper.activeIndex);
  163. $("#container .qjzs .nav .line").toggleClass("right");
  164. }
  165. });
  166. }
  167. //全景观车
  168. p.qjgc=function(){
  169. $('.vr_7').click(()=>{
  170. window.location.href = "http://foton.cloud-top.com.cn/p4_7/"
  171. })
  172. $('.vr_9').click(()=>{
  173. window.location.href = "http://foton.cloud-top.com.cn/p4_9/"
  174. })
  175. }
  176. // 精彩图集
  177. p.jctj = function(){
  178. var galleryTop = new Swiper('.swiper1', {
  179. // nextButton: '.swiper-button-next',
  180. // prevButton: '.swiper-button-prev',
  181. spaceBetween: 10,
  182. });
  183. var galleryThumbs = new Swiper('.swiper2', {
  184. spaceBetween: 10,
  185. centeredSlides: true,
  186. slidesPerView: 'auto',
  187. touchRatio: 0.2,
  188. slideToClickedSlide: true
  189. });
  190. galleryTop.params.control = galleryThumbs;
  191. galleryThumbs.params.control = galleryTop;
  192. }
  193. // 预约试驾
  194. p.yysj = function(){
  195. const _this = this;
  196. setProvince();
  197. setBrand();
  198. function setProvince(){
  199. _this.getData('get', _this.baseUrl+ "/tunland/clue/getProvince").then(resp => {
  200. if(resp.status == 1 ){
  201. return;
  202. }
  203. $("#province").empty();
  204. resp.data.unshift({ID:-1, FNAME:"省份"});
  205. $.each(resp.data, function(i, val) {
  206. var $option = $('<option data-fcode="' + val.FCODE + '" value="' + val.ID + '">' + val.FNAME + '</option>');
  207. $("#province").append($option);
  208. });
  209. })
  210. $("#province").bind("change", function() {
  211. var provinceid = $("#province option:selected").attr("value");
  212. setCity(provinceid);
  213. });
  214. }
  215. function setCity(provinceid){
  216. _this.getData('get', _this.baseUrl+ "/tunland/clue/getCityOfPronvince", {pId: provinceid}).then(resp => {
  217. if(resp.status == 1 ){
  218. return;
  219. }
  220. $("#city").empty();
  221. $.each(resp.data, function(i, val) {
  222. var $option = $('<option value="' + val.dmpCityId + '">' + val.cityName + '</option>');
  223. $("#city").append($option);
  224. });
  225. })
  226. $("#city").unbind("change");
  227. $("#city").bind("change", function() {
  228. setShop($("#city").val());
  229. });
  230. }
  231. function setBrand(){
  232. _this.getData( 'get', _this.baseUrl+ "/tunland/clue/getBrand").then(resp => {
  233. if(resp.status == 1 ){
  234. return;
  235. }
  236. $("#brand").empty();
  237. resp.data.unshift({ID:-1, NAME:"品牌"});
  238. $.each(resp.data, function(i, val) {
  239. if (val.ID == '504f7428-439a-4f87-9540-1ad1f334962e' || val.ID == -1) {
  240. var $option = $('<option value="' + val.ID + '">' + val.NAME + '</option>');
  241. $("#brand").append($option);
  242. }
  243. });
  244. })
  245. $("#brand").bind("change", function() {
  246. setCarSeries($("#brand").val());
  247. });
  248. }
  249. function setCarSeries(brandId){
  250. $("#carSeries").empty();
  251. _this.getData( 'get', _this.baseUrl+ "/tunland/clue/getSeries", {brandId}).then( resp => {
  252. if(resp.status == 1 ){
  253. return;
  254. }
  255. resp.data.unshift({ID:-1, NAME:"选择车型"});
  256. $.each(resp.data, function(i, val) {
  257. var $option = $('<option value="' + val.ID + '">' + val.NAME + '</option>');
  258. $("#carSeries").append($option);
  259. });
  260. // if(!isNaN(isbind)) {
  261. // $("#carSeries").val(isbind);
  262. // }
  263. })
  264. }
  265. }
  266. p.checkPhoneNum = function(vInput, enable) {
  267. //手机号
  268. var reg = /^1(3|4|5|6|8|7)\d{9}$/;
  269. var flag = false;
  270. var phoneVal = vInput.val();
  271. if(phoneVal == "" || phoneVal == "手机号码") {
  272. alertMsg("手机号不能为空");
  273. } else if(!reg.test(phoneVal)) {
  274. alertMsg("请输入正确的手机号");
  275. } else {
  276. //验证手机号码是否已经注册过
  277. if(enable) {
  278. var urlJson = {
  279. a: "Verifymtel",
  280. tel: phoneVal
  281. }
  282. return new Promise(resolve => {
  283. this.getData(_this.baseUrl+ "/tunland/clue/getProvince", urlJson).then(resp => {
  284. if(resp.statcode == 0) {
  285. resolve(true);
  286. }else{
  287. resolve(false);
  288. }
  289. })
  290. })
  291. } else {
  292. return Promise.resolve(true);
  293. }
  294. }
  295. return Promise.resolve(flag);
  296. }
  297. p.LzInfo = function () {
  298. const _this= this
  299. $.ajax({
  300. type: "POST",
  301. async: false,
  302. url: _this.baseUrl+"/tunland/dmp/dmpLzInfo",
  303. data: {
  304. brandId: $("#brand").val(),
  305. seriesId: $("#carSeries").val(),
  306. provinceId: $("#province").val(),
  307. cityId: $("#city").val(),
  308. name: $("#name").val(),
  309. tel: $("#realPhone").val()
  310. },
  311. dataType: "json"
  312. });
  313. }
  314. p.getData = function(method="GET", url, data={}){
  315. return new Promise(resolve=>{
  316. $.ajax({
  317. url:url,
  318. method: method,
  319. data: method.toUpperCase()=="GET" ? data : JSON.stringify(data),
  320. dataType:'json',
  321. contentType:"application/json;charset=utf-8",
  322. success:e=>{
  323. resolve(e)
  324. }
  325. })
  326. })
  327. }
  328. function alertMsg(content) {
  329. $('.alertbox').show();
  330. $('.alertbox').css("z-index", "999");
  331. $(".modalbody").html(content);
  332. };
  333. window.foton.pk = pk;
  334. })()