let price = 0 // 第1屏 $('.jiageBlock .w1400 .win').fadeIn() $('.jiageBlock .w1400 .win .moreBtn').click(function(){ $(this).parents('.win').css('display','none') $('.jiageBlock .w1400 .win2').fadeIn() $('body,html').animate({scrollTop:0}) }) // 第2屏 $('.jiageBlock .w1400 .win2 .content .list').click(function(){ $(this).addClass('on') $(this).siblings().removeClass('on') }) $('.blackBg .tips .close').click(function(){ $('.blackBg').stop().fadeOut() }) let priceFirst,priceDob,priceThree,priceFour,priceFive,priceSix,priceSeven $('.jiageBlock .w1400 .win2 .true').click(function(){ if($('.jiageBlock .w1400 .win2 .content .list').hasClass('on')){ priceFirst = $('.jiageBlock .w1400 .win2 .content .on').data('price') $(this).parent().css('display','none') $('.jiageBlock .w1400 .win3').fadeIn() $('body,html').animate({scrollTop:0}) return } $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请选择您家有多大') }) // 第3屏 $('.jiageBlock .w1400 .win3 .true').click(function(){ if($('.jiageBlock .w1400 .win3 .switch').val() == ''){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入您想要安装多少个智能开关?') return } if($('.jiageBlock .w1400 .win3 .switch').val() < 0){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入正确的数量') return } priceDob = priceFirst + ($('.jiageBlock .w1400 .win3 .switch').val() * $('.jiageBlock .w1400 .win3 .switch').data('price')) $(this).parent().css('display','none') $('.jiageBlock .w1400 .win4').fadeIn() $('body,html').animate({scrollTop:0}) }) // 第4屏 $('.jiageBlock .w1400 .win4 .true').click(function(){ if($('.jiageBlock .w1400 .win4 .switch').val() == ''){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入您要控制多少台空调?') return } if($('.jiageBlock .w1400 .win4 .switch').val() < 0){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入正确的数量') return } priceThree = priceDob + ($('.jiageBlock .w1400 .win4 .switch').val() * $('.jiageBlock .w1400 .win4 .switch').data('price')) $(this).parent().css('display','none') $('.jiageBlock .w1400 .win5').fadeIn() $('body,html').animate({scrollTop:0}) }) // 第5屏 $('.jiageBlock .w1400 .win5 .pick a').click(function(){ $(this).addClass('on') $(this).children('img').stop().fadeIn() $(this).siblings().removeClass('on') $(this).siblings().children('img').stop().fadeOut() }) $('.jiageBlock .w1400 .win5 .true').click(function(){ if($('.jiageBlock .w1400 .win5 .pick a').hasClass('on')){ priceFour = priceThree + $('.jiageBlock .w1400 .win5 .pick .on').data('price') $(this).parent().css('display','none') $('.jiageBlock .w1400 .win6').fadeIn() $('body,html').animate({scrollTop:0}) return } $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请选择是否需要智能门锁') }) // 第6屏 $('.jiageBlock .w1400 .win6 .true').click(function(){ if($('.jiageBlock .w1400 .win6 .switch').val() == ''){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入您想要安装多少个智能摄像头?') return } if($('.jiageBlock .w1400 .win6 .switch').val() < 0){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入正确的数量') return } priceFive = priceFour + ($('.jiageBlock .w1400 .win6 .switch').val() * $('.jiageBlock .w1400 .win6 .switch').data('price')) $(this).parent().css('display','none') $('.jiageBlock .w1400 .win7').fadeIn() $('body,html').animate({scrollTop:0}) }) // 第7屏 $('.jiageBlock .w1400 .win7 .true').click(function(){ if($('.jiageBlock .w1400 .win7 .switch').val() == ''){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入您想要想要控制多少个窗帘?') return } if($('.jiageBlock .w1400 .win7 .switch').val() < 0){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入正确的数量') return } priceSix = priceFive + ($('.jiageBlock .w1400 .win7 .switch').val() * $('.jiageBlock .w1400 .win7 .switch').data('price')) $(this).parent().css('display','none') $('.jiageBlock .w1400 .win8').fadeIn() $('body,html').animate({scrollTop:0}) }) // 第8屏 // $('.jiageBlock .w1400 .win8 .pick a').click(function(){ // $(this).addClass('on') // $(this).children('img').stop().fadeIn() // $(this).siblings().removeClass('on') // $(this).siblings().children('img').stop().fadeOut() // }) $('.jiageBlock .w1400 .win8 .true').click(function(){ // if($('.jiageBlock .w1400 .win8 .pick a').hasClass('on')){ // priceSeven = priceSix + $('.jiageBlock .w1400 .win8 .pick .on').data('price') // $(this).parent().css('display','none') // $('.jiageBlock .w1400 .win9').fadeIn() // $('body,html').animate({scrollTop:0}) // return // } // $('.blackBg').stop().fadeIn() // $('.blackBg .tips .text').html('请选择是否使用智能音箱控制所有智能家居设备') if($('.jiageBlock .w1400 .win8 .switch').val() == ''){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入您家需要多少智能音箱?') return } if($('.jiageBlock .w1400 .win8 .switch').val() < 0){ $('.blackBg').stop().fadeIn() $('.blackBg .tips .text').html('请输入正确的数量') return } priceSeven = priceSix + ($('.jiageBlock .w1400 .win8 .switch').val() * $('.jiageBlock .w1400 .win8 .switch').data('price') + 400) $(this).parent().css('display','none') $('.jiageBlock .w1400 .win9').fadeIn() $('body,html').animate({scrollTop:0}) }) // 表单 $('.jiageBlock .w1400 .win9 #form .submit').click(function(){ let formName = $('.jiageBlock .w1400 .win9 #form #formName').val() let formWechat = $('.jiageBlock .w1400 .win9 #form #formWechat').val() let formTel = $('.jiageBlock .w1400 .win9 #form #formTel').val() let re = /^1[3|4|5|6|7|8|9]\d{9}$/; if(formName == ''){ alert('请输入您的姓名') return } if (formTel == '') { alert("请输入您的号码"); return false; } else if (!re.test(formTel)) { alert("请输入正确的号码"); return false; } $.ajax({ type: "post", url: "Inquiry/save", data: { contacts_name: formName, wechat: formWechat, phone: formTel, referer: window.location.href }, success: function (res) { $('.jiageBlock .w1400 .win9').css('display','none') $('.jiageBlock .w1400 .win10').fadeIn() $('.jiageBlock .w1400 .win10').css('display','flex') $('body,html').animate({scrollTop:0}) $('.jiageBlock .w1400 .win10 .content .price span').html(priceSeven + priceSeven*0.2) }, Error: function(res){ alert('提交失败,请尝试联系客服') } }); // 成功后跳转 })