<template>
  <view class="container">
    <view class="result-area">
      <view class="result-icon">{{ success ? '✅' : '❌' }}</view>
      <view class="result-title">{{ success ? '预约成功' : '预约失败' }}</view>
      <view class="result-desc" v-if="success">
        <view>检查项目：{{ name }}</view>
        <view>预约日期：{{ date }}</view>
      </view>
      <view class="result-desc" v-else>
        <view>{{ msg }}</view>
      </view>
    </view>
    <view class="btn-area">
      <view class="btn-primary" @tap="goHome">返回首页</view>
      <view class="btn-warning" @tap="goMyList" style="margin-top: 20rpx;">查看我的预约</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return { success: false, date: '', name: '', msg: '' }
  },
  onLoad(options) {
    this.success = options.success === '1'
    this.date = options.date || ''
    this.name = decodeURIComponent(options.name || '')
    this.msg = decodeURIComponent(options.msg || '')
  },
  methods: {
    goHome() { uni.switchTab({ url: '/pages/index/index' }) },
    goMyList() { uni.switchTab({ url: '/pages/my/list' }) }
  }
}
</script>

<style scoped>
.result-area { text-align: center; padding: 100rpx 40rpx 60rpx; }
.result-icon { font-size: 120rpx; margin-bottom: 30rpx; }
.result-title { font-size: 40rpx; font-weight: 700; color: #333; margin-bottom: 30rpx; }
.result-desc { font-size: 28rpx; color: #666; line-height: 2; }
.btn-area { padding: 0 60rpx; }
</style>
