<template>
  <Dialog  v-model="dialogVisible" :title="dialogTitle" width="70%">
      <BalanceRecord :default-user-id="userId"/>
  </Dialog>
</template>

<script setup lang="ts" name="BalanceRecordTable">
import BalanceRecord from '@/views/member/balanceRecord/index.vue'
defineOptions({ name: 'BalanceRecordTable' })

const props = defineProps({
  defaultUserId: {
    type: Number,
  },
})

const userId = ref(props.defaultUserId)
const { t } = useI18n() // 国际化
const dialogVisible = ref(false) // 弹窗的是否展示
const dialogTitle = ref('') // 弹窗的标题

/** 打开弹窗 */
const open = async (type: string, id?: number) => {
  userId.value = id
  dialogVisible.value = true
  dialogTitle.value = t('member.balanceRecord.' + type)
}
defineExpose({ open }) // 提供 open 方法，用于打开弹窗
</script>
