<template>
  <div>
    <el-row :gutter="10">
      <el-card header="账户明细" style="width: 100%;" shadow="never">
        <template #header>
          <CardTitle title="账户明细" />
        </template>
        <el-tabs>
          <el-tab-pane label="积分">
            <UserPointList :user-id="id" :enterprise-id="enterpriseId" />
          </el-tab-pane>
          <el-tab-pane label="余额">
            <UserBalanceList :user-id="id" :enterprise-id="enterpriseId" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </el-row>
  </div>

</template>
<script setup lang="ts">
import { useTagsViewStore } from '@/store/modules/tagsView'
import UserPointList from './UserPointList.vue'
import UserBalanceList from './UserBalanceList.vue'
import { CardTitle } from '@/components/Card/index'
import { ElMessage } from 'element-plus'

defineOptions({ name: 'MemberDetail' })

/** 初始化 */
const { currentRoute } = useRouter() // 路由
const { delView } = useTagsViewStore() // 视图操作
const route = useRoute()
const id = route.params.id
const enterpriseId = route.query.enterpriseId
onMounted(() => {
  if (!id || !enterpriseId) {
    ElMessage.warning('参数错误，会员编号不能为空！')
    delView(unref(currentRoute))
    return
  }
})
</script>