<template>
	<view class="page__view">

		<navbar title="成员管理" leftClick @leftClick="$utils.navigateBack" bgColor="#FFFFFF" />

		<view class="main">

      <view class="tabs">
        <uv-tabs 
          :list="tabs" 
          :current="queryParams.status"
          :scrollable="false" 
          lineColor="#00A9FF"
          lineWidth="48rpx"
          lineHeight="4rpx"
          :activeStyle="{
            'font-family': 'PingFang SC',
            'font-weight': 500,
            'font-size': '32rpx',
            'line-height': 1.4,
            'color': '#00A9FF',
          }" 
          :inactiveStyle="{
            'font-family': 'PingFang SC',
            'font-weight': 400,
            'font-size': '32rpx',
            'line-height': 1.4,
            'color': '#181818',
          }" 
          @click="clickTabs"
        ></uv-tabs>
      </view>

      <view class="list">
        <template v-if="queryParams.status == 0">
          <view class="list-item" v-for="item in list" :key="item.id">
            <memberApplyCard :data="item" @submitted="getData"></memberApplyCard>
          </view>
        </template>
        <template v-else>
          <view class="list-item" v-for="item in list" :key="item.id">
            <memberCard :data="item" ></memberCard>
          </view>
        </template>
      </view>

    </view>

  </view>
  
</template>

<script>
	import mixinsList from '@/mixins/list.js'

  import memberCard from './memberCard.vue'
  import memberApplyCard from './memberApplyCard.vue'

  export default {
		mixins: [mixinsList],
    components: {
      memberCard,
      memberApplyCard,
    },
    data() {
      return {
        tabs: [
          { name: '绑定申请' },
          { name: '已绑定' },
        ],
        queryParams: {
          pageNo: 1,
          pageSize: 10,
          status: 0, // 绑定状态(status)：0-确认中 1-已绑定 2-已拒绝
        },
				mixinsListApi: 'queryBindList',
      }
    },
    onShow() {
      console.log('onShow')
    },
    onLoad(arg) {
      this.clickTabs({ index: arg.index || 0 })
    },
    methods: {
			//点击tab栏
			clickTabs({ index }) {
        this.queryParams.status = index
				this.getData()
			},
    },
  }
</script>

<style scoped lang="scss">
  .page__view {
		width: 100vw;
		min-height: 100vh;
		background: $uni-bg-color;
		position: relative;

    /deep/ .nav-bar__view {
      position: fixed;
      top: 0;
      left: 0;
    }
  }

  .main {
    padding: calc(var(--status-bar-height) + 244rpx) 32rpx 40rpx 32rpx;

    .tabs {
      position: fixed;
      top: calc(var(--status-bar-height) + 120rpx);
      left: 0;
      width: 100%;
      height: 84rpx;
      background: #FFFFFF;
      z-index: 1;

      /deep/ .uv-tabs__wrapper__nav__line {
        border-radius: 2rpx;
      }

    }
	}


  .list {

    &-item {

      & + & {
        margin-top: 32rpx;
      }
    }
  }
</style>