mySubscribe.vue 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="container">
  3. <view class="list" v-if="info">
  4. <!-- 每一个预约记录区域 -->
  5. <view class="box">
  6. <view class="box_header">
  7. <view class="header_left">{{ info.school }}</view>
  8. <view class="header_right">预约成功</view>
  9. </view>
  10. <view class="box_info">
  11. <!-- <view class="info_box">司机姓名:{{ info.driverName }}</view> -->
  12. <view class="info_box">学生姓名:{{ info.name }}</view>
  13. <view class="info_box">手机号:{{ info.phone }}</view>
  14. <view class="info_box">身份证号:{{ info.studentCard }}</view>
  15. <view class="info_box">同行人数:{{ info.peerNum }}</view>
  16. <view class="info_box">访问事由:{{ info.visitorReason }}</view>
  17. <view class="info_box">校区:{{ info.school }}</view>
  18. <view class="info_box">到访开始时间:{{ info.startTime }}</view>
  19. <view class="info_box">到访结束时间:{{ info.endTime }}</view>
  20. <view class="info_box">车牌号:{{ info.carNumber }}</view>
  21. <view class="info_btn" @click="handleCancel">取消预约</view>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="noData" v-else>
  26. 暂无约车信息
  27. <view class="btn" @click="handleSub">去预约</view>
  28. </view>
  29. <view class="btn" @click="handleNext">军训服装尺码采集</view>
  30. </view>
  31. </template>
  32. <script setup>
  33. import { onLoad } from '@dcloudio/uni-app'
  34. import { ref } from 'vue'
  35. import { getVisitorRecordReq, deleteVisitorRecordReq } from '@/api/index.js'
  36. // 我的预约信息
  37. const info = ref(null)
  38. onLoad(() => {
  39. // 获取我的预约信息
  40. getVisitorRecord()
  41. })
  42. // 获取我的预约
  43. const getVisitorRecord = async () => {
  44. const res = await getVisitorRecordReq()
  45. // console.log(res)
  46. if (res.code == 200) {
  47. info.value = res.data
  48. }
  49. }
  50. // 取消预约按钮回调
  51. const handleCancel = () => {
  52. uni.showModal({
  53. title: '提示',
  54. content: '确定取消预约吗?',
  55. success: async (res) => {
  56. if (res.confirm) {
  57. const res = await deleteVisitorRecordReq(info.value)
  58. // console.log(res)
  59. if (res.code == 200) {
  60. uni.showToast({
  61. title: '取消成功',
  62. icon: 'success'
  63. })
  64. setTimeout(() => {
  65. info.value = null
  66. getVisitorRecord()
  67. }, 1500)
  68. }
  69. }
  70. }
  71. })
  72. }
  73. // 去预约按钮回调
  74. const handleSub = () => {
  75. uni.navigateTo({
  76. url: '/pages/subscribe/subscribe'
  77. })
  78. }
  79. const handleNext = () => {
  80. uni.showModal({
  81. title: '提示',
  82. content: '确定前往军训服装尺码采集吗?',
  83. success: (res) => {
  84. if (res.confirm) {
  85. window.location.href = `https://wj.qq.com/s2/14907423/70b4/`
  86. }
  87. }
  88. })
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .container {
  93. box-sizing: border-box;
  94. padding: 12rpx 0;
  95. min-height: 100vh;
  96. background-color: #f5f9ff;
  97. .list {
  98. .box {
  99. margin-bottom: 20rpx;
  100. background-color: #fff;
  101. .box_header {
  102. display: flex;
  103. align-items: center;
  104. justify-content: space-between;
  105. padding: 0 20rpx;
  106. height: 86rpx;
  107. font-size: 28rpx;
  108. border-bottom: 2rpx solid #cccccc;
  109. .header_left {
  110. font-weight: bold;
  111. }
  112. .header_right {
  113. color: #0061ff;
  114. }
  115. }
  116. .box_info {
  117. padding: 30rpx 20rpx 40rpx;
  118. font-size: 28rpx;
  119. .info_box {
  120. margin-bottom: 20rpx;
  121. }
  122. .info_btn {
  123. display: flex;
  124. align-items: center;
  125. justify-content: center;
  126. margin-left: auto;
  127. margin-top: 35rpx;
  128. width: 180rpx;
  129. height: 70rpx;
  130. font-size: 28rpx;
  131. color: #fff;
  132. border-radius: 8rpx;
  133. background-color: #0061ff;
  134. }
  135. }
  136. }
  137. }
  138. .noData {
  139. display: flex;
  140. flex-direction: column;
  141. align-items: center;
  142. justify-content: center;
  143. margin-top: 400rpx;
  144. .btn {
  145. display: flex;
  146. align-items: center;
  147. justify-content: center;
  148. margin-top: 50rpx;
  149. width: 180rpx;
  150. height: 70rpx;
  151. font-size: 28rpx;
  152. color: #fff;
  153. border-radius: 8rpx;
  154. background-color: #0061ff;
  155. }
  156. }
  157. .btn {
  158. display: flex;
  159. align-items: center;
  160. justify-content: center;
  161. margin: 50rpx 20rpx;
  162. height: 100rpx;
  163. font-size: 32rpx;
  164. color: #fff;
  165. border-radius: 8rpx;
  166. background-color: #0061ff;
  167. }
  168. }
  169. </style>