<template>
    <div class="m-container">
        <h2>
          <el-page-header @back="onCancel" :content="teamName"></el-page-header>
        </h2>
        <el-tabs v-model.trim="activeIndex"
             type="card"
                    @tab-click="handleClick">
            <el-tab-pane label="学员缴费"
                        v-if="permission('/resetTeaming/teamBaseInfo')"
                        name="1">
                <resetPayList :isNewGropu="true"
                            :baseInfo="baseInfo" />
            </el-tab-pane>
            <el-tab-pane label="学校缴费"
                        v-if="permission('/resetTeaming/resetSound')"
                        name="2">
                <resetPayListSchool :isNewGropu="true"
                                    :baseInfo="baseInfo"
                                    v-if="activeIndex == 2" />
            </el-tab-pane>
        </el-tabs>
        <div style="text-align: right;">
            <el-button type="primary" @click="goHome">确定</el-button>
        </div>
    </div>
</template>

<script>
import resetPayList from "@/views/resetTeaming/components/resetPayList";
import resetPayListSchool from '@/views/resetTeaming/components/resetPayListSchool'
import { permission } from "@/utils/directivePage";
import { getTeamBaseInfo } from "@/api/buildTeam";
export default {
    name: 'createPayment',
    components: { resetPayList, resetPayListSchool },
    data () {
        const query = this.$route.query
        return {
            teamName: query.name,
            musicGroupId: query.id,
            activeIndex: '1',
            baseInfo: {}
        };
    },
    mounted() {
        // getTeamBaseInfo
        this.getList()
    },
    methods: {
        permission,
        handleClick (val) {
            this.activeIndex = val.name
        },
        onCancel() {
            this.$router.push({ path: "/business/teamDetail" });
        },
        async getList() {
            await getTeamBaseInfo({ musicGroupId: this.musicGroupId }).then((res) => {
                if (res.code == 200) {
                    this.baseInfo = res.data
                }
            });
        },
        goHome () {
            this.$store.dispatch('delVisitedViews', this.$route)
            this.$router.push({
                path: '/business/teamDetail',
            })
        }
    }
}
</script>