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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  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. $(".titleBox").addClass("fixed");
  89. }else{
  90. $(".titleBox").removeClass("fixed");
  91. }
  92. })
  93. // 锚点
  94. let ary = ["cpld", "qjzs", "jctj", "cspz"];
  95. $(".titleBox .tab").click(e=>{
  96. console.log('index');
  97. let index = $(e.currentTarget).index();
  98. let section = $(`.${ary[index]}`);
  99. let top = section.offset().top-56;
  100. window.scrollTo({
  101. top: top,
  102. behavior: "smooth"
  103. })
  104. $(".titleBox .tab").removeClass("active");
  105. $(e.currentTarget).addClass("active");
  106. })
  107. let topList = []
  108. ary.forEach((item) => {
  109. let section = $(`.${item}`);
  110. topList.push(section.offset().top-56)
  111. })
  112. $(window).scroll(function () {
  113. var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
  114. for(let i = 1 ;i<4;i++){
  115. if(scrollTop<topList[0]){
  116. $(".titleBox .tab").removeClass("active");
  117. $(".titleBox .tab")[0].className+=' active';
  118. }
  119. else if(scrollTop>topList[i-1]&&scrollTop<topList[i]){
  120. $(".titleBox .tab").removeClass("active");
  121. $(".titleBox .tab")[i-1].className+=' active'
  122. }else if(scrollTop>topList[3]){
  123. $(".titleBox .tab").removeClass("active");
  124. $(".titleBox .tab")[3].className+=' active'
  125. }
  126. }
  127. })
  128. }
  129. //预约跳转
  130. p.yysjLink = function(){
  131. $('.tab.radio').click(()=>{
  132. window.location.href="https://pickup.foton.com.cn/activity/testdrive/m/"
  133. })
  134. }
  135. // 全景展示滚动
  136. p.qjzs = function(){
  137. new Swiper(".qjzs .swiper-container", {
  138. prevButton:'.qjzs .wg',
  139. nextButton:'.qjzs .ns',
  140. onSlideChangeStart: function(swiper){
  141. // alert(swiper.activeIndex);
  142. $("#container .qjzs .nav .line").toggleClass("right");
  143. }
  144. });
  145. }
  146. //全景观车
  147. p.qjgc=function(){
  148. $('.vr').click(()=>{
  149. console.log('sss')
  150. window.location.href = "http://foton.cloud-top.com.cn/p4_7/"
  151. })
  152. }
  153. // 精彩图集
  154. p.jctj = function(){
  155. var galleryTop = new Swiper('.swiper1', {
  156. // nextButton: '.swiper-button-next',
  157. // prevButton: '.swiper-button-prev',
  158. spaceBetween: 10,
  159. });
  160. var galleryThumbs = new Swiper('.swiper2', {
  161. spaceBetween: 10,
  162. centeredSlides: true,
  163. slidesPerView: 'auto',
  164. touchRatio: 0.2,
  165. slideToClickedSlide: true
  166. });
  167. galleryTop.params.control = galleryThumbs;
  168. galleryThumbs.params.control = galleryTop;
  169. }
  170. // 预约试驾
  171. p.yysj = function(){
  172. const _this = this;
  173. setProvince();
  174. setBrand();
  175. function setProvince(){
  176. _this.getData('get', _this.baseUrl+ "/tunland/clue/getProvince").then(resp => {
  177. if(resp.status == 1 ){
  178. return;
  179. }
  180. $("#province").empty();
  181. resp.data.unshift({ID:-1, FNAME:"省份"});
  182. $.each(resp.data, function(i, val) {
  183. var $option = $('<option data-fcode="' + val.FCODE + '" value="' + val.ID + '">' + val.FNAME + '</option>');
  184. $("#province").append($option);
  185. });
  186. })
  187. $("#province").bind("change", function() {
  188. var provinceid = $("#province option:selected").attr("value");
  189. setCity(provinceid);
  190. });
  191. }
  192. function setCity(provinceid){
  193. _this.getData('get', _this.baseUrl+ "/tunland/clue/getCityOfPronvince", {pId: provinceid}).then(resp => {
  194. if(resp.status == 1 ){
  195. return;
  196. }
  197. $("#city").empty();
  198. $.each(resp.data, function(i, val) {
  199. var $option = $('<option value="' + val.dmpCityId + '">' + val.cityName + '</option>');
  200. $("#city").append($option);
  201. });
  202. })
  203. $("#city").unbind("change");
  204. $("#city").bind("change", function() {
  205. setShop($("#city").val());
  206. });
  207. }
  208. function setBrand(){
  209. _this.getData( 'get', _this.baseUrl+ "/tunland/clue/getBrand").then(resp => {
  210. if(resp.status == 1 ){
  211. return;
  212. }
  213. $("#brand").empty();
  214. resp.data.unshift({ID:-1, NAME:"品牌"});
  215. $.each(resp.data, function(i, val) {
  216. if (val.ID == '504f7428-439a-4f87-9540-1ad1f334962e' || val.ID == -1) {
  217. var $option = $('<option value="' + val.ID + '">' + val.NAME + '</option>');
  218. $("#brand").append($option);
  219. }
  220. });
  221. })
  222. $("#brand").bind("change", function() {
  223. setCarSeries($("#brand").val());
  224. });
  225. }
  226. function setCarSeries(brandId){
  227. $("#carSeries").empty();
  228. _this.getData( 'get', _this.baseUrl+ "/tunland/clue/getSeries", {brandId}).then( resp => {
  229. if(resp.status == 1 ){
  230. return;
  231. }
  232. resp.data.unshift({ID:-1, NAME:"选择车型"});
  233. $.each(resp.data, function(i, val) {
  234. var $option = $('<option value="' + val.ID + '">' + val.NAME + '</option>');
  235. $("#carSeries").append($option);
  236. });
  237. // if(!isNaN(isbind)) {
  238. // $("#carSeries").val(isbind);
  239. // }
  240. })
  241. }
  242. }
  243. p.checkPhoneNum = function(vInput, enable) {
  244. //手机号
  245. var reg = /^1(3|4|5|6|8|7)\d{9}$/;
  246. var flag = false;
  247. var phoneVal = vInput.val();
  248. if(phoneVal == "" || phoneVal == "手机号码") {
  249. alertMsg("手机号不能为空");
  250. } else if(!reg.test(phoneVal)) {
  251. alertMsg("请输入正确的手机号");
  252. } else {
  253. //验证手机号码是否已经注册过
  254. if(enable) {
  255. var urlJson = {
  256. a: "Verifymtel",
  257. tel: phoneVal
  258. }
  259. return new Promise(resolve => {
  260. this.getData(_this.baseUrl+ "/tunland/clue/getProvince", urlJson).then(resp => {
  261. if(resp.statcode == 0) {
  262. resolve(true);
  263. }else{
  264. resolve(false);
  265. }
  266. })
  267. })
  268. } else {
  269. return Promise.resolve(true);
  270. }
  271. }
  272. return Promise.resolve(flag);
  273. }
  274. p.LzInfo = function () {
  275. const _this= this
  276. $.ajax({
  277. type: "POST",
  278. async: false,
  279. url: _this.baseUrl+"/tunland/dmp/dmpLzInfo",
  280. data: {
  281. brandId: $("#brand").val(),
  282. seriesId: $("#carSeries").val(),
  283. provinceId: $("#province").val(),
  284. cityId: $("#city").val(),
  285. name: $("#name").val(),
  286. tel: $("#realPhone").val()
  287. },
  288. dataType: "json"
  289. });
  290. }
  291. p.getData = function(method="GET", url, data={}){
  292. return new Promise(resolve=>{
  293. $.ajax({
  294. url:url,
  295. method: method,
  296. data: method.toUpperCase()=="GET" ? data : JSON.stringify(data),
  297. dataType:'json',
  298. contentType:"application/json;charset=utf-8",
  299. success:e=>{
  300. resolve(e)
  301. }
  302. })
  303. })
  304. }
  305. function alertMsg(content) {
  306. $('.alertbox').show();
  307. $('.alertbox').css("z-index", "999");
  308. $(".modalbody").html(content);
  309. };
  310. window.foton.pk = pk;
  311. })()