feat: 订单详情也接口字段对接

This commit is contained in:
duanshuwen
2025-07-31 13:38:12 +08:00
parent b527e6d206
commit 283530c0e2
3 changed files with 69 additions and 21 deletions

View File

@@ -10,11 +10,11 @@
</view>
<view class="order-item">
<text class="label">支付方式</text>
<text class="value">{{ orderData.payWay }}</text>
<text class="value">{{ payWayText }}</text>
</view>
<view class="order-item amount">
<text class="label">实际支付金额</text>
<text class="value">¥{{ orderData.payAmt }}</text>
<text class="value">{{ formattedAmount }}</text>
</view>
<button class="reserve-button">再次预定</button>
<text class="feedback">投诉反馈</text>
@@ -22,24 +22,42 @@
</template>
<script setup>
import { defineProps } from "vue";
import { defineProps, computed } from "vue";
defineProps({
// 支付方式映射常量
const PAY_WAY_MAP = {
0: "微信",
1: "支付宝",
2: "云闪付",
};
const props = defineProps({
orderData: {
type: Object,
required: true,
default: () => ({
id: "",
createTime: "",
contactName: "",
contactPhone: "",
orderStatus: "0", // pending-待处理, completed-已完成, cancelled-已取消
orderType: undefined, // 0-酒店订单, 1-门票订单, 2-其他订单, undefined-工单
orderId: "",
paySerialNumber: "",
payWay: "", // 支付方式 0-微信 1-支付宝 2-云闪付
payAmt: "",
orderStatus: "0", // 订单状态 0-待支付 1-待确认 2-待使用 3-已取消 4-退款中 5-已关闭 6-已完成
orderType: "0", // 0-酒店订单, 1-门票订单, 2-餐饮
}),
},
});
// 使用计算属性缓存支付方式文本
const payWayText = computed(() => {
return PAY_WAY_MAP[props.orderData.payWay] || "未知支付方式";
});
// 格式化金额显示
const formattedAmount = computed(() => {
const amount = props.orderData.payAmt;
return amount ? `¥${parseFloat(amount).toFixed(2)}` : "¥0.00";
});
</script>
<style scoped>
@import "./styles/index.scss";
</style>
</style>

View File

@@ -1,8 +1,8 @@
<template>
<view class="user-info mb12">
<view class="user-info-title">游客信息</view>
<view class="user-info-title">{{ infoTitle }}</view>
<view class="user-info-item">
<text class="label">联系游客</text>
<text class="label">{{ contactLabel }}</text>
<text class="value">{{ orderData.visitorName }}</text>
</view>
<view class="user-info-item">
@@ -13,24 +13,55 @@
</template>
<script setup>
import { defineProps } from "vue";
import { defineProps, computed } from "vue";
defineProps({
// 订单类型常量
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: () => ({
id: "",
createTime: "",
contactName: "",
contactPhone: "",
orderStatus: "0", // pending-待处理, completed-已完成, cancelled-已取消
orderType: undefined, // 0-酒店订单, 1-门票订单, 2-其他订单, undefined-工单
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>
</style>