Merge branch 'feature/task1.0.0-0507-zz' into feature/task1.0.0

merge-requests/37/head
张征 3 years ago
commit c2d4c8103d

@ -60,9 +60,9 @@
class="main__details-skill flex flex-right flex-middle" class="main__details-skill flex flex-right flex-middle"
> >
距结束仅剩 距结束仅剩
<span>{{ getSurplus.lefth }}</span> <span>{{ surplus.lefth }}</span>
<span>{{ getSurplus.leftm }}</span> <span>{{ surplus.leftm }}</span>
<span>{{ getSurplus.lefts }}</span> <span>{{ surplus.lefts }}</span>
</div> </div>
<div class="main__details-msg"> <div class="main__details-msg">
<div class="main__details-msg--price flex flex-middle"> <div class="main__details-msg--price flex flex-middle">
@ -83,9 +83,9 @@
> >
<span class="skill-txt">即将开始秒杀</span> <span class="skill-txt">即将开始秒杀</span>
<div class="skill-2" v-if="isToday()"> <div class="skill-2" v-if="isToday()">
<span>{{ getSurplus.lefth }}</span> <span>{{ surplus.lefth }}</span>
<span>{{ getSurplus.leftm }}</span> <span>{{ surplus.leftm }}</span>
<span>{{ getSurplus.lefts }}</span> <span>{{ surplus.lefts }}</span>
</div> </div>
<span class="skill-1" v-else>{{ getBeginTime() }}</span> <span class="skill-1" v-else>{{ getBeginTime() }}</span>
</div> </div>
@ -195,6 +195,9 @@ export default {
productActivityVO: {}, productActivityVO: {},
}, },
surplus: {}, surplus: {},
timer: null,
startTime: "",
endTime: "",
}; };
}, },
async created() { async created() {
@ -211,21 +214,21 @@ export default {
!vm.detailData.productActivityVO.isStartActivity && !vm.detailData.productActivityVO.isStartActivity &&
vm.isToday() vm.isToday()
) { ) {
let startTime = new Date( vm.startTime = new Date(
vm.detailData.productActivityVO.currentTime vm.detailData.productActivityVO.currentTime
).getTime(); ).getTime();
let endTime = new Date( vm.endTime = new Date(
vm.detailData.productActivityVO.activityStartTime vm.detailData.productActivityVO.activityStartTime
).getTime(); ).getTime();
vm.setSurplus(startTime, endTime); vm.setSurplus();
} else if (vm.detailData.productActivityVO.isStartActivity) { } else if (vm.detailData.productActivityVO.isStartActivity) {
let startTime = new Date( vm.startTime = new Date(
vm.detailData.productActivityVO.currentTime vm.detailData.productActivityVO.currentTime
).getTime(); ).getTime();
let endTime = new Date( vm.endTime = new Date(
vm.detailData.productActivityVO.activityEndTime vm.detailData.productActivityVO.activityEndTime
).getTime(); ).getTime();
vm.setSurplus(startTime, endTime); vm.setSurplus();
} }
}, },
computed: { computed: {
@ -276,15 +279,15 @@ export default {
leftObj["lefts"] = Math.floor((leftObj["lefttime"] / 1000) % 60); // leftObj["lefts"] = Math.floor((leftObj["lefttime"] / 1000) % 60); //
return leftObj; return leftObj;
}, },
setSurplus(startTime, endTime) { setSurplus() {
let vm = this; let vm = this;
vm.surplus = getSurplus(startTime, endTime); vm.surplus = vm.getSurplus(vm.startTime, vm.endTime);
if (vm.timer) { if (vm.timer) {
return false; return false;
} }
vm.timer = setInterval(() => { vm.timer = setInterval(() => {
vm.startTime += 1000; vm.startTime += 1000;
vm.surplus = getSurplus(vm.startTime, vm.endTime); vm.surplus = vm.getSurplus(vm.startTime, vm.endTime);
if (vm.surplus.lefttime <= 0) { if (vm.surplus.lefttime <= 0) {
clearInterval(vm.timer); clearInterval(vm.timer);
location.reload(); location.reload();
@ -542,9 +545,9 @@ export default {
&-msg { &-msg {
width: 714px; width: 714px;
height: 127px; min-height: 127px;
background: #f8f8f8; background: #f8f8f8;
padding: 30px 20px 0; padding: 30px 20px;
.msg-txt { .msg-txt {
font-size: 14px; font-size: 14px;
font-family: Microsoft YaHei-Regular, Microsoft YaHei; font-family: Microsoft YaHei-Regular, Microsoft YaHei;

Loading…
Cancel
Save