| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208 |
- <template>
- <view class="container">
- <view class="list" v-if="info">
- <!-- 每一个预约记录区域 -->
- <view class="box">
- <view class="box_header">
- <view class="header_left">{{ info.school }}</view>
- <view class="header_right">预约成功</view>
- </view>
- <view class="box_info">
- <view class="info_box">车牌号:{{ info.carNumber }}</view>
- <view class="info_box">学生姓名:{{ info.name }}</view>
- <view class="info_box">手机号:{{ info.phone }}</view>
- <!-- <view class="info_box">身份证号:{{ info.studentCard }}</view> -->
- <view class="info_box">到访开始时间:{{ info.startTime }}</view>
- <view class="info_box">到访结束时间:{{ info.endTime }}</view>
- <!-- <view class="info_box">同行人数:{{ info.peerNum }}</view> -->
- <view class="info_box">访问事由:{{ info.visitorReason }}</view>
- <!-- <view class="info_box">校区:{{ info.school }}</view> -->
- <view class="info_btn" @click="handleCancel">取消预约</view>
- </view>
- </view>
- </view>
- <view class="noData" v-else>
- 暂无约车信息
- <view class="btn" @click="handleSub">去预约</view>
- </view>
- <view class="btn" @click="handleSelect">宿舍选择</view>
- <view class="btn" @click="logout">退出登录</view>
- </view>
- </template>
- <script setup>
- import { onLoad } from '@dcloudio/uni-app'
- import { ref } from 'vue'
- import { getVisitorRecordReq, deleteVisitorRecordReq } from '@/api/index.js'
- // 我的预约信息
- const info = ref(null)
- onLoad(() => {
- // 获取我的预约信息
- getVisitorRecord()
- })
- // 获取我的预约
- const getVisitorRecord = async () => {
- const res = await getVisitorRecordReq()
- // console.log(res)
- if (res.code == 200) {
- info.value = res.data
- }
- }
- // 取消预约按钮回调
- const handleCancel = () => {
- uni.showModal({
- title: '提示',
- content: '确定取消预约吗?',
- success: async (res) => {
- if (res.confirm) {
- const res = await deleteVisitorRecordReq(info.value)
- // console.log(res)
- if (res.code == 200) {
- uni.showToast({
- title: '取消成功',
- icon: 'success'
- })
- setTimeout(() => {
- info.value = null
- getVisitorRecord()
- }, 1500)
- }
- }
- }
- })
- }
- // 去预约按钮回调
- const handleSub = () => {
- uni.navigateTo({
- url: '/pages/subscribe/subscribe'
- })
- }
- // 宿舍选择按钮回调
- const handleSelect = () => {
- uni.showModal({
- title: '提示',
- content: '确定前往宿舍选择吗?',
- success: (res) => {
- if (res.confirm) {
- uni.reLaunch({
- url: '/pages/select/select'
- })
- }
- }
- })
- }
- // 退出登录回调
- const logout = () => {
- uni.showModal({
- title: '提示',
- content: '确定退出登录吗?',
- success: (res) => {
- if (res.confirm) {
- let urlstr = uni.getStorageSync('urlstr')
- uni.clearStorageSync()
- window.location.href = `https://chtech.ncjti.edu.cn/welcome/welcomeH5/#/?urlstr=${urlstr}`
- }
- }
- })
- }
- </script>
- <style lang="scss" scoped>
- .container {
- box-sizing: border-box;
- padding: 12rpx 0;
- min-height: 100vh;
- background-color: #f5f9ff;
- .list {
- .box {
- margin-bottom: 20rpx;
- background-color: #fff;
- .box_header {
- display: flex;
- align-items: center;
- justify-content: space-between;
- padding: 0 20rpx;
- height: 86rpx;
- font-size: 28rpx;
- border-bottom: 2rpx solid #cccccc;
- .header_left {
- font-weight: bold;
- }
- .header_right {
- color: #0061ff;
- }
- }
- .box_info {
- padding: 30rpx 20rpx 40rpx;
- font-size: 28rpx;
- .info_box {
- margin-bottom: 20rpx;
- }
- .info_btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-left: auto;
- margin-top: 35rpx;
- width: 180rpx;
- height: 70rpx;
- font-size: 28rpx;
- color: #fff;
- border-radius: 8rpx;
- background-color: #0061ff;
- }
- }
- }
- }
- .noData {
- display: flex;
- flex-direction: column;
- align-items: center;
- justify-content: center;
- margin-top: 400rpx;
- .btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin-top: 50rpx;
- width: 180rpx;
- height: 70rpx;
- font-size: 28rpx;
- color: #fff;
- border-radius: 8rpx;
- background-color: #0061ff;
- }
- }
- .btn {
- display: flex;
- align-items: center;
- justify-content: center;
- margin: 50rpx 20rpx;
- height: 100rpx;
- font-size: 32rpx;
- color: #fff;
- border-radius: 8rpx;
- background-color: #0061ff;
- }
- }
- </style>
|