<template>
  <div class="member-details">
    <div class="gap10 title">
      <div class="line_vertical"></div>
      <div class="">{{ $t('personalCenter.openMembershipDetails') }}</div>
    </div>
    <ul class="member-details-list">
      <li v-for="(item, index) in list" :key="index">
        <div class="member-details-list-t flex-center-between">
          <div class="">{{ $t('personalCenter.goumaishichang') }}：{{ item.description }}</div>
          <div class="">{{ item.amount }}{{ $t('common.baomibi') }}</div>
        </div>
        <div class="member-details-list-b flex-center-between">
          <!-- <div class="">{{ $t('personalCenter.youxiaoqi') }}：2026-01-01至2026-02-01</div> -->
          <div class="">{{ $t('personalCenter.zhifushijian') }}：{{ item.createTime }}</div>
        </div>
      </li>
    </ul>
    <template v-if="list.length">
      <Pagination :total="form.total" :page-size="form.pageSize" :current-page="form.pageNum"
        @page-change="handlePageChange" />
    </template>
    <el-empty v-else :description="$t('common.empty')" />
  </div>
</template>
<script setup lang="ts">
import Pagination from '@/components/Pagination.vue'
import { ref, onMounted } from 'vue'
import { orderList } from '@/api/my.js'
const form = ref({
  pageNum: 1,
  pageSize: 10,
  total: 0,
  orderTypeMenu:2,
  orderType:'member_recharge',
  isAsc:'desc',
  orderByColumn:'orderId'
})

const list = ref([])

const getList = async () => {
  let res = await orderList(form.value);
  form.value.total = res?.total;
  list.value = res?.rows || [];
}
const handlePageChange = (page, pageSize) => {
  list.value = []
  form.value.pageNum = page;
  if(pageSize)form.value.pageSize = pageSize;
  getList()
}
onMounted(() => {
  getList()
})
</script>
<style scoped lang="scss">
  ul,li {
    margin: 0;
    padding: 0;
  }
.member-details {
  padding-bottom: 20px;

  .title {
    height: 60px;
    font-size: 20px;
    font-weight: bold;
    color: #333333;
  }

  .member-details-list {
    li {
      padding: 16px;
      margin-bottom: 16px;
      background: #F5F7FA;
      border-radius: 16px;

      &:last-child {
        margin-bottom: 0;
      }

      .member-details-list-t {
        margin-bottom: 8px;

        div {
          font-size: 16px;

          &:last-child {
            color: #F52929;
          }
        }
      }

      .member-details-list-b {
        div {
          font-size: 14px;
          color: #666666;
        }
      }
    }
  }
}
</style>