<template> <view class="check-message-detail"> <view class="title-area"> <view class="text"> <text v-show="!isManager">您的访客申请{{status}}</text> <text v-show="!isManager && status === '已提交'" class="text">请耐心等待管理员审核</text> </view> <view v-show="!isManager" :class="item.status === '未通过' ? 'button-area' : item.status === '已通过' ? 'button-area pass' : 'button-area submit'">申请{{item.status}}</view> </view> <view class="content" v-for="item in list" :key="item.id"> <view class="title" v-if="isManager ? true : item.id === 'phone' || item.id === 'name' ? false : true" >{{item.name}}</view> <view class="value" v-if="isManager ? true : item.id === 'phone' || item.id === 'name' ? false : true" >{{item.value}}</view> </view> <view class="button-area" v-if="isManager"> <view class="pass"> <view class="icon"></view> <view class="text" @click="handleClick(item, '已通过')">申请通过</view> </view> <view class="pass no-pass"> <view class="icon"></view> <view class="text" @click="handleClick(item, '已拒绝')">申请不通过</view> </view> </view> <u-modal :show="show" showConfirmButton showCancelButton :content='content' :closeOnClickOverlay="true" @confirm="confirm" @cancel="cancel" @close="cancel" ></u-modal> </view> </template> <script> export default { data() { return { isManager: false, show: false, //控制模态框显隐 content: '', //模态框显示内容 list: [ { id: 'odd', name: '申请单号', value: '1111111111' }, { id: 'number', name: '申请者工号', value: '1111111111' }, { id: 'name', name: '申请者姓名', value: '张三' }, { id: 'phone', name: '申请者手机号', value: '12345678912' }, { id: 'visitorName', name: '访客姓名', value: '12345678912' }, { id: 'visitorKey', name: '访客身份证', value: '123456789126415897' }, { id: 'visitorPhone', name: '访客联系方式', value: '123456789126415897' }, { id: 'aim', name: '访问目的', value: '商务会议' }, { id: 'area', name: '访问区域', value: '一期主楼' }, { id: 'time', name: '访问时间', value: '2022-12-12 05:45:12 ~ 2022-16-78 15:45:36' }, { id: 'remark', name: '备注', value: '1212' }, ], status: '已提交', } }, methods: { handleClick(value, text) { let index = this.list.findIndex(item => item.id === 'odd'); if(index !== -1) { let number = this.list[index].value; this.content = `单号${number}访客访客申请${text}`; this.show = true; } else { wx.showToast({ title: '找不到单号', icon: 'none', duration: 1000, }) } }, //点击模态框取消按钮 cancel() { this.show = false; }, //点击模态框确认按钮 confirm() { wx.reLaunch({ url: '/pages/message/message' }) } } } </script> <style lang="scss" scoped> .check-message-detail { padding: 40rpx; .title-area { display: flex; flex-direction: row; justify-content: space-between; align-items: center; font-size: 32rpx; .text { display: flex; flex-direction: column; font-weight: 600; } .button-area { padding: 10rpx 16rpx; background-color: red; border-radius: 16rpx; } .pass { background-color: green; } .submit { background-color: blue; } } .content { display: flex; flex-direction: row; justify-content: space-between; align-items: center; .title { white-space: nowrap; margin-right: 60rpx; } } .button-area { display: flex; flex-direction: row; justify-content: center; align-items: center; margin-top: 60rpx; .pass { width: fit-content; padding: 10rpx 20rpx; background-color: green; border-radius: 16rpx; cursor: pointer; margin-right: 60rpx; } .no-pass { background-color: red; cursor: pointer; } } } </style>