/*var UserID = sessionStorage.getItem("MiaoMuUserID"); var userInfo = JSON.parse(sessionStorage.getItem("miaomuUserInfo"));*/ if (UserID != null && UserID != "") { var forShow = userInfo.name; if (forShow == null || forShow == "") { forShow = userInfo.mobile; } } $(function () { loadInfo(); $("#searchAll").click(function () { var content = $("#Sou").val(); var type = $("#selectType").val(); if (content.trim().length < 2) { layer.tips("请至少输入两个å—符", "#Sou"); } else { if (type == "供应") { window.location.href = "/spzs/?search=" + content; } else if (type == "采è´") { window.location.href = "/syjh/qiugou.htm?search=" + content; } else if (type == "ä¼ä¸š") { window.location.href = "/qyml/?search=" + content; } else if (type == "资讯") { window.location.href = "/hyxx/informationSearch.html?search=" + content; } else if (type == "百科") { window.location.href = "/qyfw/encyclopediaSearch.html?search=" + content; } } }); }); function getCompany() { var IDArr = window.location.href.split("?id="); var info = null; var IDs = 0; if (IDArr.length == 2) { IDs = window.location.href.split("?id=")[1]; } else { var weburl = window.location.href; IDs = weburl.substring(weburl.lastIndexOf('/') + 1).split(".")[0]; } if (parseInt(IDs)) { var id = parseInt(IDs); $(".com-Top-nav>div:first-child>a").attr("href", "/company/vip/" + id + ".html"); $(".com-Top-nav>div:nth-child(2)>a").attr("href", "/company/vip/about/" + id + ".html"); $(".com-Top-nav>div:nth-child(3)>a").attr("href", "/company/vip/spzs/" + id + ".html"); $(".com-Top-nav>div:nth-child(4)>a").attr("href", "/company/vip/syjh/" + id + ".html"); //$(".com-Top-nav>div:nth-child(5)>a").attr("href","companyMessage.html?id="+id); $(".com-Top-nav>div:last-child>a").attr("href", "/company/vip/zzry/" + id + ".html"); $("#searchThis").click(function () { var content = $("#Sou").val(); var type = $("#selectType").val(); if (content.trim().length < 2) { layer.tips("请至少输入两个å—符", "#Sou"); } else { if (type == "供应") { window.location.href = "/company/vip/spzs/" + id + ".html?search=" + content; } else if (type == "采è´") { window.location.href = "/company/vip/syjh/" + id + ".html?search=" + content; } else if (type == "ä¼ä¸š") { layer.tips("请选择供应或求è´", "#selectType"); } else if (type == "资讯") { layer.tips("请选择供应或求è´", "#selectType"); } else if (type == "百科") { layer.tips("请选择供应或求è´", "#selectType"); } } }); $.ajax({ url: url + "/user2019/qyml/listchaxungongsi", data: {"id": id}, type: "post", dateType: "json", async: false, success: function success(response, status, xhr) { info = response[0]; var zycp = ''; if (info.zycp) { zycp = info.zycp.substring(0, 19); } document.title = zycp + info.qymc; $("meta[name='keywords']").attr('content', info.zycp); $("meta[name='description']").attr('content', info.qyjj.replace(/{{br}}/g, '')); }, error: function error(e) { layer.msg("系统错误,请è”系客æœï¼", {icon: 5}); console.log("读å–ä¿¡æ¯ajax错误"); console.log(e.status); console.log(e.responseText); } }); } return info; } function getSold() { var IDArr = window.location.href.split("?id="); var result1 = ""; var result2 = ""; var IDs = 0; if (IDArr.length == 2) { IDs = window.location.href.split("?id=")[1]; } else { var weburl = window.location.href; IDs = weburl.substring(weburl.lastIndexOf('/') + 1).split(".")[0]; } if (parseInt(IDs)) { var id = parseInt(IDs); $.ajax({ url: url + "/info/supply/selectForCompany", data: {"gsid": id, "page": 0}, type: "post", dateType: "json", async: false, success: function success(response, status, xhr) { if (response.length > 0) { $.each(response, function (i, list) { var img = "/images/æ— å›¾ç‰‡.jpg"; if (list.picture != null && list.picture != "") { img = list.picture; img = formatImgUrl(img); } if (i < 4) { result1 += "<div><a href='/spzs/Show_product/" + list.id + ".html' target='_blank'><img src='" + img + "'><br>" + list.cpmc + "</a></div>"; } else if (i < 8) { result2 += "<div><a href='/spzs/Show_product/" + list.id + ".html' target='_blank'><img src='" + img + "'><br>" + list.cpmc + "</a></div>"; } else { return false; } }); } else { result1 = "æ— å†…å®¹"; } $("#sold1").html(result1); $("#sold2").html(result2); }, error: function error(e) { layer.msg("系统错误,请è”系客æœï¼", {icon: 5}); console.log("getSold方法ajax错误"); console.log(e.status); console.log(e.responseText); } }); } } function getBuy() { var IDArr = window.location.href.split("?id="); var result1 = ""; var result2 = ""; var IDs = 0; if (IDArr.length == 2) { IDs = window.location.href.split("?id=")[1]; } else { var weburl = window.location.href; IDs = weburl.substring(weburl.lastIndexOf('/') + 1).split(".")[0]; } if (parseInt(IDs)) { var id = parseInt(IDs); $.ajax({ url: url + "/mysj/info/selectInfoForCompany", data: {"gsid": id, "type": "采è´", "page": 0}, type: "post", dateType: "json", async: false, success: function success(response, status, xhr) { var result = ""; if (response.length > 0) { $.each(response, function (i, list) { if (i < 5) { result += "<li><a href='/syjh/bussiness_info/" + list.infoId + ".html' target='_blank'>" + list.showname + "</a></li>"; } else { return false; } }); } else { result = "æ— å†…å®¹"; } $("#buy").html(result); }, error: function error(e) { layer.msg("系统错误,请è”系客æœï¼", {icon: 5}); console.log("getBuy方法ajax错误"); console.log(e.status); console.log(e.responseText); } }); } } function loadInfo() { var info = getCompany(); if (info != null) { getSwiper(info.id); var zz = ""; if (info.gs == 1) { zz = "<img src='/images/三级详情页供应改danbao_23.png' title='已通过执照认è¯'>"; } var hy = ""; switch (info.hyjb) { case 5: hy = "<img src='/images/çš‡å† çº§åˆ«.png' title='çš‡å† VIP'>"; break; case 4: hy = "<img src='/images/黄钻级别.png' title='黄钻VIP'>"; break; case 3: hy = "<img src='/images/红钻级别.png' title='红钻VIP'>"; break; case 2: hy = "<img src='/images/绿钻级别.png' title='绿钻VIP'>"; break; case 1: break; default: break; } var sm = ""; if (info.shiming == 1) { sm = "<img src='/images/三级详情页供应改身份验è¯.png' title='已通过实å认è¯'>"; } var db = ""; if (info.danbao == 1) { db = "<img src='/images/三级详情页供应改danbao_30.png' title='已缴费担ä¿è®¤è¯'>" } var zycp = "æ— æ•°æ®"; if (info.zycp != null && info.zycp != "") { zycp = info.zycp; } if (info.qymc) { document.title = info.qymc; $("#company").html(info.qymc); $("#zygy").html("主è¦ä¾›åº”:" + zycp); $("#qymc").html(info.qymc + " " + hy + " " + sm + " " + zz + " " + db); } else if (info.name) { $("#company").html(info.name); $("#zygy").hide(); $("#qymc").html(info.name + " " + hy + " " + sm + " " + zz + " " + db); } else { $("#company").html(''); $("#zygy").hide(); $("#qymc").html(" " + hy + " " + sm + " " + zz + " " + db); } $("#linkman").html(info.name); $("#mobile").html(info.mobile); $("#address").html(info.address); $.ajax({ url: url+'/info/supply/selectSupplySort', data: {"gsid": info.id}, type: "post", dateType: "json", async: false, success: function (res, status, xhr) { var result = ""; if (res.length > 0) { $.each(res, function (i, list) { result += "<li><a href='/company/vip/spzs/"+ info.id +".html?type="+list+"' target='_blank'>" + list + "</a></li>"; }); } else { result = "<li>æ— å†…å®¹</li>"; } $("#supplyLi").html(result); } }); $.ajax({ url: url+'/mysj/info/selectWannaSort', data:{"gsid":info.id}, type:"post", dataType:"json", async:false, success:function (res,status,xhr) { var result = ""; if(res.length>0){ $.each(res,function (i,list) { result += "<li><a href='/company/vip/syjh/"+ info.id +".html?type="+list+"' target='_blank'>" + list + "</a></li>"; }); }else{ result = "<li>æ— å†…å®¹</li>"; } $("#wannaLi").html(result); } }); /*var comPic = "/images/æ— å›¾ç‰‡.jpg"; if(info.picture!=null&&info.picture!=""){ comPic=info.picture; }*/ $("#JJ").html(/*"<img src='"+comPic+"'>"+*/info.qyjj.split('{{br}}').join('<br>')); getSold(); getBuy(); } else { window.location.href = "/qyml/"; } } function ZZ(id) { var result = false; $.ajax({ url: url + "/user/qyzz/selectqyzz", data: {"userid": id}, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { if (response.length != 0) { if (response[0].flag == 1) { result = true; } } }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", {icon: 5}); console.log("ZZ"); console.log(e.status); console.log(e.responseText); } }); return result; } function getSwiper(id) { $.ajax({ url: url + "/gstp/gstp/selectByUser", data: {"gsid": id}, type: "get", dateType: "json", async: false, success: function (response, status, xhr) { if (response.length == 1 && response[0].flag == 1) { var arr = []; if (response[0].pic1) { arr.push(response[0].pic1); } if (response[0].pic2) { arr.push(response[0].pic2); } if (response[0].pic3) { arr.push(response[0].pic3); } if (response[0].pic4) { arr.push(response[0].pic4); } if (arr.length > 0) { var content = ""; for (var i = 0; i < arr.length; i++) { content += "<div class='swiper-slide'><img src='" + formatImgUrl(arr[i]) + "' style='width: 1200px;height: 400px'></div>"; } $(".swiper-wrapper").html(content); $(".upImg").hide(); $(".swiper-container").show(); var mySwiper = new Swiper('.swiper-container', { autoplay: true,//å¯é€‰é€‰é¡¹ï¼Œè‡ªåŠ¨æ»‘åŠ¨ loop: true, }); } } }, error: function (e) { console.log("addSeeTimes"); console.log(e.status); console.log(e.responseText); } }); }