| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397 |
- <template>
- <view class="container">
- <!-- 分段器区域 -->
- <uni-segmented-control :current="activeCurrent" :values="controlList" @clickItem="onClickItem" styleType="text" activeColor="#0061FF"></uni-segmented-control>
- <!-- 预约记录区域 -->
- <view class="body">
- <!-- 每一条预约记录区域 -->
- <view class="body_box" v-for="item in list" :key="item.id" @click="handleClick(item)">
- <view class="box_title">
- <view class="title_msg">
- <view class="msg_name">{{ item.userName }}</view>
- <view class="msg_time">/{{ time_format(item.createTime) }}</view>
- </view>
- <view class="title_type" v-if="item.statuStr == '待审核'">{{ item.statuStr }}</view>
- <view class="title_type red" v-if="item.statuStr == '已拒绝'">{{ item.statuStr }}</view>
- <view class="title_type green" v-if="item.statuStr == '已推送'">{{ item.statuStr }}</view>
- </view>
- <view class="box_info">
- <view class="info_box">
- <view class="box_key">来访时间</view>
- <view class="box_value">{{ time_format(item.visitorTime) }}</view>
- </view>
- <view class="info_box">
- <view class="box_key">访问事由</view>
- <view class="box_value">{{ item.visitReason }}</view>
- </view>
- </view>
- <view class="box_btn" v-if="item.statuStr == '待审核'">
- <view class="button" @click.stop="handleCancel(item.id)">取消预约</view>
- </view>
- </view>
- </view>
- <!-- 没有数据时展示的页面 -->
- <NoData v-if="!list.length" />
- <!-- 详情弹窗区域 -->
- <uni-popup ref="popup" type="center" :is-mask-click="false">
- <view class="popup_box">
- <!-- 弹窗标题区域 -->
- <view class="pop_header">
- 预约详情
- <view class="header_icon" @click="closePop">×</view>
- </view>
- <!-- 弹窗详细信息区域 -->
- <view class="pop_info">
- <view class="info_key">状态:</view>
- <view class="info_value blue" v-if="popObj.statuStr == '待审核'">{{ popObj.statuStr }}</view>
- <view class="info_value red" v-if="popObj.statuStr == '已拒绝'">{{ popObj.statuStr }}</view>
- <view class="info_value green" v-if="popObj.statuStr == '已推送'">{{ popObj.statuStr }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">访客姓名:</view>
- <view class="info_value">{{ popObj.userName }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">访客手机号:</view>
- <view class="info_value">{{ popObj.userPhone }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">来访时间:</view>
- <view class="info_value" v-if="popObj.visitorTime">{{ time_format(popObj.visitorTime) }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">证件号:</view>
- <view class="info_value">{{ popObj.userNumber || '暂无' }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">访问事由:</view>
- <view class="info_value">{{ popObj.visitReason }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">车牌号:</view>
- <view class="info_value">{{ popObj.carNum ? popObj.carNum : '暂无' }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">同行人数:</view>
- <view class="info_value">{{ popObj.peerNum ? popObj.peerNum : '暂无' }}</view>
- </view>
- <view class="pop_info">
- <view class="info_key">{{ popObj.visitorType == 1 ? '受访学生' : '受访人' }}:</view>
- <view class="info_value">{{ popObj.respondentName }}({{ popObj.responcode || popObj.respondentPhone }})</view>
- </view>
- </view>
- </uni-popup>
- <!-- 底部导航栏区域 -->
- <Tabber />
- </view>
- </template>
- <script setup>
- import { ref } from 'vue'
- import { onLoad, onReachBottom } from '@dcloudio/uni-app'
- import Tabber from '@/components/tabber.vue'
- import NoData from '@/components/noData.vue'
- import { myRequest } from '@/utils/api.js'
- import { decryptDes } from '@/utils/des.js'
- import { time_format } from '@/utils/formatTime.js'
- // 分段器当前索引
- const activeCurrent = ref(0)
- // 当前页
- const currentPage = ref(1)
- // 记录总条数
- const total = ref(0)
- // 分段器数组
- const controlList = ['全部', '待审核', '已拒绝', '进校核销', '出校核销', '已完成']
- // 预约记录数组
- const list = ref([])
- // 弹窗元素标记
- const popup = ref(null)
- // 弹窗详细信息
- const popObj = ref({})
- onLoad(() => {
- getData()
- })
- // 页面上拉到最底部时触发的回调
- onReachBottom(() => {
- if (total.value > list.value.length) {
- currentPage.value++
- getData()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- })
- // 获取预约记录数据
- const getData = async () => {
- let type
- if (activeCurrent.value == 0) {
- type = 0
- } else if (activeCurrent.value == 1) {
- type = 1
- } else if (activeCurrent.value == 2) {
- type = 2
- } else if (activeCurrent.value == 3) {
- type = 7
- } else if (activeCurrent.value == 4) {
- type = 8
- } else if (activeCurrent.value == 5) {
- type = 9
- }
- const res = await myRequest({
- url: '/wanzai/api/smartVisitor/appointmentPageRecord',
- data: {
- currentPage: currentPage.value,
- pageCount: 6,
- userId: uni.getStorageSync('userInfo').id,
- type
- }
- })
- // console.log(res)
- const result = JSON.parse(decryptDes(res.data))
- // console.log(result)
- total.value = result.totalCount
- list.value = [...list.value, ...result.list]
- }
- // 点击每一条预约记录时的回调
- const handleClick = (item) => {
- popObj.value = item
- popup.value.open()
- }
- // 切换分段器时的回调
- const onClickItem = (e) => {
- if (activeCurrent.value != e.currentIndex) {
- activeCurrent.value = e.currentIndex
- currentPage.value = 1
- list.value = []
- getData()
- }
- }
- // 点击取消按钮回调
- const handleCancel = (id) => {
- uni.showModal({
- title: '提示',
- content: '确定取消预约吗?',
- success: (res) => {
- if (res.confirm) {
- handleCancelReq(id)
- }
- }
- })
- }
- // 取消预约请求
- const handleCancelReq = async (id) => {
- const res = await myRequest({
- url: '/wanzai/api/smartVisitor/deleteSmartVisitorById',
- data: {
- id
- }
- })
- // console.log(res)
- uni.showToast({
- title: '取消预约成功',
- icon: 'none',
- duration: 2000
- })
- setTimeout(() => {
- currentPage.value = 1
- list.value = []
- getData()
- }, 2000)
- }
- // 点击弹窗 x 图标时的回调
- const closePop = () => {
- popup.value.close()
- }
- </script>
- <style lang="scss" scoped>
- .container {
- box-sizing: border-box;
- padding-bottom: 30rpx;
- min-height: 100vh;
- background-color: #f1f6fe;
- .body {
- padding: 0 20rpx;
- .body_box {
- padding: 0 20rpx 0 30rpx;
- box-sizing: border-box;
- margin-top: 20rpx;
- width: 710rpx;
- border-radius: 15rpx;
- background-color: #fff;
- .box_title {
- display: flex;
- justify-content: space-between;
- align-items: center;
- height: 83rpx;
- font-size: 28rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .title_msg {
- display: flex;
- align-items: center;
- .msg_name {
- font-weight: bold;
- }
- .msg_time {
- margin-left: 15rpx;
- color: #a6a6a6;
- font-size: 24rpx;
- }
- }
- .title_type {
- color: #0061ff;
- }
- .red {
- color: #d43030;
- }
- .green {
- color: #00baad;
- }
- }
- .box_info {
- display: flex;
- flex-direction: column;
- .info_box {
- display: flex;
- align-items: center;
- height: 65rpx;
- font-size: 24rpx;
- .box_key {
- width: 120rpx;
- color: #a6a6a6;
- }
- .box_value {
- flex: 1;
- margin-left: 95rpx;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
- }
- }
- .box_btn {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- height: 130rpx;
- border-top: 1rpx solid #e6e6e6;
- .button {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 160rpx;
- height: 80rpx;
- color: #0061ff;
- font-size: 28rpx;
- border-radius: 10rpx;
- border: 1rpx solid #0061ff;
- }
- }
- }
- }
- .popup_box {
- padding-bottom: 50rpx;
- width: 710rpx;
- border-radius: 22rpx;
- background-color: #fff;
- .pop_header {
- display: flex;
- justify-content: center;
- align-items: center;
- position: relative;
- height: 94rpx;
- font-size: 28rpx;
- border-bottom: 1rpx solid #e6e6e6;
- .header_icon {
- position: absolute;
- top: 18rpx;
- right: 25rpx;
- font-size: 40rpx;
- }
- }
- .pop_info {
- display: flex;
- box-sizing: border-box;
- margin-top: 22rpx;
- padding: 0 35rpx;
- width: 100%;
- font-size: 28rpx;
- .info_key {
- color: #999999;
- }
- .info_value {
- flex: 1;
- }
- .blue {
- color: #0061ff;
- }
- .red {
- color: #d43030;
- }
- .green {
- color: #00baad;
- }
- }
- }
- }
- // 修改顶部分段器样式
- ::v-deep {
- .segmented-control {
- height: 100rpx;
- background-color: #fff;
- }
- }
- </style>
|