<template>
  <view class="door-page">
    <!-- 顶部状态区域 -->
    <view class="status-section">
      <view class="status-icon closed">
        <view class="icon-lock">
          <view class="lock-body"></view>
          <view class="lock-hole"></view>
        </view>
      </view>
      <text class="status-title">柜门已关闭</text>
      <text class="status-desc">订单处理中，请稍候...</text>
    </view>

    <!-- 设备信息 -->
    <view class="info-card">
      <view class="info-row">
        <text class="info-label">设备编号</text>
        <text class="info-value">{{ deviceId }}</text>
      </view>
      <view class="info-row" v-if="flowId">
        <text class="info-label">流水号</text>
        <text class="info-value">{{ flowId }}</text>
      </view>
    </view>

    <!-- 提示信息 -->
    <view class="tips-card">
      <view class="tips-title">温馨提示</view>
      <view class="tips-list">
        <text class="tips-item">• 系统正在处理您的订单</text>
        <text class="tips-item">• 请在"我的订单"中查看订单状态</text>
        <text class="tips-item">• 如有问题请联系客服</text>
      </view>
    </view>

    <!-- 底部按钮 -->
    <view class="bottom-actions">
      <view class="btn-outline" @click="handleViewOrder">查看订单</view>
      <view class="btn-primary" @click="handleBack">返回首页</view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      deviceId: '',
      flowId: ''
    };
  },
  onLoad(options) {
    this.deviceId = options.device_id || '';
    this.flowId = options.flow_id || '';
  },
  methods: {
    handleViewOrder() {
      uni.navigateTo({ url: '/pages/order/order' });
    },
    handleBack() {
      uni.navigateBack({ delta: 10 });
    }
  }
};
</script>

<style scoped>
page {
  height: 100%;
  background-color: #f5f5f5;
}

.door-page {
  min-height: 100vh;
  background-color: #f5f5f5;
  display: flex;
  flex-direction: column;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom);
}

/* 状态区域 */
.status-section {
  background: linear-gradient(135deg, #faad14, #d48806);
  padding: 80rpx 40rpx 60rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.status-icon {
  width: 140rpx;
  height: 140rpx;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 32rpx;
}

.icon-lock {
  position: relative;
  width: 48rpx;
  height: 56rpx;
}

.lock-body {
  width: 48rpx;
  height: 36rpx;
  background: #fff;
  border-radius: 6rpx;
  position: absolute;
  bottom: 0;
}

.lock-hole {
  width: 28rpx;
  height: 24rpx;
  border: 5rpx solid #fff;
  border-radius: 14rpx 14rpx 0 0;
  border-bottom: none;
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
}

.status-title {
  font-size: 40rpx;
  font-weight: bold;
  color: #fff;
  margin-bottom: 16rpx;
}

.status-desc {
  font-size: 28rpx;
  color: rgba(255, 255, 255, 0.85);
}

/* 信息卡片 */
.info-card {
  background: #fff;
  margin: 30rpx;
  border-radius: 16rpx;
  padding: 10rpx 30rpx;
}

.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 28rpx 0;
  border-bottom: 1rpx solid #f0f0f0;
}

.info-row:last-child {
  border-bottom: none;
}

.info-label {
  font-size: 28rpx;
  color: #999;
}

.info-value {
  font-size: 28rpx;
  color: #333;
}

/* 提示卡片 */
.tips-card {
  background: #fff;
  margin: 0 30rpx 30rpx;
  border-radius: 16rpx;
  padding: 30rpx;
}

.tips-title {
  font-size: 30rpx;
  font-weight: bold;
  color: #333;
  margin-bottom: 20rpx;
}

.tips-list {
  display: flex;
  flex-direction: column;
  gap: 12rpx;
}

.tips-item {
  font-size: 26rpx;
  color: #666;
  line-height: 1.6;
}

/* 底部按钮 */
.bottom-actions {
  margin-top: auto;
  padding: 30rpx;
  display: flex;
  gap: 20rpx;
}

.btn-outline {
  flex: 1;
  background: #fff;
  color: #2979ff;
  font-size: 32rpx;
  font-weight: bold;
  text-align: center;
  padding: 28rpx;
  border-radius: 48rpx;
  border: 2rpx solid #2979ff;
}

.btn-primary {
  flex: 1;
  background: linear-gradient(135deg, #2979ff, #1e60e0);
  color: #fff;
  font-size: 32rpx;
  font-weight: bold;
  text-align: center;
  padding: 28rpx;
  border-radius: 48rpx;
}
</style>
