appointment-today.vue 1.8 KB
<template>
  <workbench-card title="今日预约" subtitle="我的预约客户" icon="el-icon-date" tone="green" :loading="loading">
    <div v-if="list.length" class="wb-list">
      <div
        v-for="item in list"
        :key="item.appointmentId || item.AppointmentId"
        class="wb-list-item"
      >
        <div class="wb-list-item__left">
          <span class="wb-list-item__dot" style="background:#10b981" />
          <span class="wb-list-item__title">
            {{ item.customerName || item.CustomerName || '无' }}
            <span class="wb-list-item__badge">{{ item.timeDisplay || item.TimeDisplay || '无' }}</span>
          </span>
        </div>
        <span class="wb-list-item__meta">{{ item.storeName || item.StoreName || '无' }}</span>
      </div>
    </div>
    <div v-else class="wb-empty">
      <div class="wb-empty__circle" style="background:#ecfdf5;color:#10b981">
        <i class="el-icon-date" />
      </div>
      <div class="wb-empty__title">今日暂无预约</div>
      <div class="wb-empty__desc">有预约客户时会显示在这里</div>
    </div>
  </workbench-card>
</template>

<script>
import request from '@/utils/request'
import WorkbenchCard from '../workbench-card.vue'

export default {
  name: 'WidgetAppointmentToday',
  components: { WorkbenchCard },
  data() {
    return { loading: false, list: [] }
  },
  mounted() {
    this.load()
  },
  methods: {
    async load() {
      this.loading = true
      try {
        const res = await request({
          url: '/api/Extend/LqYyjl/GetMyTodayAppointments',
          method: 'get'
        })
        this.list = (res.data || []).slice(0, 5)
      } catch (e) {
        this.list = []
      } finally {
        this.loading = false
      }
    }
  }
}
</script>

<style lang="scss" scoped>
@import '../widget-common.scss';
</style>