<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
$("#zw_sh_txt_tit li").click(function () {
var _this = $(this);
_this.addClass("active").siblings('li').removeClass("active");
var index = _this.attr("data");
$("#zw_sh_bd").find(".qiehuan1").eq(index).css("display","block").siblings(".qiehuan1").hide();
//获取车抵贷信息
//getCarloan();
//calcPrice(price);
});
function dianhua(){
window.location.href = "tel:4001036699";
}
function zixun(){
window.location.href = "https://ryak66.kuaishang.cn/bs/mim/69299/58465/332282.htm?ref=自建站";
/* $(location).attr('href', 'https://ryak66.kuaishang.cn/bs/mim/69299/58465/332282.htm?ref=自建站'); */
}
function booksale(){
meteor.track("form", {convert_id: "1663303473263624"});
$("#booksale").attr("onclick",null);
var userPhone =$('#userPhone').val();
var code = $('#yzm').val();
setHistory("预约卖车","估值卖车百度落地页1",userPhone);
//进行预约
$.ajax({
type: "POST",
url: "<%=request.getContextPath()%>/wxuser/bookInfo!saveBookOrder.action",
//url: "http://api.kx.cn/Account/commCode",
data: {
"userPhone":userPhone,
"code":code
},
success: function(data){
alert(data);
$('#userPhone').val("请输入手机号码");
$('#yzm').val("请输入验证码");
},error:function (data){
alert("系统异常");
}
});
}
var isPhone = 1;
function checkPhone(){
/* alert($("#changeCarStyle").text()); */
var phone = $('#userPhone').val();
var pattern = /^[1][3456789][0-9]{9}$/;
isPhone = 1;
if(phone == ''||phone=="请输入手机号码") {
alert('请输入手机号码');
isPhone = 0;
return;
}
if(!pattern.test(phone)){
alert('请输入正确的手机号码');
isPhone = 0;
return;
}
var yzm = $('#yzm').val();
if(!yzm||yzm==""||yzm=="请输入验证码"){
alert("请输入验证码");
isPhone = 0;
return;
}
setTimeout(function(){
$("#booksale").click(function(){
checkandbooksale();
});
}, 3000);
}
function checkandbooksale(){
checkPhone();
if(isPhone){
booksale();
}else{
$('#userPhone').focus();
}
}
function setHistory(button,busiName,phone){
$.ajax({
type: "POST",
url: "<%=request.getContextPath()%>/api/book!setHistory.action",
data: {
"button":button,
"busiName":busiName,
"phone":phone
},
success: function(data){
},error:function (data){
alert("系统异常");
}
});
}
function sendGuZhi2(){
var trimId =$('#trimId').val();
var trimName =$('#trimId').val();
var cityName =$('#changeAreaCity').html();
var hdRegYear = $('#hdRegYear').val();
var hdRegMonth = $('#hdRegMonth').val();
var txtMileage = $('#txtMileage').val();//公里数
var cityid = $('#hdCityId_Dw').val();//上牌城市
var phone =$('#phone').val();
var code =$('#code').val();
var Ispass = true;
if (!(trimId != "" && trimId > 0)) {
alert("请选择品牌车型后开始估值");
return false;
}
if (!($.trim(hdRegYear) != "" && $.trim(hdRegMonth) != "" &&
Number($.trim(hdRegYear)) > 0 && Number($.trim(hdRegMonth)) > 0)) {
alert("请选择上牌时间后开始估值");
return false;
}
var regdate = $.trim(hdRegYear) + "/" + $.trim(hdRegMonth) + "/1";
var rg = /^(([1-9]+)|([1-6][0-9]+)|([0-9]+\.[0-9]{1,2}))$/;
var mileage = $.trim(txtMileage);
var endDate = new Date();
var monthNum = new Date(regdate).dateDiff('m', endDate);
//alert(monthNum)
if (mileage == "" || mileage == "请输入") {
alert("请填写行驶里程后开始估值");
return false;
} else if (!rg.test(mileage)) {
alert("请输入正确的行驶里程");
return false;
} else if (Number(mileage) > Number(monthNum)) {
alert("行驶里程不能超过" + monthNum + "万公里");
return false;
}
if (cityid == null || cityid == "" || cityid <= 0) {
alert("请选择上牌城市后开始估值")
return false;
}
$("#gz2").attr("onclick",null);
meteor.track("form", {convert_id: "1663303473263624"});
setHistory("爱车估值","估值卖车百度落地页1",phone);
if(Ispass){
//进行估价
$.ajax({
type: "POST",
url: "<%=request.getContextPath()%>/api/book!getGuJia2.action",
//url: "http://api.kx.cn/Account/commCode",weixin
data: {
"trimId":trimId,
"mileage":mileage+"0000",
"phone":phone,
"code":code,
"trimName":trimName,
"buyCarDate":hdRegYear+"-"+hdRegMonth+"-01",
"cityId":cityid,
"cityName":cityName
},
success: function(data){
$('#c_low').html(data.c_low);$('#c_up').html(data.c_up);$('#c_mid').html(data.c_mid);
$('#c_price').html(data.c_mid);
$('#b_low').html(data.b_low);$('#b_up').html(data.b_up);$('#b_mid').html(data.b_mid);
$('#b_price').html(data.b_mid);
$('#a_low').html(data.a_low);$('#a_up').html(data.a_up);$('#a_mid').html(data.a_mid);
$('#a_price').html(data.a_mid);
$('#b2c').show();
document.getElementsByTagName('BODY')[0].scrollTop=280;
//页面到底部
/*document.getElementsByTagName('BODY')[0].scrollTop=document.getElementsByTagName('BODY')[0].scrollHeight;*/
//alert(data.a_mid);
//alert("估价成功");
},error:function (data){
alert("验证码不正确!");
}
});
}
}
function sendMobileCode2(){
var phone =$('#userPhone').val();
if(!phone||phone==""||phone=="请输入手机号码"){
alert("请输入手机号");
return;
}
var rge = /^[1][3456789][0-9]{9}$/;
if ($.trim(phone) != "" && $.trim(phone) != "请输入手机号码") {
if (rge.test($.trim(phone))) {
//请求dubbo接口 发送短信验证码=
$.ajax({
type: "POST",
url: "/weixin/api/book!getSMSCode.action",
//url: "http://api.kx.cn/Account/commCode",
data: {"phone":phone,"from":"wxgj"},
success: function(data){
$('#codebtn').removeAttr("class");
$('#codebtn').addClass("disableCssBtnSendSms");
$('#codebtn').removeAttr("onclick");
alert("验证码发送成功");
setTimeout("smsCode()",60000);
console.log(data);
}
});
}else{
alert("手机号码格式不正确");
}
}
}