<template>
  <div>
    <!--        顶部条-->
    <div class="navBarTOP">
      <van-nav-bar class="navBar" title="填写日报" left-arrow @click-left="onClickLeft">
        <template #right>
          <span
            v-if="temporaryShow != 'N'"
            @click="tsContentsFn"
            style="
              color: white;
              background: #74a4d9;
              display: block;
              padding: 6px 10px;
              border-radius: 6px;
            "
            >暂存</span
          >
        </template>
      </van-nav-bar>
    </div>
    <div class="lineGrey"></div>
    <div class="lineGrey"></div>
    <div class="lineGrey"></div>
    <div class="lineGrey"></div>
    <div style="height: 4px"></div>
    <!--        主体内容-->
    <div class="container linepAdd">
      <van-collapse v-model="activeNames">
        <van-collapse-item v-if="type != 3 && type != 4" name="1" :title="saptitle">
          <van-row>
            <van-col span="24" v-if="GZQuota"
              ><p>
                昨日新增:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.sapNewYesterday)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><span v-if="!JZQuota" class="leftTitle">本月业绩</span
              ><span v-if="JZQuota" class="leftTitle">本月实际</span></van-col
            >
            <van-col span="12"
              ><span v-if="!JZQuota" class="rightTitle">本季业绩</span
              ><span v-if="JZQuota" class="rightTitle">本季实际</span></van-col
            >
            <van-col span="12">
              <p v-if="!JZQuota">
                本月实际:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.sapMonthAct)
                }}</span>
              </p>
              <p v-if="JZQuota">
                本月累计:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.sapMonthAct)
                }}</span>
              </p>
            </van-col>
            <van-col span="12">
              <p v-if="!JZQuota">
                本季实际:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.sapQuarterAct)
                }}</span>
              </p>
              <p v-if="JZQuota">
                本季累计:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.sapQuarterAct)
                }}</span>
              </p>
            </van-col>
            <van-col span="12"
              ><p>
                本月达成率:<span class="colorbalck"
                  >{{ reportTargetAll.sapMonthSuccessRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                本季达成率:<span class="colorbalck"
                  >{{ reportTargetAll.sapQuarterSuccessRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                本月成长率:<span class="colorbalck">{{ reportTargetAll.sapMonthGrowRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                本季成长率:<span class="colorbalck">{{ reportTargetAll.sapQuarterGrowRate }}%</span>
              </p></van-col
            >
            <van-col span="24" v-if="JZQuota"><span class="leftTitle">年度累计</span></van-col>
            <van-col span="24" v-if="JZQuota"
              ><p>
                年度累计:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.sapYearAct)
                }}</span>
              </p></van-col
            >
            <van-col span="24" v-if="JZQuota"
              ><p>
                年度达成率:<span class="colorbalck">{{ reportTargetAll.sapYearSuccessRate }}%</span>
              </p></van-col
            >
            <van-col span="24" v-if="JZQuota"
              ><p>
                年度成长率:<span class="colorbalck">{{ reportTargetAll.sapYearGrowRate }}%</span>
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
        <van-collapse-item v-if="GZQuota" name="43" 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.gzCtzjMonthAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                业绩实际:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.gzCtzjQuarterAct)
                }}</span>
              </p></van-col
            >
            <!--            <van-col span="12" ><p>业绩达成率:<span class="colorbalck">{{ Micrometer(reportTargetAll.gzCtzjMonthSuccessRate) }}%</span></p></van-col>-->
            <!--            <van-col span="12" ><p>业绩达成率:<span class="colorbalck">{{ Micrometer(reportTargetAll.gzCtzjQuarterSuccessRate) }}%</span></p></van-col>-->
            <van-col span="12"
              ><p>
                业绩成长率:<span class="colorbalck"
                  >{{ reportTargetAll.gzCtzjMonthGrowRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                业绩成长率:<span class="colorbalck"
                  >{{ reportTargetAll.gzCtzjQuarterGrowRate }}%</span
                >
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
        <van-collapse-item v-if="GZQuota" 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">{{ Micrometer(reportTargetAll.gzZgwqMonthSuccessRate) }}%</span></p></van-col>-->
            <!--            <van-col span="12" ><p>业绩达成率:<span class="colorbalck">{{ Micrometer(reportTargetAll.gzZgwqQuarterSuccessRate) }}%</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="GZQuota" 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="GZQuota" name="40" title="今日拜访">
          <van-row>
            <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 title="建店布机" v-if="!JZQuota && !GZQuota" name="2">
          <van-row>
            <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(reportTargetAll.goldShopYearAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12">
              <p>
                金牌店点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.goldShopYearTarget)
                }}</span
                ><span class="colorbalck">({{ reportTargetAll.goldShopYearRate }}%)</span>
              </p>
            </van-col>
            <van-col span="12"
              ><p>
                金牌店布机:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.goldShopBjYearAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12">
              <p>
                金牌店布机:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.goldShopBjYearTarget)
                }}</span
                ><span class="colorbalck">({{ reportTargetAll.goldShopBjYearRate }}%)</span>
              </p>
            </van-col>
            <van-col span="12"
              ><p>
                分销店点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.allShopYearAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12">
              <p>
                分销店点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.allShopYearTarget)
                }}</span
                ><span class="colorbalck">({{ reportTargetAll.allShopYearRate }}%)</span>
              </p>
            </van-col>
            <!-- <van-col span="12"><p>调色机上传数:{{ Micrometer(reportTargetAll.tsjUploadYearAct) }}</p></van-col>
           <van-col span="12">
             <p>调色机上传数:<span class="colorbalck">{{ Micrometer(reportTargetAll.tsjUploadYearTarget) }}</span><span class="colorbalck">({{ reportTargetAll.tsjUploadYearRate }}%)</span></p>
           </van-col> -->
            <van-col span="24"
              ><p>涂料店点数:{{ Micrometer(reportTargetAll.tlShopYearAct) }}</p></van-col
            >
            <!--            <van-col span="12" >-->
            <!--              <p>涂料店点数:<span class="colorbalck">{{ Micrometer(reportTargetAll.tlShopYearTarget) }}</span><span class="colorbalck">({{ reportTargetAll.tlShopYearRate }}%)</span></p>-->
            <!--            </van-col>-->
            <van-col span="24">
              <p>厨卫店点数:{{ Micrometer(reportTargetAll.cwShopYearAct) }}</p></van-col
            >
            <!--            <van-col span="12" >-->
            <!--              <p>厨卫店点数:<span class="colorbalck">{{ Micrometer(reportTargetAll.cwShopYearTarget) }}</span><span class="colorbalck">({{ reportTargetAll.cwShopYearRate }}%)</span></p>-->
            <!--            </van-col>-->
          </van-row>
        </van-collapse-item>
        <van-collapse-item v-if="!JZQuota && !GZQuota" name="11" title="专业时时丽SAP(千元)">
          <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.czjMonthAct) }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                实际:<span class="colorbalck">{{ Micrometer(reportTargetAll.czjQuarterAct) }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                达成率:<span class="colorbalck">{{ reportTargetAll.czjMonthSuccessRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                达成率:<span class="colorbalck">{{ reportTargetAll.czjQuarterSuccessRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                成长率:<span class="colorbalck">{{ reportTargetAll.czjMonthGrowRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                成长率:<span class="colorbalck">{{ reportTargetAll.czjQuarterGrowRate }}%</span>
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
        <van-collapse-item v-if="!JZQuota && !GZQuota" name="29" title="瓷砖胶SAP(千元)">
          <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.czjSapMonthAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                实际:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.czjSapQuarterAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                达成率:<span class="colorbalck">{{ reportTargetAll.czjSapMonthSuccessRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                达成率:<span class="colorbalck"
                  >{{ reportTargetAll.czjSapQuarterSuccessRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                成长率:<span class="colorbalck">{{ reportTargetAll.czjSapMonthGrowRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                成长率:<span class="colorbalck">{{ reportTargetAll.czjSapQuarterGrowRate }}%</span>
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
        <van-collapse-item name="16" v-if="!JZQuota && !GZQuota" 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.professionalSslYes)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.professionalSslMonth)
                }}</span>
              </p></van-col
            >
            <van-col span="12"><p></p></van-col>
            <van-col span="12"
              ><p>
                下单率 :<span class="colorbalck"
                  >{{ reportTargetAll.professionalSslOrderRateMonth }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单数量(桶):<span class="colorbalck">{{
                  Micrometer(reportTargetAll.professionalSslOrderNumYes)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单数量(桶):<span class="colorbalck">{{
                  Micrometer(reportTargetAll.professionalSslOrderNumMonth)
                }}</span>
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
        <van-collapse-item name="17" v-if="!JZQuota && !GZQuota" 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.excellentPostYes)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.excellentPostMonth)
                }}</span>
              </p></van-col
            >
            <van-col span="12"><p></p></van-col>
            <van-col span="12"
              ><p>
                下单率 :<span class="colorbalck"
                  >{{ reportTargetAll.excellentPostOrderRateMonth }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单数量(包):<span class="colorbalck">{{
                  Micrometer(reportTargetAll.excellentPostOrderNumYes)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单数量(包):<span class="colorbalck">{{
                  Micrometer(reportTargetAll.excellentPostOrderNumMonth)
                }}</span>
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
        <van-collapse-item v-if="!JZQuota && !GZQuota" name="33" title="分销店下单点数">
          <van-row>
            <van-col span="24"><span class="leftTitle">本月进度</span></van-col>
            <van-col span="12"
              ><p>
                分销店下单点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.fxOrderShopMonthAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                分销店下单率:<span class="colorbalck"
                  >{{ reportTargetAll.fxShopMonthOrderRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                金牌店下单点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.jpOrderShopMonthAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                金牌店下单率 :<span class="colorbalck"
                  >{{ reportTargetAll.jpShopMonthOrderRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                厨卫店下单点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.cwOrderShopMonthAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                厨卫店下单率:<span class="colorbalck"
                  >{{ reportTargetAll.cwShopMonthOrderRate }}%</span
                >
              </p></van-col
            >
            <van-col span="12"
              ><p>
                涂料店下单点数:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.tlOrderShopMonthAct)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                涂料店下单率:<span class="colorbalck"
                  >{{ reportTargetAll.tlShopMonthOrderRate }}%</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">{{
                  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="20" 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.czjPostCustomerMonth }}</span>
              </p>
            </van-col>
            <van-col span="12"
              ><p>
                客户数:<span class="colorbalck">{{ reportTargetAll.czjPostCustomerQuarter }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单数(包):<span class="colorbalck">{{
                  reportTargetAll.czjPostOrderNumMonth
                }}</span>
              </p>
            </van-col>
            <van-col span="12"
              ><p>
                下单数(包):<span class="colorbalck">{{
                  reportTargetAll.czjPostOrderNumQuarter
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单销售额:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.czjPostOrderPriceMonth)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单销售额:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.czjPostOrderPriceQuarter)
                }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                下单率:<span class="colorbalck">{{ reportTargetAll.czjPostOrderRateMonth }}%</span>
              </p>
            </van-col>
            <van-col span="12"
              ><p>
                下单率:<span class="colorbalck"
                  >{{ reportTargetAll.czjPostOrderRateQuarter }}%</span
                >
              </p></van-col
            >
            <van-col span="24"><span class="leftTitle">年度累计实际</span></van-col>
            <van-col span="24"
              ><p>
                客户数:<span class="colorbalck">{{ reportTargetAll.czjPostCustomerYear }}</span>
              </p>
            </van-col>
            <van-col span="24"
              ><p>
                下单数(包):<span class="colorbalck">{{ reportTargetAll.czjPostOrderNumYear }}</span>
              </p>
            </van-col>
            <van-col span="24"
              ><p>
                下单销售额:<span class="colorbalck">{{
                  Micrometer(reportTargetAll.czjPostOrderPriceYear)
                }}</span>
              </p></van-col
            >
            <van-col span="24"
              ><p>
                下单率:<span class="colorbalck">{{ reportTargetAll.czjPostOrderRateYear }}%</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-item v-if="!GZQuota" title="拜访数据(实时)" name="7">
          <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.inVisitAct }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                线内拜访点数:<span class="colorbalck">{{ reportTargetAll.inVisitActMonth }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                计划拜访点数:<span class="colorbalck">{{ reportTargetAll.visitTarget }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                计划拜访点数:<span class="colorbalck">{{ reportTargetAll.coverStoreNum }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                线内拜访率:<span class="colorbalck">{{ reportTargetAll.inVisitRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                线内拜访率:<span class="colorbalck">{{ reportTargetAll.inVisitMonthRate }}%</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                整体拜访数:<span class="colorbalck">{{ reportTargetAll.allVisitNum }}</span>
              </p></van-col
            >
            <van-col span="12"
              ><p>
                整体拜访率:<span class="colorbalck">{{ reportTargetAll.allVisitMonthRate }}%</span>
              </p></van-col
            >
          </van-row>
        </van-collapse-item>
      </van-collapse>
      <div class="contentContainer">
        <div v-if="GZQuota">
          <p class="contentContainerTitle">今日项目跟进数<span class="colorRed">(必填)</span></p>
          <div style="padding: 10px 0">
            <van-field v-model="reportContents[2].projectFollowNum" type="digit" />
          </div>
          <p class="contentContainerTitle">
            今日TUC成功报备数量<span class="colorRed">(必填)</span>
          </p>
          <div style="padding: 10px 0">
            <van-field v-model="reportContents[3].tucReportingSuccessNum" type="digit" />
          </div>
        </div>
        <p class="contentContainerTitle">今日机会与挑战总结<span class="colorRed">(必填)</span></p>
        <div style="padding: 10px 0">
          <van-field
            v-model="reportContents[0].dayContent"
            rows="4"
            autosize
            maxlength="800"
            show-word-limit
            type="textarea"
            :formatter="formatter"
            placeholder="请输入不超过3条" />
        </div>
        <p class="contentContainerTitle">明日工作规划 <span class="colorRed">(必填)</span></p>
        <div style="padding: 10px 0">
          <van-field
            v-model="reportContents[1].dayContent"
            rows="4"
            autosize
            maxlength="800"
            show-word-limit
            type="textarea"
            :formatter="formatter"
            placeholder="请输入不超过3条" />
        </div>
      </div>
      <br />
    </div>
    <div class="contentborder">
      <van-button type="info" size="small" plain class="Btn1" @click="submint">提交日报</van-button>
    </div>
    <div class="lineGrey"></div>
    <div class="lineGrey"></div>
    <div class="lineGrey"></div>
    <div class="lineGrey"></div>
  </div>
</template>

<script>
import {
  userTodayPlanNum,
  updateReport,
  getReportInfo,
  getDetailById,
  tsContents,
} from '@/api/index';

export default {
  name: 'daily',
  data() {
    return {
      show: true,
      num: 0,
      todayGoal: {},
      progressWidth: 0,
      activeNames: [
        '1',
        '2',
        '3',
        '4',
        '5',
        '6',
        '7',
        '8',
        '16',
        '17',
        '20',
        '21',
        '22',
        '23',
        '29',
        '11',
        '33',
        '40',
        '41',
        '42',
        '43',
      ],
      powerGrade: '',
      value: '2',
      message: '',
      isclick: true,
      saptitle: '业绩目标SAP(千元)',
      reportTargetAll: {},
      reportTarget: {},
      temporaryShow: '',
      projectFollowNum: '',
      reportingNum: '',
      tucReportingSuccessNum: '',
      reportContents: [
        {
          dayContent: '',
          contentTime: '',
          type: 2,
          status: '1',
        },
        {
          dayContent: '',
          contentTime: '',

          type: 3,
          status: '1',
        },
        {
          dayContent: '',
          contentTime: '',
          projectFollowNum: '',
          type: 3,
          status: '1',
        },
        {
          dayContent: '',
          contentTime: '',
          tucReportingSuccessNum: '',
          type: 3,
          status: '1',
        },
      ],
      type: '-1',
      JZQuota: false,
      GZQuota: false,
      titlejz: '',
    };
  },
  created() {
    this.powerGrade = localStorage.getItem('powerGrade');
    this.temporaryShow = this.$route.query.temporaryShow;
    if (this.$route.query.reportId != undefined) {
      this.getDetailById();
    } else {
      this.getReportInfo();
    }
  },
  watch: {
    $route(to, from) {
      this.powerGrade = localStorage.getItem('powerGrade');
      if (to.path == '/daily') {
        this.temporaryShow = this.$route.query.temporaryShow;
        if (this.$route.query.reportId != undefined) {
          this.getDetailById();
        } else {
          this.getReportInfo();
        }
      }
    },
  },
  methods: {
    // return value.replace(/[^\u4E00-\u9FA5|\d|\a-zA-Z|\r\n\s,.?!，。？！"…—（）&_%【】{}:“”‘#~@;：；￥$=()-+-·——/*{}[\]]|\r\n\s/g, '');

    formatter(value) {
      return value.replace(
        /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/gi,
        ''
      );
    },
    getDetailById() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '加载中...',
        forbidClick: true,
      });
      this.reportContents[0].dayContent = '';
      getDetailById({ reportId: this.$route.query.reportId }).then((res) => {
        loading1.clear();
        if (res.code == 200) {
          if (res.data.status != '0' && res.data.status != '2') {
            this.$dialog
              .alert({
                title: '系统提示',
                message: '日报已提交或过期',
              })
              .then(() => {
                window.location.replace(window.location.origin + '/mobile/home');
              });
          } else {
            localStorage.setItem('powerGrade', res.data.positionId);
            this.GZQuota = false;
            this.JZQuota = false;
            if (res.data.postType == 'JZ') {
              this.JZQuota = true;
            } else if (res.data.postType == 'GZ') {
              this.GZQuota = true;
              this.saptitle = '公裝业绩SAP(千元)';
            } else {
              this.saptitle = '业绩目标SAP(千元)';
            }
            if (this.reportTarget.projectFollowNum) {
              this.projectFollowNum = this.reportTarget.projectFollowNum;
              this.reportingNum = this.reportTarget.reportingNum;
              this.tucReportingSuccessNum = this.reportTarget.tucReportingSuccessNum;
            }

            this.type = res.data.userType;
            if (res.data.reportContents.length > 0) {
              this.reportContents = res.data.reportContents;
              if (res.data.reportContents.length < 2) {
                res.data.reportContents.push({
                  dayContent: '',
                  contentTime: '',
                  type: 3,
                  status: '1',
                });
              }
              if (res.data.reportContents.length > 2) {
                if (res.data.reportContents[2].projectFollowNum != null) {
                  this.projectFollowNum = res.data.reportContents[2].projectFollowNum;
                } else {
                  this.projectFollowNum = '';
                  res.data.reportContents[2].projectFollowNum = '';
                }
                if (res.data.reportContents[3].tucReportingSuccessNum != null) {
                  this.tucReportingSuccessNum = res.data.reportContents[3].tucReportingSuccessNum;
                } else {
                  this.tucReportingSuccessNum = '';
                  res.data.reportContents[3].tucReportingSuccessNum = '';
                }
              }
            }
            this.reportTargetAll = res.data.reportTargetAll;
            this.reportTarget = res.data;
          }
        } else {
          this.$toast(res.msg);
        }
      });
    },
    tsContentsFn() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '数据提交中...',
        forbidClick: true,
      });
      if (this.isclick) {
        this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
        this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
        this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
        this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
        this.reportTarget.reportContents = this.reportContents;
        this.reportTarget.status = '1';
        this.isclick = false;
        tsContents(this.reportTarget).then((res) => {
          loading1.clear();
          this.isclick = true;
          if (res.code == 200) {
            this.$dialog
              .alert({
                title: '系统提示',
                message: '暂存成功',
              })
              .then(() => {
                // if(this.$route.query.reportId!=undefined){
                //   window.location.replace(window.location.origin+"/mobile/myHistoricalDaily")
                // }else{
                //   window.location.replace(window.location.origin+"/mobile/home")
                // }
              });
          } else {
            this.$toast.fail(res.msg);
          }
        });
      }
    },
    // 提交日报
    submint() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '数据提交中...',
        forbidClick: true,
      });
      if (this.isclick) {
        if (this.GZQuota) {
          if (this.reportContents[2].projectFollowNum.trim() == '') {
            this.$toast('请输入今日项目跟进数量！');
            return false;
          }
          if (this.reportContents[3].tucReportingSuccessNum.trim() == '') {
            this.$toast('请输入今日TUC成功报备数量！');
            return false;
          }
        }
        if (this.reportContents[0].dayContent.trim() == '') {
          this.$toast('请输入日报内容！');
          return false;
        } else if (this.reportContents[0].dayContent.length > 800) {
          this.$toast('日报内容太长！');
          return false;
        } else if (this.reportContents[1].dayContent.trim() == '') {
          this.$toast('请输入明日工作规划！');

          return false;
        } else if (this.reportContents[1].dayContent.length > 800) {
          this.$toast('明日工作规划内容太长！');
          return false;
        } else {
          this.reportContents[0].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
          this.reportContents[1].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
          if (this.GZQuota) {
            this.reportContents[2].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
            this.reportContents[3].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}');
          }
          // this.reportContents[4].contentTime = this.parseTime(new Date(), '{y}-{m}-{d}')
          this.reportTarget.reportContents = this.reportContents;

          this.reportTarget.status = '1';
          this.isclick = false;
          updateReport(this.reportTarget).then((res) => {
            loading1.clear();
            this.isclick = true;
            if (res.code == 200) {
              this.$dialog
                .alert({
                  title: '系统提示',
                  message: '提交成功',
                })
                .then(() => {
                  if (this.$route.query.reportId != undefined) {
                    window.location.replace(window.location.origin + '/mobile/myHistoricalDaily');
                  } else {
                    this.onClickLeft();
                    // window.location.replace(window.location.origin + '/mobile/home');
                  }
                });
            } else {
              this.$toast.fail(res.msg);
            }
          });
        }
      }
    },
    // 获取日报数据
    getReportInfo() {
      let loading1 = this.$toast.loading({
        duration: 0,
        message: '加载中...',
        forbidClick: true,
      });
      this.reportContents[0].dayContent = '';
      getReportInfo({ isContent: true }).then((res) => {
        loading1.clear();
        localStorage.setItem('powerGrade', res.data.positionId);
        this.powerGrade = res.data.positionId;
        this.showButton = res.data.showButton;
        this.type = res.data.userType;
        this.reportTargetAll = res.data.reportTargetAll;
        this.reportTarget = res.data;
        this.GZQuota = false;
        this.JZQuota = false;
        if (res.data.postType == 'JZ') {
          this.JZQuota = true;
        } else if (res.data.postType == 'GZ') {
          this.GZQuota = true;
          this.saptitle = '公裝业绩SAP(千元)';
        } else {
          this.saptitle = '业绩目标SAP(千元)';
        }
        if (res.data.reportContents.length > 0) {
          this.reportContents = res.data.reportContents;
          if (res.data.reportContents.length > 2) {
            this.projectFollowNum = res.data.reportContents[2].projectFollowNum;
            this.tucReportingSuccessNum = res.data.reportContents[3].tucReportingSuccessNum;
          }
        }
      });
    },
    userTodayPlanNum() {
      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('storeType', res.data.user.type);
        } else {
          this.$toast.fail(res.msg);
        }
      });
    },
    onClickLeft() {
      this.$router.go(-1);
    },
  },
};
</script>

<style scoped>
.container {
  margin: 10px;
}
.container .van-collapse-item {
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
}
.linepAdd p {
  margin: 6px 0 0 0;
  font-size: 14px;
  color: #666;
}

.linepAdd .texttitle {
  color: #0057ba;
  position: relative;
  padding-left: 10px;
}

.linepAdd .texttitle2 {
  padding-left: 0;
}

.linepAdd .texttitle .opint {
  position: absolute;
  left: 0px;
  top: 6px;
  margin-right: 6px;
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 10px;
  background-color: #004d8c;
}

.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;
}
</style>
<style>
.linepAdd .van-cell__title {
  color: #1e5398;
  font-weight: 500;
}
.linepAdd .contentContainer {
  background-color: white;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 10px;
}

.linepAdd .contentContainer .contentContainerTitle {
  color: #222;
}

.linepAdd .contentContainer .contentContainerTitle span {
  font-size: 12px;
  color: #666;
}
.linepAdd .contentContainer .van-field__control {
  background-color: #f8f8f8;
  padding: 10px;
  border-radius: 8px;
}
.linepAdd .contentContainer .van-cell {
  padding: 0;
}
.van-dialog__confirm,
.van-dialog__confirm:active {
  color: #0057ba;
}
.linepAdd .contentContainer .contentContainerTitle .colorRed {
  color: red;
}
</style>
