<template>
  <div class="ABtarage">
    <template v-if="BMDType && BMDType == 'BMD'">
      <HomeTarget ref="HomeTarget"></HomeTarget>
    </template>
    <template v-else>
      <p class="updataTime" v-if="userType != 4 && tabVal != '-1'">更新时间:{{ updataTime }}</p>
      <template v-if="tabVal == 0 || tabVal == 1">
        <div v-if="tabVal == 1 && userType != 4" class="container linep">
          <van-collapse v-model="activeNames">
            <!-- 拜访数据(实时) -->
            <van-collapse-item name="7" v-if="powerGrade == 1 && !GZdata">
              <template #title>
                <div>拜访数据(实时)</div>
                <!-- 工装不显示 -->
              </template>
              <visitedRealTime
                :reportTargetAll="reportTargetAll"
                :powerGrade="powerGrade"
                :JZQuota="JZQuota"></visitedRealTime>
            </van-collapse-item>
            <!-- 建店布机 -->
            <van-collapse-item name="2" v-if="!JZQuota && !GZdata" title="建店布机">
              <createStoreBJ :reportTargetAll="reportTargetAll"></createStoreBJ>
            </van-collapse-item>
            <!-- 下单点数 -->
            <van-collapse-item
              v-if="powerGrade == 1 && !JZQuota && !GZdata"
              name="33"
              title="下单点数">
              <placeOrder :reportTargetAll="reportTargetAll"></placeOrder>
            </van-collapse-item>
            <!-- 专业时时丽分销店下单 -->
            <van-collapse-item name="16" v-if="!JZQuota && !GZdata" title="专业时时丽分销店下单">
              <ZYPlaceOrder :reportTargetAll="reportTargetAll"></ZYPlaceOrder>
            </van-collapse-item>
          </van-collapse>
        </div>
        <div v-if="tabVal == 0 && userType != 4" class="container linep">
          <van-collapse v-model="activeNames">
            <!-- performanceSAP 业绩目标SAP(千元)/公裝业绩SAP(千元) -->
            <van-collapse-item v-if="userType != 3 && userType != 4" name="1" :title="saptitle">
              <performanceSAP
                :reportTargetAll="reportTargetAll"
                :JZQuota="JZQuota"></performanceSAP>
            </van-collapse-item>
            <van-collapse-item
              v-if="powerGrade != 1 && !JZQuota && !GZdata"
              name="4"
              title="质感外墙SAP(千元)">
              <zhiganwaiqiangSAP :reportTargetAll="reportTargetAll"></zhiganwaiqiangSAP>
            </van-collapse-item>
            <van-collapse-item
              v-if="powerGrade != 1 && !JZQuota && !GZdata"
              name="3"
              title="魔术漆SAP(千元)">
              <moshouqiSAP :reportTargetAll="reportTargetAll"></moshouqiSAP>
            </van-collapse-item>
            <van-collapse-item
              v-if="powerGrade != 1 && !JZQuota && !GZdata"
              name="28"
              title="防水+背胶SAP(千元)">
              <fangshuiSAP :reportTargetAll="reportTargetAll"></fangshuiSAP>
            </van-collapse-item>
            <van-collapse-item
              v-if="powerGrade != 1 && !JZQuota && !GZdata"
              name="27"
              title="内墙中高端SAP(千元)">
              <neiqiangzhonggaoduanSAP :reportTargetAll="reportTargetAll"></neiqiangzhonggaoduanSAP>
            </van-collapse-item>
            <!-- 内外墙平涂SAP -->
            <van-collapse-item
              name="2"
              v-if="powerGrade != 1 && !JZQuota && !GZdata"
              title="内外墙平涂SAP(千元)">
              <neiwaiqiangpingtu :reportTargetAll="reportTargetAll"></neiwaiqiangpingtu>
            </van-collapse-item>
            <van-collapse-item
              v-if="!JZQuota && !GZdata && [1, 4, 5].indexOf(powerGrade) !== -1"
              name="11"
              title="专业时时丽SAP(千元)">
              <ZYSAP :reportTargetAll="reportTargetAll"></ZYSAP>
            </van-collapse-item>
            <van-collapse-item
              v-if="!JZQuota && !GZdata && [1, 4, 5].indexOf(powerGrade) !== -1"
              name="29"
              :title="'瓷砖胶SAP(千元)'">
              <cizhuanjiaoSAP :reportTargetAll="reportTargetAll"></cizhuanjiaoSAP>
            </van-collapse-item>
            <van-collapse-item v-if="GZdata" name="43" title="纯态之家SAP(千元)">
              <chunTaiSAP :reportTargetAll="reportTargetAll"></chunTaiSAP>
            </van-collapse-item>
            <van-collapse-item v-if="GZdata" name="42" title="商机关联的质感外墙业绩SAP(千元)">
              <van-row style="margin-top: -10px">
                <van-col span="12"><span class="leftTitle">本月</span></van-col
                ><van-col span="12"><span class="rightTitle">本季</span></van-col>
                <van-col span="12"
                  ><p>
                    业绩实际:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzZgwqMonthAct)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    业绩实际:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzZgwqQuarterAct)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    业绩成长率:<span class="colorbalck"
                      >{{ reportTargetAll.gzZgwqMonthGrowRate }}%</span
                    >
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    业绩成长率:<span class="colorbalck"
                      >{{ reportTargetAll.gzZgwqQuarterGrowRate }}%</span
                    >
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
            <van-collapse-item v-if="GZdata" name="41" title="累计出货有效客户">
              <van-row>
                <!--            <van-col span="12"><span class="leftTitle">全年开户</span></van-col><van-col span="12"><span class="rightTitle">本月报备</span></van-col>-->
                <van-col span="12"
                  ><p>
                    全年实际:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzKhljYearAct)
                    }}</span>
                  </p></van-col
                >
                <!--            <van-col span="12" ><p>报备成功数:<span class="colorbalck">{{ Micrometer(reportTargetAll.gzBbMonthSuccessNum) }}</span></p></van-col>-->
                <!--            <van-col span="12"><p>&nbsp;</p></van-col>-->
                <van-col span="12"
                  ><p>
                    全年目标:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzKhljYearTarget)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"><p>&nbsp;</p></van-col>
                <van-col span="12"
                  ><p>
                    目标达成率:<span class="colorbalck"
                      >{{ Micrometer(reportTargetAll.gzKhljSuccessRate) }}%</span
                    >
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
            <van-collapse-item v-if="GZdata" name="40" title="今日拜访">
              <van-row style="margin-top: -10px">
                <van-col span="12"
                  ><p>
                    公装客户数:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzVisitCustomerNum)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    工地数:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzVisitGdNum)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    潜在客户数:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.gzVisitQzCustomerNum)
                    }}</span>
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
            <van-collapse-item v-if="JZQuota" name="23" title="展厅上样">
              <van-row>
                <van-col span="24"
                  ><p>
                    当月新增店数:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.exhibitionHallMonthAct)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    全年实际店数:<span class="colorbalck"
                      >{{ Micrometer(reportTargetAll.exhibitionHallYearAct) }}%</span
                    >
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    全年达成进度率:<span class="colorbalck"
                      >{{ reportTargetAll.exhibitionHallYearRate }}%</span
                    >
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
            <van-collapse-item v-if="JZQuota" name="22" title="基材粉料过账(千元)">
              <van-row>
                <van-col span="12"><span class="leftTitle">本月实际</span></van-col
                ><van-col span="12"><span class="rightTitle">本季实际</span></van-col>
                <van-col span="12"
                  ><p>
                    客户数:<span class="colorbalck">{{ reportTargetAll.jcPostCustomerMonth }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    客户数:<span class="colorbalck">{{
                      reportTargetAll.jcPostCustomerQuarter
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单数(包):<span class="colorbalck">{{
                      reportTargetAll.jcPostOrderNumMonth
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单数(包):<span class="colorbalck">{{
                      reportTargetAll.jcPostOrderNumQuarter
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单销售额:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.jcPostOrderPriceMonth)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单销售额:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.jcPostOrderPriceQuarter)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单率:<span class="colorbalck"
                      >{{ reportTargetAll.jcPostOrderRateMonth }}%</span
                    >
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单率:<span class="colorbalck"
                      >{{ reportTargetAll.jcPostOrderRateQuarter }}%</span
                    >
                  </p></van-col
                >
                <van-col span="24"><span class="leftTitle">年度累计实际</span></van-col>
                <van-col span="24"
                  ><p>
                    客户数:<span class="colorbalck">{{ reportTargetAll.jcPostCustomerYear }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p>
                    下单数(包):<span class="colorbalck">{{
                      reportTargetAll.jcPostOrderNumYear
                    }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p>
                    下单销售额:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.jcPostOrderPriceYear)
                    }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p>
                    下单率:<span class="colorbalck"
                      >{{ reportTargetAll.jcPostOrderRateYear }}%</span
                    >
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
            <van-collapse-item v-if="JZQuota" name="21" title="魔术漆过账(千元)">
              <van-row>
                <van-col span="12"><span class="leftTitle">本月实际</span></van-col
                ><van-col span="12"><span class="rightTitle">本季实际</span></van-col>
                <van-col span="12"
                  ><p>
                    客户数:<span class="colorbalck">{{
                      reportTargetAll.msqPostCustomerMonth
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    客户数:<span class="colorbalck">{{
                      reportTargetAll.msqPostCustomerQuarter
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单销售额:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.msqPostOrderPriceMonth)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单销售额:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.msqPostOrderPriceQuarter)
                    }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单率:<span class="colorbalck"
                      >{{ reportTargetAll.msqPostOrderRateMonth }}%</span
                    >
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单率:<span class="colorbalck"
                      >{{ reportTargetAll.msqPostOrderRateQuarter }}%</span
                    >
                  </p></van-col
                >
                <van-col span="24"><span class="leftTitle">年度累计实际</span></van-col>
                <van-col span="24"
                  ><p>
                    客户数:<span class="colorbalck">{{ reportTargetAll.msqPostCustomerYear }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p>
                    下单销售额:<span class="colorbalck">{{
                      Micrometer(reportTargetAll.msqPostOrderPriceYear)
                    }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p>
                    下单率:<span class="colorbalck"
                      >{{ reportTargetAll.msqPostOrderRateYear }}%</span
                    >
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
          </van-collapse>
        </div>
        <div v-if="tabVal == 1 && userType != 4" class="container linep">
          <van-collapse v-model="activeNames">
            <!-- 超好贴分销店下单 -->
            <van-collapse-item name="17" v-if="!JZQuota && !GZdata" title="超好贴分销店下单">
              <veryGoodPlaceOrder :reportTargetAll="reportTargetAll"></veryGoodPlaceOrder>
            </van-collapse-item>
            <van-collapse-item v-if="powerGrade == 2" name="8" title="当日门店拜访情况(实时)">
              <div v-if="reportTargetAll.realTimeVisits == null" style="margin-top: -10px">
                <p style="text-align: center; color: #666">暂无数据</p>
              </div>
              <div v-if="reportTargetAll.realTimeVisits != null" style="margin-top: -10px">
                <div class="container" style="width: 100%; margin: 0 auto; padding: 10px 0">
                  <el-table
                    :data="reportTargetAll.realTimeVisits"
                    border
                    class="table-headermd table-headermdhome"
                    style="width: 100%">
                    <el-table-column label="业务员" prop="userName">
                      <template slot-scope="scope">
                        <span class="tipTitle">{{ scope.row.userName }}</span>
                      </template>
                    </el-table-column>
                    <el-table-column label="拜访次数" prop="visitAct" />
                    <el-table-column :label="'金牌店\n拜访率'" prop="jpVisitRate">
                      <template slot-scope="scope">
                        <span class="tipTitle">{{ scope.row.jpVisitRate }}%</span>
                      </template>
                    </el-table-column>
                    <el-table-column :label="'同城店\n拜访率'" prop="tcVisitRate">
                      <template slot-scope="scope">
                        <span class="tipTitle">{{ scope.row.tcVisitRate }}%</span>
                      </template>
                    </el-table-column>
                  </el-table>
                </div>
              </div>
            </van-collapse-item>
          </van-collapse>
        </div>
        <!-- 经销商负责人 查看下属 -->
        <div v-if="tabVal == 1 && userType == 4" class="container linep">
          <van-collapse v-model="activeNames" v-if="reportInfoData.customerUserTargets">
            <van-collapse-item
              :name="index + ''"
              :title="item.nickName"
              v-for="(item, index) in reportInfoData.customerUserTargets"
              :key="index">
              <van-row>
                <van-col span="24"
                  ><p class="indexTile" style="margin-top: -2px">
                    <van-icon :name="bfindex" class="indexicon"></van-icon>拜访
                  </p></van-col
                >
                <van-col span="12"
                  ><p><span class="leftTitle">本日实际</span></p></van-col
                >
                <van-col span="12"
                  ><p><span class="rightTitle">本月实际</span></p></van-col
                >
                <van-col span="12"
                  ><p>
                    拜访点数:<span class="colorbalck">{{ Micrometer(item.dayVisitCount) }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    拜访点数:<span class="colorbalck">{{ Micrometer(item.monthVisitCount) }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p class="indexTile">
                    <van-icon :name="storeindex" class="indexicon"></van-icon>建店
                  </p></van-col
                >
                <van-col span="12"
                  ><p><span class="leftTitle">本日新增</span></p></van-col
                >
                <van-col span="12"
                  ><p><span class="rightTitle">本月实际</span></p></van-col
                >
                <van-col span="12"
                  ><p>
                    分销店点数:<span class="colorbalck">{{ Micrometer(item.dayFxdAct) }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    分销店点数:<span class="colorbalck">{{ Micrometer(item.monthFxdAct) }}</span>
                  </p></van-col
                >
                <van-col span="24"
                  ><p class="indexTile">
                    <van-icon :name="oderindex" class="indexicon"></van-icon>下单
                  </p></van-col
                >
                <van-col span="12"
                  ><p><span class="leftTitle">昨日新增</span></p></van-col
                >
                <van-col span="12"
                  ><p><span class="rightTitle">本月实际</span></p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单点数:<span class="colorbalck">{{ Micrometer(item.yesOrderAct) }}</span>
                  </p></van-col
                >
                <van-col span="12"
                  ><p>
                    下单点数:<span class="colorbalck">{{ Micrometer(item.monthOrderAct) }}</span>
                  </p></van-col
                >
              </van-row>
            </van-collapse-item>
          </van-collapse>
        </div>
      </template>
    </template>
  </div>
</template>

<script>
import history from '@/assets/Icon/history.png';
import tabBar from '@/components/tabBar';
import times from '@/assets/Icon/times.png';
import bfindex from '@/assets/bfindex.png';
import storeindex from '@/assets/storeindex.png';
import oderindex from '@/assets/oderindex.png';
import visitedRealTime from '@/views/componentsTarget/visitedRealTime';
import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
import placeOrder from '@/views/componentsTarget/placeOrder';
import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';
import performanceSAP from '@/views/componentsTarget/performanceSAP';
import chunTaiSAP from '@/views/componentsTarget/chunTaiSAP';
import ZYSAP from '@/views/componentsTarget/ZYSAP';
import neiwaiqiangpingtu from '@/views/componentsTarget/neiwaiqiangpingtu';
import zhiganwaiqiangSAP from '@/views/componentsTarget/zhiganwaiqiangSAP';
import moshouqiSAP from '@/views/componentsTarget/moshouqiSAP';
import fangshuiSAP from '@/views/componentsTarget/fangshuiSAP';
import neiqiangzhonggaoduanSAP from '@/views/componentsTarget/neiqiangzhonggaoduanSAP';
import cizhuanjiaoSAP from '@/views/componentsTarget/cizhuanjiaoSAP';
import HomeTarget from './HomeTarget.vue';
import {
  userTodayPlanNum,
  loginLog,
  homeImge,
  getReportInfo,
  checkVisit,
  addVisitsPosition,
  mobileReposition,
  applyNumber,
  joinInPlan,
} from '@/api/index';
import axios from 'axios';
export default {
  name: 'home',
  components: {
    tabBar,
    visitedRealTime,
    createStoreBJ,
    placeOrder,
    ZYPlaceOrder,
    veryGoodPlaceOrder,
    performanceSAP,
    chunTaiSAP,
    ZYSAP,
    neiwaiqiangpingtu,
    zhiganwaiqiangSAP,
    moshouqiSAP,
    fangshuiSAP,
    neiqiangzhonggaoduanSAP,
    cizhuanjiaoSAP,
    HomeTarget,
  },
  props: {
    tabVal: {
      type: [String, Number],
      default: '-1',
    },
    userType: {
      type: [String, Number],
      default: 1,
    },
    BMDType: {
      type: String,
      default: '',
    },
  },
  data() {
    return {
      shows: true,
      show: true,
      num: 0,
      timeimg: times,
      bfindex: bfindex,
      storeindex: storeindex,
      oderindex: oderindex,
      todayGoal: {},
      progressWidth: 0,
      updataTime: '',
      customerClueButton: false,
      saptitle: '业绩目标SAP(千元)',
      history: history,
      activeNames: [
        '1',
        '2',
        '3',
        '4',
        '5',
        '6',
        '7',
        '8',
        '10',
        '11',
        '12',
        '16',
        '17',
        '20',
        '21',
        '22',
        '23',
        '24',
        '25',
        '26',
        '27',
        '28',
        '29',
        '30',
        '31',
        '32',
        '33',
        '34',
        '35',
        '36',
        '37',
        '38',
        '39',
        '40',
        '41',
        '42',
        '43',
      ],
      activeNameType: [],
      powerGradeShow: false,
      showButton: false,
      isCommit: null,
      powerGrade: '2',
      deptLevel: '',
      // positionId：等级（1-销售员 2-销售部主管 3-大区主管 4-区域公司总经理 5-DIY公司）
      reportTargetAll: {},
      approvalPendingNum: 0,
      isDiy: false,
      approvalButton: false,
      times: 5,
      timer: null,
      type: '-1',
      monthNoVisit: {},
      flag: true,
      reportInfoData: {},
      applyNumber: '',
      proccessPendingNum: 0,
      JZQuota: false,
      GZdata: false,
    };
  },
  watch: {
    tabVal: {
      handler(val) {
        if (val == 0) {
          // keep-alive 模式watch执行了两次
          // this.initData();
        }
      },
      immediate: true,
    },
  },
  activated() {
    this.initData();
  },
  created() {
    this.initData();
  },
  methods: {
    initData() {
      console.log(this.tabVal);
      this.getReportInfo();
      this.userTodayPlanNum();
      this.isGetABFlag = false;
      this.num = 0;
      this.timeFn();
    },
    storeJoinVisit(val) {
      joinInPlan({ storeId: val.storeId }).then((res) => {
        if (res.code == 200) {
          this.$toast.success('加入成功');
        } else {
          this.$toast(res.msg);
        }
      });
    },
    applyNumberFn() {
      applyNumber().then((res) => {
        this.applyNumber = res.data;
      });
    },
    titleconfirm() {
      this.shows = false;
      localStorage.setItem('shows', false);
    },
    timeFn() {
      var t = 5;
      var that = this;
      that.timer = setInterval(function () {
        that.times = t;
        t--;
        if (t < 0) {
          clearInterval(that.timer);
          that.show = false;
        }
      }, 1000);
    },
    dailyLinks() {
      this.$router.push('/myHistoricalDaily');
    },
    getReportInfo() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '加载中...',
        forbidClick: true,
      });
      getReportInfo({ isContent: false }).then((res) => {
        if (res.code == 200) {
          if (res.data.postType == 'GZ') {
            this.GZdata = true;
            this.saptitle = '公裝业绩SAP(千元)';
          } else {
            this.saptitle = '业绩目标SAP(千元)';
            this.GZdata = false;
          }
          loading1.clear();
          localStorage.setItem('powerGrade', res.data.positionId);
          localStorage.setItem('userDeptLevel', res.data.userDeptLevel);
          localStorage.setItem('isDiy', res.data.diy);
          localStorage.setItem('uType', res.data.userType);
          localStorage.setItem('jzType', res.data.jzType);
          localStorage.setItem('customerVisits', res.data.customerManagerVisits);
          this.isDiy = res.data.diy;
          this.proccessPendingNum = res.data.proccessPendingNum;
          this.reportInfoData = res.data;
          this.approvalButton = res.data.approvalButton;
          this.powerGrade = res.data.positionId;
          this.showButton = res.data.showButton;
          this.deptLevel = res.data.deptLevel;
          if (res.data.postType == 'JZ') {
            this.JZQuota = true;
          } else {
            this.JZQuota = false;
          }
          localStorage.setItem('postType', res.data.postType);
          if (res.data.reportTargetAll != null) {
            this.reportTargetAll = res.data.reportTargetAll;
            this.updataTime = res.data.reportTargetAll.updateTime;
          }
          this.approvalPendingNum = res.data.approvalPendingNum;
          // 用户类型（默认0）：0=DIY员工；1=DIY经销商-分销人员；2=YSL；3=DIY经销商-倍增和先锋；4=DIY经销商-老板；经销商多身份时：1,4
          this.type = res.data.userType;
          // if (res.data.userType == 4) {
          //   this.tabVal = '1';
          // }
        } else {
          this.$toast(res.msg);
        }
      });
    },
    dailyLink() {
      this.$router.push('/daily');
    },
    weeklyLink() {
      this.$router.push('/weekly');
    },
    doubleWeeklyLink() {
      this.$router.push('/doubleWeekly');
    },
    login() {
      if (this.num > 4) {
        this.$router.push('/login');
      } else {
        this.num = this.num + 1;
      }
    },
    userTodayPlanNum() {
      localStorage.setItem('outvstoreName', '');
      localStorage.setItem('outvchainName', '');
      localStorage.removeItem('outvstoreLabelTypes');
      localStorage.removeItem('outvjpdStoreLevelTypes');
      localStorage.removeItem('outvstoreCategoryList');
      localStorage.setItem('outvchainCode', '');
      localStorage.setItem('outvstoreName', '');
      localStorage.setItem('deviveStoreName', '');
      localStorage.setItem('outvsortType', '');
      localStorage.setItem('outsortParam', '');
      localStorage.setItem('lat', '');
      localStorage.setItem('lon', '');
      userTodayPlanNum().then((res) => {
        if (res.code == 200) {
          this.todayGoal = res.data;
          this.progressWidth = (this.todayGoal.finishNum / this.todayGoal.planNum) * 100 + '%';
          localStorage.setItem('nickName', res.data.user.nickName);
          localStorage.setItem('postName', res.data.user.postName);
          localStorage.setItem('zipPhoto', res.data.zipPhoto);
          localStorage.setItem('storeType', res.data.user.type);
          localStorage.setItem('deptLevel', res.data.user.depts[0].deptLevel);
          localStorage.setItem('userId', res.data.user.userId);
          localStorage.setItem('deptIds', JSON.stringify(res.data.user.deptIds));
          this.monthNoVisit = res.data.monthNoVisit;
        } else {
          this.$toast(res.msg);
        }
      });
    },
    loginLogFn() {
      var appVersion = navigator.appVersion;
      var Logapp = appVersion.split('(')[1].split(';');
      var arrLog = '';
      if (Logapp[0] == 'Linux') {
        arrLog = {
          browser: navigator.appCodeName,
          os: Logapp[1],
          phoneBrand: Logapp[2].split('/')[1],
          phoneModel: Logapp[2].split('/')[0],
        };
      } else {
        arrLog = {
          browser: navigator.appCodeName,
          os: Logapp[0],
          phoneBrand: '',
          phoneModel: '',
        };
      }
      loginLog(arrLog);
    },
    onClickLeft() {
      this.$router.go(-1);
      // window.location.href = process.env.VUE_APP_SSB_LINK + "/homeIndex"
    },
  },
};
</script>
<style scoped>
.homeTitle {
  padding: 6px 16px;
}

.homeTitle .van-icon__image {
  width: 1.4em;
  height: auto;
}

.container {
  margin: 10px;
}

.container .van-collapse-item {
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
}

.progressContentlist {
  font-size: 14px;
  border-bottom: 1px dashed #f1f1f1;
  padding: 10px 0;
}

.linep p {
  margin: 10px 0 0 0;
  font-size: 14px;
  color: #666;
}

.leftTitle {
  background-color: #74a4d9;
  color: #fff;
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
}

.rightTitle {
  background-color: #e7b4bb;
  color: #fff;
  display: inline-block;
  padding: 0 4px;
  border-radius: 2px;
  white-space: nowrap;
}
</style>
<style lang="scss">
.myTab .van-tabs__nav--card {
  margin: 0 !important;
  border-left: 0;
  border-right: 0;
}
.myTab .van-tabs__wrap,
.van-tabs__nav--card {
  height: 39px;
}
.myTab .van-tab {
  line-height: 40px;
}
.linep .van-collapse-item__content {
  color: #666;
}
.linep .van-collapse-item__content {
  color: #666;
}

.linep .van-cell__title {
  color: #1e5398;
  font-weight: 500;
  font-size: 16px;
}

.homeCellIcon {
  line-height: 34px;
}

.homeTitle .van-cell__title {
  color: #444;
  font-size: 16px;
  font-weight: bold;
  padding-left: 4px;
  line-height: 36px;
  height: 36px;
}

.updataTime {
  color: #999;
  font-size: 12px;
  text-align: center;
}

.homeTitle .van-tag--danger {
  /* border-radius: 20px; */
}

.van-dialog__confirm,
.van-dialog__confirm:active {
  color: #0057ba;
}

.tipTitleBox p {
  margin: 0;
  line-height: 28px;
  color: #555;
}

.tipTitleBox .p {
  color: #555;
  font-size: 16px;
  border-bottom: 1px solid #f5f5f5;
  margin: 0;
  margin-bottom: 10px;
  text-align: center;
  padding: 14px 0px;
}

.storeTypeHome .van-collapse-item__content {
  padding: 0;
}

.storeTypeHome .storeTypeHomeList .van-cell__title {
  color: #4a4a4a;
  font-size: 14px;
}

.storeTypeHome .monthNoVisit {
  padding: 10px;
  margin: 10px;
  border-radius: 5px;
  background-color: #ebf4ff;
}

.storeTypeHome .leftContent {
  padding-right: 68px;
  position: relative;
}

.storeTypeHome .monthNoVisitStatstext {
  font-size: 12px;
  background-color: #0057ba;
  position: absolute;
  right: 0;
  top: 6px;
  padding: 2px 6px 2px 12px;
  border-bottom-left-radius: 60px;
  border-top-left-radius: 60px;
  color: #fff;
}
.ABtarage {
  .table-headermd {
    font-size: 12px;
    text-align: center;
    position: initial;
    width: 98% !important;
    margin: 0 auto;
    border-right: 0;
  }
  .table-headermdhome {
    font-size: 14px;
  }
  .table-headermdhome th.el-table__cell > .cell {
    white-space: pre;
  }
  .table-headermd .el-table__header,
  .table-headermd .el-table__body {
    width: 100% !important;
  }
  .table-headermdhome.van-cell {
    padding: 0 6px;
    height: 100%;
  }

  .table-headermd th.el-table__cell > .cell {
    padding: 0 4px;
    text-align: center;
  }

  .table-headermdhometh.el-table__cell:first-child > .cell {
    text-align: left;
  }

  .table-headermd th.el-table__cell {
    background-color: #1989fa;
    color: #fff;
  }
  .table-headermdhome th.el-table__cell {
    background-color: #fff;
    color: #444;
  }
  .table-headermd .el-table__cell {
    padding: 4px 0;
  }

  .table-headermdhome.el-table .cell {
    padding: 0 4px;
    text-align: center;
  }

  .table-headermdhome .tipTitle {
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    text-align: center;
  }

  .table-headermd::before {
    height: 0;
  }

  .table-headermd .cell,
  .el-table--border .el-table__cell:first-child .cell {
    padding: 0 4px;
  }
}
.colBack {
  width: 100%;
  height: 100%;
  display: block;
  /* overflow: unset; */
  position: relative;
  z-index: 2;
  float: left;
  z-index: 2;
  .back {
    position: absolute;
    background: rgb(226, 240, 217);
    height: 100%;
    display: block;
    overflow: hidden;
    /* z-index: 1; */
    border-radius: 12px;
    bottom: -4px;
  }
  .backLeft {
    width: 45%;
    left: -12px;
  }
  .backRight {
    width: 50%;
    left: calc(50% - 12px);
  }
  .van-col {
    position: relative;
    z-index: 3;
  }
}
</style>
<style lang="scss">
.ABtarage {
  p {
    margin: 10px 0 0 0;
    font-size: 14px;
    /* color: #666; */
  }
  .leftTitle {
    background-color: #74a4d9;
    color: #fff;
    display: inline-block;
    padding: 0 4px;
    border-radius: 2px;
  }
  .rightTitle {
    background-color: #e7b4bb;
    color: #fff;
    display: inline-block;
    padding: 0 4px;
    border-radius: 2px;
  }

  .colBack {
    width: 100%;
    height: 100%;
    display: block;
    /* overflow: unset; */
    position: relative;
    z-index: 2;
    float: left;
    z-index: 2;
    .back {
      position: absolute;
      background: rgb(226, 240, 217);
      height: 100%;
      display: block;
      overflow: hidden;
      /* z-index: 1; */
      border-radius: 12px;
      bottom: -4px;
    }
    .backLeft {
      width: 45%;
      left: -12px;
    }
    .backRight {
      width: 50%;
      left: calc(50% - 12px);
    }
    .van-col {
      position: relative;
      z-index: 3;
    }
  }
  .colLabel {
    display: inline-block;
    padding: 2px 5px;
    color: #fff;
    margin-right: 10px;
    border-radius: 3px;
  }
  .colLabel_KK {
    background: rgb(235, 104, 119);
  }
  .colLabel_FX {
    background: rgb(253 120 88);
  }
  .colLabel_JP {
    background: rgb(241, 183, 137);
  }
  .colLabel_JPBJ {
    background: rgb(248 215 189);
  }
  .colLabel_TCFX {
    background: rgb(131 204 202);
  }
}
</style>
