<template>
  <view class="pay-order-redirect">
    <text class="redirect-text">正在跳转订单详情...</text>
  </view>
</template>

<script>
export default {
  name: "PayOrderRedirectPage",
  onLoad(options) {
    let reservationId = options.id || "";

    if (!reservationId && options.item) {
      try {
        const item = JSON.parse(decodeURIComponent(options.item));
        reservationId = item && item.id ? String(item.id) : "";
      } catch (e) {
        reservationId = "";
      }
    }

    if (!reservationId) {
      uni.showToast({ title: "订单信息缺失", icon: "none" });
      setTimeout(() => {
        uni.navigateBack();
      }, 800);
      return;
    }

    uni.redirectTo({
      url: `/pages/order/pay_order_detail?id=${reservationId}`,
    });
  },
};
</script>

<style scoped>
.pay-order-redirect {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #cbe6ff 0%, #f6faff 100%);
}

.redirect-text {
  color: #3b4a6b;
  font-size: 28rpx;
}
</style>
