From 2424c2100a73714ffe248a8043768a1b62a0e544 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E4=B8=9C=E6=97=AD?= <850374051@qq.com> Date: Mon, 26 Jun 2023 09:45:32 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E6=9D=83=E4=BA=A4=E6=98=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/js/project/listingItems/items.js | 98 ++++++++++++++----------- 1 file changed, 56 insertions(+), 42 deletions(-) diff --git a/static/js/project/listingItems/items.js b/static/js/project/listingItems/items.js index 0584916..8fcac37 100644 --- a/static/js/project/listingItems/items.js +++ b/static/js/project/listingItems/items.js @@ -10,7 +10,7 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function showImgInformationDetail:'', loginNow:'', timer:null, - biddinglistInformationDetailLength:1, + biddinglistInformationDetailLength:-1, biddingTimeType:0, biddinglistInformationDetail:[] }, @@ -248,44 +248,7 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function if (data.code == 200) { var content = data.data; module.data.biddingStopTime = content.biddingStopTime; - //倒计时 - module.data.timer = setInterval(function(){ - - //挂牌项目竞价记录 - tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); - let signupStartTime = content.signupStartTime; - let signupStopTime = content.signupStopTime; - let biddingStartTime = content.biddingStartTime; - let biddingStopTime = module.data.biddingStopTime; - // '2023-05-17 14:56:00' - var nowTime = Date.parse(new Date()); - var difference = Date.parse(biddingStopTime)-nowTime; - var centerTime = 2 * 60 * 1000 - - if ( 0 < difference&&difference <= centerTime){ - console.log("竞价最后两分钟") - //正在竞价 - var m,s; - document.getElementById('biddingTitle').innerHTML = '竞价进行中...'; - document.getElementById('swiperType').style.display = 'block'; - m = Math.floor(difference/1000/60%60); - s = Math.floor(difference/1000%60); - $('#countType').html('竞价中') - $('#countDown').html('距竞价结束还有:00'+m+''+s+'秒') - //挂牌项目竞价记录 - tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformationNew,true); - - if(module.data.outProjectInformationDetail.biddingType != '公开竞价' && module.data.biddingTimeType != 2){ - document.getElementById('biddingTable').style.display = 'none'; - document.getElementById('biddingTitle').style.display = 'block'; - } - }else{ - module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime); - } - - - },1000) for(var i = 0 ; i < content.fileUrlList.length ; i++){ content.fileUrlList[i].fileUrl = serverApi+content.fileUrlList[i].fileUrl; } @@ -297,6 +260,7 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function },2000) $("#know").html(module.data.know); + //挂牌项目竞价记录 tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); @@ -335,7 +299,44 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function //期满处理字典 tools.doGet(Dictionaries+'/bidding_direct', {}, module.biddingDirectDictionaries,true); +//倒计时 + module.data.timer = setInterval(function(){ + + //挂牌项目竞价记录 + tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformation,true); + let signupStartTime = content.signupStartTime; + let signupStopTime = content.signupStopTime; + let biddingStartTime = content.biddingStartTime; + let biddingStopTime = module.data.biddingStopTime; + // '2023-05-17 14:56:00' + var nowTime = Date.parse(new Date()); + var difference = Date.parse(biddingStopTime)-nowTime; + var centerTime = 2 * 60 * 1000 + + if ( 0 < difference&&difference <= centerTime){ + console.log("竞价最后两分钟") + //正在竞价 + var m,s; + document.getElementById('biddingTitle').innerHTML = '竞价进行中...'; + document.getElementById('swiperType').style.display = 'block'; + m = Math.floor(difference/1000/60%60); + s = Math.floor(difference/1000%60); + $('#countType').html('竞价中') + $('#countDown').html('距竞价结束还有:00'+m+''+s+'秒') + //挂牌项目竞价记录 + tools.doGet(biddinglist, {projectId:getQueryVariable('id')}, module.biddinglistInformationNew,true); + + if(module.data.outProjectInformationDetail.biddingType != '公开竞价' && module.data.biddingTimeType != 2){ + document.getElementById('biddingTable').style.display = 'none'; + document.getElementById('biddingTitle').style.display = 'block'; + } + }else{ + module.dataCompare(signupStartTime,signupStopTime,biddingStartTime,biddingStopTime); + } + + + },1000) if(module.data.loginNow){ //判断是否报名 @@ -363,16 +364,28 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function //竞价记录 module.biddinglistInformation = function (data) { if (data.code == 200) { - console.log(data) var content = data.rows; if(module.data.biddinglistInformationDetailLength == content.length){ return; } + console.log(module.data.outProjectInformationDetail.biddingDirect) + setTimeout(function(){ + if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'||module.data.outProjectInformationDetail.biddingDirect == '2'){ + if (content.length>0){ + document.getElementById('money').value = parseInt(content[0].money) - parseInt(module.data.outProjectInformationDetail.ladderPrice); + }else{ + document.getElementById('money').value = parseInt(parseInt(module.data.outProjectInformationDetail.price) - parseInt(module.data.outProjectInformationDetail.ladderPrice)); + } + }else{ + + } + },2000) + module.data.biddinglistInformationDetail = content; module.data.biddinglistInformationDetailLength = content.length; var biddinglistInformationData = template('biddinglistInformationData', module.data); $("#tabDetail4").html(biddinglistInformationData); - $("#nowMoney").html(content[0].money); + if (content.length>0){$("#nowMoney").html(content[0].money);} } } @@ -686,7 +699,7 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function } }else{ if (module.data.biddinglistInformationDetail.length<1){ - if(module.data.outProjectInformationDetail.price>=$('#money').val()){ + if(module.data.outProjectInformationDetail.price>$('#money').val()){ tools.initError('出价不能低于挂牌价格'); return; } @@ -701,6 +714,7 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function $('#money').val() == null||$('#money').val() == ''?$('#money').val(0):''; console.log($('#money').val()) + module.data.outProjectInformationDetail.ladderPrice?$('#money').val(parseInt($('#money').val())+parseInt(module.data.outProjectInformationDetail.ladderPrice)):document.getElementById('money').value += 1 } @@ -709,7 +723,7 @@ define(['jquery', "template", "Tools", 'swiper', 'itemsApi', 'swiper'], function downMoney = function(){ if (module.data.outProjectInformationDetail.biddingDirect == '反向竞价'){ if (module.data.biddinglistInformationDetail.length<1){ - if(module.data.outProjectInformationDetail.price<=$('#money').val()){ + if(module.data.outProjectInformationDetail.price<$('#money').val()){ tools.initError('出价不能高于挂牌价格'); return; }