网站
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 16 KiB

пре 2 година
пре 1 година
пре 2 година
пре 1 година
пре 2 година
пре 1 година
пре 2 година
пре 1 година
пре 2 година
пре 1 година
пре 2 година
пре 2 година
пре 2 година
пре 2 година
пре 2 година
пре 1 година
пре 2 година
пре 1 година
пре 1 година
пре 2 година
пре 1 година
пре 2 година
пре 1 година
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  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. outProjectInformationDetail:{}
  15. },
  16. };
  17. var tools = new Tools();
  18. module.init = function (page) {
  19. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  20. tools.doGet(webConfig, {}, module.webConfigInformation, true)
  21. $("#nowDateNYR").html(new Date().getFullYear()+'.'+(new Date().getMonth()+1)+'.'+new Date().getDate())
  22. setInterval(function () {
  23. $("#nowDateSFM").html(new Date().toLocaleTimeString());
  24. $("#nowTime").html('服务器时间:'+new Date().getFullYear()+'.'+(new Date().getMonth()+1)+'.'+new Date().getDate()+' '+new Date().toLocaleTimeString());
  25. },1000)
  26. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  27. if (getQueryVariable('type') == 'Y'){
  28. setInterval(function (){
  29. tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  30. },5000)
  31. }
  32. };
  33. //获取地址栏参数
  34. function getQueryVariable(variable){
  35. var query = window.location.search.substring(1);
  36. var vars = query.split("&");
  37. for (var i=0;i<vars.length;i++) {
  38. var pair = vars[i].split("=");
  39. if(pair[0] == variable){return pair[1];}
  40. }
  41. return(false);
  42. }
  43. //获取地址栏参数
  44. rechSelect = function (){
  45. tools.doGet(outProject + '/id/'+getQueryVariable('id'), {}, module.outProjectInformation,true);
  46. }
  47. //项目基本信息
  48. module.outProjectInformation = function (data) {
  49. if (data.code == 200) {
  50. var content = data.data;
  51. //倒计时
  52. var timer = setInterval(function(){
  53. module.dataCompare(content.signupStartTime,content.signupStopTime,content.biddingStartTime,content.biddingStopTime);
  54. },1000);
  55. module.data.outProjectInformationDetail = content;
  56. // var outProjectInformationData = template('outProjectInformationData', module.data);
  57. // $("#outProjectInformationContent").html(outProjectInformationData);
  58. //挂牌价格字典
  59. tools.doGet(Dictionaries+'/price_unit', {}, module.unitDictionaries,true);
  60. //竞价方式字典
  61. tools.doGet(Dictionaries+'/bidding_type', {}, module.biddingTypeDictionaries,true);
  62. //期满处理字典
  63. tools.doGet(Dictionaries+'/bidding_direct', {}, module.biddingDirectDictionaries,true);
  64. //交易项目竞价记录
  65. tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  66. }
  67. }
  68. //竞价记录
  69. module.biddinglistInformation = function (data) {
  70. if (data.code == 200) {
  71. console.log(data)
  72. var content = data.rows;
  73. for (var i = 0; i < content.length-1; i++) {
  74. for (var j = 0; j < content.length - 1 - i; j++) {
  75. // 相邻元素两两对比,元素交换,大的元素交换到后面
  76. if (content[j].money < content[j + 1].money) {
  77. var temp = content[j];
  78. content[j] = content[j+1];
  79. content[j+1] = temp;
  80. }
  81. }
  82. }
  83. console.log(content)
  84. module.data.biddinglistInformationDetail = content;
  85. var biddingInformationData = template('biddingInformationData', module.data);
  86. $("#biddingInformationContent").html(biddingInformationData);
  87. }
  88. }
  89. module.dataCompare = function(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime){
  90. var signupStartTime = signupStartTime;
  91. var signupStopTime = signupStopTime;
  92. var biddingStartTime = biddingStartTime;
  93. var biddingStopTime = biddingStopTime;
  94. var nowTime = Date.parse(new Date());
  95. var beginTimes=signupStartTime.substring(0,10).split('-');
  96. var endTimes=signupStopTime.substring(0,10).split('-');
  97. var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
  98. var biddingEndTimes=biddingStopTime.substring(0,10).split('-');
  99. signupStartTime=beginTimes[1]+'/'+beginTimes[2]+'/'+beginTimes[0]+' '+signupStartTime.substring(10,19);
  100. signupStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+signupStopTime.substring(10,19);
  101. biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
  102. biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);
  103. //时间差
  104. var leftTime = Date.parse(biddingStopTime)-nowTime;
  105. //报名开始时间差
  106. var signupLeftTime = Date.parse(signupStartTime)-nowTime;
  107. //报名结束时间差
  108. var signDownLeftTime = Date.parse(signupStopTime)-nowTime;
  109. //定义变量 d,h,m,s保存倒计时的时间
  110. var d,h,m,s;
  111. if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
  112. //正在竞价
  113. module.data.biddingTimeType = 1;
  114. // console.log(((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])
  115. $('#d0').html(((Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 1 ? '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : (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]);
  116. $('#d1').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]);
  117. $('#d2').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) + '')[2]);
  118. $('#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]);
  119. $('#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]);
  120. $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  121. $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  122. $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  123. $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  124. //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  125. $('#countType').html('距竞价结束还有')
  126. }else if (nowTime>Date.parse(biddingStopTime)){
  127. //竞价结束
  128. $('#d0').html('0')
  129. $('#d1').html('0')
  130. $('#d2').html('0')
  131. $('#h0').html('0')
  132. $('#h1').html('0')
  133. $('#m0').html('0')
  134. $('#m1').html('0')
  135. $('#s0').html('0')
  136. $('#s1').html('0')
  137. $('#countType').html('竞价结束')
  138. module.data.biddingTimeType = 2;
  139. }else if (nowTime<Date.parse(biddingStartTime)){
  140. //竞价暂未开始
  141. $('#d0').html('0')
  142. $('#d1').html('0')
  143. $('#d2').html('0')
  144. $('#h0').html('0')
  145. $('#h1').html('0')
  146. $('#m0').html('0')
  147. $('#m1').html('0')
  148. $('#s0').html('0')
  149. $('#s1').html('0')
  150. $('#countType').html('暂未开始')
  151. module.data.biddingTimeType = 3;
  152. }
  153. if(Date.parse(signupStartTime)<nowTime&&nowTime<Date.parse(signupStopTime)){
  154. //正在报名
  155. module.data.signupTimeType = 1;
  156. $('#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]);
  157. $('#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]);
  158. $('#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]);
  159. $('#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]);
  160. $('#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]);
  161. $('#m0').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  162. $('#m1').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  163. $('#s0').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  164. $('#s1').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  165. $('#countType').html('距报名结束还有')
  166. }else if (nowTime>Date.parse(signupStopTime)){
  167. //报名结束
  168. module.data.signupTimeType = 2;
  169. }else if (nowTime<Date.parse(signupStartTime)){
  170. //报名暂未开始
  171. module.data.signupTimeType = 3;
  172. $('#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]);
  173. $('#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]);
  174. $('#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]);
  175. $('#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]);
  176. $('#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]);
  177. $('#m0').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  178. $('#m1').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  179. $('#s0').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  180. $('#s1').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  181. $('#countType').html('距报名开始还有')
  182. }
  183. // if(module.data.outProjectInformationDetail.biddingType != '拍卖' && module.data.biddingTimeType != 2){
  184. // document.getElementById('biddingTable').style.display = 'none';
  185. // document.getElementById('biddingTitle').style.display = 'block';
  186. // }
  187. }
  188. //网站配置信息
  189. module.webConfigInformation = function (data) {
  190. if (data.code == 200) {
  191. var content = data.data;
  192. console.log(content)
  193. //document.getElementById('time').innerHTML = '延时周期:'+content[8].configValue+content[8].remark+'<i class="wh">?</i>'
  194. module.data.timeConfig = content[8].configValue;
  195. module.data.titleConfig = content[9].configValue;
  196. module.data.importantTitle = content[7].configName+':'+ content[7].configValue.substr(3).substr(0,(content[7].configValue.substr(3).length-4));
  197. module.data.know = content[6].configValue;
  198. $("#know").html(content[6].configValue + '<span style="margin-left: 10px;"></span>' + content[6].configValue);
  199. }
  200. }
  201. module.biddingDirectDictionaries = function (data) {
  202. if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') {
  203. var content = data.data;
  204. var biddingDirect = content[(module.data.outProjectInformationDetail.biddingDirect-1)].dictLabel;
  205. module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
  206. var outProjectInformationData = template('outProjectInformationData', module.data);
  207. $("#outProjectInformationContent").html(outProjectInformationData);
  208. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  209. $("#outProjectInformationContent2").html(outProjectInformationData2);
  210. }
  211. }
  212. module.unitDictionaries = function (data) {
  213. if (data.code == 200) {
  214. var content = data.data;
  215. var unit = content[(module.data.outProjectInformationDetail.unit-1)].dictLabel;
  216. module.data.outProjectInformationDetail.unit = unit;
  217. var outProjectInformationData = template('outProjectInformationData', module.data);
  218. $("#outProjectInformationContent").html(outProjectInformationData);
  219. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  220. $("#outProjectInformationContent2").html(outProjectInformationData2);
  221. $('#unit').html('出价【'+unit+'】')
  222. }
  223. }
  224. module.biddingTypeDictionaries = function (data) {
  225. if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') {
  226. var content = data.data;
  227. var biddingType = content[(module.data.outProjectInformationDetail.biddingType-1)].dictLabel;
  228. module.data.outProjectInformationDetail.biddingType = biddingType;
  229. var outProjectInformationData = template('outProjectInformationData', module.data);
  230. $("#outProjectInformationContent").html(outProjectInformationData);
  231. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  232. $("#outProjectInformationContent2").html(outProjectInformationData2);
  233. }
  234. }
  235. return module;
  236. });