浏览代码

场地选择弹窗

学习?学个屁 1 天之前
父节点
当前提交
cc964a11a4

+ 12 - 2
src/pages/index/courseDetail/index.vue

@@ -156,7 +156,7 @@
 
 <script lang="ts" setup>
 import { ref, onMounted, getCurrentInstance, nextTick } from 'vue';
-import { RouterUtils, _previewImage } from '@/utils/util';
+import { RouterUtils, _previewImage, TipsUtils } from '@/utils/util';
 import { http } from '@/utils/http'
 import zzxNavbar from '@/components/zzx-navbar/zzx-navbar.vue';
 import { onLoad, onPageScroll } from '@dcloudio/uni-app';
@@ -260,7 +260,17 @@ const scrollToTop = () => {
 }
 
 const toOrderPage = (buyType: number) => {
-	RouterUtils.to_page(`/pages/index/gymPay/index?courseId=${courseId.value}&type=${type.value}&orderType=2&buyType=${buyType}`)
+	uni.requestSubscribeMessage({
+		tmplIds: ['Yi1Z1IKRwgF6-mpiFcOUTvavc4TUAsfsLynK_3Yu350','NPlIBEwBDPX23J3Jip0CwYUU4vF9ZlcK8U1d6Gs4yrM'],
+		success(res) {
+			TipsUtils.tips_toast('订阅成功')
+			RouterUtils.to_page(`/pages/index/gymPay/index?courseId=${courseId.value}&type=${type.value}&orderType=2&buyType=${buyType}`)
+		},
+		fail(err) {
+			RouterUtils.to_page(`/pages/index/gymPay/index?courseId=${courseId.value}&type=${type.value}&orderType=2&buyType=${buyType}`)
+			console.log(err, '订阅消息失败')
+		}
+	})
 }
 
 // 获取评价

+ 16 - 8
src/pages/index/gymDetail/components/popup.vue

@@ -85,11 +85,13 @@
 				<view class="p-price-card">
 					<view class="p-price">
 						<view class="text">商品总价(共{{ previewgymOrderDetail.timePeriod.length }}场)</view>
-						<view class="price"><text class="mini-text">¥</text>{{ previewgymOrderDetail.subtotal.toFixed(2) }}</view>
+						<view class="price"><text class="mini-text">¥</text>{{ previewgymOrderDetail.subtotal.toFixed(2)
+							}}</view>
 					</view>
 					<view class="p-subtotal">
 						<text>小计</text>
-						<view class="total-price"><text class="mini-text">¥</text>{{ previewgymOrderDetail.totalPrice.toFixed(2) }}
+						<view class="total-price"><text class="mini-text">¥</text>{{
+							previewgymOrderDetail.totalPrice.toFixed(2) }}
 						</view>
 					</view>
 				</view>
@@ -117,7 +119,8 @@
 				<view style="height: 200rpx;"></view>
 				<view class="footer-pay">
 					<button hover-class="hover-style" @click="submitOrder">
-						<view class="btn-price"><text class="mini-text">¥</text>{{ previewgymOrderDetail.totalPrice.toFixed(2) }}
+						<view class="btn-price"><text class="mini-text">¥</text>{{
+							previewgymOrderDetail.totalPrice.toFixed(2) }}
 						</view>
 						<view class="btn-text">立即支付</view>
 					</button>
@@ -128,7 +131,7 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, onMounted, computed,watch } from 'vue';
+import { ref, onMounted, computed, watch,getCurrentInstance } from 'vue';
 import { http } from '@/utils/http'
 import { TipsUtils, phoneHide, RouterUtils } from '@/utils/util';
 interface Props {
@@ -145,6 +148,7 @@ const props = withDefaults(defineProps<Props>(), {
 });
 const selectPopup = ref();
 const orderPopup = ref();
+const that=getCurrentInstance()
 onMounted(() => {
 })
 const emit = defineEmits(['change']);
@@ -173,6 +177,8 @@ watch(
 
 const open = () => {
 	// 打开弹窗时赋值默认日期,优先根据deteSelIndex
+	that.$refs.selectPopup.open();
+	// selectPopup.value.open();
 	if (
 		props.listData &&
 		Array.isArray(props.listData.stadiumConcertsVOList) &&
@@ -186,20 +192,22 @@ const open = () => {
 	} else {
 		weekDayDate.value = '';
 	}
-	selectPopup.value.open();
 }
 defineExpose({
 	open
 })
-const weekDayDate=ref();
+const weekDayDate = ref();
 const sel_tab = (e, i) => {
 	emit('change', e, i);
-	weekDayDate.value=e.weekDayDate
+	weekDayDate.value = e.weekDayDate
 }
 
 const selArr = ref([])
 const selectItem = (item1, item2) => {
+	console.log(props.listData, '场次选择');
 	const existingIndex = selArr.value.findIndex(item => item.id === item2.id);
+	if (selArr.value.length >= props.listData.buyLimit) return TipsUtils.tips_toast(`最多选择${props.listData.buyLimit}个场次`)
+
 	if (existingIndex !== -1) {
 		selArr.value.splice(existingIndex, 1);
 	} else {
@@ -253,7 +261,7 @@ const get_previewOrderPlaceGymnasiumChartered = () => {
 		setTimeout(() => {
 			selectPopup.value.close()
 			orderPopup.value && orderPopup.value.open();
-		},500)
+		}, 500)
 	})
 }
 // 提交订单

+ 8 - 6
src/pages/index/gymDetail/index.vue

@@ -62,7 +62,7 @@
 			</view>
 		</view>
 	</view>
-	<view class="content">
+	<view class="content"  v-if="charteredList">
 		<uv-sticky offset-top="74">
 			<view class="detail-select">
 				<view :class="sel_index === index ? 'select-text' : 'notsel-text'" v-for="(item, index) in selectList"
@@ -92,7 +92,7 @@
 							v-for="(item, index) in allCategoryList" :key="item.id"
 							@click="selectChartered(item, index)">{{ item.name }}</view>
 					</view>
-					<view class="info-card-list" v-if="charteredList">
+					<view class="info-card-list">
 						<scroll-view scroll-x="true" class="scroll-view_H">
 							<view class="item-card scroll-view-item_H" v-for="(item, index) in charteredList.timeSlot"
 								:key="item.id" @click="open_popup(item, index)">
@@ -274,7 +274,6 @@ import loading from '@/components/zzx-loading/zzx-loading.vue';
 import selPopup from './components/popup.vue';
 import { useCacheStore } from '@/stores/cache'
 const cache = useCacheStore()
-const openPopup = ref(null);
 const placeInfoPopup = ref()
 const statusBarHeight = ref(0);
 const sectionTops = ref<number[]>([]);
@@ -309,12 +308,14 @@ const get_navheight = () => {
 // 打开选场弹窗
 const dateIndex = ref()
 const selIndex = ref()
+const openPopup = ref(null);
 const open_popup = (e, i) => {
-	console.log(e);
 	selIndex.value = i
 	dateIndex.value = e
 	get_placeInfoDetail(categoryId.value, i)
+	console.log(openPopup.value, 'openPopup');
 	openPopup.value?.open()
+
 }
 
 // 获取所有模块的位置信息
@@ -460,7 +461,7 @@ const selectallCategory = (e, i) => {
 // 包场切换
 const selChartered = ref(0)
 const selectChartered = (e, i) => {
-	console.log(e, i,'包场切换');
+	console.log(e, i, '包场切换');
 	categoryId.value = e.id
 	selChartered.value = i
 	get_placeInfoNoFixation(e.id)
@@ -494,7 +495,7 @@ const serveTips = (e) => {
 
 const placedata = ref()
 const selItems = ref()
-const get_placeInfoDetail = (catId:any, dateIndex:any) => {
+const get_placeInfoDetail = (catId: any, dateIndex: any) => {
 	http.get('/stadium/getPlaceInfo', { data: { siteId: listId.value, categoryId: catId } }).then((res) => {
 		placedata.value = res.result
 		selItems.value = res.result.stadiumConcertsVOList[dateIndex].concertsVOList
@@ -1009,6 +1010,7 @@ const getFindByOrderPage = () => {
 			height: 220rpx;
 			border-bottom: 1rpx solid #F0F0F0;
 			padding-bottom: 10rpx;
+
 			.info-title {
 				display: flex;
 				align-items: center;

+ 14 - 2
src/pages/index/submitOrder/index.vue

@@ -28,7 +28,7 @@
 						v-for="(item, index) in timeList.timeSlot" @click="check_item(item, index)">
 						<view class="time">{{ item.name }}</view>
 						<view class="allowance">余{{ item.inventory }}</view>
-						<view class="price">¥{{ item.price||'0.00' }}</view>
+						<view class="price">¥{{ item.price || '0.00' }}</view>
 					</view>
 				</scroll-view>
 				<view class="not-data" v-if="timeList.timeSlot.length < 1">暂无可选时段</view>
@@ -278,6 +278,7 @@ const deleteUser = async (e) => {
 }
 
 let orderFormData = ref({
+	amount: 1,
 	type: 0,
 	orderType: 0,
 	productIds: null,
@@ -291,12 +292,23 @@ let orderFormData = ref({
 	}
 })
 const submitBooking = () => {
+	if(userData.vlaue<1) return TipsUtils.tips_toast('请添加成员')
 	let data = { ...orderFormData.value };
 	if (!insureData.value || insureData.value.length === 0) {
 		delete data.insureOrderInfoForm;
 	}
 	http.post('/order/createOrder', data, { loading: true }).then((res) => {
-		RouterUtils.to_page(`/pages/index/toBeUsed/index?orderId=${res.result.orderId}&orderType=${orderFormData.value.orderType}`)
+		uni.requestSubscribeMessage({
+			tmplIds: ['WSJjc9I24ijtr3EyNVXjEvTQm0gIECW9ABYVFcegOwM'],
+			success(su) {
+				TipsUtils.tips_toast('订阅成功')
+				RouterUtils.to_page(`/pages/index/toBeUsed/index?orderId=${res.result.orderId}&orderType=${orderFormData.value.orderType}`)
+			},
+			fail(err) {
+				RouterUtils.to_page(`/pages/index/toBeUsed/index?orderId=${res.result.orderId}&orderType=${orderFormData.value.orderType}`)
+				console.log(err, '订阅消息失败')
+			}
+		})
 	})
 }
 </script>

+ 110 - 9
src/pages/index/toBeUsed/index.vue

@@ -1,12 +1,20 @@
 <!-- 订单类型orderType:0-学校 1-包场 2-无固定场 3-个人赛 4-团队赛 5-课程 -->
 <template>
 	<view class="content" v-if="!loading">
-		<view class="t-header">
+		<view class="t-order-timer" v-if="orderDetailInfo?.orderStatus == '待付款'">
+			<view class="timer-text">请在<text style="color: #FB5B5B;">{{ downTime }}</text>内支付</view>
+			<view class="timer-btn">
+				<view class="cancel-btn" @click="cancelOrder(orderDetailInfo?.id)">取消订单</view>
+				<view class="pay-btn">立即支付¥119</view>
+			</view>
+		</view>
+		<view class="t-header" v-else>
 			<view class="title">{{ orderDetailInfo?.orderStatus }}</view>
 			<view style="display: flex;gap: 10rpx;">
 				<view class="time" v-for="item in orderDetailInfo?.proInfoList" :key="item.id">
-					<text style="color: #FB5B5B;" v-if="item.type!=7">{{ item.userName }}</text>
-					<text v-if="orderDetailInfo?.orderStatus&&item.type!=7">{{ orderDetailInfo?.orderStatus + ';' }}</text>
+					<text style="color: #FB5B5B;" v-if="item.type != 7">{{ item.userName }}</text>
+					<text v-if="orderDetailInfo?.orderStatus && item.type != 7">{{ orderDetailInfo?.orderStatus + ';'
+					}}</text>
 					<!-- <text v-if="orderDetailInfo?.orderStatus == '待使用'">,请按课表到上课地点按时上课。</text> -->
 				</view>
 			</view>
@@ -29,7 +37,7 @@
 				<view class="text">场次</view>
 				<view class="">
 					<view class="time-box" v-for="item in orderDetailInfo?.proInfoList" :key="item.id">
-						<view class="time">{{ item.useDateStr }} {{ item.frameTimeStr }} {{ item.productName }}</view>
+						<view class="time" v-if="item.type!=7">{{ item.useDateStr }} {{ item.frameTimeStr }} {{ item.productName }}</view>
 						<view class="status" v-if="orderPageInfo?.orderType == 1">已退款</view>
 					</view>
 				</view>
@@ -49,7 +57,8 @@
 				</view>
 			</view>
 			<view class="t-shoping-info">
-				<image class="shoping-img" :src="orderDetailInfo?.appCourses?.cover||orderDetailInfo?.proInfoList[0].productImage" mode="">
+				<image class="shoping-img"
+					:src="orderDetailInfo?.appCourses?.cover || orderDetailInfo?.proInfoList[0].productImage" mode="">
 				</image>
 				<view class="shoping-info">
 					<view class="name">{{ orderDetailInfo?.appCourses?.name ||
@@ -108,8 +117,8 @@
 						orderDetailInfo?.appCourses?.endTime || orderDetailInfo?.endTime }} 到期</view>
 				</view>
 				<view class="order-num" v-for="item in orderDetailInfo?.proInfoList" :key="item.id">
-					<text v-if="item.type!=7">{{ item.ticketNo }}&nbsp;&nbsp; {{ item.userName }}</text>
-					<zzx-icon v-if="item.type!=7" name="ashRight" size="12"></zzx-icon>
+					<text v-if="item.type != 7">{{ item.ticketNo }}&nbsp;&nbsp; {{ item.userName }}</text>
+					<zzx-icon v-if="item.type != 7" name="ashRight" size="12"></zzx-icon>
 				</view>
 			</view>
 		</view>
@@ -277,7 +286,8 @@
 			<view class="morefeatures-btn">查看成绩</view>
 		</view>
 		<!-- 已使用展示 -->
-		<view class="appraise-btn" v-if="orderPageInfo?.orderType!=3" @click="RouterUtils.to_page(`/pages/index/writeComments/index?siteId=${orderDetailInfo?.addressSiteId}&orderId=${orderDetailInfo?.id}`)">
+		<view class="appraise-btn" v-if="orderPageInfo?.orderType != 3"
+			@click="RouterUtils.to_page(`/pages/index/writeComments/index?siteId=${orderDetailInfo?.addressSiteId}&orderId=${orderDetailInfo?.id}`)">
 			写评价
 		</view>
 	</view>
@@ -455,8 +465,14 @@ const open_phone = () => {
 const orderDetailInfo = ref()
 const loading = ref(true)
 const gameCertificationList = ref({})
+const downTime = ref(null)
+const createTime = ref(null)
 const getOrderDetailInfo = (() => {
 	http.get('/order/queryOrderInfo', { data: { orderId: orderPageInfo.value.orderId }, loading: true }).then((res) => {
+		if (res.result.orderStatus == 0) {
+			createTime.value = new Date(res.result.createTime);
+			downTimeFun(); // 在获取到待付款订单信息时启动倒计时
+		}
 		switch (res.result.orderStatus) {
 			case 0:
 				res.result.orderStatus = '待付款'
@@ -483,12 +499,56 @@ const getOrderDetailInfo = (() => {
 		}
 		orderDetailInfo.value = res.result
 		gameCertificationList.value = JSON.parse(res.result.gameCertification || '{}')
-		console.log(gameCertificationList.value, '图片');
 		loading.value = false
 		getQueryWaitSignList(res.result.id)
 	})
 })
 
+// 倒计时
+let callCount = 0;
+const downTimeFun = () => {
+	const endTime = new Date(createTime.value.getTime() + 15 * 60 * 1000);
+	const remainingTime = endTime - new Date();
+	if (remainingTime > 0) {
+		const minutes = Math.floor(remainingTime / (1000 * 60));
+		const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000);
+		downTime.value = `${minutes.toString().padStart(2, '0')}分${seconds.toString().padStart(2, '0')}秒`;
+		const timer = setInterval(() => {
+			const now = new Date();
+			const newRemainingTime = endTime - now;
+			if (newRemainingTime <= 0) {
+				clearInterval(timer);
+				downTime.value = "00:00";
+				if (callCount < 3) {
+					callCount++;
+					getOrderDetailInfo();
+				}
+				return;
+			}
+			const newMinutes = Math.floor(newRemainingTime / (1000 * 60));
+			const newSeconds = Math.floor((newRemainingTime % (1000 * 60)) / 1000);
+			downTime.value = `${newMinutes.toString().padStart(2, '0')}分${newSeconds.toString().padStart(2, '0')}秒`;
+		}, 1000);
+	} else {
+		if (callCount < 3) {
+			callCount++;
+			getOrderDetailInfo();
+		}
+		downTime.value = "00:00";
+	}
+}
+
+// 取消订单
+const cancelOrder = async (e: any) => {
+	let res: any = await TipsUtils.tips_alert('确定取消订单吗?', true)
+	if (res.confirm) {
+		http.put(`/order/cancelOrder?orderId=${e}`, {}, { loading: true }).then((res: any) => {
+			TipsUtils.tips_toast('订单已取消')
+			getOrderDetailInfo()
+		})
+	}
+}
+
 const queryWaitSignList = ref([]) // 合同信息
 const notSignList = ref([]) // 未签署
 const signList = ref([]) // 已签署
@@ -539,6 +599,47 @@ const getSignUrl = (signFlowId: string) => {
 </script>
 
 <style lang="less" scoped>
+.t-order-timer {
+	margin-top: 20rpx;
+
+	.timer-text {
+		font-weight: bold;
+		font-size: 36rpx;
+		color: #222222;
+	}
+
+	.timer-btn {
+		display: flex;
+		align-items: center;
+		gap: 20rpx;
+		margin-top: 20rpx;
+
+		.cancel-btn {
+			width: 226rpx;
+			height: 68rpx;
+			background: #E6E6E6;
+			border-radius: 60rpx;
+			font-weight: bold;
+			font-size: 28rpx;
+			color: #AAAAAA;
+			text-align: center;
+			line-height: 68rpx;
+		}
+
+		.pay-btn {
+			width: 440rpx;
+			height: 68rpx;
+			background: #C8FF0C;
+			border-radius: 60rpx;
+			font-weight: bold;
+			font-size: 28rpx;
+			color: #222222;
+			text-align: center;
+			line-height: 68rpx;
+		}
+	}
+}
+
 .t-header {
 	margin-top: 20rpx;
 

+ 2 - 2
src/pages/index/venue/index.vue

@@ -27,11 +27,11 @@
 							<text>{{item.goodRate}}</text>
 						</view>
 						<view class="comment">
-							{{item.comments}}条评论
+							{{item.comments||0}}条评论
 						</view>
 					</view>
 					<view class="venues-address">
-						{{item.address}} | {{item.km}}km
+						{{item.address}} | {{item.km.toFixed(2)}}km
 					</view>
 					<view class="venues-type">
 						<view class="type-tags" v-for="(tags,index) in item.category" :key="index">

+ 1 - 1
src/pages/index/writeComments/index.vue

@@ -45,7 +45,7 @@ onLoad((options) => {
 const formData = ref({
 	score: 0,
 	evaluateContent: '',
-	images: 'https://bpic.588ku.com/element_origin_min_pic/23/07/11/d32dabe266d10da8b21bd640a2e9b611.jpg!r650,https://img.keaitupian.cn/newupload/08/1629449018344288.jpg',
+	images: '',
 	siteId: null,
 	orderId: null,
 	isAnonymous: 0,

+ 1 - 14
src/pages/mine/index.vue

@@ -30,7 +30,7 @@
 		<view class="m-function-list">
 			<view class="list-title">我的功能</view>
 			<view class="cell-list">
-				<view class="item-cell-contact" @click="testdt">
+				<view class="item-cell-contact">
 					<view class="">客服</view>
 					<zzx-icon name="ashRight" size="10"></zzx-icon>
 					<button class="contact-btn" open-type="contact"></button>
@@ -108,19 +108,6 @@ const get_userinfo = () => {
 		cache.set('USER_INFO', res.result)
 	})
 }
-
-const testdt = () => {
-	uni.requestSubscribeMessage({
-		tmplIds: ['Yi1Z1IKRwgF6-mpiFcOUTvavc4TUAsfsLynK_3Yu350'],
-		success(res) {
-			console.log(res, '订阅消息成功')
-		},
-		fail(err) {
-			console.log(err, '订阅消息失败')
-		}
-	})
-
-}
 </script>
 
 <style>

+ 107 - 40
src/pages/mine/orderInfo/index.vue

@@ -10,7 +10,7 @@
 			<view class="o-order-name">
 				<view class="order-name">场地:{{ item.orderProInfoList[0].address || '--' }}</view>
 				<!-- 待付款 -->
-				<view class="order-status" v-if="item.orderStatus == 0">待支付(剩余{{ downTime }})</view>
+				<view class="order-status" v-if="item.orderStatus == 0">待支付(剩余{{ item.downTime }})</view>
 				<view class="item-order-status" style="color:#FB5B5B;" v-if="item.orderStatus == 1">待使用</view>
 				<view class="item-order-status" v-if="item.orderStatus == 2">已使用</view>
 				<view class="item-order-status" v-if="item.orderStatus == 3">已到期</view>
@@ -49,7 +49,11 @@
 							<image :src="item.orderProInfoList[0].productImage" mode=""></image>
 						</view>
 						<view class="single-name">
-							<view class="item-single-name textHidden">{{ item.orderProInfoList[0].productName }}</view>
+							<view class="item-single-name textHidden" v-if="item.orderType!=1">{{ item.orderProInfoList[0].productName }}</view>
+							<view class="item-single-name" v-else>
+								<!-- {{ item.orderProInfoList[0].productName }} -->
+								  <view class="textHidden" v-for="name in item.orderProInfoList" :key="name.id">{{ name.productName }}</view>
+							</view>
 						</view>
 					</view>
 				</view>
@@ -61,17 +65,19 @@
 			<view class="line"></view>
 			<!-- 待付款 -->
 			<view class="o-order-btn">
-				<view class="cancel-btn" v-if="selected == 1">取消订单</view>
-				<view class="pay-btn" v-if="selected == 1">付款</view>
+				<view class="cancel-btn" v-if="item.orderStatus == 0" @click.stop="cancelOrder(item)">取消订单</view>
+				<view class="pay-btn" v-if="item.orderStatus == 0">付款</view>
 				<!-- 售后/退款 -->
-				<view class="pay-btn" v-if="selected == 3">评价</view>
+				<view class="pay-btn" v-if="item.orderStatus == 2"
+					@click="RouterUtils.to_page(`/pages/index/writeComments/index?siteId=${item.addressSiteId}&orderId=${item.orderId}`)">
+					评价</view>
 				<!-- 已使用 -->
 				<view class="cancel-btn" v-if="selected == 4">申请退款</view>
 				<view class="pay-btn" v-if="selected == 4">凭证</view>
 			</view>
 			<!-- 待使用 -->
 			<view class="o-order-tips" v-if="item.orderStatus == 1">
-				限04.23 06:00-08:00使用,过期作废
+				限{{ item.orderProInfoList[0].frameTimeStr }}使用,过期作废
 			</view>
 		</view>
 		<zs-empty v-if="orderList.length == 0"></zs-empty>
@@ -79,33 +85,51 @@
 </template>
 
 <script lang="ts" setup>
-import { ref, onMounted } from 'vue'
+import { ref, onMounted, onUnmounted } from 'vue'
 import { http } from '@/utils/http'
-import { onLoad } from '@dcloudio/uni-app';
+import { onLoad, onReachBottom } from '@dcloudio/uni-app';
 import zsEmpty from '@/components/zs-empty/index.vue'
-import { RouterUtils } from '@/utils/util'
+import { RouterUtils, TipsUtils } from '@/utils/util'
 const selected = ref(0)
 const orderTypeList = ref(['全部', '待付款', '待使用', '已使用', '退款/售后'])
 
 onLoad((option) => {
 	selected.value = option.selIndex
+	if (selected.value == 0) {
+		orderFormData.value.orderStatus = null
+	} else if (selected.value == 1) {
+		orderFormData.value.orderStatus = 0
+	} else if (selected.value == 2) {
+		orderFormData.value.orderStatus = 1
+	} else if (selected.value == 3) {
+		orderFormData.value.orderStatus = 2
+	} else if (selected.value == 4) {
+		orderFormData.value.orderStatus = null
+		orderFormData.value.orAfterSale = 1
+	}
 })
+
+onReachBottom(() => {
+	orderFormData.value.pageNum++;
+	getOrderList()
+})
+
 onMounted(() => {
 	getOrderList()
 })
 const selectedItem = (i) => {
 	selected.value = i
-	if (i == 0) {
+	if (selected.value == 0) {
 		orderFormData.value.orderStatus = null
-	} else if (i == 1) {
+	} else if (selected.value == 1) {
 		orderFormData.value.orderStatus = 0
-	} else if (i == 2) {
+	} else if (selected.value == 2) {
 		orderFormData.value.orderStatus = 1
-	} else if (i == 3) {
+	} else if (selected.value == 3) {
 		orderFormData.value.orderStatus = 2
-	}else if (i == 4) {
+	} else if (selected.value == 4) {
 		orderFormData.value.orderStatus = null
-		orderFormData.value.orAfterSale=1
+		orderFormData.value.orAfterSale = 1
 	}
 	getOrderList()
 }
@@ -114,45 +138,88 @@ const selectedItem = (i) => {
 const orderFormData = ref({
 	pageNum: 1,
 	pageSize: 10,
-	orderStatus:null,
+	orderStatus: null,
 	orAfterSale: 0
 })
 const orderList = ref([])
-const downTime = ref(null)
 // 订单状态 0-待付款 1-待使用 2-已使用 3-已到期 4-已取消 5-待退款 6已退款
 const getOrderList = () => {
 	http.post('/order/pageOrders', orderFormData.value, { loading: true }).then((res) => {
-		orderList.value = res.result.records
+		if (orderFormData.value.pageNum == 1) {
+			orderList.value = res.result.records
+		} else {
+			orderList.value = [...orderList.value, ...res.result.records]
+		}
 		orderList.value.forEach((item) => {
+			const [datePart, timePart] = item.createTime.split(' ');
+			const [year, month, day] = datePart.split('-').map(Number);
+			const [hours, minutes, seconds] = timePart.split(':').map(Number);
+			item.createTime = new Date(year, month - 1, day, hours, minutes, seconds);
 			if (item.orderStatus == 0) {
-				const createTime = new Date(item.orderProInfoList[0].createTime);
-				const endTime = new Date(createTime.getTime() + 15 * 60 * 1000);
-				const remainingTime = endTime - new Date();
-				if (remainingTime > 0) {
-					const minutes = Math.floor(remainingTime / (1000 * 60));
-					const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000);
-					downTime.value = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`;
-					const timer = setInterval(() => {
-						const now = new Date();
-						const newRemainingTime = endTime - now;
-						if (newRemainingTime <= 0) {
-							clearInterval(timer);
-							downTime.value = "00:00";
-							return;
-						}
-						const newMinutes = Math.floor(newRemainingTime / (1000 * 60));
-						const newSeconds = Math.floor((newRemainingTime % (1000 * 60)) / 1000);
-						downTime.value = `${newMinutes.toString().padStart(2, '0')}:${newSeconds.toString().padStart(2, '0')}`;
-					}, 1000);
-				} else {
-					downTime.value = "00:00";
-				}
+				item.downTime = "";
+				item.timer = null;
+				startCountdown(item);
 			}
 		})
+
 	})
 }
+// 倒计时
+let callCount = 0;
+const startCountdown = (item) => {
+	if (item.timer) {
+		clearInterval(item.timer);
+	}
+	const endTime = new Date(item.epxTime);
+	const remainingTime = endTime - new Date();
+	if (remainingTime > 0) {
+		const minutes = Math.floor(remainingTime / (1000 * 60));
+		const seconds = Math.floor((remainingTime % (1000 * 60)) / 1000);
+		item.downTime = `${minutes.toString().padStart(2, '0')}分${seconds.toString().padStart(2, '0')}秒`;
+		item.timer = setInterval(() => {
+			const now = new Date();
+			const newRemainingTime = endTime - now;
+			if (newRemainingTime <= 0) {
+				clearInterval(item.timer);
+				item.downTime = "00:00";
+				if (callCount < 3) {
+					callCount++;
+					getOrderList();
+				}
+				return;
+			}
 
+			const newMinutes = Math.floor(newRemainingTime / (1000 * 60));
+			const newSeconds = Math.floor((newRemainingTime % (1000 * 60)) / 1000);
+			item.downTime = `${newMinutes.toString().padStart(2, '0')}分${newSeconds.toString().padStart(2, '0')}秒`;
+		}, 1000);
+	} else {
+		item.downTime = "00:00";
+		if (callCount < 3) {
+			callCount++;
+			getOrderList();
+		}
+	}
+}
 
+
+const cancelOrder = async (e: any) => {
+	let res: any = await TipsUtils.tips_alert('确定取消订单吗?', true)
+	if (res.confirm) {
+		http.put(`/order/cancelOrder?orderId=${e.orderId}`, {}, { loading: true }).then((res: any) => {
+			TipsUtils.tips_toast('订单已取消')
+			getOrderList()
+		})
+	}
+}
+
+onUnmounted(() => {
+	orderList.value.forEach(item => {
+		if (item.timer) {
+			clearInterval(item.timer);
+		}
+	});
+});
 </script>
 
 <style lang="less" scoped>