<template>
  <div class="container">
    <van-tabs
      type="card"
      @click="onClick"
      title-active-color="#fff"
      title-inactive-color="#2D476A"
      class="tab"
      background="#F8F8F8"
    >
      <van-tab title="人员拉新">
        <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
      <van-tab title="复购">
         <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
      <van-tab title="接受问询">
         <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
      <van-tab title="回复问询">
         <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
      <van-tab title="推券">
         <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
      <van-tab title="推活动">
         <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
      <van-tab title="推商品">
         <van-list v-model="writeOff" :finished="finished" @load="onLoad">
          <van-cell
            :value="item.number"
            class="content"
            v-for="(item, index) in newMemberList"
            :key="index"
            is-link
          >
            <template slot="title">
              <img src="../../../public/img/photo.png" alt="" />
              <span class="custom-title">{{ item.name }}</span>
            </template>
          </van-cell>
        </van-list>
      </van-tab>
    </van-tabs>
    <div class="main-menuBar">
      <div class="menuBar-menu" @click="menuBarClick('MainSale')">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['1']" />
        <div class="menuBar-title">活动</div>
      </div>
      <div class="menuBar-menu" @click="menuCase()">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['2']" />
        <div class="menuBar-title">案例</div>
      </div>
      <div class="menuBar-menu" @click="menuProfit()">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['3']" />
        <div class="menuBar-title">收益</div>
      </div>
      <div class="menuBar-menu" @click="menuTask()">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['4']" />
        <div class="menuBar-title menuBar-title-ac">任务</div>
      </div>
      <div class="menuBar-menu" @click="menuBarClick('Me')">
        <img class="menuBar-icon" :src="menuBarInfo.icon.now['5']" />
        <div class="menuBar-title">我的</div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      writeOff: false,
      finished: false,
      newMemberList: [
        {
          number: 100,
          src: "",
          name: "Solomon"
        }
      ],
      // 图标
      menuBarInfo: {
        list: {
          main: [
            {
              name: "",
              iconUaUrl: "",
              iconAcUrl: ""
            }
          ]
        },
        icon: {
          now: {
            "1": "",
            "2": "",
            "3": "",
            "4": "",
            "5": ""
          },
          ua: {
            "1": "/mainSale/icon-menuBar-1-ua.png",
            "2": "/mainSale/icon-menuBar-2-ua.png",
            "3": "/mainSale/icon-menuBar-3-ua.png",
            "4": "/mainSale/icon-menuBar-4-ua.png",
            "5": "/mainSale/icon-menuBar-5-ua.png"
          },
          ac: {
            "1": "/mainSale/icon-menuBar-1-ac.png",
            "2": "/mainSale/icon-menuBar-2-ac.png",
            "3": "/mainSale/icon-menuBar-3-ac.png",
            "4": "/mainSale/icon-menuBar-4-ac.png",
            "5": "/mainSale/icon-menuBar-5-ac.png"
          }
        }
      }
    };
  },
  created() {
    this.checkNowMenuBar();
  },
  methods: {
    onClick() {},
    onLoad() {
      // fetchSomeThing().catch(() => {
      this.writeOff = false;
      // })
    },
    // 导航
    checkNowMenuBar() {
      let inData = "4";
      this.menuBarInfo.icon.now = this.menuBarInfo.icon.ua;
      this.menuBarInfo.icon.now[inData] = this.menuBarInfo.icon.ac[inData];
    },
    menuBarClick(inData) {
      this.$router.push(inData);
    },
    listTaskClick() {
      this.$router.push("Task");
    },
    menuProfit() {
      this.$router.push({ path: "/profitList" });
    },
    menuTask() {
      this.$router.push({ path: "/taskList" });
    },
    menuCase() {
      this.$router.push({ path: "/case" });
    }
  }
};
</script>

<style scoped>
.container {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  height: auto;
}
.container >>> .van-tabs__wrap,
.van-tabs__wrap--scrollable {
  height: 40px;
}
.container >>> .van-tab,
.van-tab--active,
.van-ellipsis {
  line-height: 40px;
}
.content >>> .van-icon-arrow:before {
  margin-top: 10px;
  color: #2d476a;
}
.content >>> .van-cell__value {
  font-size: 14px;
  font-weight: 400;
  color: rgba(45, 71, 106, 1);
  line-height: 44px;
}
.custom-title {
  margin-left: 12px;
  font-size: 16px;
  font-weight: bold;
  color: rgba(45, 71, 106, 1);
}
.content img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  vertical-align: middle;
}
.tab >>> .van-tabs__nav--card .van-tab {
  border-right: none;
}
.tab >>> .van-tab.van-tab--active {
  background-color: #75b2fd;
}
.tab >>> .van-tabs__nav--card {
  margin: 0;
  border: none;
  height: 40px;
}
.tab >>> .van-tabs__nav,
.van-tabs__nav--card {
  margin: 0;
}
.main-menuBar {
  /*border: 1px solid darkviolet;*/
  box-shadow: inset 0px 1px 2px 0px rgba(221, 221, 221, 1);
  width: 100%;
  height: 82px;
  position: fixed;
  bottom: 0px;
  left: 0px;
  background-color: #fafafa;
  padding: 0px 14px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}
.menuBar-menu {
  /*background-color: greenyellow;*/
  width: 48px;
  height: 47px;

  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}
.menuBar-icon {
  width: 24px;
  height: 24px;
  object-fit: cover;
}
.menuBar-title {
  width: auto;
  height: 12px;
  font-size: 10px;
  font-weight: bold;
  color: rgba(67, 119, 188, 0.4);
  text-align: center;
}
.menuBar-title-ac {
  color: rgba(67, 119, 188, 1);
}
</style>
