From 60b01b7affffebe2fcad66fe9aa421c9b9f7e565 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BA=9E=E4=B8=9C=E6=97=AD?= <850374051@qq.com> Date: Sat, 14 Oct 2023 22:17:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=A7=E6=9D=83=E4=BA=A4=E6=98=93=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.js | 2 +- src/views/project/projectDetail.vue | 347 +++++++++++++++------------- 2 files changed, 182 insertions(+), 167 deletions(-) diff --git a/src/main.js b/src/main.js index 5f251465..e926243e 100644 --- a/src/main.js +++ b/src/main.js @@ -26,7 +26,7 @@ import global from '@/utils/global'; import { getDicts ,getConfigKey } from "@/utils/data"; import { houseGetDicts } from '@/utils/data'; -import { selectDictLabel , selectDictScheme , onClickLeft , getNowFormatDate , format , isBankCard } from "@/utils/utils"; +import { selectDictLabel , selectDictScheme , onClickLeft , getNowFormatDate , format , isBankCard } from "@/utils/utils"; import vueEsign from 'vue-esign' Vue.use(vueEsign) diff --git a/src/views/project/projectDetail.vue b/src/views/project/projectDetail.vue index ca3383a3..44506250 100644 --- a/src/views/project/projectDetail.vue +++ b/src/views/project/projectDetail.vue @@ -21,18 +21,12 @@ - {{ process }}    {{tip}} + {{ process }}    
【{{ detail.rollout }}】{{ detail.projectName }} - - {{ process }} - - - - 挂牌价 {{detail.price}} {{detail.unit}} @@ -64,7 +58,7 @@ 竞价开始时间:{{ detail.biddingStartTime }} - 竞价截止时间:{{ detail.biddingStopTime }} + 竞价截止时间(含延期):{{ detail.biddingStopTime }} 竞价方式:{{ detail.biddingType }} @@ -198,7 +192,7 @@
-
+
@@ -257,6 +251,7 @@ projectNewBidMoney } from "../../api/project"; import {getInfo} from "../../api/login"; +import $ from "jquery"; export default { name: "projectDetail", @@ -277,7 +272,7 @@ export default { process:"", tip:"", btnMsg:"", - time:1000000000000000, + time:10000, timeMsg:"", isSignup:false, showBtn:false, @@ -289,7 +284,10 @@ export default { biddinglistInformationLength:0, biddingTimeType:2, isFirst:'', - timer:null + timer:null, + getSignupData:'', + bottomBtn:true, + nowDate:0 }; }, computed: { @@ -422,110 +420,9 @@ export default { }); } - this.getBidding(); - - let biddingStartTime = Date.parse(this.detail.biddingStartTime)+0 - let biddingStopTime = Date.parse(this.detail.biddingStopTime)+0 - let signupStartTime = Date.parse(this.detail.signupStartTime)+0 - let signupStopTime = Date.parse(this.detail.signupStopTime)+0 - let nowDate = Date.parse(new Date()); - - if(signupStartTime>nowDate){ - console.log('未开始') - this.process= "报名未开始" - this.tip=this.detail.signupStartTime+"开始报名" - this.btnMsg="立即报名" - this.timeMsg="距报名开始" - this.time = signupStartTime-nowDate - this.isSignup=true - } - if(signupStopTime>nowDate&&signupStopTime>signupStartTime){ - console.log('报名中') - this.process= "报名中" - this.tip=this.detail.signupStopTime+"报名截止" - this.btnMsg="立即报名" - this.timeMsg="距报名截止" - this.time = signupStopTime-nowDate - getInfo().then(response => { - let _this = this - getMember(response.user.userId).then(res => { - console.log(res) - let data= { - projectId:this.id, - memberId:res.data.id, - depositStatus:'1' - }; - getSignup(data).then(r =>{ - if(r.data=="1"){ - _this.isSignup=true - this.btnMsg="已报名" - } - }) - }) - }) - } - if(biddingStartTime>nowDate&&nowDate>signupStopTime){ - console.log('竞价未开始') - this.biddingTimeType = 3; - this.process= "竞价未开始" - this.tip=this.detail.biddingStartTime+"开始竞价" - this.timeMsg="距竞价开始" - this.time = biddingStartTime-nowDate - getInfo().then(response => { - let _this = this - getMember(response.user.userId).then(res => { - let data= { - projectId:this.id, - memberId:res.data.id, - depositStatus:'1' - }; - getSignup(data).then(r =>{ - if(r.data=="1"){ - _this.isSignup=true; - this.btnMsg="立即竞价" - // this.price=this.detail.ladderPrice?this.biddinglistInformation[0].money+this.detail.ladderPrice:this.biddinglistInformation[0].money+1 - }else{ - this.btnMsg="未报名" - } - }) - }) - }) - } - if(biddingStopTime>nowDate&&nowDate>biddingStartTime){ - this.biddingTimeType = 1; - this.process= "竞价中" - this.tip=this.detail.biddingStopTime+"结束竞价" - this.timeMsg="距竞价结束" - this.time = biddingStopTime-nowDate - getInfo().then(response => { - let _this = this - this.userId=response.user.userId - getMember(response.user.userId).then(res => { - this.userAccount=res.data.phone - this.userName=res.data.realname - this.memberId=res.data.id - let data= { - projectId:this.id, - memberId:res.data.id, - depositStatus:'1' - }; - getSignup(data).then(r =>{ - if(r.data=="1"){ - _this.isSignup=true - this.btnMsg="立即竞价" - this.showBtn=true - _this.isFirst = r.signup.isFirst; - // this.price=this.detail.ladderPrice?this.biddinglistInformation[0].money+this.detail.ladderPrice:this.biddinglistInformation[0].money+1 - }else{ - this.btnMsg="未报名" - _this.isSignup=true - } - }) - }) - }) - - var that = this; - this.timer = setInterval(function () { + var that = this; + this.timer = setInterval(function () { + if(that.process == "竞价中"){ getBiddingList(that.id).then(response =>{ that.biddinglistInformation = response.rows if((response.rows.length != that.biddinglistInformationLength) && that.detail.ladderPrice){ @@ -538,19 +435,32 @@ export default { } that.biddinglistInformationLength = response.total }); - },10000) - } - if(nowDate>biddingStopTime){ - console.log('竞价结束') - this.process= "竞价结束" - this.tip=this.detail.biddingStopTime+"结束竞价" - this.btnMsg="竞价结束" - this.timeMsg="竞价结束" - this.time = 0 - this.isSignup = true - this.showBtn=false - this.biddingTimeType = 2; - } + } + },3000) + + getInfo().then(response => { + this.userId=response.user.userId + getMember(response.user.userId).then(res => { + this.userAccount=res.data.phone + this.userName=res.data.realname + this.memberId=res.data.id + let data= { + projectId:this.id, + memberId:res.data.id, + depositStatus:'1' + }; + getSignup(data).then(r =>{ + this.getSignupData = r.data; + this.isFirst = r.signup.isFirst; + + this.getBidding(); + this.getTime(); + + }) + }) + }) + + }); getWebConfig().then(response =>{ this.timeConfig = response.data[8].configValue; @@ -561,7 +471,85 @@ export default { }) }); }, + getTime(){ + this.bottomBtn = true; + let biddingStartTime = Date.parse(this.detail.biddingStartTime)+0 + let biddingStopTime = Date.parse(this.detail.biddingStopTime)+0 + let signupStartTime = Date.parse(this.detail.signupStartTime)+0 + let signupStopTime = Date.parse(this.detail.signupStopTime)+0 + let nowDate = Date.parse(this.format($.ajax({async:false}).getResponseHeader("Date"), "yyyy-MM-dd HH:mm:ss")); + if(signupStartTime>nowDate){ + console.log('未开始') + this.process= "报名未开始" + this.tip=this.detail.signupStartTime+"开始报名" + this.btnMsg="立即报名" + this.timeMsg="距报名开始" + this.time = signupStartTime-nowDate + this.isSignup=true + } + if(signupStopTime>nowDate&&signupStopTime>signupStartTime){ + console.log('报名中') + this.process= "报名中" + this.tip=this.detail.signupStopTime+"报名截止" + this.btnMsg="立即报名" + this.timeMsg="距报名截止" + this.time = signupStopTime-nowDate + if(this.getSignupData=="1"){ + this.isSignup=true + this.btnMsg="已报名" + } + } + if(biddingStartTime>nowDate&&nowDate>signupStopTime){ + console.log('竞价未开始') + this.biddingTimeType = 3; + this.process= "竞价未开始" + this.tip=this.detail.biddingStartTime+"开始竞价" + this.timeMsg="距竞价开始" + this.time = biddingStartTime-nowDate + if(this.getSignupData=="1"){ + this.isSignup=true; + this.btnMsg="立即竞价" + // this.price=this.detail.ladderPrice?this.biddinglistInformation[0].money+this.detail.ladderPrice:this.biddinglistInformation[0].money+1 + }else{ + this.btnMsg="未报名" + } + } + if(biddingStopTime>nowDate&&nowDate>biddingStartTime){ + console.log('竞价中') + // console.log(biddingStopTime) + // console.log(nowDate) + // console.log(biddingStartTime) + this.biddingTimeType = 1; + this.process= "竞价中" + this.tip=this.detail.biddingStopTime+"结束竞价" + this.timeMsg="距竞价结束" + this.time = biddingStopTime-nowDate + if(this.getSignupData=="1"){ + this.isSignup=true + this.btnMsg="立即竞价" + this.showBtn=true + // this.price=this.detail.ladderPrice?this.biddinglistInformation[0].money+this.detail.ladderPrice:this.biddinglistInformation[0].money+1 + }else{ + this.btnMsg="未报名" + this.isSignup=true + } + + } + if(nowDate>biddingStopTime){ + console.log('竞价结束') + this.process= "竞价结束" + this.tip=this.detail.biddingStopTime+"结束竞价" + this.btnMsg="竞价结束" + this.timeMsg="竞价结束" + this.time = 0 + this.isSignup = true + this.showBtn=false + this.biddingTimeType = 2; + } + + + }, getBidding(){ var that = this; getBiddingList(that.id).then(response =>{ @@ -593,7 +581,6 @@ export default { }, offerFirst(){ - clearInterval(this.timer); let newMoney; projectNewBidMoney(this.id).then(response =>{ if (response.data&&response.code==200){ @@ -618,7 +605,17 @@ export default { message: '出价成功', duration:"1000", onClose:function(){ + clearInterval(this.timer); // _this.reload() + _this.getBidding(); + if (_this.detail.delayPeriod != 0){ + _this.time = null; + } + if (_this.detail.biddingType=='自由竞价'||_this.detail.biddingType=='公开竞价'){ + _this.price = null; + }else{ + _this.price = _this.price-_this.detail.ladderPrice; + } } }) @@ -727,7 +724,9 @@ export default { clearInterval(this.timer); // _this.reload() _this.getBidding(); - _this.time = null; + if (_this.detail.delayPeriod != 0){ + _this.time = null; + } if (_this.detail.biddingType=='自由竞价'||_this.detail.biddingType=='公开竞价'){ _this.price = null; }else{ @@ -875,52 +874,62 @@ export default { let h = value.hours; let m = value.minutes; let s = value.seconds; - + console.log('aaa') let biddingStopTime = Date.parse(this.detail.biddingStopTime)+0 - let nowDate = Date.parse(new Date()); + let nowDate = Date.parse(this.format($.ajax({async:false}).getResponseHeader("Date"), "yyyy-MM-dd HH:mm:ss")); let time = this.detail.delayPeriod * 1000; - console.log((biddingStopTime-nowDate)) - console.log(time) - if ((biddingStopTime-nowDate)<=time){ - console.log("竞价剩余两分钟"+"m:"+m+"s:"+s) + if (s < 1 && m < 1){ + console.log("竞价结束22222222222") + getBiddingStopTime(this.id).then(response => { + this.$set(this.detail,'biddingStopTime',response.data) + let timeNew = Date.parse(response.data) + 0 - nowDate; + if (timeNew > 0) { + this.$set(this.detail,'biddingStopTime',response.data) + this.getTime(); + } else { + this.process = "竞价结束" + this.tip = this.detail.biddingStopTime + "结束竞价" + this.btnMsg = "竞价结束" + this.timeMsg = "竞价结束" + this.time = 0 + this.isSignup = true + this.showBtn = false + this.biddingTimeType = 2; + return; + } + }); + }else if (s%2 == 0&&time!=0){ + + // console.log((biddingStopTime-nowDate)) + // console.log(time) + // this.getTime(); + if ((biddingStopTime-nowDate)<=time){ + // console.log("竞价剩余两分钟"+"m:"+m+"s:"+s) + getBiddingStopTime(this.id).then(response =>{ + // this.detail.biddingStopTime = response.data + this.$set(this.detail,'biddingStopTime',response.data) + // this.time = Date.parse(response.data)+0-nowDate; + }); + } + } - if (m == 0 && s==0){ + }, + finishTimer(){ + console.log('结束进入11111111111') + getBiddingStopTime(this.id).then(response =>{ + this.$set(this.detail,'biddingStopTime',response.data) + // this.time = Date.parse(response.data)+0-nowDate; + console.log(this.time) + if (this.time <= 1000){ console.log("竞价结束22222222222") + this.bottomBtn= false this.reload(); return; } - getBiddingList(this.id).then(response =>{ - this.biddinglistInformation = response.rows - if (response.rows.length>this.biddinglistInformationLength){ - console.log("有人出价") - this.biddinglistInformationLength = response.rows.length; - getBiddingStopTime(this.id).then(response =>{ - this.detail.biddingStopTime = response.data - this.time = time; - }); - } - - }); - - } + }); } }, - timeInterval(timestamp) { - //时间戳转化为天时分秒 - // 总秒数 - var second = Math.floor(timestamp / 1000); - // 天数 - var day = Math.floor(second / 3600 / 24); - // 小时 - var hr = Math.floor(second / 3600 % 24); - // 分钟 - var min = Math.floor(second / 60 % 60); - // 秒 - var sec = Math.floor(second % 60); - return (day?day + "天":'') + (hr?hr+ "小时":'') + ( min?min + "分钟":'') + sec + "秒"; - - }, destroyed () { console.log('bbbbbbbbbb') clearInterval(this.timer); @@ -940,6 +949,11 @@ export default {