| @@ -21,7 +21,8 @@ | |||||
| <!-- </template>--> | <!-- </template>--> | ||||
| <!-- </van-swipe>--> | <!-- </van-swipe>--> | ||||
| <van-notice-bar color="#fff" background="#007E72" left-icon="clock-o"> | <van-notice-bar color="#fff" background="#007E72" left-icon="clock-o"> | ||||
| {{ process }}    <van-count-down ref="countDown" :time="time" format="DD 天 HH 时 mm 分 ss 秒" @change="timerChange" /> | |||||
| {{ process }}    {{timeData}} | |||||
| <!-- <van-count-down ref="countDown" :time="time" format="DD 天 HH 时 mm 分 ss 秒" @change="timerChange" />--> | |||||
| </van-notice-bar> | </van-notice-bar> | ||||
| <div class="information"> | <div class="information"> | ||||
| <van-row> | <van-row> | ||||
| @@ -293,7 +294,8 @@ export default { | |||||
| projectId:this.$route.query.id, | projectId:this.$route.query.id, | ||||
| pageSize:10, | pageSize:10, | ||||
| pageNum:1 | pageNum:1 | ||||
| } | |||||
| }, | |||||
| timeData:'', | |||||
| }; | }; | ||||
| }, | }, | ||||
| computed: { | computed: { | ||||
| @@ -460,7 +462,9 @@ export default { | |||||
| this.isFirst = r.signup.isFirst; | this.isFirst = r.signup.isFirst; | ||||
| this.getBidding(); | this.getBidding(); | ||||
| this.getTime(); | |||||
| this.timeCount = setInterval(()=>{ | |||||
| this.getTime() | |||||
| },1000) | |||||
| this.bottomBtn = true; | this.bottomBtn = true; | ||||
| }) | }) | ||||
| }) | }) | ||||
| @@ -482,13 +486,23 @@ export default { | |||||
| let signupStartTime = Date.parse(this.detail.signupStartTime)+0 | let signupStartTime = Date.parse(this.detail.signupStartTime)+0 | ||||
| let signupStopTime = Date.parse(this.detail.signupStopTime)+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")); | let nowDate = Date.parse(this.format($.ajax({async:false}).getResponseHeader("Date"), "yyyy-MM-dd HH:mm:ss")); | ||||
| let time = this.detail.delayPeriod * 1000; | |||||
| var difference = biddingStopTime-nowDate; | |||||
| let m = Math.floor(difference/1000/60%60); | |||||
| let s = Math.floor(difference/1000%60); | |||||
| if(signupStartTime>nowDate){ | if(signupStartTime>nowDate){ | ||||
| console.log('未开始') | console.log('未开始') | ||||
| this.process= "报名未开始" | this.process= "报名未开始" | ||||
| this.tip=this.detail.signupStartTime+"开始报名" | this.tip=this.detail.signupStartTime+"开始报名" | ||||
| this.btnMsg="立即报名" | this.btnMsg="立即报名" | ||||
| this.timeMsg="距报名开始" | this.timeMsg="距报名开始" | ||||
| this.time = signupStartTime-nowDate | |||||
| this.timeData = { | |||||
| days :signupStartTime-nowDate, | |||||
| hours :signupStartTime-nowDate, | |||||
| minutes :signupStartTime-nowDate, | |||||
| seconds :signupStartTime-nowDate, | |||||
| } | |||||
| this.isSignup=true | this.isSignup=true | ||||
| } | } | ||||
| if(signupStopTime>nowDate&&signupStopTime>signupStartTime){ | if(signupStopTime>nowDate&&signupStopTime>signupStartTime){ | ||||
| @@ -520,14 +534,13 @@ export default { | |||||
| } | } | ||||
| if(biddingStopTime>nowDate&&nowDate>biddingStartTime){ | if(biddingStopTime>nowDate&&nowDate>biddingStartTime){ | ||||
| console.log('竞价中') | console.log('竞价中') | ||||
| // console.log(biddingStopTime) | |||||
| // console.log(nowDate) | |||||
| // console.log(biddingStartTime) | |||||
| this.biddingTimeType = 1; | this.biddingTimeType = 1; | ||||
| this.process= "竞价中" | this.process= "竞价中" | ||||
| this.tip=this.detail.biddingStopTime+"结束竞价" | this.tip=this.detail.biddingStopTime+"结束竞价" | ||||
| this.timeMsg="距竞价结束" | this.timeMsg="距竞价结束" | ||||
| this.time = biddingStopTime-nowDate | |||||
| // this.time = biddingStopTime-nowDate | |||||
| this.timeData = this.TimeInterval(biddingStopTime-nowDate); | |||||
| console.log(this.timeData) | |||||
| if(this.getSignupData=="1"){ | if(this.getSignupData=="1"){ | ||||
| this.isSignup=true | this.isSignup=true | ||||
| this.btnMsg="立即竞价" | this.btnMsg="立即竞价" | ||||
| @@ -552,6 +565,47 @@ export default { | |||||
| this.biddingTimeType = 2; | this.biddingTimeType = 2; | ||||
| } | } | ||||
| // console.log(s+'---------------'+m) | |||||
| 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('aaa') | |||||
| // console.log((biddingStopTime-nowDate)) | |||||
| // console.log(time) | |||||
| // this.getTime(); | |||||
| if ((biddingStopTime-nowDate)<=time){ | |||||
| // console.log("竞价剩余两分钟"+"m:"+m+"s:"+s) | |||||
| getBiddingStopTime(this.id).then(response =>{ | |||||
| if(this.detail.biddingStopTime!=response.data){ | |||||
| console.log('有人出价') | |||||
| this.time = null; | |||||
| } | |||||
| this.detail.biddingStopTime = response.data | |||||
| this.$set(this.detail,'biddingStopTime',response.data); | |||||
| this.delayPeriodNow = true; | |||||
| // this.time = Date.parse(response.data)+0-nowDate; | |||||
| }); | |||||
| } | |||||
| } | |||||
| }, | }, | ||||
| getBidding(){ | getBidding(){ | ||||
| @@ -924,20 +978,21 @@ export default { | |||||
| } | } | ||||
| }, | }, | ||||
| 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; | |||||
| } | |||||
| }); | |||||
| } | |||||
| 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 + "天":'0天') + (hr?hr+ "时":'时') + ( min?min + "分":'0分') + ( sec?sec + "秒":'0秒'); | |||||
| }, | |||||
| }, | }, | ||||
| destroyed () { | destroyed () { | ||||
| console.log('bbbbbbbbbb') | console.log('bbbbbbbbbb') | ||||