网站
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
 
 
 

298 строки
16 KiB

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