Commit 8d78ae70 authored by 刘用法's avatar 刘用法

工单cell倒计时结束变超时

parent 2c729a1a
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
<view class="bottom-view"> <view class="bottom-view">
<view> <view>
<view v-if="showCountTime" class="bottom-left-view"> <view v-if="showCountTime" class="bottom-left-view">
<view :class="['bottom-tag-view', {'will': orderData.currentWillOverTime}]">{{tagText}}</view> <view :class="['bottom-tag-view', {'timeout': timeout}]"><text>{{tagText}}</text></view>
<u-count-down :timestamp="orderData.currentWillOverTime || orderData.currentOverTime" font-size="44" <u-count-down :timestamp="timestamp" font-size="44"
color="#FF930D" @change="handleChange" ref="order-count-down"></u-count-down> :color="timeout ? '#FA5A49' : '#FF930D'" @change="handleChange" 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>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
orderStatus: 0, // 工单状态 orderStatus: 0, // 工单状态
appointmentDatetime: '', // 预约时间 appointmentDatetime: '', // 预约时间
currentWillOverTime: 10000, // 剩余时间 currentWillOverTime: 10000, // 剩余时间
currentOverTime: 0, // 超过时间 currentOverTime: new Date().getTime() + 10000, // 超过时间点
auditDatetime: '2021.04.19 12:45:09', // 审核时间 auditDatetime: '2021.04.19 12:45:09', // 审核时间
submissionTime: '2021.04.19 16:24:48', // 提交时间 submissionTime: '2021.04.19 16:24:48', // 提交时间
auditResults: {}, // 审核结果 auditResults: {}, // 审核结果
...@@ -97,7 +97,8 @@ ...@@ -97,7 +97,8 @@
}, },
data() { data() {
return { return {
timeout: false,
timestamp: 0,
}; };
}, },
computed: { computed: {
...@@ -204,8 +205,8 @@ ...@@ -204,8 +205,8 @@
return this.orderData.orderServiceType == '安装' return this.orderData.orderServiceType == '安装'
}, },
tagText() { tagText() {
return this.orderData.currentWillOverTime ? '剩' : '超' return this.timeout ? '超' : '剩'
}, },
timeText() { timeText() {
return this.orderType == 4 ? this.orderData.submissionTime : this.orderData.auditDatetime return this.orderType == 4 ? this.orderData.submissionTime : this.orderData.auditDatetime
}, },
...@@ -232,6 +233,10 @@ ...@@ -232,6 +233,10 @@
orderType() { orderType() {
return this.types[this.type] return this.types[this.type]
} }
},
created() {
this.timeout = this.orderData.currentOverTime < new Date().getTime()
this.timestamp = Math.round(Math.abs(this.orderData.currentOverTime - new Date().getTime()) / 1000)
}, },
methods: { methods: {
handleClick() { handleClick() {
...@@ -241,8 +246,15 @@ ...@@ -241,8 +246,15 @@
handleClickCell() { handleClickCell() {
this.$emit('click') this.$emit('click')
}, },
handleChange(timestamp) { handleChange(timestamp) {
if (this.orderData.currentOverTime) this.$refs['order-count-down'].seconds += 2 console.log(timestamp)
if (this.timeout) this.$refs['order-count-down'].seconds += 2
if (timestamp == 0 && !this.timeout) {
setTimeout(()=> {
this.timestamp = 1
this.timeout = true
}, 1000)
}
}, },
getDistance(Latitud, Longitud) { getDistance(Latitud, Longitud) {
return this.distance(Latitud, Longitud, this.location[0], this.location[1]) return this.distance(Latitud, Longitud, this.location[0], this.location[1])
...@@ -389,18 +401,19 @@ ...@@ -389,18 +401,19 @@
align-items: center; align-items: center;
.bottom-tag-view { .bottom-tag-view {
text-align: center;
width: 52rpx; width: 52rpx;
height: 52rpx; height: 52rpx;
border-radius: 26rpx; border-radius: 26rpx;
line-height: 56rpx;
color: #FFFFFF; color: #FFFFFF;
font-size: 26rpx; font-size: 26rpx;
background-color: #FA5A49; background-color: #FF930D;
margin-right: 20rpx; margin-right: 20rpx;
display: flex;
justify-content: center;
align-items: center;
&.will { &.timeout {
background-color: #FF930D; background-color: #FA5A49;
} }
} }
} }
......
...@@ -420,7 +420,7 @@ ...@@ -420,7 +420,7 @@
margin-right:-24rpx; margin-right:-24rpx;
.txt-item{ .txt-item{
border-radius: 12rpx; border-radius: 12rpx;
padding:24rpx 38rpx; padding:24rpx 24rpx;
width: 196rpx; width: 196rpx;
height: 72rpx; height: 72rpx;
text-align: center; text-align: center;
......
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