+
@@ -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 {