<template>
  <el-table v-loading="loading" :data="tableData" :stripe="true" class="m-t-20px">
    <el-table-column label="标题" align="center" prop="title" />
    <el-table-column label="描述" align="center" prop="description" />
    <el-table-column label="获得积分点" align="center" prop="point" />
    <el-table-column label="剩余点数" align="center" prop="totalPoint" />
    <el-table-column
      label="发生时间"
      align="center"
      prop="createTime"
      :formatter="dateFormatter"
      width="180px"
    />
  </el-table>

  <Pagination
    :total="total"
    v-model:page="queryParams.pageNo"
    v-model:limit="queryParams.pageSize"
    @pagination="getList"
  />
</template>

<script setup>
/* 积分变动记录 */
defineOptions({ name: 'PersonPointsChangeList'})
import { PersonInfoApi } from '@/api/menduner/system/person'
import { DICT_TYPE } from '@/utils/dict'
import { dateFormatter } from '@/utils/formatTime'

const props = defineProps({
  userId: String
})

const loading = ref(false)
const tableData = ref([])
const total = ref(0)
const queryParams = reactive({
  pageNo: 1,
  pageSize: 10,
  userId: props.userId
})

const getList = async () => {
  loading.value = true
  try {
    const data = await PersonInfoApi.getPersonAccountRecordPage(queryParams)
    tableData.value = data.list
    total.value = data.total
  } finally {
    loading.value = false
  }
}
getList()
</script>
