var pageSize = 50; var nbflag = false;//是否显示的是最新招标数据 var currentPage = 1; var submitflag = true; var searchvalue = ""; var searchvalueArray = searchvalue.split("+"); $(function() { $("#minprice").click(function(){ $(".pricebut").show(); $(".pricefat").addClass("customtime-active"); }) $("#maxprice").click(function(){ $(".pricebut").show(); $(".pricefat").addClass("customtime-active"); }) $("#starttime").click(function(){ $("#timebut").show(); $(".timerInput").addClass("customtime-active"); }) $("#endtime").click(function(){ $("#timebut").show(); $(".timerInput").addClass("customtime-active"); }) $(".Price-content").find("span:first-child").click(function(){ $(this).addClass("active"); $(".pricefat").removeClass("active"); beforeSubmit(); }) $(".timer").find("ul li:first-child").click(function(){ $(this).addClass("active"); $(".timerInput").removeClass("active"); }) // $(".pricebut").click(function(){ var minp = $("#minprice").val(); var maxp = $("#maxprice").val(); if (minp==""||maxp==""){ return false; } if (minp>maxp){ $("#minprice").val(maxp); $("#maxprice").val(minp); } $(this).hide(); $(".pricefat").addClass("active"); $(".Price-content").find("span:first-child").removeClass("active"); $(".pricefat").removeClass("customtime-active"); beforeSubmit() }) // $("#timebut").click(function(){ $(this).hide(); $(".timerInput").addClass("active"); $(".timerInput").removeClass("customtime-active"); $(".timer").find("ul li:first-child").removeClass("active"); $(".release-time .timer li").removeClass("active"); beforeSubmit() }) // $(".nbprev").click(function(){ $(window).scrollTop(0); prev(); }) $(".nbnext").click(function(){ $(window).scrollTop(0); next(); }) //筛选关闭和打开 //根据cookie值设置筛选是否显示 var rsw = localStorage.getItem("hideorshow"); if(rsw==null){ setTimeout(function(){ $(".searchTender").stop(false,true).slideDown(1000); localStorage.setItem("hideorshow", "D"); },500); }else{ if(rsw=="U"){ $("#screenBtn").addClass("down"); $(".searchTender").hide(); }else{ $("#screenBtn").removeClass("down"); $(".searchTender").show(); } } //记录用户刷选按钮状态 $("#screenBtn").click(function(){ if($(this).attr("class").indexOf("down")>0){ localStorage.setItem("hideorshow", "U"); }else{ localStorage.setItem("hideorshow", "D"); } }) // $("#zbSeatchT input[type='button']").click(function(){ beforeSubmit() }) }) // function next(){ if($(".nbnext").hasClass("disabled")){ return false; } var page = parseInt($(".pagination-inner").find("span").text())+parseInt(1) if(!nbflag&&page<11){ if(page==10){ $(".nbnext").addClass("disabled"); }else if(page==2){ $(".nbprev").removeClass("disabled"); } getNewBiddings(page) } } function prev(){ if($(".nbprev").hasClass("disabled")){ return false; } var page = parseInt($(".pagination-inner").find("span").text())-parseInt(1) if(!nbflag&&page>0){ if(page==1){ $(".nbprev").addClass("disabled"); }else if(page==9){ $(".nbnext").removeClass("disabled"); } getNewBiddings(page) } } ////最新招标信息 function getNewBiddings(page){ currentPage = page if(page==1){ $(".nbprev").addClass("disabled"); } var param = { pageNumber: currentPage, reqType: "lastNews", searchvalue: $("#zbSeatchT [name='searchvalue']").val(), area: $("#zbSeatchT [name='area']").val(), subtype: $("#zbSeatchT [name='subtype']").val(), publishtime: $("#zbSeatchT [name='publishtime']").val(), selectType : $("#zbSeatchT [name='selectType']").val(), minprice : $("#zbSeatchT [name='minprice']").val(), maxprice : $("#zbSeatchT [name='maxprice']").val(), industry : $("#zbSeatchT [name='industry']").val(), }; $.post("/front/pcAjaxReq",param,function(r){ if(r&&r.list!=null&&r.list.length>0){ $(".tabContainer").show(); $(".pagination").show(); $(".hasNoData").hide(); $(".pagination-inner").find("span").text(page); if(r.list.length$1"); detail = keyWordHighlight(detail,searchvalueArray.join("|"),"$1"); } var href = datas[i].href.replace(/\n/g,""); var aHref = '/article/content/'+datas[i]._id; if(searchvalue != ""){ aHref += '.html?kds='+searchvalue; }else{ aHref += '.html'; } var type = datas[i].subtype; if(typeof(type) == "undefined" || type == null || type == ""){ type = datas[i].toptype; } if(typeof(type) == "undefined" || type == null || type == ""){ type = datas[i].type; if(type == "bid"){ type = "中标"; datas[i].stypeadd="ZHB" }else if(type == "tender"){ datas[i].stypeadd="ZB" type = "招标"; }else{ type = ""; } } if(!flag){ $("#allnews").hide(); $(".tabContainer-2").show(); }else{ $("#allnews").show(); $(".tabContainer-2").hide(); } listHtml += '
  • ' +'
    ' +'
    '+index+'.' +'
    ' +' '+title+'' +'
    ' if(flag){ listHtml += '' } listHtml += '
    ' if($.trim(datas[i].area) != "" && datas[i].area != "A"){ listHtml += ''+datas[i].area+''; }else{ listHtml += ''; } if(typeof(type) != "undefined" && type != null && type != ""){ listHtml += ''+type+''; }else{ listHtml += ''; } // if(typeof(datas[i].industry) != "undefined" && datas[i].industry != null && datas[i].industry != ""){ listHtml += ''+datas[i].industry+''; }else{ listHtml += ''; } // if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){ var diff = timeDiff(new Date(Number(datas[i].publishtime+"000"))); if(diff != null){ listHtml += ''+diff+''; } } listHtml += '
  • '; tableHtml +='' +'
    '+index+'
    ' if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){ var diff = formatDate(Number(datas[i].publishtime),"s"); if(diff != null){ tableHtml += '
    '+diff+'
    '; } }else{ tableHtml += '
    '; } if(typeof(type) != "undefined" && type != null && type != ""){ tableHtml += '
    '+type+'公告
    '; }else{ tableHtml += '
    '; } if(typeof(datas[i].agency) != "undefined" && datas[i].agency != null && datas[i].agency != ""){ tableHtml += '
    '+datas[i].agency+'
    '; }else{ tableHtml += '
    '; } if(typeof(datas[i].projectname) != "undefined" && datas[i].projectname != null && datas[i].projectname != ""){ tableHtml += '
    '+datas[i].projectname+'
    '; }else{ tableHtml += '
    '; } if(typeof(datas[i].budget) != "undefined" && datas[i].budget != null && datas[i].budget != ""){ var budget =parseInt(datas[i].budget)/10000 if(budget.toString().length>6){ if(budget.toString().indexOf(".")==5){ budget=budget.toString().substr(0,7) }else{ budget=budget.toString().substr(0,6) } } tableHtml += '
    '+budget+'
    '; }else{ tableHtml += '
    '; } if(typeof(datas[i].bidopentime) != "undefined" && datas[i].bidopentime != null && datas[i].bidopentime != ""){ var diff = formatDate(Number(datas[i].publishtime),"l"); tableHtml += '
    '+diff+'
    '; }else{ tableHtml += '
    '; } if(typeof(datas[i].winner) != "undefined" && datas[i].winner != null && datas[i].winner != ""){ tableHtml += '
    '+datas[i].winner+'
    '; }else{ tableHtml += '
    '; } if(typeof(datas[i].bidamount) != "undefined" && datas[i].bidamount != null && datas[i].bidamount != ""){ var bidamount = parseInt(datas[i].bidamount)/10000 if(bidamount.toString().length>6){ if(bidamount.toString().indexOf(".")==5){ bidamount=bidamount.toString().substr(0,7) }else{ bidamount=bidamount.toString().substr(0,6) } } tableHtml += '
    '+bidamount+'
    '; }else{ tableHtml += '
    '; } tableHtml+='' } $(".tabContainer-2 .lucene ul").html(listHtml); $(".tabContainer-2 .lucene-table table tbody").html(tableHtml); backTopAdjust(); } // // function formatDate(date,sl) { var myDate = new Date(date*1000); var year=myDate.getFullYear(); var month=myDate.getMonth()+1; // if(month<10){ // month="0"+month // } var date=myDate.getDate(); // if(date<10){ // date="0"+date // } var hour = myDate.getHours() var min = myDate.getMinutes() if(sl=="l"){ if(hour<10){ hour="0"+hour } if(min<10){ min="0"+min } return year+"-"+month+"-"+date+"
    "+hour+":"+min; }else{ return year+"-"+month+"-"+date; } } // function onpicking(dp,obj){ var time = new Date(dp.cal.newdate.y,dp.cal.newdate.M-1,dp.cal.newdate.d).getTime()+""; time = time.substring(0,time.length - 3); $(obj).attr("data-value",time); } // function onclearing(obj){ $(obj).attr("data-value",""); //localStorage.removeItem($(obj).attr("id")) if($(".customtime").hasClass("active") && getInputTime().join("") == ""){ $(".customtime").removeClass("active"); $("#publishtime #alltime").addClass("active"); } } // function picked(dp,obj){ //localStorage.setItem($(obj).attr("id"),$(obj).val()+"_"+$(obj).attr("data-value")) } // function getInputTime(){ var starttime = $("#starttime").attr("data-value"); if(starttime){ starttime = $.trim(starttime); }else{ starttime = ""; } var endtime = $("#endtime").attr("data-value"); if(endtime){ endtime = $.trim(endtime); }else{ endtime = ""; } return [starttime,endtime] } /// function beforeSubmit(){ setTimeout(function(){ //时间 var publishtime = null; var timeslot = getInputTime().join("_"); if($(".timerInput").hasClass("active")){ if(timeslot != "_"){ $("#zbSeatchT [name='publishtime']").val(timeslot); }else{ $("#zbSeatchT [name='publishtime']").val(""); } }else{ publishtime = $(".timer .active").attr("data-value"); if(typeof(publishtime) != "undefined"){ $("#zbSeatchT [name='publishtime']").val(publishtime); }else{ $("#zbSeatchT [name='publishtime']").val(""); } } if(timeslot != "_"){ $("#zbSeatchT [name='timeslot']").val(timeslot); }else{ $("#zbSeatchT [name='timeslot']").val(""); } //地区 var selectAreas = ""; $(".region-content .active:not(.parent-node)").each(function(){ var thisText = $(this).text(); if(thisText != "全国"){ if(selectAreas != ""){ selectAreas += ","; } selectAreas += thisText; } }); $("#zbSeatchT [name='area']").val(selectAreas); //类型 var selectSubTypes = ""; $(".info-content .active:not(.parent-node)").each(function(){ if($(this).attr("id") == "whole"||$(this).attr("id") == "infoBtn"){ return true; } var thisText = $(this).attr("data-value"); if(selectSubTypes != ""){ selectSubTypes += ","; } selectSubTypes += thisText; }); $("#zbSeatchT [name='subtype']").val(selectSubTypes); //行业 var selectIndustrys = ""; $(".industry-content .active:not(.parent-node)").each(function(){ if($(this).attr("id") == "induAll"){ return true; } var thisText = $(this).attr("data-value"); if(selectIndustrys != ""){ selectIndustrys += ","; } selectIndustrys += thisText; }); $("#zbSeatchT [name='industry']").val(selectIndustrys); //价格 var selectMinPrices = $(".PriceInput [name='minprice']").val(); var selectMaxPrices = $(".PriceInput [name='maxprice']").val(); $("#zbSeatchT [name='minprice']").val(selectMinPrices); $("#zbSeatchT [name='maxprice']").val(selectMaxPrices); //搜索关键词 var searchname = $("#zbSeatchT input[name='keywords']").val(); $("#zbSeatchT input[name='searchvalue']").val($.trim(searchname)) if(submitflag){ if($.trim(searchname)==""){ getNewBiddings(1) nbflag = false; console.log(nbflag+"-----") }else{ searchOnsubmit(); nbflag = true; console.log("2222") } submitflag=false; } setTimeout(function(){ submitflag=true },200); return true },200) } // function searchOnsubmit(){ var param = { pageNumber: currentPage, reqType: "bidSearch", searchvalue: $("#zbSeatchT [name='searchvalue']").val(), area: $("#zbSeatchT [name='area']").val(), subtype: $("#zbSeatchT [name='subtype']").val(), publishtime: $("#zbSeatchT [name='publishtime']").val(), selectType : $("#zbSeatchT [name='selectType']").val(), minprice : $("#zbSeatchT [name='minprice']").val(), maxprice : $("#zbSeatchT [name='maxprice']").val(), industry : $("#zbSeatchT [name='industry']").val(), }; $.post("/front/pcAjaxReq",param,function(r){ if(r.list == null || r.list.length == 0){ }else{ appendDatas(r.list,true) } }); }