<template>
  <div class="Btarget">
    <div v-if="type != 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-item name="17" v-if="!JZQuota && !GZdata" title="超好贴分销店下单">
          <veryGoodPlaceOrder :reportTargetAll="reportTargetAll"></veryGoodPlaceOrder>
        </van-collapse-item>
        <van-collapse-item v-if="powerGrade != 1 && !JZQuota && !GZdata" name="32" title="客户开拓">
          <van-row>
            <van-col span="24"><span class="leftTitle">非片客户开发</span></van-col>
            <van-col span="24">
              <p>
                全年开发数：<span class="colorbalck">{{
                  Micrometer(reportTargetAll.customerAct)
                }}</span>
              </p>
            </van-col>
            <van-col span="24">
              <p>
                全年进度率：
                <span class="colorbalck"> {{ reportTargetAll.customerYearRate }}% </span>
              </p>
            </van-col>
          </van-row>
        </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="type == 4" class="container linep">
      <van-collapse v-model="activeNames" v-if="reportInfo.customerUserTargets">
        <van-collapse-item
          :name="index + ''"
          :title="item.nickName"
          v-for="(item, index) in reportInfo.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>
  </div>
</template>
<script>
import createStoreBJ from '@/views/componentsTarget/createStoreBJ';
import visitedRealTime from '@/views/componentsTarget/visitedRealTime';
import placeOrder from '@/views/componentsTarget/placeOrder';
import ZYPlaceOrder from '@/views/componentsTarget/ZYPlaceOrder';
import veryGoodPlaceOrder from '@/views/componentsTarget/veryGoodPlaceOrder';

import neiqiangzhonggaoduanSAP from '@/views/componentsTarget/neiqiangzhonggaoduanSAP';
export default {
  components: {
    createStoreBJ,
    visitedRealTime,
    placeOrder,
    ZYPlaceOrder,
    veryGoodPlaceOrder,
    neiqiangzhonggaoduanSAP,
  },
  props: {
    reportInfo: {
      type: Object,
    },
  },
  watch: {
    reportInfo: {
      handler(val) {
        if (val.postType == 'GZ') {
          this.GZdata = true;
          this.saptitle = '公裝业绩SAP(千元)';
        } else {
          this.saptitle = '业绩目标SAP(千元)';
          this.GZdata = false;
        }
        if (val.postType == 'JZ') {
          this.JZQuota = true;
        } else {
          this.JZQuota = false;
        }
        this.reportInfoData = val;
        this.powerGrade = val.positionId;
        if (val.reportTargetAll != null) {
          this.reportTargetAll = val.reportTargetAll;
        }
        this.type = val.userType;
      },
      deep: true,
      immediate: true,
    },
  },
  data() {
    return {
      type: '-1',
      JZQuota: false,
      GZdata: false,
      saptitle: '业绩目标SAP(千元)',
      powerGrade: '2',
      reportTargetAll: {},
      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',
      ],
    };
  },
};
</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>
