<template>
  <div class="mobile-detail-header" v-loading="loading">
    <!-- 标题和操作按钮 -->
    <div class="mobile-detail-header__top">
      <div class="mobile-detail-header__title">{{ clue.name }}</div>
      <div class="mobile-detail-header__actions">
        <slot></slot>
      </div>
    </div>
    <!-- 关键信息卡片 -->
    <div class="mobile-detail-header__card">
      <div class="mobile-info-list">
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">线索来源</span>
          <span class="mobile-info-row__value">
            <dict-tag :type="DICT_TYPE.CRM_CUSTOMER_SOURCE" :value="clue.source" />
          </span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">手机</span>
          <span class="mobile-info-row__value">{{ clue.mobile || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">负责人</span>
          <span class="mobile-info-row__value">{{ clue.ownerUserName || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">创建时间</span>
          <span class="mobile-info-row__value">{{ formatDate(clue.createTime) || '-' }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import { DICT_TYPE } from '@/utils/dict'
import * as ClueApi from '@/api/crm/clue'
import { formatDate } from '@/utils/formatTime'

defineOptions({ name: 'CrmClueDetailsHeader' })
defineProps<{
  clue: ClueApi.ClueVO // 线索信息
  loading: boolean // 加载中
}>()
</script>

<style lang="scss" scoped>
.mobile-detail-header {
  padding: 12px;
  background: #f5f7fa;
}
.mobile-detail-header__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  gap: 12px;
}
.mobile-detail-header__title {
  font-size: 18px;
  font-weight: 600;
  color: #303133;
  flex: 1;
  word-break: break-all;
}
.mobile-detail-header__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}
.mobile-detail-header__card {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.mobile-info-list {
  font-size: 13px;
}
.mobile-info-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid #f5f5f5;
  &:last-child {
    border-bottom: none;
  }
  &__label {
    color: #909399;
    flex-shrink: 0;
    margin-right: 12px;
  }
  &__value {
    color: #303133;
    text-align: right;
  }
}
</style>
