网站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

biddingBigDataDetail.js 27 KiB

2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
2 年之前
2 年之前
1 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
2 年之前
1 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
1 年之前
1 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
2 年之前
1 年之前
1 年之前
1 年之前
1 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
1 年之前
2 年之前
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  1. /**
  2. * Created by Administrator on 2021/4/5.
  3. */
  4. define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, template, Tools ) {
  5. //数据存储
  6. var module = {
  7. data: {
  8. timeArray: {
  9. d: '',
  10. h: '',
  11. m: '',
  12. s: '',
  13. },
  14. timer:null,
  15. setimer:null,
  16. outProjectInformationDetail:{}
  17. },
  18. };
  19. var tools = new Tools();
  20. module.init = function (page) {
  21. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  22. tools.doGet(webConfig, {}, module.webConfigInformation, true)
  23. var nowTime = new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"));
  24. $("#nowDateNYR").html(nowTime.getFullYear()+'.'+(nowTime.getMonth()+1)+'.'+nowTime.getDate())
  25. setInterval(function () {
  26. var nowTime = new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date"));
  27. $("#nowDateSFM").html(nowTime.toLocaleTimeString());
  28. $("#nowTime").html('服务器时间:'+nowTime.getFullYear()+'.'+(nowTime.getMonth()+1)+'.'+nowTime.getDate()+' '+nowTime.toLocaleTimeString());
  29. },1000)
  30. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  31. setInterval(function (){
  32. tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  33. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation2,true);
  34. },5000)
  35. };
  36. //获取地址栏参数
  37. function getQueryVariable(variable){
  38. var query = window.location.search.substring(1);
  39. var vars = query.split("&");
  40. for (var i=0;i<vars.length;i++) {
  41. var pair = vars[i].split("=");
  42. if(pair[0] == variable){return pair[1];}
  43. }
  44. return(false);
  45. }
  46. //获取地址栏参数
  47. rechSelect = function (){
  48. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  49. }
  50. //项目基本信息
  51. module.outProjectInformation = function (data) {
  52. if (data.code == 200) {
  53. var content = data.data;
  54. module.data.outProjectInformationDetail = content;
  55. // var outProjectInformationData = template('outProjectInformationData', module.data);
  56. // $("#outProjectInformationContent").html(outProjectInformationData);
  57. //挂牌价格字典
  58. tools.doGet(Dictionaries+'/price_unit', {}, (data)=>{
  59. if (data.code == 200) {
  60. var unit = eval(data.data).filter(function (e) { return e.dictValue == content.unit;})[0].dictLabel;
  61. module.data.outProjectInformationDetail.unit = unit;
  62. var outProjectInformationData = template('outProjectInformationData', module.data);
  63. $("#outProjectInformationContent").html(outProjectInformationData);
  64. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  65. $("#outProjectInformationContent2").html(outProjectInformationData2);
  66. $('#unit').html('出价【'+unit+'】')
  67. }
  68. },true);
  69. //竞价方式字典
  70. tools.doGet(Dictionaries+'/bidding_type', {}, (data)=>{
  71. if (data.code == 200) {
  72. var biddingType = eval(data.data).filter(function (e) { return e.dictValue == content.biddingType;})[0].dictLabel;
  73. module.data.outProjectInformationDetail.biddingType = biddingType;
  74. var outProjectInformationData = template('outProjectInformationData', module.data);
  75. $("#outProjectInformationContent").html(outProjectInformationData);
  76. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  77. $("#outProjectInformationContent2").html(outProjectInformationData2);
  78. }
  79. },true);
  80. //期满处理字典
  81. tools.doGet(Dictionaries+'/bidding_direct', {}, (data)=>{
  82. if (data.code == 200) {
  83. var biddingDirect = eval(data.data).filter(function (e) { return e.dictValue == content.biddingDirect;})[0].dictLabel;
  84. module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
  85. var outProjectInformationData = template('outProjectInformationData', module.data);
  86. $("#outProjectInformationContent").html(outProjectInformationData);
  87. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  88. $("#outProjectInformationContent2").html(outProjectInformationData2);
  89. }
  90. },true);
  91. //交易项目竞价记录
  92. tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  93. //倒计时
  94. module.data.timer = setInterval(function(){
  95. let signupStartTime = module.data.outProjectInformationDetail.signupStartTime;
  96. let signupStopTime = module.data.outProjectInformationDetail.signupStopTime;
  97. let biddingStartTime = module.data.outProjectInformationDetail.biddingStartTime;
  98. let biddingStopTime = module.data.outProjectInformationDetail.biddingStopTime;//延时后结束时间
  99. let biddingStopSetime = module.data.outProjectInformationDetail.biddingStopSetime;//原始结束时间
  100. var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  101. var difference = Date.parse(biddingStopTime)-nowTime;//延时后时间差
  102. var differenceSetime = Date.parse(biddingStopSetime)-nowTime;//原始时间差
  103. var centerTime = content.delayPeriod * 1000//延时周期
  104. var m,s;
  105. m = Math.floor(difference/1000/60%60);
  106. s = Math.floor(difference/1000%60);
  107. if(s%2 == 0&&centerTime!=0){
  108. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{
  109. if (data.code == 200) {
  110. module.data.outProjectInformationDetail.biddingStopTime = data.data
  111. }
  112. },true);
  113. }
  114. if ( differenceSetime <= 0 && difference >= 0 && difference <= centerTime){
  115. module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime);
  116. if (s < 1 && m < 1){
  117. console.log("竞价结束22222222222")
  118. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, function(data){
  119. if (data.code == 200) {
  120. module.data.outProjectInformationDetail.biddingStopTime = data.data
  121. let timeNew = Date.parse(data.data) + 0 - nowTime;
  122. if (timeNew > 0) {
  123. module.data.outProjectInformationDetail.biddingStopTime = data.data;
  124. }else{
  125. $('#countDown').html('竞价结束')
  126. module.data.outProjectInformationDetail.projectShowStatus = '竞价结束';
  127. var biddingInformationData = template('biddingInformationData', module.data);
  128. $("#biddingInformationContent").html(biddingInformationData);
  129. return;
  130. }
  131. }
  132. },true);
  133. }else if(s%2 == 0&&centerTime!=0){
  134. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{
  135. if (data.code == 200) {
  136. module.data.outProjectInformationDetail.biddingStopTime = data.data
  137. }
  138. },true);
  139. }
  140. }else{
  141. module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopSetime);
  142. }
  143. },1000);
  144. }
  145. }
  146. //项目基本信息
  147. module.outProjectInformation2 = function (data) {
  148. if (data.code == 200) {
  149. var content = data.data;
  150. $("#bmrs").html(content.bidderNum);
  151. if((module.data.outProjectInformationDetail.biddingType=='自由竞价'||module.data.outProjectInformationDetail.biddingType=='1')&&(module.data.outProjectInformationDetail.projectShowStatus=='正在竞价'||module.data.outProjectInformationDetail.projectShowStatus=='等待竞价')){
  152. $("#cjcs").html('*');
  153. }else{
  154. $("#cjcs").html(content.bidPriceNum);
  155. }
  156. }
  157. }
  158. //竞价记录
  159. module.biddinglistInformation = function (data) {
  160. if (data.code == 200) {
  161. //console.log(data)
  162. var content = data.rows;
  163. // for (var i = 0; i < content.length-1; i++) {
  164. // for (var j = 0; j < content.length - 1 - i; j++) {
  165. // // 相邻元素两两对比,元素交换,大的元素交换到后面
  166. // if (content[j].money < content[j + 1].money) {
  167. // var temp = content[j];
  168. // content[j] = content[j+1];
  169. // content[j+1] = temp;
  170. // }
  171. // }
  172. // }
  173. //console.log(content)
  174. module.data.biddinglistInformationDetail = content;
  175. var biddingInformationData = template('biddingInformationData', module.data);
  176. $("#biddingInformationContent").html(biddingInformationData);
  177. if (content.length > 0){
  178. if((module.data.outProjectInformationDetail.biddingType=='自由竞价'||module.data.outProjectInformationDetail.biddingType=='1')&&(module.data.outProjectInformationDetail.projectShowStatus=='正在竞价'||module.data.outProjectInformationDetail.projectShowStatus=='等待竞价')){
  179. $("#biddingMoney").html('*');
  180. $("#biddingPeople").html('*');
  181. }else{
  182. $("#biddingMoney").html(content[0].money+module.data.outProjectInformationDetail.unit);
  183. $("#biddingPeople").html(content[0].memberId);
  184. }
  185. }else{
  186. if((module.data.outProjectInformationDetail.biddingType=='自由竞价'||module.data.outProjectInformationDetail.biddingType=='1')&&(module.data.outProjectInformationDetail.projectShowStatus=='正在竞价'||module.data.outProjectInformationDetail.projectShowStatus=='等待竞价')){
  187. $("#biddingMoney").html('*');
  188. $("#biddingPeople").html('*');
  189. }else{
  190. $("#biddingPeople").html('无');
  191. $("#biddingMoney").html('无');
  192. }
  193. }
  194. }
  195. }
  196. module.dataCompare = function(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime){
  197. var signupStartTime = signupStartTime;
  198. var signupStopTime = signupStopTime;
  199. var biddingStartTime = biddingStartTime;
  200. var biddingStopTime = biddingStopTime;
  201. var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  202. var beginTimes=signupStartTime.substring(0,10).split('-');
  203. var endTimes=signupStopTime.substring(0,10).split('-');
  204. var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
  205. var biddingEndTimes=biddingStopTime.substring(0,10).split('-');
  206. signupStartTime=beginTimes[1]+'/'+beginTimes[2]+'/'+beginTimes[0]+' '+signupStartTime.substring(10,19);
  207. signupStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+signupStopTime.substring(10,19);
  208. biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
  209. biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);
  210. //时间差
  211. var leftTime = Date.parse(biddingStopTime)-nowTime;
  212. //报名开始时间差
  213. var signupLeftTime = Date.parse(signupStartTime)-nowTime;
  214. //报名结束时间差
  215. var signDownLeftTime = Date.parse(signupStopTime)-nowTime;
  216. var centerTime = module.data.delayPeriod * 1000//延时周期
  217. //定义变量 d,h,m,s保存倒计时的时间
  218. var d,h,m,s;
  219. if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
  220. //正在竞价
  221. module.data.biddingTimeType = 1;
  222. module.data.outProjectInformationDetail.projectShowStatus = '正在竞价';
  223. $('#d0').html(
  224. (
  225. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
  226. '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  227. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
  228. '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  229. Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
  230. )[0]
  231. );
  232. $('#d1').html(
  233. (
  234. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
  235. '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  236. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
  237. '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  238. Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
  239. )[1]
  240. );
  241. $('#d2').html(
  242. (
  243. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
  244. '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  245. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
  246. '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  247. Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
  248. )[2]
  249. );
  250. $('#h0').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
  251. $('#h1').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);
  252. $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  253. $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  254. $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  255. $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  256. //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  257. $('#countType').html('距竞价结束还有')
  258. }else if (nowTime>Date.parse(biddingStopTime)){
  259. module.data.outProjectInformationDetail.projectShowStatus = '等待成交';
  260. //竞价结束
  261. $('#d0').html('0')
  262. $('#d1').html('0')
  263. $('#d2').html('0')
  264. $('#h0').html('0')
  265. $('#h1').html('0')
  266. $('#m0').html('0')
  267. $('#m1').html('0')
  268. $('#s0').html('0')
  269. $('#s1').html('0')
  270. $('#countType').html('竞价结束')
  271. module.data.biddingTimeType = 2;
  272. }else if (nowTime<Date.parse(biddingStartTime)){
  273. module.data.outProjectInformationDetail.projectShowStatus = '等待竞价';
  274. //竞价暂未开始
  275. $('#d0').html('0')
  276. $('#d1').html('0')
  277. $('#d2').html('0')
  278. $('#h0').html('0')
  279. $('#h1').html('0')
  280. $('#m0').html('0')
  281. $('#m1').html('0')
  282. $('#s0').html('0')
  283. $('#s1').html('0')
  284. $('#countType').html('暂未开始')
  285. module.data.biddingTimeType = 3;
  286. }
  287. if(Date.parse(signupStartTime)<nowTime&&nowTime<Date.parse(signupStopTime)){
  288. //正在报名
  289. module.data.signupTimeType = 1;
  290. $('#d0').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[0]);
  291. $('#d1').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[1]);
  292. $('#d2').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[2]);
  293. $('#h0').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
  294. $('#h1').html(((Math.floor(signDownLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);
  295. $('#m0').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  296. $('#m1').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  297. $('#s0').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  298. $('#s1').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  299. $('#countType').html('距报名结束还有')
  300. }else if (nowTime>Date.parse(signupStopTime)){
  301. //报名结束
  302. module.data.signupTimeType = 2;
  303. }else if (nowTime<Date.parse(signupStartTime)){
  304. //报名暂未开始
  305. module.data.signupTimeType = 3;
  306. $('#d0').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[0]);
  307. $('#d1').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[1]);
  308. $('#d2').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : Math.floor(leftTime / 1000 / 60 / 60 / 24) + '')[2]);
  309. $('#h0').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
  310. $('#h1').html(((Math.floor(signupLeftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);
  311. $('#m0').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  312. $('#m1').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  313. $('#s0').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  314. $('#s1').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  315. $('#countType').html('距报名开始还有')
  316. }
  317. // if(module.data.outProjectInformationDetail.biddingType != '拍卖' && module.data.biddingTimeType != 2){
  318. // document.getElementById('biddingTable').style.display = 'none';
  319. // document.getElementById('biddingTitle').style.display = 'block';
  320. // }
  321. }
  322. module.setimeDataCompare = function(){
  323. tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{
  324. if (data.code == 200) {
  325. module.data.outProjectInformationDetail.biddingStopTime = data.data
  326. }
  327. },true);
  328. var biddingStartTime = module.data.outProjectInformationDetail.biddingStartTime
  329. var biddingStopTime = module.data.outProjectInformationDetail.biddingStopTime;
  330. var nowTime = Date.parse(new Date($.ajax({type:'HEAD',async:false,data:{i: Date.parse(new Date())}}).getResponseHeader("Date")));
  331. var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
  332. var biddingEndTimes=biddingStopTime.substring(0,10).split('-');
  333. biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
  334. biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);
  335. //时间差
  336. var leftTime = Date.parse(biddingStopTime)-nowTime;
  337. //定义变量 d,h,m,s保存倒计时的时间
  338. var d,h,m,s;
  339. if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
  340. //正在竞价
  341. module.data.biddingTimeType = 1;
  342. $('#d0').html(
  343. (
  344. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
  345. '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  346. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
  347. '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  348. Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
  349. )[0]
  350. );
  351. $('#d1').html(
  352. (
  353. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
  354. '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  355. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
  356. '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  357. Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
  358. )[1]
  359. );
  360. $('#d2').html(
  361. (
  362. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ?
  363. '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  364. (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ?
  365. '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) :
  366. Math.floor(leftTime / 1000 / 60 / 60 / 24) + ''
  367. )[2]
  368. );
  369. $('#h0').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[0]);
  370. $('#h1').html(((Math.floor(leftTime / 1000 / 60 / 60 % 24) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 / 60 % 24) : Math.floor(leftTime / 1000 / 60 / 60 % 24) + '')[1]);
  371. $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  372. $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  373. $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  374. $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  375. let d,h,m,s;
  376. d = Math.floor(leftTime / 1000 / 60 / 60 / 24);
  377. h = Math.floor(leftTime / 1000 / 60 / 60 % 24);
  378. m = Math.floor(leftTime / 1000 / 60 % 60);
  379. s = Math.floor(leftTime / 1000 % 60);
  380. if (d<1&&h<1&&m<1&&s<1){
  381. console.log('竞价结束')
  382. clearInterval(module.data.setimer)
  383. }
  384. //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  385. $('#countType').html('距竞价结束还有')
  386. }
  387. }
  388. //网站配置信息
  389. module.webConfigInformation = function (data) {
  390. if (data.code == 200) {
  391. var content = data.data;
  392. //console.log(content)
  393. //document.getElementById('time').innerHTML = '延时周期:'+content[8].configValue+content[8].remark+'<i class="wh">?</i>'
  394. module.data.timeConfig = content[8].configValue;
  395. module.data.titleConfig = content[9].configValue;
  396. module.data.importantTitle = content[7].configName+':'+ content[7].configValue.substr(3).substr(0,(content[7].configValue.substr(3).length-4));
  397. module.data.know = content[6].configValue;
  398. $("#know").html(content[6].configValue + '<span style="margin-left: 10px;"></span>' + content[6].configValue);
  399. }
  400. }
  401. module.biddingDirectDictionaries = function (data) {
  402. if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') {
  403. var content = data.data;
  404. var biddingDirect = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingDirect;})[0].dictLabel;
  405. module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
  406. }
  407. }
  408. module.unitDictionaries = function (data) {
  409. if (data.code == 200 && module.data.outProjectInformationDetail.unit!='') {
  410. var content = data.data;
  411. var unit = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.unit;})[0].dictLabel;
  412. module.data.outProjectInformationDetail.unit = unit;
  413. }
  414. }
  415. module.biddingTypeDictionaries = function (data) {
  416. if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') {
  417. var content = data.data;
  418. console.log(eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingType;}))
  419. var biddingType = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingType;})[0].dictLabel;
  420. module.data.outProjectInformationDetail.biddingType = biddingType;
  421. }
  422. }
  423. return module;
  424. });