<template>
  <view class="bg-white rounded-[10px] p-[12px]">
    <view class="flex mb-8 font-size-12">
      <text class="w-60 text-[#99a0ae]">订单编号</text>
      <text class="text-[#525866]">{{ orderData.orderId }}</text>
    </view>
    <view class="flex mb-8 font-size-12">
      <text class="w-60 text-[#99a0ae]">下单时间</text>
      <text class="text-[#525866]">{{ orderData.createTime }}</text>
    </view>
    <view class="flex font-size-12">
      <text class="w-60 text-[#99a0ae]">支付状态</text>
      <text :class="[
        {
          'text-[#ff3d60]': statusCode === '0' || statusCode === '3',
          'color-21B466': ['1', '2', '4', '5', '6'].includes(statusCode),
        },
      ]">
        {{ statusText }}
      </text>
    </view>
  </view>
</template>

<script setup>
import { defineProps, computed } from "vue";

const props = defineProps({
  orderData: {
    type: Object,
    required: true,
    default: () => ({
      orderId: "",
      paySerialNumber: "",
      payWay: "", // 支付方式 0-微信 1-支付宝 2-云闪付
      payAmt: "",
      orderStatus: "0", // 订单状态 0-待支付 1-待确认 2-待使用 3-已取消 4-退款中 5-已关闭 6-已完成
      orderType: "0", // 0-酒店订单, 1-门票订单, 2-餐饮
    }),
  },
});
const statusCode = computed(() => props.orderData.orderStatus);

// 使用计算属性缓存支付方式文本
const statusText = computed(() =>
  statusCode.value === "0" || statusCode.value === "3" ? "未支付" : "已支付"
);
</script>

<style scoped lang="scss"></style>
