/*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; } } UrlSearch(); var title = window.search; if(title==undefined||title==null||title.trim().length<2){ title = ""; } var type = window.type; if(type==undefined||type==null||type.trim().length<2){ type = ""; } $(function () { $("#Sou").val(title); loadInfo(); UrlSearch(); $("#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 (response, status, xhr) { info = response[0]; document.title = info.qymc + '苗木供应信æ¯'; $("meta[name='keywords']").attr('content',info.zycp); $("meta[name='description']").attr('content',info.qyjj); }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log("getCompany方法ajax错误"); console.log(e.status); console.log(e.responseText); } }); } return info; } function getSold(page) { var limit = (page-1)*10; var IDArr = window.location.href.split("?id="); 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":limit,"cpmc":title,"type":type}, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { var result = ""; if(response.length==0){ $(".list").html("<div>æ— ç¬¦åˆæ¡ä»¶çš„内容</div>"); layer.msg("æ— ç¬¦åˆæ¡ä»¶çš„内容",{icon:0}); }else{ $.each(response,function (i, list) { var pic = "/images/æ— å›¾ç‰‡.jpg"; var content = "æ— è¯¦ç»†å†…å®¹"; var price = "é¢è®®"; if(list.picture!=null&&list.picture!=""){ pic = list.picture; pic = formatImgUrl(pic); } if(list.bz!=null&&list.bz!=""){ content = list.bz; } if(list.cpjg!=null&&list.cpjg!=""&&list.cpjg!=0&&list.cpjg!="æ— "&&list.cpjg!="0"){ price=list.cpjg; if(!isNaN(price)){ price+="å…ƒ"; } } result +="<div><table><tr><td><img src='"+pic+"'></td><td><a href='/spzs/Show_product/"+list.id+".html' target='_blank'><p>"+list.cpmc+"</p></a><span title='"+content+"'>"+content.slice(0,30)+"</span></td><td>"+list.address+"</td><td>"+price+"</td></tr></table></div>" }); $(".list").html(result); } }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log("getSold方法ajax错误"); console.log(e.status); console.log(e.responseText); } }); } } function getTotal() { var total = 0; var IDArr = window.location.href.split("?id="); 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/countForCompany", data: {"gsid":id,"cpmc":title,"type":type}, type: "post", dateType: "json", async: false, success: function (response, status, xhr) { total = response; }, error: function (e) { layer.msg("系统错误,请è”系客æœï¼", { icon: 5 }); console.log("查询总数ajax错误"); console.log(e.status); console.log(e.responseText); } }); $("#myPage").sPage({ page: 1, //当å‰é¡µç ,必填 total: total, //æ•°æ®æ€»æ¡æ•°ï¼Œå¿…å¡« pageSize: 10, //æ¯é¡µæ˜¾ç¤ºå¤šå°‘æ¡æ•°æ®ï¼Œé»˜è®¤10æ¡ showTotal: false, //æ˜¯å¦æ˜¾ç¤ºæ€»æ¡æ•°ï¼Œé»˜è®¤å…³é—:false totalTxt: "å…±{total}æ¡", //æ•°æ®æ€»æ¡æ•°æ–‡å—æè¿°ï¼Œ{total}为å ä½ç¬¦ï¼Œé»˜è®¤"å…±{total}æ¡" noData: true, //æ²¡æœ‰æ•°æ®æ—¶æ˜¯å¦æ˜¾ç¤ºåˆ†é¡µï¼Œé»˜è®¤false䏿˜¾ç¤ºï¼Œtrue显示第一页 showSkip: true, //æ˜¯å¦æ˜¾ç¤ºè·³é¡µï¼Œé»˜è®¤å…³é—:false showPN: true, //æ˜¯å¦æ˜¾ç¤ºä¸Šä¸‹ç¿»é¡µï¼Œé»˜è®¤å¼€å¯ï¼štrue prevPage: "上一页", //ä¸Šç¿»é¡µæ–‡å—æè¿°ï¼Œé»˜è®¤â€œä¸Šä¸€é¡µâ€ nextPage: "下一页", //ä¸‹ç¿»é¡µæ–‡å—æè¿°ï¼Œé»˜è®¤â€œä¸‹ä¸€é¡µâ€ backFun: function backFun(page) { //点击分页按钮回调函数,返回当å‰é¡µç //$("#pNum").text(page); scrollTo(0, 0); getSold(page); } }); } } function loadInfo() { var info = getCompany(); if(info!=null){ getSwiper(info.id); 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); }else if(info.name){ $("#company").html(info.name); $("#zygy").hide(); }else{ $("#company").html(''); $("#zygy").hide(); } getSold(1); getTotal(); }else{ window.location.href="/qyml/"; } } function UrlSearch(){ var str=window.location.href; //å–å¾—æ•´ä¸ªåœ°å€æ var num=str.indexOf("?"); str=str.substr(num+1); //å–å¾—æ‰€æœ‰å‚æ•° stringvar.substr(start [, length ] var arr=str.split("&"); //å„ä¸ªå‚æ•°æ”¾åˆ°æ•°ç»„里 for(var i=0;i < arr.length;i++){ num=arr[i].indexOf("="); if(num>0){ name=arr[i].substring(0,num); value=decodeURI(arr[i].substr(num+1)); this[name]=value; } } } 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); } }); }