Files
pj_h5_cloud/src/pages/integrated/visitor/detail.vue
T
2025-09-16 12:03:32 +08:00

115 lines
3.8 KiB
Vue

<template>
<crud-layout title="详情" mainIsScroll bg="/static/page/blue-bg.png">
<view v-if="detail.id">
<view class="h-20rpx" />
<tm-alert v-if="alertList[detail.checkStatus]" :showClose="false" skin="normal" :color="alertList[detail.checkStatus].color">
{{ alertList[detail.checkStatus].text }}
</tm-alert>
<tm-sheet :margin="[0, 20]" class="second-text-30">
<tm-text class="prefix_title" font-size="32">访客信息</tm-text>
<view class="flex mt-1">
<text class="w-220rpx mr-6">访客姓名</text>
<text>{{ detail.name }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">访客手机号</text>
<text>{{ detail.mobile }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">来访公司名称</text>
<text>{{ detail.companyName }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">来访原因</text>
<text>{{ visitorReasonList.find((item) => item.id == detail.reasonValue)?.title || "" }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">接待人</text>
<text>{{ detail.userName }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">来访人数</text>
<text>{{ detail.peopleNumber }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">是否可随行人员</text>
<text>{{ detail.isOtherPeople == "1" ? "是" : "否" }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">是否可驾驶车辆</text>
<text>{{ detail.isDrive == "1" ? "是" : "否" }}</text>
</view>
</tm-sheet>
<tm-sheet :margin="[0, 20]" class="second-text-30">
<tm-text class="prefix_title" font-size="32">时间</tm-text>
<view class="flex mt-1">
<text class="w-220rpx mr-6">预计来访时间</text>
<text>{{ detail.vendDate }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">预计离开时间</text>
<text>{{ detail.vstartDate }}</text>
</view>
</tm-sheet>
<tm-sheet :margin="[0, 20]" class="second-text-30">
<tm-text class="prefix_title" font-size="32">其他</tm-text>
<view class="flex mt-1">
<text class="w-220rpx mr-6">创建方式</text>
<text>{{ detail.type == "1" ? "主动申请" : detail.type == "2" ? "邀约" : "后台创建" }}</text>
</view>
<view class="flex mt-1">
<text class="w-220rpx mr-6">提交时间</text>
<text>{{ detail.createTime }}</text>
</view>
</tm-sheet>
</view>
<view class="h-40rpx" />
</crud-layout>
</template>
<script setup lang="ts">
import { ref } from "vue"
import { onLoad } from "@dcloudio/uni-app"
import { invitationApi } from "@/sheep/api"
const alertList = {
1: { color: "#f5a623", text: "访客未接受邀约" },
2: { color: "#2db7f5", text: "访客待到访" },
3: { color: "#52c41a", text: "访客拒绝了邀约" },
5: { color: "#f5222d", text: "访客取消了邀约" },
}
const detail = ref<any>({})
const visitorReasonList = ref<{ title: string; id: string }[]>([])
onLoad(async (options: any) => {
const id = options.id
try {
uni.showLoading({ title: "加载中..." })
const { code, data, msg } = await invitationApi.getInvitationDetail(id)
if (code != 0) return uni.showToast({ title: msg || "获取详情失败", icon: "none" })
detail.value = data
} catch (error: any) {
uni.showToast({ title: error.message, icon: "none" })
} finally {
uni.hideLoading()
}
await getVisitorReasonList()
})
// 获取拜访原因列表
const getVisitorReasonList = async () => {
const { code, data } = await invitationApi.getDictListByType("1")
if (code == 0 && data) {
visitorReasonList.value = data.map((item: any) => ({ title: item.label, id: item.value }))
return
}
visitorReasonList.value = []
}
</script>