<template>
  <el-dialog title="选择客户类型" :visible.sync="dialogVisible" width="500px" append-to-body
             :close-on-click-modal="false">
    <div class="customer-type-selector">
      <div class="type-card" @click="selectType('personal')">
        <div class="card-icon">
          <i class="el-icon-user"></i>
        </div>
        <div class="card-content">
          <div class="card-title">个人客户</div>
          <div class="card-desc">个人客户利率定价</div>
        </div>
      </div>
      <div class="type-card" @click="selectType('corporate')">
        <div class="card-icon">
          <i class="el-icon-office-building"></i>
        </div>
        <div class="card-content">
          <div class="card-title">企业客户</div>
          <div class="card-desc">企业客户利率定价</div>
        </div>
      </div>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: "CustomerTypeSelector",
  props: {
    visible: {
      type: Boolean,
      default: false
    }
  },
  data() {
    return {}
  },
  computed: {
    dialogVisible: {
      get() {
        return this.visible
      },
      set(val) {
        this.$emit('update:visible', val)
      }
    }
  },
  methods: {
    selectType(type) {
      this.$emit('select', type)
      this.dialogVisible = false
    }
  }
}
</script>

<style scoped>
.customer-type-selector {
  display: flex;
  gap: 20px;
  padding: 20px 0;
}

.type-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
}

.type-card:hover {
  border-color: #409EFF;
  background-color: #f0f7ff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(64, 158, 255, 0.2);
}

.card-icon {
  font-size: 48px;
  color: #409EFF;
  margin-bottom: 15px;
}

.card-content {
  text-align: center;
}

.card-title {
  font-size: 18px;
  font-weight: 500;
  color: #303133;
  margin-bottom: 8px;
}

.card-desc {
  font-size: 14px;
  color: #909399;
}
</style>
