<template>
  <!-- 首页：流程概览 -->
  <div v-if="currentStep === 0" class="home-entry">
    <h3 class="title"><el-image :src="homeIcon" class="homeIcon" />免费入驻店铺</h3>
    <div class="steps-container">
      <el-steps align-center>
        <el-step v-for="(item, index) in entryList" :key="index">
          <template #title>
            <div class="step-title-wrapper">
              <span class="step-title">{{ item.title }}</span>
              <span class="step-time">{{ item.time }}</span>
            </div>
          </template>
          <template #description>
            <div class="step-desc">
              {{ item.desc }}
            </div>
          </template>
        </el-step>
      </el-steps>
    </div>
    <div class="button-container">
      <el-button type="primary" size="large" class="register-btn" @click="handleRegister"> 去入驻 </el-button>
    </div>
  </div>
</template>
<script setup lang="ts">
import { ref, defineProps, defineEmits } from "vue";
import homeIcon from "../../../assets/images/home-icon.png";

const entryList = ref([
  {
    title: "个人实名",
    time: "约3分钟",
    desc: "填写店铺经营者姓名、身份证号等"
  },
  {
    title: "填写信息",
    time: "约30分钟",
    desc: "上传营业执照及填写店铺信息等"
  },
  {
    title: "等待审核",
    time: "约1-3个工作日",
    desc: "平台进行资质审核"
  },
  {
    title: "入驻成功",
    desc: "入驻成功后即可管理您的店铺"
  }
]);

const props = defineProps({
  currentStep: {
    type: Number,
    default: 0
  }
});

const emit = defineEmits(["update:currentStep"]);

// 处理入驻按钮
const handleRegister = () => {
  emit("update:currentStep", 1);
};
</script>

<style scoped lang="scss">
// 首页样式
.home-entry {
  box-sizing: border-box;
  width: 100%;
  height: calc(100vh - 105px);
  overflow: hidden;
  background: url("../../../assets/images/home-bg.png") center center no-repeat;
  background-size: cover;
  .title {
    display: flex;
    align-items: center;
    height: 105px;
    font-size: 20px;
    font-weight: 600;
    color: #ffffff;
    background: linear-gradient(90deg, #6c8ff8 0%, rgb(255 255 255 / 0%) 100%);
    border-radius: 10px;
    .homeIcon {
      width: 76px;
      height: 76px;
      margin-right: 8px;
      margin-left: 25px;
    }
  }
  .steps-container {
    margin-top: 120px;
    margin-bottom: 60px;
    :deep(.el-steps) {
      .el-step__head {
        .el-step__icon {
          width: 30px;
          height: 30px;
          font-size: 16px;
          font-weight: 600;
          color: #ffffff;
          background: #6c8ff8;
          border: 0;
        }
        .el-step__line {
          border: 1px solid #6c8ff8;
        }
      }
      .el-step__title {
        .step-title-wrapper {
          display: flex;
          flex-direction: column;
          gap: 8px;
          align-items: center;
          .step-title {
            padding-top: 15px;
            font-size: 16px;
            font-weight: 600;
            line-height: 1.5;
            color: #6c8ff8;
          }
          .step-time {
            display: inline-block;
            padding: 4px 12px;
            font-size: 12px;
            color: #909399;
            white-space: nowrap;
            background: #f5f7fa;
            border-radius: 12px;
          }
        }
      }
      .el-step__description {
        .step-desc {
          margin-top: 8px;
          font-size: 14px;
          line-height: 1.5;
          color: #606266;
        }
      }
    }
  }
  .button-container {
    display: flex;
    align-items: center;
    justify-content: center;
    .register-btn {
      width: 200px;
      height: 44px;
      font-size: 16px;
      font-weight: 500;
      background: #6c8ff8;
      border: 0;
      border-radius: 4px;
      outline: none;
    }
  }
}
</style>
