| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484 | <template>	<view>		<view style="width: 100%;text-align: center;position: fixed;height: 96rpx;z-index: 999;">			<u-tabs :list="list" sticky :current="current" @change="change" active-color="#007AFF" inactive-color="#999"></u-tabs>		</view>		<view class="safeArea" style="position: absolute;top: 96rpx;width: 100%;">			<view class="examMain">				<view class="noData" v-if="!listData.length">您暂无相关考试预约哦~</view>				<view v-for="(item, index) in listData" :key="index" class="examList">					<view class="time">{{ $method.timestampToTime(item.createTime, false) }}</view>					<view class="main">						<view class="top" @click="showDetails(item)">							<view class="subject">{{ item.goodsName }}</view>							<u-icon name="arrow-right" color="#999999" size="28"></u-icon>						</view>						<view class="item">							<view class="left">报考专业</view>							<view class="right">{{ item.categoryName }}专业</view>						</view>						<view class="item">							<view class="left">考试地点</view>							<view class="right">{{ item.applySiteAddress }}</view>						</view>						<view class="item">							<view class="left">考试时间</view>							<view class="right">								{{ $method.timestampToTime(item.applySiteExamTime) }} {{ item.applySiteStartTime.replace('-', ':') }} ~								{{ item.applySiteEndTime.replace('-', ':') }}							</view>						</view>						<view class="item" v-if="item.applySiteAddressTrain">							<view class="left">考前培训地点</view>							<view class="right">{{ item.applySiteAddressTrain }}</view>						</view>						<view class="item" v-if="item.applySiteExamTrainTime && item.applySiteStartTrainTime && item.applySiteEndTrainTime">							<view class="left">考前培训时间</view>							<view class="right">								{{ $method.timestampToTime(item.applySiteExamTrainTime) }} {{ item.applySiteStartTrainTime.replace('-', ':') }} ~								{{ item.applySiteEndTrainTime.replace('-', ':') }}							</view>						</view>					</view>				</view>			</view>		</view>		<!-- 弹框 考试详情-->		<u-popup v-model="details_show" mode="center" class="detailsModel">			<view class="detailsBox">				<view class="time">{{ $method.timestampToTime(activeList.createTime, false) }}</view>				<view class="boxItem border">					<view class="title">报考学员信息</view>					<view class="item">						姓名:						<text class="val">{{ activeList.realname }}</text>					</view>					<view class="item">						身份证:						<text class="val">{{ activeList.idCard }}</text>					</view>					<view class="item">						考试身份:						<text class="val">{{ activeList.studentType == 1 ? '非补考学员' : activeList.studentType == 2 ? '补考学员' : '' }}</text>					</view>				</view>				<view class="boxItem">					<view class="title">考试预约信息</view>					<view class="item">						考试标题:						<text class="val">{{ activeList.applyName }}</text>					</view>					<view class="item">						报名开放时间:						<text class="val">{{ $method.timestampToTime(activeList.applyStartTime) }} ~ {{ $method.timestampToTime(activeList.applyEndTime) }}</text>					</view>					<view class="item">						报考专业:						<text class="val">{{ activeList.categoryName }}</text>					</view>					<view class="item">						考试地点:						<text class="val">{{ activeList.applySiteAddress }}</text>					</view>					<view class="item">						考试时间:						<text class="val">							{{								$method.timestampToTime(activeList.applySiteExamTime) +									' ' +									activeList.applySiteStartTime.replace('-', ':') +									'~' +									activeList.applySiteEndTime.replace('-', ':')							}}						</text>					</view>					<view class="item" v-if="activeList.applySiteAddressTrain">						考前培训地点:						<text class="val">{{ activeList.applySiteAddressTrain }}</text>					</view>					<view class="item" v-if="activeList.applySiteExamTrainTime && activeList.applySiteStartTrainTime && activeList.applySiteEndTrainTime">						考前培训时间:						<text class="val">							{{								$method.timestampToTime(activeList.applySiteExamTrainTime) +									' ' +									activeList.applySiteStartTrainTime.replace('-', ':') +									'~' +									activeList.applySiteEndTrainTime.replace('-', ':')							}}						</text>					</view>				</view>				<u-line color="#EEEEEE" />				<view class="foot" v-if="activeList.subscribeStatus === 1">					<view class="btn" @click="hideModel">知道了</view>					<view class="btn cancel" v-if="isShowFun(activeList)" @click="cancelBtn">取消预约</view>				</view>				<view class="foot" v-else><view class="abtns" @click="hideModel">知道了</view></view>			</view>		</u-popup>		<!-- 弹框 取消预约-->		<u-popup v-model="cancel_show" mode="center" class="detailsModel">			<view class="tipBox">				<view class="title">温馨提示</view>				<view class="main">					<view class="item">每次考试均有名额限制,</view>					<view class="item">取消预约后,您可能无法再次预约本次考试。</view>					<view class="item">请慎重考虑。</view>					<view class="item">您确定要取消本次考试预约吗?。</view>				</view>				<view class="btn">					<view class="btn1 cancel" @click="cancel_show = false">取消</view>					<view class="btn1 submit" @click="submit">确定</view>				</view>			</view>		</u-popup>	</view></template><script>import { mapGetters } from 'vuex';export default {	data() {		return {			details_show: false,			cancel_show: false,			list: [				{					name: '已预约'				},				{					name: '已取消'				},				{					name: '已过期'				}			],			listData: [],			current: 0,			activeList: {				applySiteStartTime: '',				applySiteEndTime: '',				applySiteStartTrainTime: '',				applySiteEndTrainTime: ''			}		};	},	onPullDownRefresh() {},	onLoad(option) {		this.$api.getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 }).then(res => {			if (res.data.code === 200) {				this.listData = res.data.rows;			}		});	},	onShow() {		/* if(this.current === 2 && this.$method.isLogin()){			this.$refs.refMy.init();		} */	},	onShareAppMessage(res) {		var self = this;		return {			title: '中正',			path: `/pages/index/index?inviteCode=` + userInfo == null ? '' : userInfo.userAccount		};	},	methods: {		isShowFun(times) {			var timestamp = parseInt(new Date().getTime() / 1000);			var newDataAge = parseInt(new Date(new Date().toLocaleDateString()).getTime() / 1000);			if (times.applyEndTime <= timestamp) {				return false;			} else {				if (times.beforeStatus === 1) {					console.log(1);					return false;				} else if (times.examStatus !== 0) {					console.log(2);					return false;				} else if (times.applySiteExamTime < newDataAge) {					console.log(3);					return false;				} else if (times.applySiteExamTime > newDataAge) {					console.log(4);					return true;				} else if (times.applySiteExamTime == newDataAge) {					console.log(5);					var hours = new Date().getHours();					var mins = new Date().getMinutes();					var arrays = times.applySiteStartTime.split('-').map(Number);					if (arrays[0] > hours) {						return true;					} else if (arrays[0] < hours) {						return false;					} else {						if (arrays[1] <= mins) {							return false;						} else {							return true;						}					}				} else {					return true;				}			}		},		showDetails(item) {			this.activeList = JSON.parse(JSON.stringify(item));			this.details_show = true;		},		cancelBtn() {			this.cancel_show = true;		},		hideModel() {			this.details_show = false;		},		submit() {			var bols = this.isShowFun(this.activeList);			if (!bols) {				uni.showToast({					icon: 'none',					title: '当前已无法取消预约'				});				return;			}			this.$api				.editApply({					subscribeId: this.activeList.subscribeId,					subscribeStatus: 2				})				.then(res => {					if (res.data.code === 200) {						this.cancel_show = false;						this.details_show = false;						this.$api.getApplylist({ subscribeStatus: 1, exceedExamExpend: 2 }).then(res => {							this.listData = res.data.rows;						});					}				});		},		change(index) {			if (this.current === index) {				return;			}			this.current = index;			var data = {};			if (index === 0) {				data = {					subscribeStatus: 1,					exceedExamExpend: 2				};			}			if (index === 1) {				data = {					subscribeStatus: 2				};			}			if (index === 2) {				data = {					subscribeStatus: 1,					exceedExamExpend: 1				};			}			this.$api.getApplylist(data).then(res => {				if (res.data.code === 200) {					this.listData = res.data.rows;				}			});		}	},	onReachBottom() {}	// computed: { ...mapGetters(['userInfo']) }};</script><style>page {	background: #eaeef1;}.detailsModel .u-mode-center-box {	border-radius: 24rpx;}</style><style scoped lang="scss">.noData {	text-align: center;	font-size: 32rpx;	font-family: PingFang SC;	font-weight: 500;	color: #999999;	margin: 160rpx 0;}.examMain {	padding: 8rpx;	.time {		text-align: center;		font-size: 24rpx;		font-family: PingFang SC;		font-weight: 500;		color: #999999;	}	.main {		background: #ffffff;		border-radius: 16rpx;		margin: 20rpx 0;	}	.top {		height: 103rpx;		display: flex;		justify-content: center;		align-items: center;		border-bottom: 1px solid #eeeeee;		.subject {			max-width: 514rpx;			height: 40rpx;			font-size: 30rpx;			font-family: PingFang SC;			font-weight: bold;			color: #007aff;			white-space: nowrap;			overflow: hidden;			text-overflow: ellipsis;		}	}	.item {		display: flex;		justify-content: space-between;		align-items: center;		margin-left: 31rpx;		height: 80rpx;		padding-right: 24rpx;		border-bottom: 1px solid #eeeeee;		font-size: 24rpx;		font-family: PingFang SC;		font-weight: 500;		color: #666666;		.right {			font-size: 30rpx;			font-family: PingFang SC;			font-weight: bold;		}	}}.detailsBox {	width: 640rpx;	background: #ffffff;	border-radius: 24rpx;	.time {		margin: 32rpx 0;		padding: 0 37rpx;		font-size: 30rpx;		font-family: PingFang SC;		font-weight: bold;		color: #333333;	}	.boxItem {		margin-left: 36rpx;		margin-bottom: 29rpx;		&.border {			border-bottom: 1px solid #eee;		}		.title {			font-size: 24rpx;			font-family: PingFang SC;			font-weight: 500;			color: #007aff;			position: relative;			&::before {				content: '';				width: 4rpx;				height: 24rpx;				background: #007aff;				border-radius: 2rpx;				position: absolute;				top: 6rpx;				left: -8rpx;			}		}		.item {			margin: 24rpx 0;			font-size: 26rpx;			font-family: PingFang SC;			font-weight: 500;			color: #999999;			.val {				color: #333333;			}		}	}	.foot {		padding: 20rpx 40rpx;		display: flex;		justify-content: center;		.btn {			width: 200rpx;			height: 80rpx;			line-height: 80rpx;			text-align: center;			background: #f5f5f5;			border-radius: 40rpx;			font-size: 30rpx;			font-family: PingFang SC;			font-weight: bold;			color: #007aff;			&.cancel {				background: #ff3b30;				color: #ffffff;			}		}		.abtns {			width: 526rpx;			height: 80rpx;			line-height: 80rpx;			text-align: center;			background: #007aff;			border-radius: 40rpx;			font-size: 30rpx;			font-family: PingFang SC;			font-weight: bold;			color: #fff;		}	}}.tipBox {	width: 640rpx;	padding: 30rpx 20rpx 40rpx;	background: #ffffff;	border-radius: 24rpx;	font-family: PingFang SC;	.title {		text-align: center;		font-size: 30rpx;		font-weight: bold;		color: #333333;		margin-bottom: 40rpx;	}	.main {		font-size: 30rpx;		font-weight: 500;		color: #666666;		line-height: 48rpx;		margin-bottom: 40rpx;	}	.btn {		display: flex;		justify-content: center;		.btn1 {			width: 200rpx;			height: 80rpx;			line-height: 80rpx;			text-align: center;			background: #f5f5f5;			border-radius: 40px;			font-size: 30rpx;			font-weight: bold;			color: #007aff;			margin: 0 20rpx;			&.submit {				background: #007aff;				color: #fff;			}		}	}}</style>
 |