| @@ -11,6 +11,8 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| m: '', | m: '', | ||||
| s: '', | s: '', | ||||
| }, | }, | ||||
| timer:null, | |||||
| setimer:null, | |||||
| outProjectInformationDetail:{} | outProjectInformationDetail:{} | ||||
| }, | }, | ||||
| }; | }; | ||||
| @@ -58,22 +60,49 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| module.outProjectInformation = function (data) { | module.outProjectInformation = function (data) { | ||||
| if (data.code == 200) { | if (data.code == 200) { | ||||
| var content = data.data; | var content = data.data; | ||||
| //倒计时 | |||||
| var timer = setInterval(function(){ | |||||
| module.dataCompare(content.signupStartTime,content.signupStopTime,content.biddingStartTime,content.biddingStopTime); | |||||
| },1000); | |||||
| module.data.outProjectInformationDetail = content; | module.data.outProjectInformationDetail = content; | ||||
| // var outProjectInformationData = template('outProjectInformationData', module.data); | // var outProjectInformationData = template('outProjectInformationData', module.data); | ||||
| // $("#outProjectInformationContent").html(outProjectInformationData); | // $("#outProjectInformationContent").html(outProjectInformationData); | ||||
| //挂牌价格字典 | //挂牌价格字典 | ||||
| tools.doGet(Dictionaries+'/price_unit', {}, module.unitDictionaries,true); | |||||
| tools.doGet(Dictionaries+'/price_unit', {}, (data)=>{ | |||||
| if (data.code == 200) { | |||||
| var unit = eval(data.data).filter(function (e) { return e.dictValue == content.unit;})[0].dictLabel; | |||||
| module.data.outProjectInformationDetail.unit = unit; | |||||
| var outProjectInformationData = template('outProjectInformationData', module.data); | |||||
| $("#outProjectInformationContent").html(outProjectInformationData); | |||||
| var outProjectInformationData2 = template('outProjectInformationData2', module.data); | |||||
| $("#outProjectInformationContent2").html(outProjectInformationData2); | |||||
| } | |||||
| },true); | |||||
| //竞价方式字典 | //竞价方式字典 | ||||
| tools.doGet(Dictionaries+'/bidding_type', {}, module.biddingTypeDictionaries,true); | |||||
| tools.doGet(Dictionaries+'/bidding_type', {}, (data)=>{ | |||||
| if (data.code == 200) { | |||||
| var biddingType = eval(data.data).filter(function (e) { return e.dictValue == content.biddingType;})[0].dictLabel; | |||||
| module.data.outProjectInformationDetail.biddingType = biddingType; | |||||
| var outProjectInformationData = template('outProjectInformationData', module.data); | |||||
| $("#outProjectInformationContent").html(outProjectInformationData); | |||||
| var outProjectInformationData2 = template('outProjectInformationData2', module.data); | |||||
| $("#outProjectInformationContent2").html(outProjectInformationData2); | |||||
| } | |||||
| },true); | |||||
| //期满处理字典 | //期满处理字典 | ||||
| tools.doGet(Dictionaries+'/bidding_direct', {}, module.biddingDirectDictionaries,true); | |||||
| tools.doGet(Dictionaries+'/bidding_direct', {}, (data)=>{ | |||||
| if (data.code == 200) { | |||||
| var biddingDirect = eval(data.data).filter(function (e) { return e.dictValue == content.biddingDirect;})[0].dictLabel; | |||||
| module.data.outProjectInformationDetail.biddingDirect = biddingDirect; | |||||
| var outProjectInformationData = template('outProjectInformationData', module.data); | |||||
| $("#outProjectInformationContent").html(outProjectInformationData); | |||||
| var outProjectInformationData2 = template('outProjectInformationData2', module.data); | |||||
| $("#outProjectInformationContent2").html(outProjectInformationData2); | |||||
| } | |||||
| },true); | |||||
| //交易项目竞价记录 | //交易项目竞价记录 | ||||
| tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); | tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); | ||||
| //倒计时 | |||||
| module.data.timer = setInterval(function(){ | |||||
| module.dataCompare(content.signupStartTime,content.signupStopTime,content.biddingStartTime,content.biddingStopSetime); | |||||
| },1000); | |||||
| } | } | ||||
| } | } | ||||
| @@ -91,19 +120,19 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| //竞价记录 | //竞价记录 | ||||
| module.biddinglistInformation = function (data) { | module.biddinglistInformation = function (data) { | ||||
| if (data.code == 200) { | if (data.code == 200) { | ||||
| console.log(data) | |||||
| //console.log(data) | |||||
| var content = data.rows; | var content = data.rows; | ||||
| for (var i = 0; i < content.length-1; i++) { | |||||
| for (var j = 0; j < content.length - 1 - i; j++) { | |||||
| // 相邻元素两两对比,元素交换,大的元素交换到后面 | |||||
| if (content[j].money < content[j + 1].money) { | |||||
| var temp = content[j]; | |||||
| content[j] = content[j+1]; | |||||
| content[j+1] = temp; | |||||
| } | |||||
| } | |||||
| } | |||||
| console.log(content) | |||||
| // for (var i = 0; i < content.length-1; i++) { | |||||
| // for (var j = 0; j < content.length - 1 - i; j++) { | |||||
| // // 相邻元素两两对比,元素交换,大的元素交换到后面 | |||||
| // if (content[j].money < content[j + 1].money) { | |||||
| // var temp = content[j]; | |||||
| // content[j] = content[j+1]; | |||||
| // content[j+1] = temp; | |||||
| // } | |||||
| // } | |||||
| // } | |||||
| //console.log(content) | |||||
| module.data.biddinglistInformationDetail = content; | module.data.biddinglistInformationDetail = content; | ||||
| var biddingInformationData = template('biddingInformationData', module.data); | var biddingInformationData = template('biddingInformationData', module.data); | ||||
| $("#biddingInformationContent").html(biddingInformationData); | $("#biddingInformationContent").html(biddingInformationData); | ||||
| @@ -143,15 +172,42 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| var signupLeftTime = Date.parse(signupStartTime)-nowTime; | var signupLeftTime = Date.parse(signupStartTime)-nowTime; | ||||
| //报名结束时间差 | //报名结束时间差 | ||||
| var signDownLeftTime = Date.parse(signupStopTime)-nowTime; | var signDownLeftTime = Date.parse(signupStopTime)-nowTime; | ||||
| var centerTime = module.data.delayPeriod * 1000//延时周期 | |||||
| //定义变量 d,h,m,s保存倒计时的时间 | //定义变量 d,h,m,s保存倒计时的时间 | ||||
| var d,h,m,s; | var d,h,m,s; | ||||
| if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){ | if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){ | ||||
| //正在竞价 | //正在竞价 | ||||
| module.data.biddingTimeType = 1; | module.data.biddingTimeType = 1; | ||||
| // 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]) | |||||
| $('#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]); | |||||
| $('#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]); | |||||
| $('#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]); | |||||
| $('#d0').html( | |||||
| ( | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? | |||||
| '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ? | |||||
| '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| Math.floor(leftTime / 1000 / 60 / 60 / 24) + '' | |||||
| )[0] | |||||
| ); | |||||
| $('#d1').html( | |||||
| ( | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? | |||||
| '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ? | |||||
| '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| Math.floor(leftTime / 1000 / 60 / 60 / 24) + '' | |||||
| )[1] | |||||
| ); | |||||
| $('#d2').html( | |||||
| ( | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? | |||||
| '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ? | |||||
| '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| Math.floor(leftTime / 1000 / 60 / 60 / 24) + '' | |||||
| )[2] | |||||
| ); | |||||
| $('#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]); | $('#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]); | ||||
| $('#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]); | $('#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]); | ||||
| @@ -162,6 +218,26 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]); | $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]); | ||||
| $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]); | $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]); | ||||
| let d,h,m,s; | |||||
| d = Math.floor(leftTime / 1000 / 60 / 60 / 24); | |||||
| h = Math.floor(leftTime / 1000 / 60 / 60 % 24); | |||||
| m = Math.floor(leftTime / 1000 / 60 % 60); | |||||
| s = Math.floor(leftTime / 1000 % 60); | |||||
| if ( d == 0 && h == 0 && m == 0 && s < 2 ){ | |||||
| clearInterval(module.data.timer); | |||||
| module.data.setimer = setInterval(()=>{ | |||||
| module.setimeDataCompare() | |||||
| },1000) | |||||
| console.log('开始延时') | |||||
| } | |||||
| if(s%2 == 0&¢erTime!=0){ | |||||
| tools.doGet(getBiddingStopTime+getQueryVariable('id'), {}, (data)=>{ | |||||
| if (data.code == 200) { | |||||
| module.data.outProjectInformationDetail.biddingStopTime = data.data | |||||
| } | |||||
| },true); | |||||
| } | |||||
| //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); | //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); | ||||
| $('#countType').html('距竞价结束还有') | $('#countType').html('距竞价结束还有') | ||||
| @@ -243,11 +319,85 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| // } | // } | ||||
| } | } | ||||
| module.setimeDataCompare = function(){ | |||||
| var biddingStartTime = module.data.outProjectInformationDetail.biddingStartTime | |||||
| var biddingStopTime = module.data.outProjectInformationDetail.biddingStopTime; | |||||
| var nowTime = Date.parse(new Date()); | |||||
| var biddingBeginTimes=biddingStartTime.substring(0,10).split('-'); | |||||
| var biddingEndTimes=biddingStopTime.substring(0,10).split('-'); | |||||
| biddingStartTime=biddingBeginTimes[1]+'/'+biddingBeginTimes[2]+'/'+biddingBeginTimes[0]+' '+biddingStartTime.substring(10,19); | |||||
| biddingStopTime=biddingEndTimes[1]+'/'+biddingEndTimes[2]+'/'+biddingEndTimes[0]+' '+biddingStopTime.substring(10,19); | |||||
| //时间差 | |||||
| var leftTime = Date.parse(biddingStopTime)-nowTime; | |||||
| //定义变量 d,h,m,s保存倒计时的时间 | |||||
| var d,h,m,s; | |||||
| if(Date.parse(biddingStartTime)<nowTime&&nowTime<Date.parse(biddingStopTime)){ | |||||
| //正在竞价 | |||||
| module.data.biddingTimeType = 1; | |||||
| $('#d0').html( | |||||
| ( | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? | |||||
| '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ? | |||||
| '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| Math.floor(leftTime / 1000 / 60 / 60 / 24) + '' | |||||
| )[0] | |||||
| ); | |||||
| $('#d1').html( | |||||
| ( | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? | |||||
| '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ? | |||||
| '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| Math.floor(leftTime / 1000 / 60 / 60 / 24) + '' | |||||
| )[1] | |||||
| ); | |||||
| $('#d2').html( | |||||
| ( | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 2 ? | |||||
| '00' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| (Math.floor(leftTime / 1000 / 60 / 60 / 24) + '').length < 3 ? | |||||
| '0' + Math.floor(leftTime / 1000 / 60 / 60 / 24) : | |||||
| Math.floor(leftTime / 1000 / 60 / 60 / 24) + '' | |||||
| )[2] | |||||
| ); | |||||
| $('#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]); | |||||
| $('#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]); | |||||
| $('#m0').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[0]); | |||||
| $('#m1').html(((Math.floor(leftTime / 1000 / 60 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 / 60 % 60) : Math.floor(leftTime / 1000 / 60 % 60) + '')[1]); | |||||
| $('#s0').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[0]); | |||||
| $('#s1').html(((Math.floor(leftTime / 1000 % 60) + '').length < 2 ? '0' + Math.floor(leftTime / 1000 % 60) : Math.floor(leftTime / 1000 % 60) + '')[1]); | |||||
| let d,h,m,s; | |||||
| d = Math.floor(leftTime / 1000 / 60 / 60 / 24); | |||||
| h = Math.floor(leftTime / 1000 / 60 / 60 % 24); | |||||
| m = Math.floor(leftTime / 1000 / 60 % 60); | |||||
| s = Math.floor(leftTime / 1000 % 60); | |||||
| if (d<1&&h<1&&m<1&&s<1){ | |||||
| console.log('竞价结束') | |||||
| clearInterval(module.data.setimer) | |||||
| } | |||||
| //tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); | |||||
| $('#countType').html('距竞价结束还有') | |||||
| } | |||||
| } | |||||
| //网站配置信息 | //网站配置信息 | ||||
| module.webConfigInformation = function (data) { | module.webConfigInformation = function (data) { | ||||
| if (data.code == 200) { | if (data.code == 200) { | ||||
| var content = data.data; | var content = data.data; | ||||
| console.log(content) | |||||
| //console.log(content) | |||||
| //document.getElementById('time').innerHTML = '延时周期:'+content[8].configValue+content[8].remark+'<i class="wh">?</i>' | //document.getElementById('time').innerHTML = '延时周期:'+content[8].configValue+content[8].remark+'<i class="wh">?</i>' | ||||
| module.data.timeConfig = content[8].configValue; | module.data.timeConfig = content[8].configValue; | ||||
| module.data.titleConfig = content[9].configValue; | module.data.titleConfig = content[9].configValue; | ||||
| @@ -260,36 +410,25 @@ define(['jquery', "template", "Tools", "biddingApi", "itemsApi"], function ($, t | |||||
| module.biddingDirectDictionaries = function (data) { | module.biddingDirectDictionaries = function (data) { | ||||
| if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') { | if (data.code == 200 && module.data.outProjectInformationDetail.biddingDirect!='') { | ||||
| var content = data.data; | var content = data.data; | ||||
| var biddingDirect = content[(module.data.outProjectInformationDetail.biddingDirect-1)].dictLabel; | |||||
| var biddingDirect = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingDirect;})[0].dictLabel; | |||||
| module.data.outProjectInformationDetail.biddingDirect = biddingDirect; | module.data.outProjectInformationDetail.biddingDirect = biddingDirect; | ||||
| var outProjectInformationData = template('outProjectInformationData', module.data); | |||||
| $("#outProjectInformationContent").html(outProjectInformationData); | |||||
| var outProjectInformationData2 = template('outProjectInformationData2', module.data); | |||||
| $("#outProjectInformationContent2").html(outProjectInformationData2); | |||||
| } | } | ||||
| } | } | ||||
| module.unitDictionaries = function (data) { | module.unitDictionaries = function (data) { | ||||
| if (data.code == 200) { | |||||
| if (data.code == 200 && module.data.outProjectInformationDetail.unit!='') { | |||||
| var content = data.data; | var content = data.data; | ||||
| var unit = content[(module.data.outProjectInformationDetail.unit-1)].dictLabel; | |||||
| var unit = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.unit;})[0].dictLabel; | |||||
| module.data.outProjectInformationDetail.unit = unit; | module.data.outProjectInformationDetail.unit = unit; | ||||
| var outProjectInformationData = template('outProjectInformationData', module.data); | |||||
| $("#outProjectInformationContent").html(outProjectInformationData); | |||||
| var outProjectInformationData2 = template('outProjectInformationData2', module.data); | |||||
| $("#outProjectInformationContent2").html(outProjectInformationData2); | |||||
| } | } | ||||
| } | } | ||||
| module.biddingTypeDictionaries = function (data) { | module.biddingTypeDictionaries = function (data) { | ||||
| if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') { | if (data.code == 200 && module.data.outProjectInformationDetail.biddingType!='') { | ||||
| var content = data.data; | var content = data.data; | ||||
| var biddingType = content[(module.data.outProjectInformationDetail.biddingType-1)].dictLabel; | |||||
| console.log(eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingType;})) | |||||
| var biddingType = eval(content).filter(function (e) { return e.dictValue == module.data.outProjectInformationDetail.biddingType;})[0].dictLabel; | |||||
| module.data.outProjectInformationDetail.biddingType = biddingType; | module.data.outProjectInformationDetail.biddingType = biddingType; | ||||
| var outProjectInformationData = template('outProjectInformationData', module.data); | |||||
| $("#outProjectInformationContent").html(outProjectInformationData); | |||||
| var outProjectInformationData2 = template('outProjectInformationData2', module.data); | |||||
| $("#outProjectInformationContent2").html(outProjectInformationData2); | |||||
| } | } | ||||
| } | } | ||||