<template>
  <div class="mobile-detail-info">
    <!-- 基本信息 -->
    <div class="mobile-form__section">
      <div class="mobile-form__section-title">基本信息</div>
      <div class="mobile-info-list">
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">线索名称</span>
          <span class="mobile-info-row__value">{{ clue.name || '-' }}</span>
        </div>
        <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.telephone || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">邮箱</span>
          <span class="mobile-info-row__value">{{ clue.email || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">地址</span>
          <span class="mobile-info-row__value">{{ clue.areaName || '' }} {{ clue.detailAddress || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">QQ</span>
          <span class="mobile-info-row__value">{{ clue.qq || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">微信</span>
          <span class="mobile-info-row__value">{{ clue.wechat || '-' }}</span>
        </div>
        <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_INDUSTRY" :value="clue.industryId" />
          </span>
        </div>
        <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_LEVEL" :value="clue.level" />
          </span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">下次联系时间</span>
          <span class="mobile-info-row__value">{{ formatDate(clue.contactNextTime) || '-' }}</span>
        </div>
        <div class="mobile-info-row" v-if="clue.remark">
          <span class="mobile-info-row__label">备注</span>
          <span class="mobile-info-row__value">{{ clue.remark }}</span>
        </div>
      </div>
    </div>

    <!-- 系统信息 -->
    <div class="mobile-form__section">
      <div class="mobile-form__section-title">系统信息</div>
      <div class="mobile-info-list">
        <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" v-if="clue.contactLastContent">
          <span class="mobile-info-row__label">最后跟进记录</span>
          <span class="mobile-info-row__value">{{ clue.contactLastContent }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">最后跟进时间</span>
          <span class="mobile-info-row__value">{{ formatDate(clue.contactLastTime) || '-' }}</span>
        </div>
        <div class="mobile-info-row">
          <span class="mobile-info-row__label">创建人</span>
          <span class="mobile-info-row__value">{{ clue.creatorName || '-' }}</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 class="mobile-info-row">
          <span class="mobile-info-row__label">更新时间</span>
          <span class="mobile-info-row__value">{{ formatDate(clue.updateTime) || '-' }}</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script lang="ts" setup>
import * as ClueApi from '@/api/crm/clue'
import { DICT_TYPE } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'

defineOptions({ name: 'CrmClueDetailsInfo' })
const { clue } = defineProps<{
  clue: ClueApi.ClueVO // 线索明细
}>()
</script>

<style lang="scss" scoped>
.mobile-detail-info {
  padding: 12px;
  background: #f5f7fa;
}
.mobile-form__section {
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}
.mobile-form__section-title {
  font-size: 15px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}
.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;
    word-break: break-all;
  }
}
</style>
