Commit 96dbc023 authored by youjie's avatar youjie

定时器

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