Browse Source

修改倒计时错误的问题

zyh
Gaoxs 4 years ago
parent
commit
183f9fa4c3
  1. 22
      components/CountDown.vue
  2. 58
      pages/activity/DargainDetails/index.vue
  3. 16
      pages/activity/GroupRule/index.vue

22
components/CountDown.vue

@ -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)
},
},
}

58
pages/activity/DargainDetails/index.vue

@ -7,9 +7,9 @@
{{ bargainShare.lookCount }}人查看 {{ bargainShare.shareCount }}人分享 {{ bargainShare.userCount }}人参与
</view> -->
<!-- 帮助砍价帮砍成功-->
<view class="pictxt acea-row row-center-wrapper ">
<view class="pictxt acea-row row-center-wrapper">
<div class="bargain-header">
<view class="pictrue"><image :src="bargainUserInfo.avatar"/></view>
<view class="pictrue"><image :src="bargainUserInfo.avatar" /></view>
<view class="text">
{{ bargainUserInfo.nickname }}
<text>邀请您帮忙砍价</text>
@ -18,7 +18,7 @@
</view>
</view>
<view class="wrapper bargain-box time on">
<div class="pictxt ">
<div class="pictxt">
<count-down :isDay="true" :tipText="'倒计时 '" :dayText="' 天 '" :hourText="' 时 '" :minuteText="' 分 '" :secondText="' 秒'" :datatime="goodsDetail.stopTime"></count-down>
</div>
</view>
@ -92,14 +92,14 @@
</view>
<view class="bargainGang bargain-box">
<view class="title font-color-red acea-row row-center-wrapper">
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
<view class="titleCon">砍价帮</view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
</view>
<view class="list">
<view class="item acea-row row-between-wrapper" v-for="(item, bargainHelpListIndex) in bargainHelpList" :key="bargainHelpListIndex">
<view class="pictxt acea-row row-between-wrapper">
<view class="pictrue"><image :src="item.avatar"/></view>
<view class="pictrue"><image :src="item.avatar" /></view>
<view class="text">
<view class="name line1" v-text="item.nickname"></view>
<view class="line1" v-text="item.add_time"></view>
@ -116,18 +116,18 @@
</view>
<view class="goodsDetails bargain-box">
<view class="title font-color-red acea-row row-center-wrapper">
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
<view class="titleCon">商品详情</view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
</view>
<view class="conter" v-html="goodsDetail.description"></view>
<view class="lock"></view>
</view>
<view class="goodsDetails bargain-box">
<view class="title font-color-red acea-row row-center-wrapper">
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="pictrue"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
<view class="titleCon">活动规则</view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`"/></view>
<view class="pictrue on"><image :src="`${$VUE_APP_RESOURCES_URL}/images/left.png`" /></view>
</view>
<view class="conter" v-html="goodsDetail.rule"></view>
</view>
@ -163,7 +163,7 @@ export default {
CountDown,
},
props: {},
data: function() {
data: function () {
return {
bargainId: 0, //
bargainSumCount: 0, //
@ -190,12 +190,12 @@ export default {
}
},
computed: mapGetters(['userInfo', 'isLogin']),
mounted: function() {
mounted: function () {
this.mountedStart()
},
methods: {
//
mountedStart: function() {
mountedStart: function () {
var that = this
let url = handleQrCode()
// bargainId id
@ -213,8 +213,6 @@ export default {
// urluiduid
that.bargainUid = that.userInfo.uid
}
console.log(this)
//
that.getBargainDetail()
//
@ -236,7 +234,7 @@ export default {
this.getBargainHelpCount()
},
//
openAlone: function() {
openAlone: function () {
this.$yrouter.push({
path: '/pages/shop/GoodsCon/index',
query: {
@ -245,7 +243,7 @@ export default {
})
},
//
goPay: function() {
goPay: function () {
var data = {}
var that = this
data.productId = that.goodsDetail.productId
@ -271,7 +269,7 @@ export default {
})
},
//
goPoster: function() {
goPoster: function () {
var that = this
that.getBargainShare(that.bargainId)
this.$yrouter.push({
@ -283,7 +281,7 @@ export default {
})
},
//
goList: function() {
goList: function () {
this.$yrouter.push({
path: '/pages/activity/GoodsBargain/index',
})
@ -291,7 +289,7 @@ export default {
//
//bargainId 0
//bargainId
getBargainShare: function(bargainId) {
getBargainShare: function (bargainId) {
var that = this
getBargainShare({
bargainId: bargainId,
@ -300,7 +298,7 @@ export default {
})
},
//
getBargainDetail: function() {
getBargainDetail: function () {
var that = this
uni.showLoading({
title: '加载中',
@ -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 => {
@ -325,7 +323,7 @@ export default {
})
},
// -
getBargainStart: function() {
getBargainStart: function () {
var that = this
getBargainStart({
bargainId: that.bargainId,
@ -344,7 +342,7 @@ export default {
})
},
//
getBargainHelp: function() {
getBargainHelp: function () {
var that = this
if (this.bargainHelpCount.price === 0 && that.bargainUid !== that.userInfo.uid) {
return uni.showToast({
@ -382,7 +380,7 @@ export default {
})
},
//
getBargainHelpPrice: function() {
getBargainHelpPrice: function () {
var that = this
getBargainHelpPrice({
bargainId: that.bargainId,
@ -409,7 +407,7 @@ export default {
})
},
//
getBargainHelpList: function() {
getBargainHelpList: function () {
var that = this
if (that.helpListStatus === true) return
getBargainHelpList({
@ -440,7 +438,7 @@ export default {
})
},
//
getBargainHelpCount: function() {
getBargainHelpCount: function () {
getBargainHelpCount({
bargainId: this.bargainId,
bargainUserUid: this.bargainUid,
@ -515,7 +513,7 @@ export default {
},
//
//
getBargainStartUser: function() {
getBargainStartUser: function () {
var that = this
getBargainStartUser({
bargainId: that.bargainId,
@ -534,11 +532,11 @@ export default {
})
},
//
close: function() {
close: function () {
this.active = false
},
//
onShareAppMessage: function() {
onShareAppMessage: function () {
return {
title: this.storeInfo.title,
imageUrl: this.storeInfo.image,

16
pages/activity/GroupRule/index.vue

@ -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>
@ -17,7 +17,7 @@
</view>
<view class="tui-group__box tui-mtop__20">
<tui-divider backgroundColor="#fff" width="70%" gradual >
<tui-divider backgroundColor="#fff" width="70%" gradual>
<view class="tui-divider__content">
<text v-if="pinkBool == 0">进行中</text>
<text v-if="pinkBool == 1">拼团成功</text>
@ -55,8 +55,8 @@
<tui-button type="danger" height="88rpx" shadow shape="circle" v-if="userBool === 1 && isOk == 0 && pinkBool === 0" @click="goPoster">邀请好友参团</tui-button>
<tui-button type="warning" height="88rpx" shadow shape="circle" v-else-if="userBool === 0 && pinkBool === 0 && count > 0" @click="pay">我要参团</tui-button>
<tui-button type="danger" height="88rpx" shadow shape="circle" v-if="pinkBool === 1 || pinkBool === -1" @click="goDetail(storeCombination.id)">再次开团</tui-button>
<tui-button type="warning" height="88rpx" shadow shape="circle" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">取消开团</tui-button>
<tui-button type="danger" height="88rpx" shadow shape="circle" v-if="pinkBool === 1" @click="goOrder">查看订单信息</tui-button>
<tui-button type="warning" height="88rpx" shadow shape="circle" @click="getCombinationRemove" v-if="pinkBool === 0 && userBool === 1">取消开团</tui-button>
<tui-button type="danger" height="88rpx" shadow shape="circle" v-if="pinkBool === 1" @click="goOrder">查看订单信息</tui-button>
</view>
</view>
</view>
@ -418,10 +418,9 @@ export default {
}
.tui-btn__box {
padding-top: 60rpx;
}
.tni-cell{
.tni-cell {
height: 20rpx;
}
@ -498,9 +497,8 @@ export default {
.tui-between {
justify-content: space-between;
}
.tui-btn__box .tui-btn{
margin-bottom:30rpx !important
.tui-btn__box .tui-btn {
margin-bottom: 30rpx !important;
}
/*拼团玩法介绍 modal*/
.tui-modal__title {

Loading…
Cancel
Save