Commit ef8c1142 authored by 刘用法's avatar 刘用法

超时控件

parent 1acc779b
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<view v-if="showCountTime" class="bottom-left-view"> <view v-if="showCountTime" class="bottom-left-view">
<view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view> <view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view>
<u-count-down :timestamp="timestamp" font-size="40" show-days separator="zh" <u-count-down :timestamp="timestamp" font-size="40" show-days separator="zh"
:color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange" ref="order-count-down"></u-count-down> :color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange"separator-color="#333333" ref="order-count-down"></u-count-down>
</view> </view>
<view v-else-if="showTime"> <view v-else-if="showTime">
<text>{{timeTitle}}</text> <text>{{timeTitle}}</text>
...@@ -408,7 +408,7 @@ ...@@ -408,7 +408,7 @@
color: #FFFFFF; color: #FFFFFF;
font-size: 26rpx; font-size: 26rpx;
background-color: #FF930D; background-color: #FF930D;
margin-right: 20rpx; margin-right: 16rpx;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
...@@ -118,8 +118,8 @@ ...@@ -118,8 +118,8 @@
</view> </view>
<view v-if="showCenterBtn" @click="handleBtn" class="button" :class="['center-button-view', btnClass]"> <view v-if="showCenterBtn" @click="handleBtn" class="button" :class="['center-button-view', btnClass]">
<text>{{ centerButtonText }}</text> <text>{{ centerButtonText }}</text>
<view v-if="order.currentOverTime > 0" class="time-view"> <view v-if="order.currentOverTime" class="time-view">
<text style="margin-right: 8rpx;">{{order.currentOverTime * 1000 > new Date().getTime()?'剩':'超'}}</text> <text>{{order.currentOverTime > new Date().getTime()?'剩':'超'}}</text>
<u-count-down <u-count-down
:timestamp="timestampDiff(order.currentOverTime)" :timestamp="timestampDiff(order.currentOverTime)"
font-size="20" font-size="20"
...@@ -128,7 +128,6 @@ ...@@ -128,7 +128,6 @@
separator-color="#FFFFFF" separator-color="#FFFFFF"
separator-size="20" separator-size="20"
:ref="'uCountDown'" :ref="'uCountDown'"
height="20"
:show-days="threeDays()" :show-days="threeDays()"
:show-minutes="!threeDays()" :show-minutes="!threeDays()"
:show-seconds="!threeDays()" :show-seconds="!threeDays()"
...@@ -614,13 +613,7 @@ ...@@ -614,13 +613,7 @@
if(!currentOverTime){ if(!currentOverTime){
return 0 return 0
} }
var nowTime = new Date(); // 当前时间 return Math.round(Math.abs(currentOverTime - new Date().getTime()) / 1000)
if(nowTime.getTime() > currentOverTime*1000){
var diff = nowTime.getTime() - (currentOverTime*1000);
}else{
var diff = (currentOverTime*1000) - nowTime.getTime();
}
return diff;
}, },
timeOutChange(currentOverTime){ timeOutChange(currentOverTime){
let self = this let self = this
...@@ -638,7 +631,7 @@ ...@@ -638,7 +631,7 @@
}) })
}, },
threeDays() { threeDays() {
return this.timestampDiff(order.currentOverTime) > 3600 * 24 * 3 return this.timestampDiff(this.order.currentOverTime) > 3600 * 24 * 3
} }
} }
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment