<template>
  <el-card>
    <template #header><div class="title">活动配置总览</div></template>
    <el-table :data="rows" border stripe>
      <el-table-column prop="id" label="活动编号" width="130" />
      <el-table-column prop="name" label="活动名称" min-width="180" />
      <el-table-column label="客群" min-width="160"><template #default="{ row }">{{ text(row.visibleCrowds) }} / {{ text(row.signupCrowds) }}</template></el-table-column>
      <el-table-column label="报名表单" min-width="140"><template #default="{ row }">{{ row.needExtraInfo ? `${row.extraForms?.length || 0}个表单` : '无' }}</template></el-table-column>
      <el-table-column label="达标规则" min-width="150"><template #default="{ row }">{{ row.progressEnabled ? `${row.progressStyle}` : '无' }}</template></el-table-column>
      <el-table-column label="互斥组" min-width="150"><template #default="{ row }">{{ row.mutexEnabled ? row.mutexGroup : '无' }}</template></el-table-column>
      <el-table-column label="发放计划" min-width="160"><template #default="{ row }">{{ row.reward?.grantPlan || row.reward?.name || '-' }}</template></el-table-column>
      <el-table-column label="通知" min-width="120"><template #default="{ row }">{{ [row.smsEnabled && '报名', row.beforeStartSmsEnabled && '开始前', row.rewardSmsEnabled && '发奖'].filter(Boolean).join('、') || '无' }}</template></el-table-column>
      <el-table-column label="投放" min-width="170"><template #default="{ row }">{{ text(row.launchChannels) }}</template></el-table-column>
      <el-table-column prop="updatedAt" label="更新时间" width="170" />
    </el-table>
  </el-card>
</template>
<script>
import activityStore from '@/store/activityStore'
export default {
  name: 'ActivityConfigOverview',
  computed: { rows() { return activityStore.activities } },
  methods: { text(v) { return Array.isArray(v) ? v.join('、') : v || '-' } }
}
</script>
<style scoped>.title{font-weight:600}</style>
