<template>
  <AdminTablePage
    eyebrow="SITE LEADS"
    title="咨询线索"
    description="跟进官网预约演示、价格页咨询和套餐意向，优先处理高价值线索。"
    primary-action="新增线索"
    :columns="columns"
    :rows="rows"
    :loading="loading"
    :status-options="statusOptions"
    @refresh="load"
  />
</template>
<script setup>
import { onMounted, ref } from 'vue'
import AdminTablePage from './AdminTablePage.vue'
import { getAdminLeads } from '@/api/request/site'
const columns = [
  { key: 'name', label: '联系人' },
  { key: 'phone', label: '手机号' },
  { key: 'clinic_name', label: '诊所名称' },
  { key: 'city', label: '城市' },
  { key: 'plan_code', label: '意向套餐', type: 'tag', map: { starter: '基础版', growth: '增长版', enterprise: '连锁版' } },
  { key: 'source_page', label: '来源页面', type: 'tag' },
  { key: 'remark', label: '备注' }
]
const statusOptions = [{ label: '增长版', value: 'growth' }, { label: '基础版', value: 'starter' }, { label: '连锁版', value: 'enterprise' }]
const rows = ref([])
const loading = ref(false)
const load = async () => {
  loading.value = true
  rows.value = await getAdminLeads().catch(() => [])
  loading.value = false
}
onMounted(load)
</script>
