<template>
  <CommonPage show-footer :title="$route.title">
    <n-data-table
      class="mt-10"
      :loading="loading"
      :columns="columns"
      :data="data"
      :pagination="pagination"
      :bordered="false"
      remote
    />
  </CommonPage>
</template>

<script setup>
import api from './api'

// const queryData = ref({})

const loading = ref(false)

const columns = ref([])

const data = ref([])

const pagination = ref({
  page: 1,
  pageSize: 10,
  itemCount: 0,
  onChange: (page) => {
    pagination.value.page = page
    getList()
  },
})

onMounted(() => {
  getList()
})

const getList = async () => {
  loading.value = true
  // const query_data = {
  //   Status: queryData.value.status || '',
  //   Phone: queryData.value.word || '',
  //   StartTime: queryData.value.time === null ? '' : queryData.value.time[0] || '',
  //   EndTime: queryData.value.time === null ? '' : queryData.value.time[1] || '',
  // }
  const res = await api.suyuanData({
    pageNum: pagination.value.page,
    pageSize: pagination.value.pageSize,
    // ...query_data,
  })

  data.value = res.data.data || []
  pagination.value.itemCount = res.data.total
  // cardData.value.total = res.data.all
  // cardData.value.service = res.data.audit_number
  // cardData.value.commission = res.data.audit_commission
  // cardData.value.count = res.data.success_amount
  loading.value = false
}
</script>

<style lang="scss" scoped></style>
