diff --git a/pages/order/components/GoodsInfo/index.vue b/pages/order/components/GoodsInfo/index.vue index 73d4b78..9937ead 100644 --- a/pages/order/components/GoodsInfo/index.vue +++ b/pages/order/components/GoodsInfo/index.vue @@ -37,8 +37,8 @@ defineProps({ createTime: "", contactName: "", contactPhone: "", - orderStatus: "0", // pending-待处理, completed-已完成, cancelled-已取消 - orderType: undefined, // 0-酒店订单, 1-门票订单, 2-其他订单, undefined-工单 + orderStatus: "0", // 订单状态 0-待支付 1-待确认 2-待使用 3-已取消 4-退款中 5-已退款 6-已完成 + orderType: undefined, // 0-酒店订单, 1-门票订单, 2-餐饮 }), }, }); diff --git a/pages/order/components/UserInfo/index.vue b/pages/order/components/UserInfo/index.vue index f922a2f..8fe66b5 100644 --- a/pages/order/components/UserInfo/index.vue +++ b/pages/order/components/UserInfo/index.vue @@ -1,13 +1,19 @@ @@ -40,9 +46,7 @@ const props = defineProps({ required: true, default: () => ({ createTime: "", - contactName: "", - contactPhone: "", - visitorName: "", // 游客姓名 + consumerInfoList: [], orderStatus: "0", // 订单状态 0-待支付 1-待确认 2-待使用 3-已取消 4-退款中 5-已关闭 6-已完成 orderType: "0", // 0-酒店订单, 1-门票订单, 2-餐饮 }), @@ -60,6 +64,31 @@ const contactLabel = computed(() => { const config = INFO_CONFIG[props.orderData.orderType] || INFO_CONFIG.default; return config.contactLabel; }); + +// 使用计算属性处理用户信息列表,提供更好的响应性和缓存 +const consumerList = computed(() => { + return props.orderData.consumerInfoList || []; +}); + +// 检查是否有用户数据 +const hasConsumerData = computed(() => { + return consumerList.value.length > 0; +}); + +// 生成更稳定的key值,优先使用唯一标识 +const getConsumerKey = (item, index) => { + return item.id || item.visitorName || `consumer-${index}`; +}; + +// 格式化电话号码显示 +const formatPhone = (phone) => { + if (!phone) return "未填写"; + // 简单的电话号码格式化,中间部分用*号隐藏 + if (phone.length === 11) { + return phone.replace(/(\d{3})\d{4}(\d{4})/, "$1****$2"); + } + return phone; +};