网站
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 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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. if (content.length > 0){
  88. if(module.data.outProjectInformationDetail.biddingType=='自由竞价'&&module.data.outProjectInformationDetail.projectShowStatus!='已经成交'){
  89. $("#biddingMoney").html('*');
  90. }else{
  91. $("#biddingMoney").html(content[0].money+module.data.outProjectInformationDetail.unit);
  92. }
  93. }else{
  94. $("#biddingMoney").html('无');
  95. }
  96. }
  97. }
  98. module.dataCompare = function(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime){
  99. var signupStartTime = signupStartTime;
  100. var signupStopTime = signupStopTime;
  101. var biddingStartTime = biddingStartTime;
  102. var biddingStopTime = biddingStopTime;
  103. var nowTime = Date.parse(new Date());
  104. var beginTimes=signupStartTime.substring(0,10).split('-');
  105. var endTimes=signupStopTime.substring(0,10).split('-');
  106. var biddingBeginTimes=biddingStartTime.substring(0,10).split('-');
  107. var biddingEndTimes=biddingStopTime.substring(0,10).split('-');
  108. signupStartTime=beginTimes[1]+'/'+beginTimes[2]+'/'+beginTimes[0]+' '+signupStartTime.substring(10,19);
  109. signupStopTime=endTimes[1]+'/'+endTimes[2]+'/'+endTimes[0]+' '+signupStopTime.substring(10,19);
  110. biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19);
  111. biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19);
  112. //时间差
  113. var leftTime = Date.parse(biddingStopTime)-nowTime;
  114. //报名开始时间差
  115. var signupLeftTime = Date.parse(signupStartTime)-nowTime;
  116. //报名结束时间差
  117. var signDownLeftTime = Date.parse(signupStopTime)-nowTime;
  118. //定义变量 d,h,m,s保存倒计时的时间
  119. var d,h,m,s;
  120. if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){
  121. //正在竞价
  122. module.data.biddingTimeType = 1;
  123. // 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])
  124. $('#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]);
  125. $('#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]);
  126. $('#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]);
  127. $('#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]);
  128. $('#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]);
  129. $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  130. $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  131. $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  132. $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  133. //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true);
  134. $('#countType').html('距竞价结束还有')
  135. }else if (nowTime>Date.parse(biddingStopTime)){
  136. //竞价结束
  137. $('#d0').html('0')
  138. $('#d1').html('0')
  139. $('#d2').html('0')
  140. $('#h0').html('0')
  141. $('#h1').html('0')
  142. $('#m0').html('0')
  143. $('#m1').html('0')
  144. $('#s0').html('0')
  145. $('#s1').html('0')
  146. $('#countType').html('竞价结束')
  147. module.data.biddingTimeType = 2;
  148. }else if (nowTime<Date.parse(biddingStartTime)){
  149. //竞价暂未开始
  150. $('#d0').html('0')
  151. $('#d1').html('0')
  152. $('#d2').html('0')
  153. $('#h0').html('0')
  154. $('#h1').html('0')
  155. $('#m0').html('0')
  156. $('#m1').html('0')
  157. $('#s0').html('0')
  158. $('#s1').html('0')
  159. $('#countType').html('暂未开始')
  160. module.data.biddingTimeType = 3;
  161. }
  162. if(Date.parse(signupStartTime)<nowTime&&nowTime<Date.parse(signupStopTime)){
  163. //正在报名
  164. module.data.signupTimeType = 1;
  165. $('#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]);
  166. $('#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]);
  167. $('#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]);
  168. $('#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]);
  169. $('#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]);
  170. $('#m0').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  171. $('#m1').html(((Math.floor(signDownLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  172. $('#s0').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  173. $('#s1').html(((Math.floor(signDownLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  174. $('#countType').html('距报名结束还有')
  175. }else if (nowTime>Date.parse(signupStopTime)){
  176. //报名结束
  177. module.data.signupTimeType = 2;
  178. }else if (nowTime<Date.parse(signupStartTime)){
  179. //报名暂未开始
  180. module.data.signupTimeType = 3;
  181. $('#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]);
  182. $('#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]);
  183. $('#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]);
  184. $('#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]);
  185. $('#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]);
  186. $('#m0').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]);
  187. $('#m1').html(((Math.floor(signupLeftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]);
  188. $('#s0').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]);
  189. $('#s1').html(((Math.floor(signupLeftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]);
  190. $('#countType').html('距报名开始还有')
  191. }
  192. // if(module.data.outProjectInformationDetail.biddingType != '拍卖' && module.data.biddingTimeType != 2){
  193. // document.getElementById('biddingTable').style.display = 'none';
  194. // document.getElementById('biddingTitle').style.display = 'block';
  195. // }
  196. }
  197. //网站配置信息
  198. module.webConfigInformation = function (data) {
  199. if (data.code == 200) {
  200. var content = data.data;
  201. console.log(content)
  202. //document.getElementById('time').innerHTML = '延时周期:'+content[8].configValue+content[8].remark+'<i class="wh">?</i>'
  203. module.data.timeConfig = content[8].configValue;
  204. module.data.titleConfig = content[9].configValue;
  205. module.data.importantTitle = content[7].configName+':'+ content[7].configValue.substr(3).substr(0,(content[7].configValue.substr(3).length-4));
  206. module.data.know = content[6].configValue;
  207. $("#know").html(content[6].configValue + '<span style="margin-left: 10px;"></span>' + content[6].configValue);
  208. }
  209. }
  210. module.biddingDirectDictionaries = function (data) {
  211. if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') {
  212. var content = data.data;
  213. var biddingDirect = content[(module.data.outProjectInformationDetail.biddingDirect-1)].dictLabel;
  214. module.data.outProjectInformationDetail.biddingDirect = biddingDirect;
  215. var outProjectInformationData = template('outProjectInformationData', module.data);
  216. $("#outProjectInformationContent").html(outProjectInformationData);
  217. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  218. $("#outProjectInformationContent2").html(outProjectInformationData2);
  219. }
  220. }
  221. module.unitDictionaries = function (data) {
  222. if (data.code == 200) {
  223. var content = data.data;
  224. var unit = content[(module.data.outProjectInformationDetail.unit-1)].dictLabel;
  225. module.data.outProjectInformationDetail.unit = unit;
  226. var outProjectInformationData = template('outProjectInformationData', module.data);
  227. $("#outProjectInformationContent").html(outProjectInformationData);
  228. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  229. $("#outProjectInformationContent2").html(outProjectInformationData2);
  230. $('#unit').html('出价【'+unit+'】')
  231. }
  232. }
  233. module.biddingTypeDictionaries = function (data) {
  234. if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') {
  235. var content = data.data;
  236. var biddingType = content[(module.data.outProjectInformationDetail.biddingType-1)].dictLabel;
  237. module.data.outProjectInformationDetail.biddingType = biddingType;
  238. var outProjectInformationData = template('outProjectInformationData', module.data);
  239. $("#outProjectInformationContent").html(outProjectInformationData);
  240. var outProjectInformationData2 = template('outProjectInformationData2', module.data);
  241. $("#outProjectInformationContent2").html(outProjectInformationData2);
  242. }
  243. }
  244. return module;
  245. });