<template>
  <el-card shadow="always" :body-style="{ padding: '20px' }">
    <div class="wrapper">
      <div class="row">
        <div class="item"><span class="label">用户ID：</span><span class="content">{{ userInfo.uid }}</span></div>
        <div class="item"><span class="label">会员：</span><span class="content">{{ userInfo.vip_text }}</span></div>
        <div class="item"><span class="label">会员到期时间：</span><span class="content">{{ userInfo.vip_end }}</span></div>
      </div>
      <div class="row">
        <div class="item"><span class="label">小程序：</span><span class="content">{{ userInfo.ju_chang }}</span></div>
        <div class="item"><span class="label">看剧币：</span><span class="content">{{ userInfo.charge_coin }}</span></div>
        <div class="item"><span class="label">赠币：</span><span class="content">{{ userInfo.reward_coin }}</span></div>
      </div>
      <div class="row">
        <div class="item"><span class="label">染色注册时间：</span><span class="content">{{ userInfo.ranse_start_at }}</span>
        </div>
      </div>
    </div>
  </el-card>
  <el-tabs v-model="activeName" @tab-change="handChange">
    <el-tab-pane label="阅读记录" name="readLog">
      <readLogTable v-if="activeName == 'readLog'" :primary="props.primary"></readLogTable>
    </el-tab-pane>

    <el-tab-pane label="充值记录" name="recharge">
      <rechargeTable v-if="activeName == 'recharge'" :primary="props.primary"></rechargeTable>
    </el-tab-pane>

    <el-tab-pane label="消耗记录" name="consume">
      <consumeTable v-if="activeName == 'consume'" :primary="props.primary"></consumeTable>
    </el-tab-pane>
  </el-tabs>
</template>

<script lang="ts" setup>
import { wechatMinUserInfo } from '@/api/orders/index';
import { useGetList } from '@/hook/curd/useGetList';
import rechargeTable from './tables/recharge.vue'
import consumeTable from './tables/consume.vue'
import readLogTable from './tables/readLog.vue'
import { ref } from 'vue'
import type { TabsPaneContext } from 'element-plus'
const props = defineProps({
  primary: Object,
});
const userInfo = ref({});

const activeName = ref('readLog')

const handChange = (tab: TabsPaneContext, event: Event) => {
  activeName.value = tab
}
onMounted(() => {
  wechatMinUserInfo(props.primary.uid).then(res => {
    userInfo.value = res.data;
  });
})

</script>

<style lang="scss" scoped>
.wrapper {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  width: 100%;

  .row {
    width: 100%;
    display: flex;

    .item {
      margin: 9px;

      .label {
        font-size: 16px;
      }

      .content {
        font-size: 18px;
        font-weight: 600;
      }
    }
  }

}
</style>
