修改倒计时错误的问题

This commit is contained in:
Gaoxs
2021-05-15 01:34:25 +08:00
parent 3b76e7754b
commit 183f9fa4c3
3 changed files with 50 additions and 46 deletions

View File

@ -54,28 +54,36 @@ export default {
created: function () {
this.show_time()
},
watch: {
datatime(val) {
clearInterval(this.timeInterval)
this.time = val
this.show_time()
},
},
mounted: function () {},
methods: {
show_time: function () {
let that = this
if (parseInt(this.datatime).length == 13) {
if (parseInt(this.time).length == 13) {
// 毫秒级
console.log('毫秒')
this.datatime = this.datatime / 1000
} else if (parseInt(this.datatime).length == 10) {
this.time = this.time / 1000
} else if (parseInt(this.time).length == 10) {
console.log('秒')
// 秒级
} else {
// 时间
console.log('时间')
this.datatime = Date.parse(this.datatime) / 1000
console.log(this.time)
this.time = Date.parse(this.time) / 1000
}
console.log(that.time)
function runTime() {
console.log(that.datatime)
//时间函数
let intDiff = that.datatime - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差;
let intDiff = that.time - Date.parse(new Date()) / 1000 //获取数据中的时间戳的时间差;
let day = 0,
hour = 0,
minute = 0,
@ -105,7 +113,7 @@ export default {
}
}
runTime()
setInterval(runTime, 1000)
this.timeInterval = setInterval(runTime, 1000)
},
},
}

View File

@ -213,8 +213,6 @@ export default {
// url未携带用户uid填上登录用户uid跳转
that.bargainUid = that.userInfo.uid
}
console.log(this)
// 获取商品详情
that.getBargainDetail()
// 砍价数据统计
@ -310,9 +308,9 @@ export default {
.then(res => {
uni.hideLoading()
that.goodsDetail = res.data.bargain
console.log(that.goodsDetail)
that.goodsDetail.description = that.goodsDetail.description.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
that.goodsDetail.rule = that.goodsDetail.rule.replace(/\<img/gi, '<img style="max-width:100%;height:auto;"')
that.goodsDetail.stopTime = that.goodsDetail.stopTime / 1000
that.getBargainHelpCount()
})
.catch(res => {

View File

@ -1,6 +1,6 @@
<template>
<view class="group-con">
<view class="tui-goods-item">
<view class="tui-goods-item" v-if="storeCombination">
<image :src="storeCombination.image" class="tui-goods-img"></image>
<view class="tui-goods-center">
<view class="tui-goods-name">{{ storeCombination.title }}</view>
@ -418,7 +418,6 @@ export default {
}
.tui-btn__box {
padding-top: 60rpx;
}
.tni-cell {
@ -499,8 +498,7 @@ export default {
justify-content: space-between;
}
.tui-btn__box .tui-btn {
margin-bottom:30rpx !important
margin-bottom: 30rpx !important;
}
/*拼团玩法介绍 modal*/
.tui-modal__title {