record.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  1. <template>
  2. <view class="container">
  3. <!-- 分段器区域 -->
  4. <uni-segmented-control :current="activeCurrent" :values="controlList" @clickItem="onClickItem" styleType="text" activeColor="#0061FF"></uni-segmented-control>
  5. <!-- 预约记录区域 -->
  6. <view class="body">
  7. <!-- 每一条预约记录区域 -->
  8. <view class="body_box" v-for="item in list" :key="item.id" @click="handleClick(item)">
  9. <view class="box_title">
  10. <view class="title_msg">
  11. <view class="msg_name">{{ item.userName }}</view>
  12. <view class="msg_time">/{{ item.createTime }}</view>
  13. </view>
  14. <view class="title_type" v-if="item.statuStr == '待审核'">{{ item.statuStr }}</view>
  15. <view class="title_type red" v-if="item.statuStr == '已拒绝'">{{ item.statuStr }}</view>
  16. <view class="title_type green" v-if="item.statuStr == '已推送'">{{ item.statuStr }}</view>
  17. </view>
  18. <view class="box_info">
  19. <view class="info_box">
  20. <view class="box_key">来访时间</view>
  21. <view class="box_value">{{ item.visitorTime }}</view>
  22. </view>
  23. <view class="info_box">
  24. <view class="box_key">访问事由</view>
  25. <view class="box_value">{{ item.visitReason }}</view>
  26. </view>
  27. </view>
  28. <view class="box_btn" v-if="item.statuStr == '待审核'">
  29. <view class="button" @click.stop="handleCancel">取消预约</view>
  30. </view>
  31. </view>
  32. </view>
  33. <!-- 没有数据时展示的页面 -->
  34. <NoData v-if="!list.length" />
  35. <!-- 详情弹窗区域 -->
  36. <uni-popup ref="popup" type="center" :is-mask-click="false">
  37. <view class="popup_box">
  38. <!-- 弹窗标题区域 -->
  39. <view class="pop_header">
  40. 预约详情
  41. <view class="header_icon" @click="closePop">×</view>
  42. </view>
  43. <!-- 弹窗详细信息区域 -->
  44. <view class="pop_info">
  45. <view class="info_key">状态:</view>
  46. <view class="info_value blue" v-if="popObj.statuStr == '待审核'">{{ popObj.statuStr }}</view>
  47. <view class="info_value red" v-if="popObj.statuStr == '已拒绝'">{{ popObj.statuStr }}</view>
  48. <view class="info_value green" v-if="popObj.statuStr == '已推送'">{{ popObj.statuStr }}</view>
  49. </view>
  50. <view class="pop_info">
  51. <view class="info_key">访客姓名:</view>
  52. <view class="info_value">{{ popObj.userName }}</view>
  53. </view>
  54. <view class="pop_info">
  55. <view class="info_key">访客手机号:</view>
  56. <view class="info_value">136562262626</view>
  57. </view>
  58. <view class="pop_info">
  59. <view class="info_key">来访时间:</view>
  60. <view class="info_value">{{ popObj.visitorTime }}</view>
  61. </view>
  62. <view class="pop_info">
  63. <view class="info_key">证件号:</view>
  64. <view class="info_value">2662626262626262626</view>
  65. </view>
  66. <view class="pop_info">
  67. <view class="info_key">访问事由:</view>
  68. <view class="info_value">{{ popObj.visitReason }}</view>
  69. </view>
  70. <view class="pop_info">
  71. <view class="info_key">车牌号:</view>
  72. <view class="info_value">无</view>
  73. </view>
  74. <view class="pop_info">
  75. <view class="info_key">同行人数:</view>
  76. <view class="info_value">无</view>
  77. </view>
  78. <view class="pop_info">
  79. <view class="info_key">受访学生:</view>
  80. <view class="info_value">张三(262626)</view>
  81. </view>
  82. </view>
  83. </uni-popup>
  84. <!-- 底部导航栏区域 -->
  85. <Tabber />
  86. </view>
  87. </template>
  88. <script setup>
  89. import { ref } from 'vue'
  90. import { onLoad, onReachBottom } from '@dcloudio/uni-app'
  91. import Tabber from '@/components/tabber.vue'
  92. import NoData from '@/components/noData.vue'
  93. import { myRequest } from '@/utils/api.js'
  94. // 分段器当前索引
  95. const activeCurrent = ref(0)
  96. // 当前页
  97. const currentPage = ref(1)
  98. // 记录总条数
  99. const total = ref(0)
  100. // 分段器数组
  101. const controlList = ['全部', '待审核', '已拒绝', '已推送']
  102. // 预约记录数组
  103. const list = ref([])
  104. // 弹窗元素标记
  105. const popup = ref(null)
  106. // 弹窗详细信息
  107. const popObj = ref({})
  108. onLoad(() => {
  109. getData()
  110. })
  111. // 页面上拉到最底部时触发的回调
  112. onReachBottom(() => {
  113. if (total.value > list.value.length) {
  114. currentPage.value++
  115. getData()
  116. } else {
  117. uni.showToast({
  118. title: '没有更多数据了',
  119. icon: 'none'
  120. })
  121. }
  122. })
  123. // 获取预约记录数据
  124. const getData = async () => {
  125. const res = await myRequest({
  126. url: '/wanzai/api/smartVisitor/appointmentPageRecord',
  127. data: {
  128. currentPage: currentPage.value,
  129. pageCount: 6,
  130. userId: uni.getStorageSync('userId'),
  131. type: activeCurrent.value
  132. }
  133. })
  134. // console.log(res)
  135. total.value = res.data.totalCount
  136. list.value = [...list.value, ...res.data.list]
  137. }
  138. // 点击每一条预约记录时的回调
  139. const handleClick = (item) => {
  140. popObj.value = item
  141. popup.value.open()
  142. }
  143. // 切换分段器时的回调
  144. const onClickItem = (e) => {
  145. if (activeCurrent.value != e.currentIndex) {
  146. activeCurrent.value = e.currentIndex
  147. currentPage.value = 1
  148. list.value = []
  149. getData()
  150. }
  151. }
  152. // 点击取消按钮回调
  153. const handleCancel = () => {
  154. console.log('取消')
  155. }
  156. // 点击弹窗 x 图标时的回调
  157. const closePop = () => {
  158. popup.value.close()
  159. }
  160. </script>
  161. <style lang="scss" scoped>
  162. .container {
  163. box-sizing: border-box;
  164. padding-bottom: 30rpx;
  165. min-height: 100vh;
  166. background-color: #f1f6fe;
  167. .body {
  168. padding: 0 20rpx;
  169. .body_box {
  170. padding: 0 20rpx 0 30rpx;
  171. box-sizing: border-box;
  172. margin-top: 20rpx;
  173. width: 710rpx;
  174. border-radius: 15rpx;
  175. background-color: #fff;
  176. .box_title {
  177. display: flex;
  178. justify-content: space-between;
  179. align-items: center;
  180. height: 83rpx;
  181. font-size: 28rpx;
  182. border-bottom: 1rpx solid #e6e6e6;
  183. .title_msg {
  184. display: flex;
  185. align-items: center;
  186. .msg_name {
  187. font-weight: bold;
  188. }
  189. .msg_time {
  190. margin-left: 15rpx;
  191. color: #a6a6a6;
  192. font-size: 24rpx;
  193. }
  194. }
  195. .title_type {
  196. color: #0061ff;
  197. }
  198. .red {
  199. color: #d43030;
  200. }
  201. .green {
  202. color: #00baad;
  203. }
  204. }
  205. .box_info {
  206. display: flex;
  207. flex-direction: column;
  208. .info_box {
  209. display: flex;
  210. align-items: center;
  211. height: 65rpx;
  212. font-size: 24rpx;
  213. .box_key {
  214. width: 120rpx;
  215. color: #a6a6a6;
  216. }
  217. .box_value {
  218. flex: 1;
  219. margin-left: 95rpx;
  220. overflow: hidden;
  221. text-overflow: ellipsis;
  222. white-space: nowrap;
  223. }
  224. }
  225. }
  226. .box_btn {
  227. display: flex;
  228. justify-content: flex-end;
  229. align-items: center;
  230. height: 130rpx;
  231. border-top: 1rpx solid #e6e6e6;
  232. .button {
  233. display: flex;
  234. justify-content: center;
  235. align-items: center;
  236. width: 160rpx;
  237. height: 80rpx;
  238. color: #0061ff;
  239. font-size: 28rpx;
  240. border-radius: 10rpx;
  241. border: 1rpx solid #0061ff;
  242. }
  243. }
  244. }
  245. }
  246. .popup_box {
  247. padding-bottom: 50rpx;
  248. width: 710rpx;
  249. border-radius: 22rpx;
  250. background-color: #fff;
  251. .pop_header {
  252. display: flex;
  253. justify-content: center;
  254. align-items: center;
  255. position: relative;
  256. height: 94rpx;
  257. font-size: 28rpx;
  258. border-bottom: 1rpx solid #e6e6e6;
  259. .header_icon {
  260. position: absolute;
  261. top: 18rpx;
  262. right: 25rpx;
  263. font-size: 40rpx;
  264. }
  265. }
  266. .pop_info {
  267. display: flex;
  268. align-items: center;
  269. margin-top: 22rpx;
  270. padding: 0 35rpx;
  271. font-size: 28rpx;
  272. .info_key {
  273. color: #999999;
  274. }
  275. .info_value {
  276. }
  277. .blue {
  278. color: #0061ff;
  279. }
  280. .red {
  281. color: #d43030;
  282. }
  283. .green {
  284. color: #00baad;
  285. }
  286. }
  287. }
  288. }
  289. // 修改顶部分段器样式
  290. ::v-deep {
  291. .segmented-control {
  292. height: 100rpx;
  293. background-color: #fff;
  294. }
  295. }
  296. </style>