<template>
  <div>
    <el-card shadow="always" :body-style="{ padding: '20px' }">
      <el-tabs v-model="activeName" class="demo-tabs" @tab-change="handChange">
        <el-tab-pane label="充值订单" name="recharge">
          <rechargeList v-if="activeName == 'recharge'"></rechargeList>
        </el-tab-pane>
        <el-tab-pane label="退款订单" name="refund">
          <refundList v-if="activeName == 'refund'"></refundList>
        </el-tab-pane>
      </el-tabs>
    </el-card>
  </div>
</template>

<script lang="ts" setup>
import { useRouter, useRoute } from 'vue-router'
import type { TabsPaneContext } from 'element-plus'
import rechargeList from "./tabs/rechargeList/index.vue"
import refundList from "./tabs/refundList/index.vue"
const router = useRouter()
const route = useRoute()
const handChange = (tab: TabsPaneContext, event: Event) => {
  router.push({ path: '/orders/order', query: { tab } })
  activeName.value = tab
}
const activeName = ref('recharge')
onMounted(() => {
  activeName.value = route.query.tab || 'recharge'
});
</script>

<style scoped lang="scss"></style>
