<template>
	<view class="page__view">

		<navbar title="我的团队" leftClick @leftClick="$utils.navigateBack" color="#191919" bgColor="#FFFFFF" />

		<view class="main">

      <view class="tabs">
        <uv-tabs 
          :list="tabs" 
          :current="current"
          :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">
        <view class="flex list-item" v-for="item in list" :key="item.id">
          <view class="avatar">
            <image class="img" :src="item.avatar" mode="scaleToFill"></image>
          </view>
          <view>{{ item.name }}</view>
        </view>
      </view>

    </view>

  </view>
  
</template>

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

  export default {
		mixins: [mixinsList],
    data() {
      return {
        tabs: [
          { name: '直推用户列表' },
          { name: '间推用户列表' },
        ],
				mixinsListApi: '',
        current: 0,
      }
    },
    onShow() {
      console.log('onShow')
    },
    onLoad(arg) {
      this.clickTabs({ index: arg.index || 0 })
    },
    methods: {
      // todo: delete
      getData() {
        this.list = [
          {
            id: '001',
            avatar: '/static/image/temp-30.png',
            name: '李世海',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '002',
            avatar: '/static/image/temp-30.png',
            name: '周静',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '003',
            avatar: '/static/image/temp-30.png',
            name: '周海',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '004',
            avatar: '/static/image/temp-30.png',
            name: '冯启彬',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '005',
            avatar: '/static/image/temp-30.png',
            name: '李娉',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '006',
            avatar: '/static/image/temp-30.png',
            name: '李书萍',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '007',
            avatar: '/static/image/temp-30.png',
            name: '李世海',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '008',
            avatar: '/static/image/temp-30.png',
            name: '周静',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '009',
            avatar: '/static/image/temp-30.png',
            name: '周海',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '010',
            avatar: '/static/image/temp-30.png',
            name: '冯启彬',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '011',
            avatar: '/static/image/temp-30.png',
            name: '李娉',
            price: 10,
            createTime: '2025-07-15',
          },
          {
            id: '012',
            avatar: '/static/image/temp-30.png',
            name: '李书萍',
            price: 10,
            createTime: '2025-07-15',
          },
        ]
      },
			//点击tab栏
			clickTabs({ index }) {
        console.log('clickTabs')
        this.current = index

				if (index == 0) {
					delete this.queryParams.status
				} else {
					this.queryParams.status = index - 1
				}
				this.getData()
			},
    },
  }
</script>

<style scoped lang="scss">
  .page__view {
		width: 100vw;
		min-height: 100vh;
		background-color: $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 {
    background: #FFFFFF;
    border-radius: 32rpx;
    overflow: hidden;

    &-item {
      margin-top: 16rpx;
      padding: 16rpx 32rpx;
      font-size: 28rpx;
      color: #333333;
      background: #FFFFFF;
      border-bottom: 2rpx solid #F1F1F1;
      justify-content: flex-start;
      column-gap: 24rpx;

      &:last-child {
        border: none;
      }

      .avatar {
        width: 72rpx;
        height: 72rpx;
        border-radius: 50%;
        overflow: hidden;
        
        .img {
          width: 100%;
          height: 100%;
        }
      }
    }
  }
</style>