superSearch.js 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474
  1. var pageSize = 50;
  2. var nbflag = false;//是否显示的是最新招标数据
  3. var currentPage = 1;//当前页
  4. var submitflag = true;
  5. var tabularflag = "Y";
  6. $(function() {
  7. priceTime();
  8. $(".Price-content").find("span:first-child").click(function(){
  9. $(this).addClass("active");
  10. $(".pricefat").removeClass("active");
  11. beforeSubmit();
  12. })
  13. $(".timer").find("ul li:first-child").click(function(){
  14. timeshow = false;
  15. $("#starttime").css({"border-color":""});
  16. $("#endtime").css({"border-color":""});
  17. $("#timebut").hide();
  18. $(".timerInput").removeClass("customtime-active");
  19. $(this).addClass("active");
  20. $(".timerInput").removeClass("active");
  21. })
  22. //
  23. $(".pricebut").click(function(){
  24. priceCss();
  25. beforeSubmit();
  26. })
  27. //
  28. $("#timebut").click(function(){
  29. timeshow=false;
  30. $(this).hide();
  31. $(".timerInput").removeClass("customtime-active");
  32. if($("#starttime").val()==""&&$("#endtime").val()==""){
  33. $("#starttime").css({"border-color":""});
  34. $("#endtime").css({"border-color":""});
  35. $("#timebut").hide();
  36. $(".timerInput").removeClass("customtime-active");
  37. $("#timerAll").addClass("active");
  38. $(".timerInput").removeClass("active");
  39. }else{
  40. $(".timerInput").addClass("active");
  41. $(".timer").find("ul li:first-child").removeClass("active");
  42. $(".release-time .timer li").removeClass("active");
  43. }
  44. beforeSubmit()
  45. })
  46. //
  47. $(".nbprev").click(function(){
  48. $(window).scrollTop(0);
  49. $('.custom-checkbox.check-all').prop('checked', false)
  50. prev();
  51. })
  52. $(".nbnext").click(function(){
  53. $(window).scrollTop(0);
  54. $('.custom-checkbox.check-all').prop('checked', false)
  55. next();
  56. })
  57. //筛选关闭和打开
  58. //根据cookie值设置筛选是否显示
  59. var rsw = localStorage.getItem("hideorshow");
  60. if(rsw!=null){
  61. if(rsw=="D"){
  62. $("#screenBtn").addClass("down");
  63. $(".searchTender").show();
  64. $('#fold').show()
  65. }else{
  66. $("#screenBtn").removeClass("down");
  67. $(".searchTender").hide();
  68. $('#fold').hide()
  69. }
  70. }
  71. //记录用户刷选按钮状态
  72. $("#screenBtn").click(function(){
  73. if($(this).attr("class").indexOf("down")>0){
  74. localStorage.setItem("hideorshow", "D");
  75. $('#fold').show()
  76. }else{
  77. localStorage.setItem("hideorshow", "U");
  78. $('#fold').hide()
  79. }
  80. })
  81. //
  82. var iuod = localStorage.getItem("industryuod");
  83. if(iuod!=null){
  84. if(iuod=="U"){
  85. $(".stop").click();
  86. }
  87. }
  88. //
  89. $(".stop").click(function(){
  90. if($(this).attr("class").indexOf("up")>0){
  91. localStorage.setItem("industryuod", "U");
  92. }else{
  93. localStorage.setItem("industryuod", "D");
  94. }
  95. })
  96. //全文检索和标题检索切换
  97. $("#newsclass li:nth-child(2)").click(function(){
  98. // searchInnerVue.listState.total = totalPage
  99. // 重置全选按钮
  100. $('.custom-checkbox.check-all').prop('checked', false)
  101. $(".tabContainer-2 .lucene ul").html("");
  102. $("#zbSeatchT [name='selectType']").val("all");
  103. $("#right-list").addClass("active").siblings().removeClass("active");
  104. $("#allnews .lucene").show().siblings().hide();
  105. $(".tabContainer-2").hide();
  106. currentPage=1;
  107. if(submitflag){
  108. $(".hasNoData").hide();
  109. $(".working").show();
  110. // 隐藏页码
  111. searchInnerVue.showPage = false
  112. $(".tabContainer").css("min-height","600px");
  113. selectType = "all";
  114. searchOnsubmit();
  115. submitflag=false;
  116. }
  117. })
  118. $("#newsclass li:nth-child(1)").click(function(){
  119. // 重置全选按钮
  120. $('.custom-checkbox.check-all').prop('checked', false)
  121. $("#allnews .lucene ul").html("");
  122. $("#zbSeatchT [name='selectType']").val("title");
  123. $("#right-list").addClass("active").siblings().removeClass("active");
  124. $(".tabContainer-2 .lucene").show().siblings().hide();
  125. $("#allnews").hide();
  126. currentPage=1;
  127. if(submitflag){
  128. $(".hasNoData").hide();
  129. $(".working").show();
  130. // 隐藏页码
  131. searchInnerVue.showPage = false
  132. $(".tabContainer").css("min-height","600px");
  133. selectType = "title";
  134. searchOnsubmit();
  135. submitflag=false;
  136. }
  137. })
  138. $('#entsearch, #pursearch, #gysearch').on('click', function () {
  139. location.href= $(this).attr('datahref')
  140. })
  141. })
  142. //
  143. function next(){
  144. if($(".nbnext").hasClass("disabled")){
  145. return false;
  146. }
  147. $(".hasNoData").hide();
  148. $(".working").show();
  149. $(".tabContainer").hide();
  150. $("#allnews").hide();
  151. $(".pagination").hide();
  152. currentPage = parseInt($(".pagination-inner").find("span").text())+parseInt(1)
  153. if(currentPage==10){
  154. $(".nbnext").addClass("disabled");
  155. }else if(currentPage==2){
  156. $(".nbprev").removeClass("disabled");
  157. }
  158. if($("#zbSeatchT [name='keywords']").val()==""&&$("#zbSeatchT [name='industry']").val()==""){
  159. getNewBids(currentPage);
  160. }else{
  161. if(!$("#right-table").hasClass("active")){
  162. if(secondFlag=="T"){
  163. $(".tabContainer").show();
  164. $(".hasNoData").hide();
  165. $(".nbnext").addClass("disabled");
  166. appendDatas(secondList,true,false);
  167. }else if(!nbflag&&currentPage<11){
  168. getNewBiddings();
  169. }else{
  170. searchOnsubmit(true);
  171. }
  172. }else{
  173. //表格点击下一页
  174. // if(secondFlag=="T"){
  175. // $(".tabContainer").show();
  176. // $(".hasNoData").hide();
  177. // $(".nbnext").addClass("disabled");
  178. // appendDatas(secondList,true,false);
  179. // }else{
  180. // getVIPData(true);
  181. // }
  182. }
  183. }
  184. }
  185. function prev(){
  186. if($(".nbprev").hasClass("disabled")){
  187. return false;
  188. }
  189. $(".hasNoData").hide();
  190. $(".working").show();
  191. $(".tabContainer").hide();
  192. $("#allnews").hide();
  193. $(".pagination").hide();
  194. currentPage = parseInt($(".pagination-inner").find("span").text())-parseInt(1)
  195. if(currentPage==1){
  196. $(".nbprev").addClass("disabled");
  197. }else if(currentPage<10){
  198. $(".nbnext").removeClass("disabled");
  199. }
  200. if($("#zbSeatchT [name='keywords']").val()==""&&$("#zbSeatchT [name='industry']").val()==""){
  201. getNewBids(currentPage);
  202. }else{
  203. if(!$("#right-table").hasClass("active")){
  204. if(secondFlag=="T"){
  205. $(".tabContainer").show();
  206. $(".hasNoData").hide();
  207. //$(".nbnext").addClass("disabled");
  208. appendDatas(list,true,false);
  209. }else if(!nbflag&&currentPage>0){
  210. getNewBiddings();
  211. }else{
  212. searchOnsubmit(true);
  213. }
  214. }else{
  215. //表格点击上一页
  216. // getVIPData(true);
  217. }
  218. }
  219. }
  220. //取redis里的数据
  221. function getNewBids(pnum){
  222. $.post("/jylab/supsearch/getNewBids",{pageNumber:pnum,pageType:""},function(r){
  223. if(r&&r.list!=null&&r.list.length>0){
  224. $(".tabContainer").show();
  225. //$(".pagination").show();
  226. $(".hasNoData").hide();
  227. //$(".pagination-inner").find("span").text(currentPage);
  228. if(r.list.length<pageSize||currentPage==10){
  229. $(".nbnext").addClass("disabled");
  230. }else{
  231. $(".nbnext").removeClass("disabled");
  232. }
  233. searchInnerVue.listState.total = Math.ceil(r.count/50)
  234. searchInnerVue.checkPageNumAdd1()
  235. appendDatas(r.list,false,true);
  236. }else{
  237. submitflag=true;
  238. $(".tabContainer").hide();
  239. $(".pagination").hide();
  240. $(".working").hide();
  241. $(".hasNoData").show();
  242. // 隐藏页码
  243. searchInnerVue.showPage = false
  244. }
  245. // getBidIsColl()
  246. })
  247. }
  248. ////最新招标信息
  249. function getNewBiddings(){
  250. // $("#newsclass").hide();
  251. // $("#newsnow").show();
  252. if(currentPage==1){
  253. $(".nbprev").addClass("disabled");
  254. }
  255. var param = {
  256. pageNumber: currentPage,
  257. reqType: "lastNews",
  258. searchvalue: $("#zbSeatchT [name='keywords']").val(),
  259. area: $("#zbSeatchT [name='area']").val(),
  260. subtype: $("#zbSeatchT [name='subtype']").val(),
  261. publishtime: $("#zbSeatchT [name='publishtime']").val(),
  262. selectType : $("#zbSeatchT [name='selectType']").val() || 'title',
  263. minprice : $("#zbSeatchT [name='minprice']").val(),
  264. maxprice : $("#zbSeatchT [name='maxprice']").val(),
  265. industry : $("#zbSeatchT [name='industry']").val(),
  266. buyerclass: $("#zbSeatchT [name='buyerclass']").val(),
  267. buyertel: $("#zbSeatchT [name='buyertel']").val(),
  268. winnertel: $("#zbSeatchT [name='winnertel']").val(),
  269. notkey: $(".not-key-input-group input").val().slice(0, 10)
  270. };
  271. $.post("/front/pcAjaxReq",param,function(r){
  272. if(r&&r.list!=null&&r.list.length>0){
  273. // 计算总页码
  274. if (currentPage == 1) {
  275. searchInnerVue.listState.total = Math.ceil(r.count/50)
  276. searchInnerVue.checkPageNumAdd1()
  277. }
  278. $(".tabContainer").show();
  279. //$(".pagination").show();
  280. $(".hasNoData").hide();
  281. //$(".pagination-inner").find("span").text(currentPage);
  282. if(r.list.length<pageSize||currentPage==10){
  283. $(".nbnext").addClass("disabled");
  284. }else{
  285. $(".nbnext").removeClass("disabled");
  286. }
  287. appendDatas(r.list,false,true);
  288. }else{
  289. if(currentPage>1){
  290. $(".nbnext").addClass("disabled");
  291. if(currentPage==2){
  292. $(".nbprev").addClass("disabled");
  293. }
  294. currentPage = currentPage-1;
  295. return false
  296. }
  297. submitflag=true;
  298. $(".tabContainer").hide();
  299. $(".pagination").hide();
  300. $(".working").hide();
  301. $(".hasNoData").show();
  302. // 隐藏页码
  303. searchInnerVue.showPage = false
  304. }
  305. })
  306. }
  307. //
  308. function appendDatas(datas,flag,isNew,onlyUpdateTable){
  309. // flag // 是否有输入
  310. // console.log('selectType: ' + selectType,',flag: ',flag)
  311. var listHtml = '';
  312. var tableHtml = '';
  313. $(".working").hide();
  314. $(".pagination").show();
  315. // 显示页码
  316. searchInnerVue.showPage = true
  317. var searchvalueArray = searchvalue.split("+");
  318. $(".pagination-inner").find("span").text(currentPage);
  319. if(datas.length<pageSize){
  320. $(".nbnext").addClass("disabled");
  321. }
  322. if(!isNew && typeof(totalPage) != "undefined"){
  323. if(currentPage == totalPage){
  324. $(".nbnext").addClass("disabled");
  325. }else{
  326. $(".nbnext").removeClass("disabled");
  327. }
  328. }
  329. //(数据够20条显示查看更多遮罩层)
  330. if (currentPage==1){//第一页得时候需要判断 是否显示遮罩层
  331. if(datas.length>=20){
  332. $(".shade_table").css("display","");
  333. }else{
  334. $(".shade_table").css("display","none");
  335. }
  336. }
  337. for(var i=0;i<datas.length;i++){
  338. var index = (currentPage - 1) * pageSize + i + 1;
  339. var title = datas[i].title;
  340. var detail = datas[i].detail;
  341. if(detail){
  342. detail = detail.replace(/[^\{\u4e00-\u9fa5]{1,90}{[^\}\u4e00-\u9fa5]+?}/g,"")
  343. if(detail.length>200){
  344. detail = detail.substring(0,200)+"..."
  345. }
  346. }
  347. if(flag){
  348. title = keyWordHighlight(title,searchvalueArray,"<font class='com-highlight'>$1</font>");
  349. title=title.replace(/\<br>/g,"")
  350. detail = keyWordHighlight(detail,searchvalueArray,"<font class='com-highlight'>$1</font>");
  351. }
  352. if(title.length<40){
  353. title=title+"<span style='color:#fff;display:none;'>"+Math.random().toString(36).substring(2)+"<span>";
  354. }
  355. var type = datas[i].subtype;
  356. if(typeof(type) == "undefined" || type == null || type == ""){
  357. type = datas[i].toptype;
  358. }
  359. if(typeof(type) == "undefined" || type == null || type == ""){
  360. type = datas[i].type;
  361. if(type == "bid"){
  362. type = "中标";
  363. datas[i].stypeadd="ZHB"
  364. }else if(type == "tender"){
  365. datas[i].stypeadd="ZB"
  366. type = "招标";
  367. }else{
  368. type = "";
  369. }
  370. }
  371. if (!onlyUpdateTable){ //是否仅更新table
  372. listHtml += '<li>'
  373. //if(datas.length==(i+1)){
  374. // listHtml +='<div class="liLuceneList">'
  375. //}else{
  376. listHtml +='<div class="liLuceneList" style="border-bottom: 1px solid #EBEBEB;">'
  377. //}
  378. // 标题搜索 选择框
  379. if (selectType.indexOf('content') == -1 || !flag) {
  380. listHtml += '<input class="custom-checkbox title-text-checkbox" name="bid-list" type="checkbox" dataid="'+datas[i]._id+'" />'
  381. listHtml +='<div class="luce-left">'
  382. if(datas[i].site == '剑鱼信息发布平台') {
  383. listHtml += '<span class="userPublish">用户发布</span>'
  384. }
  385. listHtml += '<em class="visited-hd">'+index+'.</em>'
  386. +'<div class="left-title" style="width:auto;max-width:700px">'
  387. +'<a class="visited-hd" onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank"> '+title+ '</a>'
  388. if(fileExists) {
  389. listHtml+='<span class="haveFile">'+'有附件'+'</span>'
  390. }
  391. listHtml+='</div>'
  392. }
  393. // 全文搜索
  394. if(flag && selectType.indexOf('content') > -1){
  395. listHtml +='<div class="luce-left">'
  396. if(datas[i].site == '剑鱼信息发布平台') {
  397. listHtml += '<span class="userPublish">用户发布</span>'
  398. listHtml+= '<em class="visited-hd">'+index+'.</em>'
  399. +'<div class="left-title" style="width:auto;max-width:1080px">'
  400. +'<a class="visited-hd" onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank"> '+title+ '</a>'
  401. } else {
  402. listHtml+= '<em class="visited-hd" style="padding-left:30px;">'+index+'.</em>'
  403. +'<div class="left-title" style="width:auto;max-width:1080px">'
  404. +'<a class="visited-hd" onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank"> '+title+ '</a>'
  405. }
  406. if(fileExists) {
  407. listHtml+='<span class="haveFile">'+'有附件'+'</span>'
  408. }
  409. listHtml+='</div>'
  410. // 全文搜索选择框
  411. listHtml += '<div class="left-content" style="width:100%;padding:0;">'
  412. + '<input class="custom-checkbox all-text-checkbox" name="bid-list" type="checkbox" dataid="'+datas[i]._id+'" />'
  413. +'<a style="float:left;width:calc(100% - 32px)" href="javascript:volid(0);">'+detail+'...</a>'
  414. +'</div>'
  415. }
  416. listHtml += '</div><div class="luce-right">'
  417. if($.trim(datas[i].area) != "" && datas[i].area != "A"){
  418. listHtml += '<a href="/list/area/'+datas[i].areaadd+'.html">'+datas[i].area+'</a>';
  419. }else{
  420. listHtml += '<a href="#" style="display:none;"></a>';
  421. }
  422. if(typeof(type) != "undefined" && type != null && type != ""){
  423. listHtml += '<a href="/list/stype/'+datas[i].stypeadd+'.html">'+type+'</a>';
  424. }else{
  425. listHtml += '<a href="#" style="display:none;"></a>';
  426. }
  427. //
  428. if(typeof(datas[i].industry) != "undefined" && datas[i].industry != null && datas[i].industry != ""){
  429. listHtml += '<a href="/list/industry/'+datas[i].indadd+'.html">'+datas[i].industry+'</a>';
  430. }else{
  431. listHtml += '<a href="javascript:volid(0);" style="display:none;"></a>';
  432. }
  433. // vipState付费用户显示采购单位类型 免费用户不显示
  434. // if(typeof(datas[i].buyerclass) != "undefined" && datas[i].buyerclass != null && datas[i].buyerclass != "" && vipState){
  435. // listHtml += '<a href="javascript:;">'+datas[i].buyerclass+'</a>';
  436. // }else{
  437. // listHtml += '<a href="javascript:volid(0);" style="display:none;"></a>';
  438. // }
  439. var amount= getacount(datas[i].bidamount,datas[i].budget)
  440. if(amount!=""){
  441. listHtml += '<a>'+conversionMoeny(amount)+'</a>';
  442. }else{
  443. listHtml += '<a href="javascript:volid(0);" style="display:none;"></a>';
  444. }
  445. //
  446. if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){
  447. var diff = utils.dateFromNow(Number(datas[i].publishtime+"000"));
  448. if(diff != null){
  449. listHtml += '<span class="com-time">'+diff+'</span>';
  450. }
  451. }
  452. // 是否收藏
  453. listHtml += '<i class="icon-collect" dataid="'+datas[i]._id+'"></i>'
  454. listHtml += '</div></li>';
  455. if(i == 5) {
  456. listHtml += '<div class="_t3di2018y5"></div>'
  457. }
  458. if(i == 26) {
  459. listHtml += '<div class="_6omliqck79a"></div>'
  460. }
  461. }
  462. //表格仅显示前20条信息
  463. if (i >= 20||currentPage!=1){
  464. continue
  465. }
  466. tableHtml +='<tr onclick="noIn(this)" dataid="'+datas[i]._id+'" dataindustry="'+datas[i].industry+'" target="_blank">'
  467. +'<td width="48"><div>'+index+'</div></td>'
  468. if(typeof(datas[i].projectname) != "undefined" && datas[i].projectname != null && datas[i].projectname != ""){
  469. datas[i].projectname = keyWordHighlight(datas[i].projectname,searchvalueArray,"<font class='com-highlight'>$1</font>");
  470. tableHtml += '<td class="tt-l" width="315"><div>'+datas[i].projectname+'</div></td>';
  471. }else{
  472. let title=datas[i].title.replace(/\<br>/g,"")
  473. tableHtml += '<td class="tt-l" width="315"><div>'+title+'</div></td>';
  474. }
  475. if(typeof(type) != "undefined" && type != null && type != ""){
  476. tableHtml += '<td width="84"><div>'+type+'公告</div></td>';
  477. }else{
  478. tableHtml += '<td width="84"><div></div></td>';
  479. }
  480. if(typeof(datas[i].budget) != "undefined" && datas[i].budget != null && datas[i].budget != ""){
  481. var budget =parseInt(datas[i].budget)/10000
  482. if(budget.toString().length>6){
  483. if(budget.toString().indexOf(".")==5){
  484. budget=budget.toString().substr(0,7)
  485. }else{
  486. budget=budget.toString().substr(0,6)
  487. }
  488. }
  489. tableHtml += '<td class="tt-r" width="73"><div>'+budget+'</div></td>';
  490. }else{
  491. tableHtml += '<td class="tt-r" width="73"><div></div></td>';
  492. }
  493. if(typeof(datas[i].buyer) != "undefined" && datas[i].buyer != null && datas[i].buyer != ""){
  494. tableHtml += '<td class="tt-l" width="181"><div>'+datas[i].buyer+'</div></td>';
  495. }else{
  496. tableHtml += '<td class="tt-l" width="181"><div></div></td>';
  497. }
  498. if(typeof(datas[i].bidopentime) != "undefined" && datas[i].bidopentime != null && datas[i].bidopentime != ""){
  499. var diff = formatDate(Number(datas[i].bidopentime),"l");
  500. tableHtml += '<td width="103"><div>'+diff+'</div></td>';
  501. }else{
  502. tableHtml += '<td width="103"><div></div></td>';
  503. }
  504. if(typeof(datas[i].winner) != "undefined" && datas[i].winner != null && datas[i].winner != ""){
  505. tableHtml += '<td class="tt-l" width="174"><div>'+datas[i].winner+'</div></td>';
  506. }else{
  507. tableHtml += '<td class="tt-l" width="174"><div></div></td>';
  508. }
  509. if(typeof(datas[i].bidamount) != "undefined" && datas[i].bidamount != null && datas[i].bidamount != ""){
  510. var bidamount = parseInt(datas[i].bidamount)/10000;
  511. if(bidamount.toString().length>6){
  512. if(bidamount.toString().indexOf(".")==5){
  513. bidamount=bidamount.toString().substr(0,7);
  514. }else{
  515. bidamount=bidamount.toString().substr(0,6);
  516. }
  517. }
  518. tableHtml += '<td class="tt-r" width="76"><div>'+bidamount+'</div></td>';
  519. }else{
  520. tableHtml += '<td class="tt-r" width="76"><div></div></td>';
  521. }
  522. if(typeof(datas[i].publishtime) != "undefined" && datas[i].publishtime != null && datas[i].publishtime != ""){
  523. var diff = formatDate(Number(datas[i].publishtime),"s");
  524. if(diff != null){
  525. tableHtml += '<td width="103"><div>'+diff+'</div></td>';
  526. }
  527. }else{
  528. tableHtml += '<td width="103"><div></div></td>';
  529. }
  530. tableHtml+='</tr>'
  531. }
  532. // 搜索框有输入词
  533. if(flag){
  534. if(selectType.indexOf('content') > -1) {
  535. $("#allnews").show();
  536. $(".tabContainer-2").hide();
  537. } else {
  538. $("#allnews").hide();
  539. $(".tabContainer-2").show();
  540. }
  541. }else{
  542. $("#allnews").hide();
  543. $(".tabContainer-2").show();
  544. }
  545. if (currentPage!=1){
  546. tableHtml = sessionStorage.getItem("table_first_context")
  547. }else{
  548. sessionStorage.setItem("table_first_context",tableHtml)
  549. }
  550. // 没有关键词或者没有选中正文
  551. if(!flag||selectType.indexOf('content') == -1){
  552. if (!onlyUpdateTable){
  553. $(".tabContainer-2 .lucene ul").html(listHtml);
  554. }
  555. $(".tabContainer-2 .lucene-table table tbody").html(tableHtml);
  556. }else{
  557. if(selectType.indexOf('content') > -1){
  558. if (!onlyUpdateTable){
  559. $("#allnews .lucene ul").html(listHtml);
  560. }
  561. $("#allnews .lucene-table table tbody").html(tableHtml);
  562. }
  563. }
  564. $(".tabContainer").css("min-height","");
  565. submitflag=true;
  566. // backTopAdjust();
  567. // 生成dom之后再查标讯有无收藏
  568. getBidIsColl()
  569. checkVisited()
  570. // 生成dom之后再查询是否勾选
  571. getCheckList()
  572. }
  573. function getacount(bidamount,budget){
  574. if(typeof(bidamount) != "undefined" && bidamount != null && bidamount != ""){
  575. return bidamount
  576. }
  577. if(typeof(budget) != "undefined" && budget != null && budget != ""){
  578. return budget
  579. }
  580. return ""
  581. }
  582. //金额转化 金额:0-万元以下单位为元 ,万元以上至亿元以下单位为万元 ,亿元以上单位为亿元。保留 小数点后 2 位,不进行四舍五入。
  583. function conversionMoeny(money){
  584. var m = ""+money;
  585. var m_arr = m.split(".")
  586. var m_1 = m_arr[0]
  587. var len_m1 = m_1.length;
  588. if (len_m1 >= 9 ){
  589. m = m_1.substring(0,len_m1-8) + "." + m_1.substring(len_m1-8,len_m1-6) + "亿元"
  590. } else if (len_m1 >= 5) {
  591. m =m_1.substring(0,len_m1-4) + "." + m_1.substring(len_m1-4,len_m1-2) + "万元"
  592. } else {
  593. if(m_arr.length == 1) {
  594. return m + ".00元"
  595. }
  596. var m_2 = m_arr[1]
  597. if (m_2.length > 1) {
  598. m_2 = m_2.substring(0,2)
  599. } else {
  600. m_2 = m_2.substring(0,1) + "0"
  601. }
  602. m = m_1 + "." + m_2 + "元"
  603. }
  604. return m
  605. }
  606. //关闭遮罩层
  607. function layerClose(){
  608. $("#myModal").modal("hide");
  609. }
  610. //
  611. function formatDate(date,sl) {
  612. var myDate = new Date(date*1000);
  613. var year=myDate.getFullYear();
  614. var month=myDate.getMonth()+1;
  615. var date=myDate.getDate();
  616. var hour = myDate.getHours()
  617. var min = myDate.getMinutes()
  618. if(sl=="l"){
  619. if(hour<10){
  620. hour="0"+hour
  621. }
  622. if(min<10){
  623. min="0"+min
  624. }
  625. return year+"-"+month+"-"+date+"<br>"+hour+":"+min;
  626. }else{
  627. return year+"-"+month+"-"+date;
  628. }
  629. }
  630. //
  631. function onpicking(dp,obj){
  632. var time = new Date(dp.cal.newdate.y,dp.cal.newdate.M-1,dp.cal.newdate.d).getTime()+"";
  633. time = time.substring(0,time.length - 3);
  634. $(obj).attr("data-value",time);
  635. }
  636. //
  637. function onclearing(obj){
  638. $(obj).attr("data-value","");
  639. //localStorage.removeItem($(obj).attr("id"))
  640. if($(".customtime").hasClass("active") && getInputTime().join("") == ""){
  641. $(".customtime").removeClass("active");
  642. $("#publishtime #alltime").addClass("active");
  643. }
  644. }
  645. //
  646. function picked(dp,obj){
  647. //localStorage.setItem($(obj).attr("id"),$(obj).val()+"_"+$(obj).attr("data-value"))
  648. }
  649. //
  650. function getInputTime(){
  651. var starttime = $("#starttime").attr("data-value");
  652. if(starttime){
  653. starttime = $.trim(starttime);
  654. }else{
  655. starttime = "";
  656. }
  657. var endtime = $("#endtime").attr("data-value");
  658. if(endtime){
  659. endtime = $.trim(endtime);
  660. }else{
  661. endtime = "";
  662. }
  663. return [starttime,endtime]
  664. }
  665. //---取VIP数据---
  666. function getVIPData(clickpaging){
  667. var this_selectType = $("#zbSeatchT [name='selectType']").val();
  668. if(this_selectType != "all"){
  669. LimitClass.limitFlag = false;
  670. LimitClass.result = null;
  671. LimitClass.list = null;
  672. }else{
  673. if(LimitClass.limitFlag){
  674. if(clickpaging){
  675. LimitClass.paging(currentPage);
  676. }else{
  677. $(".tabContainer .lucene").hide();
  678. $(".tabContainer .lucene-table").show();
  679. }
  680. return true;
  681. }
  682. }
  683. var tlflag = false;
  684. $(".tabContainer-2 .lucene").hide();
  685. $("#allnews").hide();
  686. $(".pagination").hide();
  687. $(".working").show();
  688. // 隐藏页码
  689. searchInnerVue.showPage = false
  690. if($("#zbSeatchT [name='keywords']").val()==""&&$("#zbSeatchT [name='keywords']").val()==""&&$("#zbSeatchT [name='industry']").val()==""){
  691. $(".working").hide();
  692. $(".pagination").show();
  693. // 显示页码
  694. searchInnerVue.showPage = true
  695. return true;
  696. }
  697. var tabflag = false;
  698. if($("#zbSeatchT [name='keywords']").val()!=""){
  699. // $("#newsclass").show();
  700. // $("#newsnow").hide();
  701. tlflag = true;
  702. }else{
  703. // $("#newsclass").hide();
  704. // $("#newsnow").show();
  705. tlflag = false;
  706. }
  707. if(currentPage==1){
  708. $(".nbprev").addClass("disabled");
  709. }
  710. var reqType="bidSearch";
  711. if($("#zbSeatchT [name='keywords']").val()==""){
  712. reqType="lastNews";
  713. }
  714. var param = {
  715. pageNumber: 1,
  716. reqType: reqType,
  717. searchvalue: $("#zbSeatchT [name='keywords']").val(),
  718. area: $("#zbSeatchT [name='area']").val(),
  719. subtype: $("#zbSeatchT [name='subtype']").val(),
  720. publishtime: $("#zbSeatchT [name='publishtime']").val(),
  721. selectType : this_selectType || 'title',
  722. minprice : $("#zbSeatchT [name='minprice']").val(),
  723. maxprice : $("#zbSeatchT [name='maxprice']").val(),
  724. industry : $("#zbSeatchT [name='industry']").val(),
  725. tabularflag : tabularflag,
  726. buyerclass: $("#zbSeatchT [name='buyerclass']").val(),
  727. buyertel: $("#zbSeatchT [name='buyertel']").val(),
  728. winnertel: $("#zbSeatchT [name='winnertel']").val(),
  729. notkey: $(".not-key-input-group input").val().slice(0, 10)
  730. };
  731. $.ajax({
  732. type:'post',
  733. url:'/front/pcAjaxReq',
  734. async:false,
  735. data:param,
  736. dataType:'json',
  737. success:function(r){
  738. afterAjaxReq(r);
  739. if(r&&r.list!=null&&r.list.length>0){
  740. $(".hasNoData").hide();
  741. if(r.list.length<pageSize||currentPage==10){
  742. $(".nbnext").addClass("disabled");
  743. }else{
  744. $(".nbnext").removeClass("disabled");
  745. }
  746. appendDatas(r.list,tlflag,true,true);
  747. }else{
  748. $(".working").hide();
  749. $(".hasNoData").show();
  750. // 隐藏页码
  751. searchInnerVue.showPage = false
  752. }
  753. tabflag = true;
  754. }
  755. })
  756. return tabflag
  757. }
  758. ///
  759. function beforeSubmit(n){
  760. // n有值即执行的是点击搜索按钮或回车搜索事件
  761. // n有值且关键词不为空时 存sessionStorage值
  762. if ($("#zbSeatchT [name='keywords']").val() !=="") {
  763. sessionStorage.setItem('is-click-search', 1)
  764. } else {
  765. sessionStorage.removeItem('is-click-search')
  766. }
  767. // 重置全选按钮
  768. $('.custom-checkbox.check-all').prop('checked', false)
  769. $(".hasNoData").hide();
  770. $(".working").show();
  771. // 隐藏页码
  772. searchInnerVue.showPage = false
  773. //$(".tabContainer-2 .lucene ul").html("");
  774. //$(".tabContainer-2 .lucene-table table tbody").html("");
  775. $(".tabContainer .lucene ul").html("");
  776. //$(".tabContainer .lucene-table table tbody").html("");
  777. $(".tabContainer").css("min-height","600px");
  778. $("#right-list").addClass("active").siblings().removeClass("active");
  779. $(".tabContainer-2 .lucene").show().siblings().hide();
  780. $("#right-list").addClass("active").siblings().removeClass("active");
  781. $("#allnews .lucene").show().siblings().hide();
  782. $(".tabContainer-2").hide();
  783. $("#allnews").hide();
  784. $(".pagination").hide();
  785. setTimeout(function(){
  786. currentPage=1;
  787. // 重置element ui页码为1
  788. searchInnerVue.listState.num = 1
  789. //时间
  790. if(currentPage==1){
  791. $(".nbprev").addClass("disabled");
  792. }
  793. var publishtime = null;
  794. var timeslot = getInputTime().join("_");
  795. if($(".timerInput").hasClass("active")){
  796. if(timeslot != "_"){
  797. $("#zbSeatchT [name='publishtime']").val(timeslot);
  798. }else{
  799. $("#zbSeatchT [name='publishtime']").val("");
  800. }
  801. }else{
  802. publishtime = $(".timer .active").attr("data-value");
  803. if(typeof(publishtime) != "undefined"){
  804. $("#zbSeatchT [name='publishtime']").val(publishtime);
  805. }else{
  806. $("#zbSeatchT [name='publishtime']").val("");
  807. }
  808. }
  809. if(timeslot != "_"){
  810. $("#zbSeatchT [name='timeslot']").val(timeslot);
  811. }else{
  812. $("#zbSeatchT [name='timeslot']").val("");
  813. }
  814. //地区
  815. var selectAreas = "";
  816. $(".region-content .active:not(.parent-node)").each(function(){
  817. var thisText = $(this).text();
  818. if(thisText != "全国"){
  819. if(selectAreas != ""){
  820. selectAreas += ",";
  821. }
  822. selectAreas += thisText;
  823. }
  824. });
  825. $("#zbSeatchT [name='area']").val(selectAreas);
  826. //类型
  827. var selectSubTypes = "";
  828. $(".info-content .active:not(.parent-node)").each(function(){
  829. if($(this).attr("id") == "whole"||$(this).attr("id") == "infoBtn"){
  830. return true;
  831. }
  832. var thisText = $(this).attr("data-value");
  833. if (thisText!=undefined){
  834. if(selectSubTypes != ""){
  835. selectSubTypes += ",";
  836. }
  837. selectSubTypes += thisText;
  838. }
  839. });
  840. $("#zbSeatchT [name='subtype']").val(selectSubTypes);
  841. //行业
  842. var selectIndustrys = "";
  843. var thisText = "";
  844. $(".industry-content .active").each(function(){
  845. if($(this).attr("id") == "induAll"){
  846. return true;
  847. }else if($(this).hasClass("active")&&$(this).hasClass("parent-node")){
  848. $(this).nextUntil(".diver").each(function(){
  849. thisText = $(this).attr("data-value");
  850. if(selectIndustrys != ""){
  851. selectIndustrys += ",";
  852. }
  853. selectIndustrys += thisText;
  854. });
  855. }else{
  856. thisText = $(this).attr("data-value");
  857. if(selectIndustrys != ""){
  858. selectIndustrys += ",";
  859. }
  860. selectIndustrys += thisText;
  861. }
  862. });
  863. $("#zbSeatchT [name='industry']").val(selectIndustrys);
  864. //价格
  865. if(!$("#priceAll").hasClass("active")){
  866. var selectMinPrices = $(".PriceInput [name='minprice']").val();
  867. var selectMaxPrices = $(".PriceInput [name='maxprice']").val();
  868. $("#zbSeatchT [name='minprice']").val(selectMinPrices);
  869. $("#zbSeatchT [name='maxprice']").val(selectMaxPrices);
  870. }else{
  871. $("#zbSeatchT [name='minprice']").val("");
  872. $("#zbSeatchT [name='maxprice']").val("");
  873. }
  874. //搜索关键词
  875. var searchname = $("#zbSeatchT input[name='keywords']").val();
  876. //$("#zbSeatchT input[name='searchvalue']").val($.trim(searchname));
  877. // 采购单位类型
  878. var buyerTypeArr = ""
  879. var buyerText = ""
  880. $(".buyclass .active").each(function(){
  881. if ($(this).hasClass('buyclass-all')) {
  882. return true
  883. } else if ($(this).hasClass('buy-list')) {
  884. if ($(this).attr("data-value")) {
  885. buyerText = $(this).attr("data-value");
  886. if(buyerTypeArr != ""){
  887. buyerTypeArr += ",";
  888. }
  889. buyerTypeArr += buyerText;
  890. }
  891. }
  892. })
  893. //采购单位类型
  894. $("#zbSeatchT [name='buyerclass']").val(buyerTypeArr)
  895. // $("#buyerInput").val(buyerTypeArr);
  896. //采购单位联系方式有无
  897. $("#zbSeatchT [name='buyertel']").val($(".custom-input[name='buyertel']").attr('data-value'));
  898. //中标单位联系方式有无
  899. $("#zbSeatchT [name='winnertel']").val($(".custom-input[name='winnertel']").attr('data-value'));
  900. //排除词
  901. $("#zbSeatchT [name='notkey']").val($(".not-key-input-group input").val().slice(0, 10));
  902. if($("#zbSeatchT [name='keywords']").val()==""&&$("#zbSeatchT [name='industry']").val()==""){
  903. getNewBids(currentPage);
  904. }else{
  905. if(n!="F"){
  906. if(submitflag){
  907. if($.trim(searchname)==""){
  908. getNewBiddings();
  909. nbflag = false;
  910. }else{
  911. searchvalue = $.trim(searchname);
  912. searchOnsubmit();
  913. nbflag = true;
  914. }
  915. submitflag=false;
  916. }
  917. setTimeout(function(){
  918. submitflag=true
  919. },200);
  920. }else{
  921. if($.trim(searchname)!=""){
  922. nbflag = true;
  923. }
  924. }
  925. }
  926. return true
  927. },200)
  928. }
  929. var LimitClass = {
  930. prevNoLimitFlag: false,
  931. limitFlag: false,
  932. list: null,
  933. result: null,
  934. paging: function(cp){
  935. if(LimitClass.list != null){
  936. var start = (cp-1)*pageSize;
  937. var end = start+pageSize;
  938. if(end > LimitClass.list.length){
  939. end = LimitClass.list.length;
  940. }
  941. LimitClass.result.list = LimitClass.list.slice(start,end);
  942. }
  943. pcAjaxReqCallBack(LimitClass.result);
  944. }
  945. };
  946. //搜索关键词信息
  947. function searchOnsubmit(clickpaging){
  948. var this_selectType = $("#zbSeatchT [name='selectType']").val();
  949. if(this_selectType != "all"){
  950. LimitClass.limitFlag = false;
  951. LimitClass.result = null;
  952. LimitClass.list = null;
  953. }else{
  954. if(clickpaging&&LimitClass.limitFlag){
  955. LimitClass.paging(currentPage);
  956. return;
  957. }
  958. }
  959. // $("#newsclass").show();
  960. // $("#newsnow").hide();
  961. if(currentPage==1){
  962. $(".nbprev").addClass("disabled");
  963. }
  964. var param = {
  965. pageNumber: currentPage,
  966. reqType: "bidSearch",
  967. searchvalue: $("#zbSeatchT [name='keywords']").val(),
  968. area: $("#zbSeatchT [name='area']").val(),
  969. subtype: $("#zbSeatchT [name='subtype']").val(),
  970. publishtime: $("#zbSeatchT [name='publishtime']").val(),
  971. selectType : this_selectType || 'title',
  972. minprice : $("#zbSeatchT [name='minprice']").val(),
  973. maxprice : $("#zbSeatchT [name='maxprice']").val(),
  974. industry : $("#zbSeatchT [name='industry']").val(),
  975. tabularflag: "Y",
  976. buyerclass: $("#zbSeatchT [name='buyerclass']").val(),
  977. buyertel: $("#zbSeatchT [name='buyertel']").val(),
  978. winnertel: $("#zbSeatchT [name='winnertel']").val(),
  979. notkey: $(".not-key-input-group input").val().slice(0, 10)
  980. };
  981. $.post("/front/pcAjaxReq",param,function(r){
  982. if(r.limitFlag){
  983. LimitClass.limitFlag = true;
  984. LimitClass.result = r;
  985. LimitClass.list = r.list;
  986. LimitClass.paging(currentPage);
  987. LimitClass.prevNoLimitFlag = false;
  988. // 重新分页
  989. searchInnerVue.listState.total = r.totalPage
  990. searchInnerVue.checkPageNumAdd1()
  991. }else{
  992. LimitClass.prevNoLimitFlag = true;
  993. LimitClass.limitFlag = false;
  994. pcAjaxReqCallBack(r);
  995. }
  996. // getBidIsColl()
  997. });
  998. }
  999. function showSearchTipForTimeRange (type) {
  1000. var tempDom = $("#hasNoData_tiptext>font:eq(0)")
  1001. var tipMap = {
  1002. 'fiveyear': '近5年',
  1003. 'threeyear': '近3年',
  1004. 'thisyear': '近1年',
  1005. 'lately-7': '近7天',
  1006. 'lately-30': '近30天'
  1007. }
  1008. var tempStr = ''
  1009. var defaultRange = $("#zbSeatchT [name='publishtime']").val() || selectPublishtime
  1010. if (tipMap[defaultRange]) {
  1011. tempStr = tipMap[defaultRange]
  1012. } else {
  1013. var tempTimeList = defaultRange.split('_')
  1014. if (tempTimeList[0]) {
  1015. tempStr = new Date(tempTimeList[0] * 1000).pattern('yyyy/MM/dd')
  1016. }
  1017. if (tempTimeList[1]) {
  1018. if (tempStr.length) {
  1019. tempStr += '-'
  1020. }
  1021. tempStr += new Date(tempTimeList[1] * 1000).pattern('yyyy/MM/dd')
  1022. }
  1023. }
  1024. tempDom.find('span').text(tempStr)
  1025. if (type !== false) {
  1026. tempDom.show();
  1027. }
  1028. }
  1029. $(function () {
  1030. setTimeout(function(){
  1031. showSearchTipForTimeRange(false);
  1032. },500)
  1033. })
  1034. function pcAjaxReqCallBack(r){
  1035. afterAjaxReq(r);
  1036. var isAllSearch = $("#zbSeatchT [name='selectType']").val()=="all";
  1037. if(r.list == null || r.list.length == 0){
  1038. $("#hasNoData_tiptext>font").hide();
  1039. if(r.status==-1){
  1040. $("#hasNoData_tiptext>font:eq(1)").show();
  1041. }else if (r.status==-2){
  1042. $("#hasNoData_tiptext>font:eq(2)").show();
  1043. }else{
  1044. showSearchTipForTimeRange()
  1045. }
  1046. if(isAllSearch){
  1047. $("#allSearchModel").hide();
  1048. }else{
  1049. // $("#allSearchModel").show();
  1050. }
  1051. //分页过程中,突然切换控制状态
  1052. if(r.limitFlag && LimitClass.prevNoLimitFlag){
  1053. $("#hasNoData_tiptext>font").hide();
  1054. $("#hasNoData_tiptext>font:eq(1)").show();
  1055. }else{
  1056. if(currentPage>1){
  1057. $(".nbnext").addClass("disabled");
  1058. if(currentPage==2){
  1059. $(".nbprev").addClass("disabled");
  1060. }
  1061. currentPage = currentPage-1;
  1062. return false
  1063. }
  1064. }
  1065. $(".tabContainer").hide();
  1066. $(".pagination").hide();
  1067. $(".working").hide();
  1068. $(".hasNoData").show();
  1069. // 隐藏页码
  1070. searchInnerVue.showPage = false
  1071. submitflag=true;
  1072. }else{
  1073. //$(".tabContainer").show();
  1074. $(".hasNoData").hide();
  1075. appendDatas(r.list,true,false)
  1076. }
  1077. }
  1078. function afterAjaxReq(r){
  1079. secondFlag=r.secondFlag;
  1080. if(r.interceptWord != ""){
  1081. $("#intercept>span").text(r.interceptWord);
  1082. $("#intercept").removeClass("hidden");
  1083. }else{
  1084. $("#intercept").addClass("hidden");
  1085. }
  1086. if(r.keywords != null && typeof(r.keywords) != "undefined"){
  1087. $(".searchname").val(r.keywords);
  1088. }
  1089. $(".side-bar-bottom-font").text("“"+$.trim($(".searchname").val()).replace(/\s+/," ")+"”");
  1090. if(secondFlag==""&&typeof(r.searchvalue) != "undefined"){
  1091. searchvalue = r.searchvalue;
  1092. }
  1093. if(r.pcAjaxFlag=="T"){
  1094. searchvalue = r.searchvalue;
  1095. totalPage = r.totalPage;
  1096. list= r.list;
  1097. secondList= r.secondList;
  1098. // vue 重置总页数
  1099. searchInnerVue.listState.total = totalPage
  1100. searchInnerVue.checkPageNumAdd1()
  1101. }
  1102. if(secondFlag==""&&typeof(totalPage) != "undefined" && currentPage == 1){
  1103. if (r.totalPage==1){
  1104. totalPage = parseInt(r.count/pageSize)+1;
  1105. if(totalPage>10){
  1106. totalPage=10;
  1107. }
  1108. // vue 重置总页数
  1109. searchInnerVue.listState.total = totalPage
  1110. searchInnerVue.checkPageNumAdd1()
  1111. }else{
  1112. totalPage = r.totalPage;
  1113. searchInnerVue.listState.total = totalPage
  1114. searchInnerVue.checkPageNumAdd1()
  1115. }
  1116. }
  1117. }
  1118. function getCheckList() {
  1119. var getSelectNum = 0 // 获取这一页有多少个选中
  1120. var $dom = $('.custom-checkbox:not(.check-all)[name="bid-list"]')
  1121. $dom.each(function() {
  1122. if(selectDataIds.length == 0) return
  1123. selectDataIds.forEach((item,index) => {
  1124. let dataid = $(this).attr('dataid')
  1125. if (item == dataid) {
  1126. getSelectNum++
  1127. $(this).attr('checked', true)
  1128. }
  1129. })
  1130. })
  1131. if(getSelectNum>=50) {
  1132. $('.custom-checkbox').prop("checked",true)
  1133. } else {
  1134. $('.custom-checkbox').prop("checked",false)
  1135. $dom.each(function() {
  1136. if(selectDataIds.length == 0) return
  1137. selectDataIds.forEach((item,index) => {
  1138. let dataid = $(this).attr('dataid')
  1139. if (item == dataid) {
  1140. getSelectNum++
  1141. $(this).prop('checked', true)
  1142. }
  1143. })
  1144. })
  1145. }
  1146. }
  1147. /*
  1148. 招标信息是否被收藏接口ajax
  1149. bids: String, // 招标信息id(多个用,号拼接) 必填
  1150. */
  1151. function getBidIsColl () {
  1152. collectClick()
  1153. var bids = ""
  1154. var dataId = ""
  1155. // 区分标题搜索和全文搜索收藏
  1156. var allSearch = selectType.indexOf('content') > -1 && $("#zbSeatchT [name='keywords']").val() !==""
  1157. // console.log('当前是否显示的是全文',allSearch)
  1158. var $dom = allSearch ? $('.all-text-checkbox[name="bid-list"]') : $('.title-text-checkbox[name="bid-list"]')
  1159. $dom.each(function() {
  1160. if ($(this).attr('dataid')) {
  1161. dataId = $(this).attr("dataid");
  1162. if(bids != ""){
  1163. bids += ",";
  1164. }
  1165. bids += dataId;
  1166. }
  1167. })
  1168. $.ajax({
  1169. type:'post',
  1170. url:'/publicapply/bidcoll/isColl?t=' + Date.now(),
  1171. data: {
  1172. bids: bids
  1173. },
  1174. dataType:'json',
  1175. success: function(r){
  1176. if (r.data) {
  1177. var data = r.data
  1178. $('.icon-collect').removeClass('checked')
  1179. data.forEach(function(item,index){
  1180. if (selectType == 'title') {
  1181. $('.icon-collect[dataid="' + item + '"]').addClass('checked')
  1182. } else {
  1183. $('.icon-collect[dataid="' + item + '"]').addClass('checked')
  1184. }
  1185. })
  1186. }
  1187. }
  1188. })
  1189. }
  1190. // 收藏点击事件
  1191. function collectClick() {
  1192. // console.log(vipState, '是否是超级订阅用户')
  1193. // 单个收藏点击事件
  1194. $('.icon-collect').unbind('click').on('click',function(e) {
  1195. // 登录判断
  1196. if (!loginflag) {
  1197. openLoginDig()
  1198. return
  1199. }
  1200. baiduEvent('列表页标讯收藏-星标') // 百度统计代码
  1201. e.stopPropagation()
  1202. var $that = $(this)
  1203. var checked = $(this).hasClass('checked')
  1204. var checkedId = $(this).attr('dataid')
  1205. var binfo = [{
  1206. bid: checkedId
  1207. }]
  1208. if (checked) {
  1209. // 单个取消收藏行为
  1210. collBidAction('R', binfo, function(res) {
  1211. if (res.data) {
  1212. if (selectType == 'title') {
  1213. // 标题搜索下相关样式
  1214. // $that.removeClass('checked').parents().siblings('input[type="checkbox"]').prop("checked",false).removeAttr('disabled')
  1215. $that.removeClass('checked')
  1216. } else {
  1217. // 全文搜索下相关样式
  1218. // $that.removeClass('checked').parents('.luce-right').siblings().find('input[type="checkbox"]').prop("checked",false).removeAttr('disabled')
  1219. $that.removeClass('checked')
  1220. }
  1221. toastFn('已取消收藏', 800)
  1222. } else {
  1223. toastFn(res.error_msg, 1000)
  1224. }
  1225. })
  1226. } else {
  1227. // 单个收藏行为
  1228. vm.dialogTitle = '重要项目一键创建标签收藏!请完善个人信息,为您匹配精准服务'
  1229. // 查询是否需要用户留资料 不需要 则执行下一步回调(收藏标讯行为)
  1230. vm.isNeedSubmit('article_collection',function() {
  1231. sessionStorage.setItem('$save-tags-binfo', JSON.stringify(binfo)) // 将本次收藏的标讯id缓存起来 用于绑定标签时使用
  1232. collBidAction('C', binfo, function(res) {
  1233. if (res.data) {
  1234. toastFn('收藏成功', 1500)
  1235. if (selectType == 'title') {
  1236. $that.addClass('checked')
  1237. } else {
  1238. $that.addClass('checked')
  1239. }
  1240. var top = (parseInt($that.position().top) + 50 ) + 'px';
  1241. $('.tags-box').show(function(){
  1242. activeTags = []
  1243. $('.tag-labels').empty()
  1244. $('.clear-input').val('')
  1245. $('.tags-list').find('.tags-item').removeClass('tags-active')
  1246. $('.tag-placeholder').show()
  1247. }).css('top', top)
  1248. getUserTags()
  1249. } else {
  1250. // 是超级订阅用户或者其他付费用户
  1251. if (vipState || res.error_msg.indexOf('付费') > -1) {
  1252. toastFn('您的标讯收藏上限为5000条,请联系客服人员。', 1500)
  1253. } else {
  1254. updateVipDialog('标讯收藏满100条-去升级')
  1255. }
  1256. }
  1257. })
  1258. }, $(this))
  1259. }
  1260. })
  1261. // 批量收藏
  1262. $('#bid-collect').off('click').bind('click',function(e){
  1263. // 登录判断
  1264. if (!loginflag) {
  1265. openLoginDig()
  1266. return
  1267. }
  1268. baiduEvent('列表页标讯收藏-星标') // 百度统计代码
  1269. e.stopPropagation()
  1270. var top = (parseInt($(this).position().top) + 60 ) + 'px';
  1271. var len = $('.custom-checkbox:not(".check-all"):checked').length;
  1272. var checkedId = [] // 提交后端需要的标讯id数组
  1273. var leftArr = [] // checkbox选中的数据
  1274. var rightArr = [] // 当前已收藏过的数据
  1275. var notSameArr = [] // 选中的数据 与 收藏过的数据相比不同的数组
  1276. $('.custom-checkbox:not(".check-all"):checked').each(function(){
  1277. if ($(this).attr('dataid')) {
  1278. checkedId.push({
  1279. bid: $(this).attr('dataid')
  1280. })
  1281. leftArr.push($(this).attr('dataid'))
  1282. }
  1283. })
  1284. $('.icon-collect.checked').each(function() {
  1285. if ($(this).attr('dataid')) {
  1286. rightArr.push($(this).attr('dataid'))
  1287. }
  1288. })
  1289. var $that = $(this)
  1290. // 判断有无选中的标讯信息
  1291. if (len > 0 || selectDataIds.length > 0) {
  1292. selectDataIds.forEach(function(v) {
  1293. checkedId.push({
  1294. bid: v
  1295. })
  1296. })
  1297. checkedId = arrUnique(checkedId)
  1298. if(leftArr.length <= rightArr.length) {
  1299. for (key in leftArr) {
  1300. var stra = leftArr[key];
  1301. var count = 0;
  1302. for (var j = 0; j < rightArr.length; j++) {
  1303. var strb = rightArr[j];
  1304. if (stra == strb) {
  1305. count++;
  1306. }
  1307. }
  1308. if (count === 0) { //表示数组1的这个值没有重复的,放到notSameArr列表中
  1309. notSameArr.push(stra);
  1310. }
  1311. }
  1312. // 如果没有不同的值 即为选中的标讯都已收藏过 有不同的值即为有未收藏的标讯
  1313. // console.log(notSameArr, 'notSameArr')
  1314. if(notSameArr.length == 0) {
  1315. toastFn('已收藏', 800)
  1316. return
  1317. }
  1318. }
  1319. vm.dialogTitle = '重要项目一键创建标签收藏!请完善个人信息,为您匹配精准服务'
  1320. // 查询是否需要用户留资料 不需要 则执行下一步回调(批量收藏标讯行为)
  1321. vm.isNeedSubmit('article_collection', function() {
  1322. sessionStorage.setItem('$save-tags-binfo', JSON.stringify(checkedId)) // 将本次收藏的标讯id缓存起来 用于绑定标签时使用
  1323. collBidAction('C', checkedId, function(res) {
  1324. if (res.data) {
  1325. toastFn('收藏成功', 1500)
  1326. if (selectType == 'title') {
  1327. $('.custom-checkbox:not(".check-all"):checked').siblings().children('.icon-collect').addClass('checked')
  1328. } else {
  1329. $('.custom-checkbox:not(".check-all"):checked').parents('.liLuceneList').find('.icon-collect').addClass('checked')
  1330. }
  1331. // 收藏成功后再查一次收藏状态,为了区分达到收藏上限点时部分收藏成功,部分收藏失败
  1332. getBidIsColl()
  1333. // 弹出标签弹框时 清除上次选择的标签
  1334. $('.tags-box').show().css('top', top)
  1335. getUserTags()
  1336. } else {
  1337. // 是超级订阅用户或者其他付费用户
  1338. if (vipState || res.error_msg.indexOf('付费') > -1) {
  1339. toastFn('您的标讯收藏上限为5000条,请联系客服人员。', 1500)
  1340. } else {
  1341. updateVipDialog('标讯收藏满100条-去升级')
  1342. }
  1343. }
  1344. })
  1345. })
  1346. } else {
  1347. toastFn('尚未选择标讯,请选择', 1000)
  1348. }
  1349. })
  1350. }
  1351. function arrUnique(arr){
  1352. let ojb = {};
  1353. arr = arr.reduce(function(prevArr, currentItem) {
  1354. //利用对象的键名无法重复的特点,mch_id是唯一区别的属性值
  1355. ojb[currentItem.bid] ? '' : ojb[currentItem.bid] = true && prevArr.push(currentItem);
  1356. return prevArr
  1357. }, [])
  1358. return arr;
  1359. }
  1360. function openBigMemberDialog (str, content) {
  1361. $('.auth-dialog').show()
  1362. $('.auth-dialog .dialog-title').text('您暂无使用权限')
  1363. $('.auth-dialog .dialog-content').html(content || '开通大会员,查看更多招标项目,畅享商机不受限!')
  1364. $('.auth-dialog .default-btn').click(function () {
  1365. $('.auth-dialog').hide(300)
  1366. })
  1367. $('.auth-dialog .confirm-btn').text('免费体验')
  1368. $('.auth-dialog .confirm-btn').off('click').bind('click',function () {
  1369. var advName = '招标搜索' + str + '-去开通'
  1370. baiduEvent(advName) // 点击去开通事件 百度统计
  1371. $('.auth-dialog').hide(300)
  1372. vm.dialogTitle = '免费用户查看超过500条招标搜索结果'
  1373. vm.isNeedSubmit('jylab_see500_plus', function () {
  1374. vm.showSuccess = true
  1375. })
  1376. })
  1377. }
  1378. // 开通提醒弹框
  1379. function openVipDialog(str, content) {
  1380. $('.auth-dialog').show()
  1381. $('.auth-dialog .dialog-title').text('开通超级订阅')
  1382. $('.auth-dialog .dialog-content').html(content || '立享更多搜索权限,寻找商机更精准')
  1383. $('.auth-dialog .default-btn').click(function () {
  1384. $('.auth-dialog').hide(300)
  1385. })
  1386. $('.auth-dialog .confirm-btn').text('去开通')
  1387. $('.auth-dialog .confirm-btn').off('click').bind('click',function () {
  1388. var advName = '招标搜索' + str + '-去开通'
  1389. baiduEvent(advName) // 点击去开通事件 百度统计
  1390. window.open('/swordfish/page_big_pc/free/svip/buy')
  1391. })
  1392. }
  1393. // 升级提醒弹框
  1394. function updateVipDialog(str) {
  1395. $('.update-dialog').show()
  1396. $('.update-dialog .default-btn').click(function () {
  1397. $('.update-dialog').hide(300)
  1398. })
  1399. $('.update-dialog .confirm-btn').off('click').bind('click',function () {
  1400. baiduEvent(str) // 点击去升级事件 百度统计
  1401. window.open('/front/subscribe.html')
  1402. })
  1403. }
  1404. // 列表页收藏点击事件 百度统计
  1405. function baiduEvent(name) {
  1406. // console.log(name, 'name')
  1407. try {
  1408. _hmt.push(['_trackEvent', '超级订阅-pc', 'click', name]);
  1409. } catch (e) {
  1410. console.log('未初始化百度统计')
  1411. }
  1412. }
  1413. // toast上限提示
  1414. function toastFn (text, duration) {
  1415. if (duration) {
  1416. duration = 1000
  1417. }
  1418. var _html = ""
  1419. _html+='<div class="custom-toast"><div class="mask" style="background-color: transparent;"></div><div class="toast-container">'
  1420. _html+='<span>' + text + '</span></div></div>'
  1421. $('body').append(_html)
  1422. setTimeout(function(){
  1423. $(".custom-toast").fadeOut().remove();
  1424. },duration)
  1425. }
  1426. // 是否有权限
  1427. // isPower()
  1428. function isPower () {
  1429. $.ajax({
  1430. type:'post',
  1431. url:'/publicapply/bidcoll/power?t=' + Date.now(),
  1432. success: function(r){
  1433. if (r.data) {
  1434. var entniche = r.data.entniche
  1435. var member = r.data.member
  1436. var vip = r.data.vip
  1437. if (entniche || member || vip > 0) {
  1438. return 'true'
  1439. } else {
  1440. return 'false'
  1441. }
  1442. } else {
  1443. return 'false'
  1444. }
  1445. }
  1446. })
  1447. }