68 lines
1.7 KiB
Vue
68 lines
1.7 KiB
Vue
<template>
|
||
<view class="user-info mb12">
|
||
<view class="user-info-title">{{ infoTitle }}</view>
|
||
<view class="user-info-item">
|
||
<text class="label">{{ contactLabel }}</text>
|
||
<text class="value">{{ orderData.visitorName }}</text>
|
||
</view>
|
||
<view class="user-info-item">
|
||
<text class="label">联系电话:</text>
|
||
<text class="value">{{ orderData.contactPhone }}</text>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script setup>
|
||
import { defineProps, computed } from "vue";
|
||
|
||
// 订单类型常量
|
||
const ORDER_TYPES = {
|
||
HOTEL: "0", // 酒店订单
|
||
TICKET: "1", // 门票订单
|
||
DINING: "2", // 餐饮订单
|
||
};
|
||
|
||
// 信息配置映射
|
||
const INFO_CONFIG = {
|
||
[ORDER_TYPES.HOTEL]: {
|
||
title: "订房信息",
|
||
contactLabel: "联系房客:",
|
||
},
|
||
default: {
|
||
title: "游客信息",
|
||
contactLabel: "联系游客:",
|
||
},
|
||
};
|
||
|
||
const props = defineProps({
|
||
orderData: {
|
||
type: Object,
|
||
required: true,
|
||
default: () => ({
|
||
createTime: "",
|
||
contactName: "",
|
||
contactPhone: "",
|
||
visitorName: "", // 游客姓名
|
||
orderStatus: "0", // 订单状态 0-待支付 1-待确认 2-待使用 3-已取消 4-退款中 5-已关闭 6-已完成
|
||
orderType: "0", // 0-酒店订单, 1-门票订单, 2-餐饮
|
||
}),
|
||
},
|
||
});
|
||
|
||
// 使用计算属性缓存信息标题
|
||
const infoTitle = computed(() => {
|
||
const config = INFO_CONFIG[props.orderData.orderType] || INFO_CONFIG.default;
|
||
return config.title;
|
||
});
|
||
|
||
// 使用计算属性缓存联系人标签
|
||
const contactLabel = computed(() => {
|
||
const config = INFO_CONFIG[props.orderData.orderType] || INFO_CONFIG.default;
|
||
return config.contactLabel;
|
||
});
|
||
</script>
|
||
|
||
<style scoped>
|
||
@import "./styles/index.scss";
|
||
</style>
|