<template>
  <view class="content">
    <scroll-view class="left_scrol_style" scroll-x="false" scroll-y="true">
      <view class="top-lists">
        <view
          v-for="(item, index) in navList"
          v-show="item.menuKey != ''"
          :key="index"
          :class="navIndex == index ? 'styles' : ''"
          class="nav-view"
          @click="clickHref(index)"
        >
          {{ item.name }}
        </view>
      </view>
    </scroll-view>
    <direct v-if="navIndex == 0" ref="sgsyData" />
    <circulation v-if="navIndex == 1" ref="sgsyData" />
    <hignFans v-if="navIndex == 2" ref="sgsyData" />
  </view>
</template>

<script>
import * as mar from '@/config/market.js'
import direct from '@/components/invest/direct.vue'
import circulation from '@/components/invest/circulation.vue'
import hignFans from '@/components/invest/hignFans.vue'
import { formatMsToDate } from '@/util/index'
export default {
  components: { direct, hignFans, circulation },
  data() {
    return {
      navIndex: 0,
      navList: [
        { name: '直推列表', path: '0', menuKey: '' },
        { name: '三单循环', path: '0', menuKey: '' },
        { name: '免费注册', path: '0', menuKey: '' },
      ],
      queryParams: {
        pageNum: 1,
        pageSize: 50,
        memberInfo: '',
        startCreationTime: '',
        endCreationTime: '',
        pkRegisterGrade: '',
      },
      dataShow: false,
      timeIndex: 0,
      listShow: false,
      thegrade: '',
      value1: '',
      gradeList: [],
      dataList: [],
    }
  },
  onLoad() {
    // this.getOthers()
    // this.getDataList()
    this.getMenuLists()
  },
  async onReachBottom() {
    this.queryParams.pageNum + 1
    this.$refs.sgsyData.getDataList((this.queryParams.pageNum += 1))
  },
  methods: {
    clickHref(index) {
      this.navIndex = index
      this.queryParams.pageNum = 1
    },
    getMenuLists() {
      mar.menuList().then(res => {
        res.data.forEach(item => {
          if (item.menuKey == 'directList') {
            this.navList[0].menuKey = 'directList'
          }
          if (item.menuKey == 'attractDetailList') {
            this.navList[1].menuKey = 'attractDetailList'
          }
          if (item.menuKey == 'haiList') {
            this.navList[2].menuKey = 'haiList'
          }
        })
      })
    },
    getOthers() {
      mar.getGradeList().then(res => {
        this.gradeList = [res.data]
      })
    },
    getDataList() {
      mar.tripleCycleList(this.queryParams).then(res => {
        this.dataList = res.rows
      })
    },
    openDate(index) {
      this.timeIndex = index
      this.dataShow = true
    },
    confirm(e) {
      this.queryParams.pkRegisterGrade = e.value[0].pkId
      this.thegrade = e.value[0].gradeName
      this.listShow = false
    },
    getDate(e) {
      if (this.timeIndex == 1) {
        this.queryParams.endCreationTime = formatMsToDate(e.value)
      } else {
        this.queryParams.startCreationTime = formatMsToDate(e.value)
      }
      this.dataShow = false
    },
  },
}
</script>

<style lang="scss" scoped>
/*左侧分类视图*/
.left_scrol_style {
  white-space: nowrap;
  width: 100%;
}
.styles {
  border: none !important;
  color: #fff !important;
  background: #d61820;
}
.top-lists {
  width: 100%;
  display: flex;
  padding: 30rpx 30rpx 0 0;
  background-color: #fff;
  height: 80rpx;
  line-height: 80rpx;
  .nav-view {
    width: 200rpx;
    cursor: pointer;
    padding: 0 26rpx;
    height: 44rpx;
    border-radius: 10rpx;
    border: 1rpx solid #999999;
    font-size: 14rpx;
    text-align: center;
    line-height: 44rpx;
    margin-left: 20rpx;
    color: #999;
  }
}
.content {
  background: #f2f2f2;

  .seach {
    background: #fff;
    overflow: hidden;
    padding: 20rpx 23rpx;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    border-bottom: 2rpx solid #eee;

    .seach_i {
      padding: 0 20rpx;
      border-radius: 34rpx;
      background: #fff;
      flex: 1;
      background: #f5f6f8;
      // margin-right: 40rpx;
    }

    .neibox {
      display: flex;
      align-items: center;
      font-size: 26rpx;
      font-family: PingFang SC;
      font-weight: 400;
      color: #999999;
      margin-left: 20rpx;
    }
  }

  .timeSlide {
    display: flex;
    align-items: center;
    padding: 38rpx 26rpx;
    justify-content: space-between;
    background-color: #ffffff;

    .timeA {
      font-size: 26rpx;
      font-family: Source Han Sans CN;
      font-weight: 400;
      color: #333;
      margin-right: 46rpx;
    }

    .timeB {
      font-size: 24rpx;
      font-family: Arial;
      font-weight: 400;
      color: #999999;
      text-align: center;
    }

    .seatch_r {
      background: #fb3024;
      border-radius: 50%;
      padding: 8rpx;
      margin-left: 24rpx;
    }
  }

  .thecontent {
    background-color: #ffffff;
    margin-top: 25rpx;
    margin-bottom: 21rpx;
    padding: 10rpx 23rpx 30rpx 23rpx;

    .line_box {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-top: 25rpx;

      .line1 {
        font-size: 26rpx;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #999999;
      }

      .line2 {
        font-size: 26rpx;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: #333333;
      }

      .line3 {
        font-size: 26rpx;
        font-family: Source Han Sans CN;
        font-weight: 400;
        color: rgba(251, 48, 36, 1);
      }
    }
  }
}
</style>
