Commit 96dbc023 authored by youjie's avatar youjie

定时器

parent 7a494792
......@@ -128,6 +128,14 @@
if (options.OrderTypeStr) this.msg.OrderTypeStr = options.OrderTypeStr
if (options.OrderStatus) this.msg.OrderStatus = options.OrderStatus
},
beforeDestroy() {
// 清除所有定时器
clearInterval(null)
},
onHide() {
// 清除所有定时器
clearInterval(null)
},
onShow() {
this.research()
},
......
......@@ -61,7 +61,8 @@
:style="{'width':!item.remainingSeconds?'150rpx':'auto'}"
:class="[item.remainingSeconds?'active':'']"
@click.stop="submitGetCodeByOrderNo(item)">
立即支付 <text v-if="item.remainingSeconds" style="margin-left: 10rpx;"> 剩余:{{ formatTime(item.remainingSeconds) }}</text>
立即支付
<!--<text v-if="item.remainingSeconds" style="margin-left: 10rpx;"> 剩余:{{ formatTime(item.remainingSeconds) }}</text> -->
</view>
<view v-if="item.orderStatus!=1" style="margin-left: 10rpx;" class="jz_Zailai"
@click.stop="AnotherOrder(item)">再来一单</view>
......@@ -77,7 +78,8 @@
:style="{'width':!item.remainingSeconds?'150rpx':'auto'}"
:class="[item.remainingSeconds?'active':'']"
@click.stop="submitGetCodeByOrderNo(item)">
立即支付 <text v-if="item.remainingSeconds" style="margin-left: 10rpx;"> 剩余:{{ formatTime(item.remainingSeconds) }}</text>
立即支付
<!--<text v-if="item.remainingSeconds" style="margin-left: 10rpx;"> 剩余:{{ formatTime(item.remainingSeconds) }}</text>-->
</view>
<view v-else class="jz_Zailai" style="margin-left: 10rpx;" @click.stop="AnotherOrder(item)">
再来一单</view>
......@@ -151,9 +153,12 @@
},
beforeDestroy() {
// 清除所有定时器
Object.values(this.timers).forEach(timer => clearInterval(timer))
clearInterval(this.checkInterval)
// Object.values(this.timers).forEach(timer => clearInterval(timer))
// clearInterval(this.checkInterval)
},
onShow(){
},
mounted() {
this.b2b_user = uni.getStorageSync("b2b_user")
// 全局定时检查(防止极端情况下定时器失效)
......@@ -184,7 +189,7 @@
ConfirmID: "",
Amount: 0,
};
this.cancelOrder(cancelMsg)
this.cancelOrder(cancelMsg,1)
clearInterval(null)
this.timers[order.erpOrderId] = null
}
......@@ -212,7 +217,7 @@
ConfirmID: "",
Amount: 0,
};
this.cancelOrder(cancelMsg)
this.cancelOrder(cancelMsg,1)
}
})
},
......@@ -286,15 +291,17 @@
}
})
},
cancelOrder(postMsg) {
cancelOrder(postMsg,type) {
this.apipost(
"post_CancelThirdHotelOrder", postMsg,
(res) => {
if (res.resultCode == 1) {
uni.showToast({
title: "操作成功",
icon: "success",
});
if(!type){
uni.showToast({
title: "操作成功",
icon: "success",
});
}
this.$emit('research');
}
},
......
......@@ -775,7 +775,7 @@ export default {
flex-wrap: wrap;
text-align: center;
margin-left: 5px;
margin-right: 5px;
/* margin-right: 5px; */
}
.section > .item > .day > .day-list {
......
......@@ -56,7 +56,7 @@
<!-- #endif -->
</view>
<view style="flex: 1; margin-left: 30rpx; text-align: left" class="name-ali">
{{ dataList.name }}
{{ dataList.name?dataList.name:'' }}
</view>
</view>
<view class="hotel-content">
......@@ -70,7 +70,7 @@
style=""
:src="dataList.starRating==3?StarImgs[0]:dataList.starRating==4?StarImgs[1]:dataList.starRating==5?StarImgs[2]:StarImgs[3]" />
<!--<text v-else class="hotel-Economy">经济型</text>-->
{{ dataList.name }}
{{ dataList.name?dataList.name:'' }}
</view>
<view class="hotel-brand">
{{ dataList.brandname?dataList.brandname:'' }}
......@@ -109,14 +109,14 @@
<view class="row">
<view class="hotelTime column">
<text class="hotelTimeTop">入住</text>
<view>{{ formatMonthDay(startDay) }}
<view>{{ formatMonthDay(startDay)?formatMonthDay(startDay):'' }}
<text
style="font-weight: 100;color: #080A09;position: relative;top: -15rpx;left: 11rpx;">-</text>
</view>
</view>
<view class="hotelTime column" style="padding-left: 22rpx;">
<text class="hotelTimeTop">离开</text>
<view>{{ formatMonthDay(endDay) }}</view>
<view>{{ formatMonthDay(endDay)?formatMonthDay(endDay):'' }}</view>
</view>
</view>
<view class="hotelTimeEven column">
......
......@@ -323,6 +323,10 @@
beforeDestroy() {
this.clearInterval()
},
onHide() {
// 清除所有定时器
this.clearInterval()
},
created() {
this.Up = uni.getStorageSync("mall_UserInfo") ?
uni.getStorageSync("mall_UserInfo").UserPageType :
......@@ -536,6 +540,7 @@
this.orderData.directOrder.CreateTime = this.$utils.formatDates(new Date(tempData.directOrder.CreateTime), 'yyyy-MM-dd hh:mm:ss')
// 支付倒计时
console.log(tempData.directOrder.OrderStatus,'--------')
if (this.orderData.directOrder.CreateTime&&tempData.directOrder.OrderStatus==1) {
const now = Date.now();
// const customStr = '2025-05-12 14:33:47'
......
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