<template>
  <a-card :bordered="false" class="content-card">
    <template #title>物流总览</template>
    <template #extra>
      <a-button @click="loadLogistics">
        <template #icon><icon-refresh /></template>
        刷新
      </a-button>
    </template>
    <a-table :columns="logisticsColumns" :data="logistics" :pagination="{ pageSize: 8 }" :bordered="false" />
  </a-card>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { api } from '../../api'
import { IconRefresh } from '@arco-design/web-vue/es/icon'

const logistics = ref([])

const logisticsColumns = [
  { title: 'ID', dataIndex: 'id', width: 60 },
  { title: '订单号', dataIndex: 'orderNo', width: 160 },
  { title: '商家', dataIndex: 'merchantUsername', width: 100 },
  { title: '状态', dataIndex: 'status', width: 100 },
  { title: '备注', dataIndex: 'note', ellipsis: true },
  { title: '时间', dataIndex: 'createdAt', width: 160 }
]

const loadLogistics = async () => {
  logistics.value = await api.adminLogistics()
}

onMounted(() => {
  loadLogistics()
})
</script>

<style scoped>
.content-card {
  border-radius: 12px;
}

:deep(.arco-btn-primary) {
  background: linear-gradient(135deg, #722ed1 0%, #9254de 100%);
  border-color: transparent;
}

:deep(.arco-card-header) {
  border-bottom: 1px solid #f0f0f0;
}
</style>
