123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487 |
- 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<pageSize||page==10){
- $(".nbnext").addClass("disabled");
- }else{
- $(".nbnext").removeClass("disabled");
- }
- appendDatas(r.list,false);
- }else{
- $(".tabContainer").hide();
- $(".pagination").hide();
- $(".hasNoData").show();
- }
- })
- }
- //
- function appendDatas(datas,flag){
- var listHtml = '';
- var tableHtml = '';
- var searchvalue = '';
- for(var i=0;i<datas.length;i++){
- var index = (currentPage - 1) * pageSize + i + 1;
- var title = datas[i].title;
- var detail = datas[i].detail;
- if(flag){
- title = keyWordHighlight(title,searchvalueArray.join("|"),"<font class='com-highlight'>$1</font>");
- detail = keyWordHighlight(detail,searchvalueArray.join("|"),"<font class='com-highlight'>$1</font>");
- }
- 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 += '<li>'
- +'<div class="liLuceneList">'
- +'<div class="luce-left"><em>'+index+'.</em>'
- +'<div class="left-title">'
- +'<a href="'+aHref+'"> '+title+'</a>'
- +'</div>'
- if(flag){
- listHtml += '<div class="left-content">'
- +'<a href="'+aHref+'">'+detail+'...</a>'
- +'</div>'
- }
- listHtml += '</div><div class="luce-right">'
- if($.trim(datas[i].area) != "" && datas[i].area != "A"){
- listHtml += '<a href="/list/area/'+datas[i].areaadd+'.html">'+datas[i].area+'</a>';
- }else{
- listHtml += '<a href="#" style="display:none;"></a>';
- }
- if(typeof(type) != "undefined" && type != null && type != ""){
- listHtml += '<a href="/list/stype/'+datas[i].stypeadd+'.html">'+type+'</a>';
- }else{
- listHtml += '<a href="#" style="display:none;"></a>';
- }
- //
- if(typeof(datas[i].industry) != "undefined" && datas[i].industry != null && datas[i].industry != ""){
- listHtml += '<a href="#">'+datas[i].industry+'</a>';
- }else{
- listHtml += '<a href="#" style="display:none;"></a>';
- }
-
- //
- 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 += '<span class="com-time">'+diff+'</span>';
- }
- }
- listHtml += '</div></li>';
- tableHtml +='<tr>'
- +'<td><div>'+index+'</div></td>'
- 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 += '<td><div>'+diff+'</div></td>';
- }
- }else{
- tableHtml += '<td><div></div></td>';
- }
- if(typeof(type) != "undefined" && type != null && type != ""){
- tableHtml += '<td><div>'+type+'公告</div></td>';
- }else{
- tableHtml += '<td><div></div></td>';
- }
- if(typeof(datas[i].agency) != "undefined" && datas[i].agency != null && datas[i].agency != ""){
- tableHtml += '<td class="tt-l"><div>'+datas[i].agency+'</div></td>';
- }else{
- tableHtml += '<td class="tt-l"><div></div></td>';
- }
- if(typeof(datas[i].projectname) != "undefined" && datas[i].projectname != null && datas[i].projectname != ""){
- tableHtml += '<td class="tt-l"><div>'+datas[i].projectname+'</div></td>';
- }else{
- tableHtml += '<td class="tt-l"><div></div></td>';
- }
- 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 += '<td class="tt-r"><div>'+budget+'</div></td>';
- }else{
- tableHtml += '<td class="tt-r"><div></div></td>';
- }
- if(typeof(datas[i].bidopentime) != "undefined" && datas[i].bidopentime != null && datas[i].bidopentime != ""){
- var diff = formatDate(Number(datas[i].publishtime),"l");
- tableHtml += '<td><div>'+diff+'</div></td>';
- }else{
- tableHtml += '<td><div></div></td>';
- }
- if(typeof(datas[i].winner) != "undefined" && datas[i].winner != null && datas[i].winner != ""){
- tableHtml += '<td class="tt-l"><div>'+datas[i].winner+'</div></td>';
- }else{
- tableHtml += '<td class="tt-l"><div></div></td>';
- }
- 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 += '<td class="tt-r"><div>'+bidamount+'</div></td>';
- }else{
- tableHtml += '<td class="tt-r"><div></div></td>';
- }
- tableHtml+='</tr>'
- }
- $(".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+"<br>"+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)
- }
- });
- }
|