$(document).ready(function () { var myhref = window.location.href if (myhref.indexOf("qw=true") > -1 && myhref.indexOf("erp.")>-1) { $('.qwTrue').attr('src','/img/qwTrue.png') } if (myhref.indexOf("qw=sgtrue") > -1) { $('.qwTrue').attr('src', '/img/qwSgtrue.png') } if (myhref.indexOf("cancelLogin=true") > -1 && myhref.indexOf("erp.") > -1) { $('.cancelLoginBtn').css('display', 'none') } // erp电话判断 if (myhref.indexOf("cancelLogin=true&qw=true") > -1 && myhref.indexOf("erp.") > -1) { $('#footerphone').hide(); $('#headerphone').hide(); $('#popupsPhone').hide(); $('.erp-phone').show(); } //erp360推广 if (myhref.indexOf("cancelLogin=true&dianjing=true") > -1 || myhref.indexOf("cancelLogin=true&dalei=true") > -1) { $('.erp-dianjing').hide(); $('.cancelLoginBtn').css('display', 'none')//免费注册 $('#dianjingTryoutBtn').css('display', 'block');//免费试用咨询按钮 $('.qwTrue').attr('src', '/img/erpDianjing_img.png') $('#dianjingTryOut').css('display', 'block');//右侧免费试用弹窗免费试用咨询按钮 } //回到顶部按钮 $('#top').on('click', function () { $("html, body").animate({ scrollTop: 0 }, { duration: 500, easing: "swing" }); return false; }); $(window).bind('scroll', function () { if (window.innerWidth >= 900) { var len = $(this).scrollTop(); var hig = $(this).height() if (len >= hig) { //显示回到顶部按钮 $('#top').fadeIn('1000'); } else { //影藏回到顶部按钮 $('#top').fadeOut('1000'); } } }); var urlHref = window.location.href var ajaxPostUrl = 'https://yl.wsgjp.com/' if (urlHref.indexOf(".199") != -1) { ajaxPostUrl = "http://gateway.yl.ca.com/"; } else if (urlHref.indexOf("localhost") != -1) { ajaxPostUrl = "http://gateway.yl.ca.com/"; } else if (urlHref.indexOf("stage") != -1) { ajaxPostUrl = "https://ylstage.wsgjp.com/"; } getUrlData('urlWeChat'); getUrlData('urlcode'); getUrlData('urlPhone'); //微信咨询 function getUrlData(name) { var data = { number: 999, siteId: 5, title: "", typeId: 0, typeKey: name } $.ajax({ type: "POST", url: ajaxPostUrl + "tx_web/api/information/getInformationDataByTypeId", async: false, data: JSON.stringify(data), contentType: 'application/json', success: function (res) { var max = 0, result = 0, list = []; for (var i = 0; i < res.data.list.length; i++) { if (res.data.list[i].webTitle == '' || res.data.list[i].webTitle == null || res.data.list[i].webTitle == undefined) { if (location.search.indexOf(res.data.list[i].webKeyWords) != -1) { list.push(res.data.list[i]) } } else { if (location.search.indexOf(res.data.list[i].webKeyWords) != -1 && location.search.indexOf(res.data.list[i].webTitle) != -1) { list.push(res.data.list[i]) } } } for (var i = 0; i < list.length; i++) { if (list[i].webKeyWords.length > max) { max = list[i].webKeyWords.length; result = i; } }; if (name == 'urlcode') { if (list.length > 0) { $('.qwTrue').attr('src', list[result].coverPic) } }; if (name == 'urlPhone') { if (list.length > 0) { $('#footerphone').html(list[result].content); $('#headerphone').html(list[result].content); $('#popupsPhone').html(list[result].content); $('.erp-phone').html(list[result].content); } }; if (name == 'urlWeChat') { if (list.length > 0) { $('#urlWeChat').val(list[result].content); } }; } }) } }) //右侧点击免费试用弹窗窗口 function showPopupBox() { $('.bg000popup').show() $('.registerPopupBox').show() } function closePopupBox() { $('.bg000popup').hide() $('.registerPopupBox').hide() } //售前咨询 function qidian() { if ($('.qidian_wpa_img').length > 0) { $('.qidian_wpa_img').click(); } if ($('.addqidianDetail').find('iframe').length > 0) { $('.addqidianDetail').find('iframe').contents().find('.wpa-container')[0].click(); } postDetail(); //var myhref = window.location.href //if (myhref.indexOf("cancelLogin=true&qw=true") > -1 && myhref.indexOf("erp.") > -1 ) { // window.open("https://wpa1.qq.com/FnHayCut?_type=wpa&qidian=true",'_blank'); //} else if (myhref.indexOf("cancelLogin=true&dianjing=true") > -1 ) { // $('#qidian_wpa_2852107810_2791').contents().find('.wpa-container')[0].click(); //} else { // $('#qidian_wpa_2852107810_1149').trigger("click")//JQ唤醒QQ // } }; //微信咨询 function gowexin() { var url = $('#urlWeChat').val(); if (url) { window.open(url, 'blank') } else { window.open('https://work.weixin.qq.com/kfid/kfc51d18d1fd4420e28', 'blank') } postDetail(); } //360跳转新的微信 function gonewwexin() { var url = $('#urlWeChat').val(); if (url) { window.open(url, 'blank') } else { window.open('https://work.weixin.qq.com/kfid/kfc5970801238be7ae9', 'blank') } postDetail(); } $('.jxcCall .block1').click(function () { var url = $('#urlWeChat').val(); if (url) { window.open(url, 'blank') } else { window.open('https://work.weixin.qq.com/kfid/kfc51d18d1fd4420e28', 'blank') } postDetail(); }) $('.addButtonwx').click(function () { var url = $('#urlWeChat').val(); if (url) { window.open(url, 'blank') } else { window.open('https://work.weixin.qq.com/kfid/kfc51d18d1fd4420e28', 'blank') } postDetail(); }) //qq咨询 function qidian_qq() { $('.class_qidian_wpa').contents().find(".icon-qq").trigger("click"); //JQ唤醒QQ postDetail(); } function default_qidian_qq() { $('.class_qidian_wpa').contents().find(".icon-qq").trigger("click"); //JQ唤醒QQ postDetail(); } //function qidian_qq() { // //$('#_QD_STATUS_MANAGE_SOCKET_IFRAME').contents.find() // $('.class_qidian_wpa').contents().find(".icon-qq").trigger("click") //JQ唤醒QQ //}; //价格 $('.clickMaiDianUrl').click(function (){ postDetail(); }) function postDetail() { var utmS = GetQueryString('utm_s') || ''; var keyWord = GetQueryString('keyword') || ''; if (utmS == "360") { keyWord = GetQueryString('utm_term') } var currentReferer = location.href; var formMySite = currentReferer.indexOf('wsgjp'); addAjax(utmS, currentReferer, keyWord, '', '','1'); } //点击 在线咨询 按钮 function clickShowHouBtn() { //判断是否有缓存登录信息 if (getCookieValText('loginSrviceDetailVal')) { //有缓存登录信息 $('#login-popup-alod').show();//显示加载中 var loginValue = getCookieValText('loginSrviceDetailVal'); loginValue = decodeURIComponent(loginValue) loginValue = JSON.parse(loginValue); if (loginValue.companyName && loginValue.crmProductId) { chatFunction(loginValue.companyName, loginValue.crmProductId, loginValue.employeeId, loginValue.profileId) } else { $('#login-popup-box').show() } } else { //没有缓存登录信息 $('#login-popup-box').show() } } //获取cookie function getCookieValText(cookieName) { const strCookie = document.cookie const cookieList = strCookie.split(';') for (let i = 0; i < cookieList.length; i++) { const arr = cookieList[i].split('=') if (cookieName === arr[0].trim()) { return arr[1] } } return '' } var chatUrl = 'https://fuwu.wsgjp.com'; var urlHrefVal = window.location.href; if (urlHrefVal.indexOf("stage") != -1) { chatUrl = 'https://fuwustage.mygjp.com'; } else if ((urlHrefVal.indexOf(".199") != -1) || (urlHrefVal.indexOf("localhost") != -1)) { chatUrl = 'http://master.fuwu.ca.com'; } //获取服务中心接口路径 function getServiceUrlVal() { var onlineInterfaceUrl = ''; $.ajax({ url: chatUrl + '/getOnLineInterfaceInfo', type: 'POST', async: false, contentType: 'application/json;charset=utf-8', success: function (res) { if (res.code == 0) { onlineInterfaceUrl = res.data.onlineInterfaceUrl; } } }) return onlineInterfaceUrl; }; //判断服务中心版本 function getServiceType() { var onlineVerNo = ''; $.ajax({ url: chatUrl + '/getOnLineInterfaceInfo', type: 'POST', async: false, contentType: 'application/json;charset=utf-8', success: function (res) { if (res.code == 0) { onlineVerNo = res.data.onlineVerNo; } } }) return onlineVerNo; }; //提交表单 function submitFormServices() { var textDetail = $('#inputText').val(); if (textDetail == '') { alert('请输入公司名或者手机号'); return false; } $('#login-popup-alod').show();//显示加载中 $.ajax({ url: chatUrl + '/queryCompanyNameOrPhone', type: 'POST', contentType: 'application/json;charset=utf-8', data: JSON.stringify({ keyword: textDetail }), success: function (res) { if (res.code != 0) { $('#login-popup-alod').hide();//隐藏加载中 $('#login-popup-box').hide();//隐藏输入公司弹窗 $('#login-popup-error').show(); $('#login-popup-error .name').html('信息填写错误,请重新输入!'); $('#inputText').val('');//清空输入框 } else { chatFunction(res.data.companyName, res.data.crmProductId, res.data.productId, 0, 0) } } }) } //获取在线咨询 function chatFunction(companyName, crmProductId, productId, employeeId, profileId) { var onlineVerNo = getServiceType(); //获取版本类型 1 是1.0 2是2.0 if (onlineVerNo == '1') { //1.0版本 参数 var data = { companyName: companyName, productId: productId, crmProductId: crmProductId, employeeId: employeeId || 0, fromSource: 'gw', } } else {//2.0版本 参数 var data = { companyName: companyName, productId: crmProductId, crmProductId: crmProductId, employeeId: employeeId || 0, //职员id profileId: profileId || 0, //账套id customSource: "", openId: "", fromSource: 'gw', } } $('#login-popup-box').hide(); //隐藏输入公司弹窗 $.ajax({ url: getServiceUrlVal(), type: 'POST', contentType: 'application/json;charset=utf-8', data: JSON.stringify(data), success: function (res) { $('#login-popup-alod').hide();//隐藏加载中 if (res.code != 0) { //没有找到公司 $('#login-popup-error').show(); //显示未有联系方式弹窗 $('#login-popup-error .name').html('信息填写错误,请重新输入!'); $('#inputText').val(''); //清空输入框 document.cookie = "loginSrviceDetailVal=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; } else { $('#inputText').val(''); //清空输入框 if (onlineVerNo == '1') { //1.0版本 if (res.data.typeid == 1) { //帮我吧 $('#login-popup-url').show(); $('#goUrlLink').attr('href', res.data.babLinkUrl); window.open(res.data.babLinkUrl, "_blank"); setCookieValText(companyName, crmProductId) } else { if (res.data.qqtypeid == 1) { //打开企点qq $('#login-popup-qq').show(); dynamicLoadJs(res.data.qq); setCookieValText(companyName, crmProductId) } else if (res.data.qqtypeid == 2) {//打开企业QQ $('#login-popup-url').show(); $('#goUrlLink').attr('href', res.data.qq); window.open(res.data.qq, "_blank"); setCookieValText(companyName, crmProductId) } else if (res.data.qqtypeid == 3) { //打开个人QQ $('#login-popup-url').show(); $('#goUrlLink').attr('href', "https://wpa.qq.com/msgrd?v=3&uin=" + res.data.qq + "&site=qq&menu=yes"); window.open("https://wpa.qq.com/msgrd?v=3&uin=" + res.data.qq + "&site=qq&menu=yes", "_blank"); setCookieValText(companyName, crmProductId) } else { //没有咨询方式 $('#login-popup-error').show(); $('#login-popup-error .name').html('温馨提示'); document.cookie = "loginSrviceDetailVal=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; } } } else { //2.0版本 if (res.data.consultType == '1') { //打开企点qq $('#login-popup-qq').show(); dynamicLoadJs(res.data.consultValue); setCookieValText(companyName, crmProductId) } else if (res.data.consultType == '2') {//打开企业QQ $('#login-popup-url').show(); $('#goUrlLink').attr('href', res.data.consultValue); window.open(res.data.consultValue, "_blank") setCookieValText(companyName, crmProductId) } else if (res.data.consultType == '3') {//打开个人QQ $('#login-popup-url').show(); $('#goUrlLink').attr('href', "https://wpa.qq.com/msgrd?v=3&uin=" + res.data.consultValue + "&site=qq&menu=yes"); window.open("https://wpa.qq.com/msgrd?v=3&uin=" + res.data.consultValue + "&site=qq&menu=yes", "_blank") setCookieValText(companyName, crmProductId) } else if (res.data.consultType == '4') {//帮我吧 $('#login-popup-url').show(); $('#goUrlLink').attr('href', res.data.consultValue); setCookieValText(companyName, crmProductId) window.open(res.data.consultValue, "_blank") } else if (res.data.consultType == '5') { //二维码 if (res.data.consultValueType == '2') { //图片 $('#login-popup-ewm').show(); $('#service-ewm-img').attr('src', res.data.consultValue) setCookieValText(companyName, crmProductId) } else { $('#login-popup-url').show(); $('#goUrlLink').attr('href', res.data.consultValue); setCookieValText(companyName, crmProductId) } } else { //没有咨询方式 $('#login-popup-error').show(); $('#login-popup-error .name').html('温馨提示'); document.cookie = "loginSrviceDetailVal=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;"; } } } } }) } //有咨询方式存储一下 function setCookieValText(name, id) { var ConsultObj = { companyName: name, crmProductId: id }; ConsultObj = JSON.stringify(ConsultObj); document.cookie = 'loginSrviceDetailVal=' + ConsultObj; } //内嵌起点qq function dynamicLoadJs(url) { var head = document.getElementsByTagName('head')[0]; var script = document.createElement('script'); script.type = 'text/javascript'; script.src = url; script.defer = "defer"; head.appendChild(script); setTimeout(function () { clickQQUrl('1') }, 100) } //点击起点qq function clickQQUrl(index) { if (!index) { $('#login-popup-qq').hide(); } var items = document.getElementsByTagName("iframe"); if (items != null) { for (var i = 0; i < items.length; i++) { var iframeid = items[i].id; if (iframeid.indexOf("qidian_wpa_") != -1) { items[i].contentDocument.getElementsByClassName("icon-qq")[0].click(); } } } } //点击关闭提交表单 function closePopupBoxNew() { $('#login-popup-box').hide(); $('#inputText').val('') } //回车事件 $("#login-popup-box").bind("keydown", function (e) { // 兼容FF和IE和Opera var theEvent = e || window.event; var code = theEvent.keyCode || theEvent.which || theEvent.charCode; if (code == 13) { //回车执行查询 submitFormServices() } }); /*登录左侧版本修改 结束*/