<template>
  <section class="AppCreditPoints">
    <AiTabPanes :tabs="tabList" v-model="tabIndex"/>
    <family-rank v-if="tabIndex == 0" :showDetail="showDetail"/>
    <user-rank v-if="tabIndex == 1" :showDetail="showDetail"/>
    <sys-user-integral v-if="tabIndex==2"/>
  </section>
</template>
<script>
import {mapState} from 'vuex'
import userRank from './components/userRank.vue'
import familyRank from './components/familyRank.vue'
import SysUserIntegral from "./components/sysUserIntegral";

export default {
  name: "AppCreditPoints",
  appName: "我的积分",
  computed: {
    ...mapState(['user', 'token'])
  },
  components: {SysUserIntegral, userRank, familyRank},
  data() {
    return {
      tabList: ['家庭积分', '个人积分', "员工积分"],
      tabIndex: 0,
      showDetail: true
    }
  },
  onLoad(options) {
    if (options.type == 'detail') {
      this.showDetail = true
    }
    uni.setNavigationBarTitle({
      title: options.title
    })
  },
  onReachBottom() {
    uni.$emit("reachBottom")
  },
  onShow() {
    uni.$emit("onShow")
  },
  methods: {
    tabClick(index) {
      this.tabIndex = index
    }
  },
}
</script>
<style scoped lang="scss">
.AppCreditPoints {
  width: 100vw;
  overflow-x: hidden;
  background-color: #f3f6f9;
  min-height: 100vh;
}
</style>
