<template>
  <div class="white_bg burt-container">
    <a-tabs v-model="activeKey" @change="paneChange">
        <a-tab-pane v-for="pane in panes" :key="pane.key" :tab="pane.title">
            <component v-if="pane.show" :is="pane.content" 
              :companyOptions="companyOptions" :expressList="expressList"></component>
        </a-tab-pane>
    </a-tabs>
  </div>
</template>

<script>
import PaymentClaims from "./components/PaymentClaims.vue";
import Insurance from "./components/Insurance.vue";
import Verification from "./components/Verification.vue";
import CollectionRate from "./components/CollectionRate.vue";
import CollectionDays from "./components/CollectionDays.vue";
import PersonalFee from "./components/PersonalFee.vue";
import MaterialSupplement from "./components/MaterialSupplement.vue";
import AppealCase from "./components/AppealCase.vue";
import MailingList from "./components/MailingList.vue";
import PreAuth from "./components/PreAuth.vue";
import Benefit from "./components/Benefit.vue";
export default {
  data() {
    return {
      activeKey: '0',
      panes: [
        { title: "理赔数据", key: '0', show: true, content: 'PaymentClaims'},
        { title: "保险应收", key: '1', show: false, content: 'Insurance'},
        { title: "核销", key: '2', show: false, content: 'Verification'},
        { title: "回款率", key: '3', show: false, content: 'CollectionRate'},
        { title: "回款天数", key: '4', show: false, content: 'CollectionDays'},
        { title: "个人欠费", key: '5', show: false, content: 'PersonalFee'},
        { title: "材料补充", key: '6', show: false, content: 'MaterialSupplement'},
        { title: "申诉案件", key: '7', show: false, content: 'AppealCase'},
        { title: "寄送清单", key: '8', show: false, content: 'MailingList'},
        { title: "预授权", key: '9', show: false, content: 'PreAuth'},
        { title: "福利查询", key: '10', show: false, content: 'Benefit'}
      ],
      companyOptions: [], //保险公司
      expressList: [], //快递公司
    };
  },
  components: {
    PaymentClaims, Insurance, Verification, CollectionRate, CollectionDays,
    PersonalFee, MaterialSupplement, AppealCase, MailingList, PreAuth, Benefit
  },
  created() {
    let type = this.$route.query.type;
    if(type){
      this.activeKey = type;
      this.paneChange();
    }
    this._getCompanyOptions();
    this.getRefcdByRefgrp();
  },
  methods: {
    paneChange(){
      this.panes.forEach((item)=>{
          item.show = false;
      });
      this.panes[Number(this.activeKey)].show = true;
    },
    // 获取保险公司下拉选项
    _getCompanyOptions() {
      this.$apis.GETCOMPANYOPTIONS().then((res) => {
        this.companyOptions = res.content || [];
      });
    },
    // 获取快递列表
    getRefcdByRefgrp() {
      this.$apis.GETREFCDBYREFGRP({
        modid: "CI",
        refgrp: "SEND_COMPANY"
      }).then((res) => {
        this.expressList = res.content || [];
      });
    },
  },
};
</script>

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