yeg
2 天以前 d8eaa16682cf180e9563d6be05fb43057daf6c07
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<script setup lang="ts">
import { computed, onMounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { ElMessage } from 'element-plus'
import { getServiceApplicationDetail, updateServiceApplicationStatus } from '../api/admin'
import type { ServiceApplication } from '../types/admin'
 
const route = useRoute()
const detail = ref<ServiceApplication>()
const loading = ref(false)
 
function text(value?: string | number) {
  return value === undefined || value === null || value === '' ? '-' : String(value)
}
 
function dateTimeText(value?: string | number) {
  return text(value).replace('T', ' ')
}
 
const cardholderInfo = computed(() => [
  { label: '持卡人姓名:', value: text(detail.value?.talentName) },
  { label: '手机号:', value: text(detail.value?.talentMobile) },
  { label: '人才等级:', value: text(detail.value?.talentLevel) },
])
 
const reservationInfo = computed(() => [
  { label: '酒店名称:', value: text(detail.value?.merchantName) },
  { label: '联系电话:', value: text(detail.value?.contactMobile) },
  { label: '房型:', value: text(detail.value?.productName) },
  { label: '期望入住时间:', value: text(detail.value?.expectedTime) },
  { label: '入住人数:', value: detail.value?.guestCount ? `${detail.value.guestCount}人` : '-' },
  { label: '提交时间:', value: dateTimeText(detail.value?.submittedAt) },
])
 
const statusInfo = computed(() => [
  { label: '状态:', value: text(detail.value?.status) },
  { label: '处理时间:', value: dateTimeText(detail.value?.handledAt) },
  { label: '处理人:', value: text(detail.value?.handlerName) },
])
 
const handled = computed(() => detail.value?.status === '已处理')
 
async function loadDetail() {
  loading.value = true
  try {
    detail.value = await getServiceApplicationDetail(String(route.params.id))
  } finally {
    loading.value = false
  }
}
 
async function markHandled() {
  detail.value = await updateServiceApplicationStatus(String(route.params.id), '已处理')
  ElMessage.success('已处理')
}
 
onMounted(loadDetail)
</script>
 
<template>
  <div v-loading="loading" class="hotel-reservation-detail-page">
    <section class="hotel-reservation-detail-panel">
      <div class="reservation-detail-section">
        <h3>持卡人信息</h3>
        <div class="reservation-detail-grid single-line">
          <div v-for="item in cardholderInfo" :key="item.label" class="reservation-detail-item">
            <span>{{ item.label }}</span>
            <strong>{{ item.value }}</strong>
          </div>
        </div>
      </div>
 
      <div class="reservation-detail-section">
        <h3>预约信息</h3>
        <div class="reservation-detail-grid reservation-grid">
          <div v-for="item in reservationInfo" :key="item.label" class="reservation-detail-item">
            <span>{{ item.label }}</span>
            <strong>{{ item.value }}</strong>
          </div>
        </div>
      </div>
 
      <div class="reservation-detail-section">
        <h3>状态信息</h3>
        <div class="reservation-detail-grid single-line">
          <div v-for="item in statusInfo" :key="item.label" class="reservation-detail-item">
            <span>{{ item.label }}</span>
            <strong>{{ item.value }}</strong>
          </div>
        </div>
      </div>
    </section>
 
    <el-button v-if="!handled" type="primary" class="reservation-detail-action" @click="markHandled">已处理</el-button>
  </div>
</template>