<template>
  <div class="dashboard-card">
    <div class="card-header">
      <h3>销售实时进度</h3>
    </div>
    <div class="progress-content">
      <div class="center-progress" v-if="salesData.company_real_time_progress && salesData.company_real_time_progress.length > 0">
        <div class="center-item" v-for="center in salesData.company_real_time_progress" :key="center.center_leader">
          <div class="progress-text">
            <p>{{ center.center_leader }}团队加微{{ center.plus_v_count }}个，今日通话{{ center.total_call_count }}通，成交{{ center.total_turnover_count }}单。</p>
          </div>
        </div>
      </div>
      <div class="no-data" v-else>
        <p>暂无实时进度数据</p>
      </div>
    </div>
  </div>
</template>

<script setup>
import { defineProps } from 'vue';

defineProps({
  salesData: Object
});
</script>

<style scoped>
.dashboard-card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  padding: 20px;
  display: flex;
  flex-direction: column;
  flex: 1;
  height: 350px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.card-header h3 {
  margin: 0;
  font-size: 18px;
}

.metric-periods {
  font-size: 14px;
  color: #666;
}

.user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.user-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.user-level {
  font-size: 12px;
  color: #666;
}

.progress-content {
  flex: 1;
  overflow-y: auto;
}

.center-progress {
  list-style: none;
  padding: 0;
  margin: 0;
}

.center-item {
  padding: 8px 0;
  border-bottom: 1px solid #eee;
}

.center-item:last-child {
  border-bottom: none;
}

.progress-text p {
  margin: 0;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}

.no-data {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #999;
  font-size: 14px;
}
</style>