| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547 |
- <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">/{{ 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">{{ item.visitorType === 1 ? '学生家长预约' : '其他访客预约' }}</view>
- </view>
- <view class="info_box">
- <view class="box_key">来访时间</view>
- <view class="box_value">{{ item.visitorTime }}</view>
- </view>
- <view class="info_box">
- <view class="box_key">访问事由</view>
- <view class="box_value">{{ item.visitReason }}</view>
- </view>
- <view class="info_box">
- <view class="box_key">{{ item.visitorType === 1 ? '受访学生' : '受访人' }}</view>
- <view class="box_value">{{ item.respondentName }}</view>
- </view>
- </view>
- <view class="box_btn" v-if="item.statuStr == '待审核'">
- <view class="button reject" @click.stop="handleReject(item)">拒绝</view>
- <view class="button agree" @click.stop="handleAgree(item)">同意</view>
- </view>
- </view>
- </view>
- <!-- 悬浮设置按钮区域 -->
- <view class="set" @click="handleClickSet" v-if="showSet">
- <uni-icons type="gear-filled" size="18"></uni-icons>
- 设置
- </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.visitorType === 1 ? '学生家长预约' : '其他访客预约' }}</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">{{ 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.carNum : '无' }}</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 class="pop_btn" v-if="popObj.statuStr == '待审核'">
- <view class="button reject" @click="handleReject(popObj)">拒绝</view>
- <view class="button agree" @click="handleAgree(popObj)">同意</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'
- // 分段器当前索引
- const activeCurrent = ref(0)
- // 当前页
- const currentPage = ref(1)
- // 记录总条数
- const total = ref(0)
- // 分段器数组
- const controlList = ['待审核', '已拒绝', '进校核销', '出校核销', '已完成']
- // 待办记录
- const list = ref([])
- // 弹窗元素标记
- const popup = ref(null)
- // 弹窗详细信息
- const popObj = ref({})
- // 是否展示设置按钮
- const showSet = ref(false)
- // 配置信息
- const configInfo = ref({})
- onLoad(() => {
- getConfig()
- getData()
- })
- // 页面上拉到最底部时触发的回调
- onReachBottom(() => {
- if (total.value > list.value.length) {
- currentPage.value++
- getData()
- } else {
- uni.showToast({
- title: '没有更多数据了',
- icon: 'none'
- })
- }
- })
- // 获取配置信息
- const getConfig = async () => {
- const res = await myRequest({
- url: '/wanzai/api/smartVisitorParentsConfig/getUserId',
- data: {
- userId: uni.getStorageSync('userInfo').id
- }
- })
- // console.log(res)
- if (res.code == 200) {
- showSet.value = true
- const result = JSON.parse(decryptDes(res.data))
- // console.log(result)
- configInfo.value = result
- }
- }
- // 获取到访代办数据
- const getData = async () => {
- let type
- if (activeCurrent.value == 0) {
- type = 1
- } else if (activeCurrent.value == 1) {
- type = 2
- } else if (activeCurrent.value == 2) {
- type = 7
- } else if (activeCurrent.value == 3) {
- type = 8
- } else if (activeCurrent.value == 4) {
- type = 9
- }
- const res = await myRequest({
- url: '/wanzai/api/smartVisitor/visitingAgencys',
- data: {
- currentPage: currentPage.value,
- pageCount: 6,
- userId: uni.getStorageSync('userInfo').id,
- type
- }
- })
- // console.log(res)
- const result = res.data
- total.value = result.totalCount
- list.value = [...list.value, ...(result.list || [])]
- }
- // 切换分段器时的回调
- const onClickItem = (e) => {
- if (activeCurrent.value != e.currentIndex) {
- activeCurrent.value = e.currentIndex
- currentPage.value = 1
- list.value = []
- getData()
- }
- }
- // 点击每一条待办记录时的回调
- const handleClick = (item) => {
- popObj.value = item
- popup.value.open()
- }
- // 点击拒绝按钮回调
- const handleReject = (info) => {
- handleExamine(info, 2)
- }
- // 点击同意按钮回调
- const handleAgree = (info) => {
- handleExamine(info, 4)
- }
- // 审核回调
- const handleExamine = (info, type) => {
- uni.showModal({
- title: '提示',
- content: type == 4 ? '确定同意吗?' : '确定拒绝吗?',
- success: (res) => {
- if (res.confirm) {
- if (info.visitorType == 1) {
- // 学生家长预约审核
- handleExamineReq(info.id, type)
- } else {
- // 其他访客预约审核
- handleExamineReq_other(info.id, type)
- }
- }
- }
- })
- }
- // 学生家长预约审核请求
- const handleExamineReq = async (id, type) => {
- const res = await myRequest({
- url: '/wanzai/api/smartVisitor/parentsAudit',
- data: {
- id,
- type
- }
- })
- // console.log(res)
- uni.showToast({
- title: type == 4 ? '已同意该审核' : '已拒绝该审核',
- icon: 'success',
- duration: 2000
- })
- setTimeout(() => {
- list.value = []
- currentPage.value = 1
- getData()
- }, 2000)
- }
- // 其他访客预约审核请求
- const handleExamineReq_other = async (id, type) => {
- const res = await myRequest({
- url: '/wanzai/api/smartVisitor/restsAudit',
- data: {
- id,
- type
- }
- })
- // console.log(res)
- uni.showToast({
- title: type == 4 ? '已同意该审核' : '已拒绝该审核',
- icon: 'success',
- duration: 2000
- })
- setTimeout(() => {
- list.value = []
- currentPage.value = 1
- getData()
- }, 2000)
- }
- // 点击弹窗 x 图标时的回调
- const closePop = () => {
- popup.value.close()
- }
- // 点击悬浮设置按钮时的回调
- const handleClickSet = () => {
- let info = JSON.stringify(configInfo.value)
- uni.navigateTo({
- url: `/pagesReservation/set/set?info=${info}`
- })
- }
- </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: 146rpx;
- height: 80rpx;
- color: #fff;
- font-size: 28rpx;
- border-radius: 10rpx;
- }
- .reject {
- background-color: #d43030;
- }
- .agree {
- margin-left: 28rpx;
- width: 214rpx;
- background-color: #0061ff;
- }
- }
- }
- }
- .set {
- position: fixed;
- bottom: 310rpx;
- right: 0;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 169rpx;
- height: 83rpx;
- font-size: 28rpx;
- border-radius: 110rpx 0 0 110rpx;
- box-shadow: 0 2rpx 9rpx rgba(0, 0, 0, 0.25);
- background-color: #fff;
- }
- .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;
- margin-top: 22rpx;
- padding: 0 35rpx;
- font-size: 28rpx;
- .info_key {
- color: #999999;
- }
- .info_value {
- flex: 1;
- }
- .blue {
- color: #0061ff;
- }
- .red {
- color: #d43030;
- }
- .green {
- color: #00baad;
- }
- }
- .pop_btn {
- display: flex;
- justify-content: flex-end;
- align-items: center;
- margin-top: 28rpx;
- padding-top: 40rpx;
- box-sizing: border-box;
- height: 129rpx;
- border-top: 1rpx solid #e6e6e6;
- .button {
- display: flex;
- justify-content: center;
- align-items: center;
- width: 146rpx;
- height: 80rpx;
- color: #fff;
- font-size: 28rpx;
- border-radius: 10rpx;
- }
- .reject {
- background-color: #d43030;
- }
- .agree {
- margin-left: 28rpx;
- margin-right: 36rpx;
- width: 214rpx;
- background-color: #0061ff;
- }
- }
- }
- }
- // 修改顶部分段器样式
- ::v-deep {
- .segmented-control {
- height: 100rpx;
- background-color: #fff;
- }
- }
- </style>
|