<template>
  <div class="dashboard_container">
    <template>
      <div class="flex">
        <div class="mode" @click="gotopage('attachmentProfile')">
          <div class="title">配件资料配置统计</div>
          <div class="flex head">
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.allpGoodsNum }}</div>
                <div class="title">总配置数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.onPGoodsNum }}</div>
                <div class="title">有效配置数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.offPGoodsNum }}</div>
                <div class="title">无效配置数量</div>
              </div>
            </div>
          </div>
        </div>
        <div class="mode" @click="gotopage('center-parts-shop-in-stock')">
          <div class="title">网点新件入库统计</div>
          <div class="flex head">
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.checkPNum }}</div>
                <div class="title">总数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.checkNeverPNum }}</div>
                <div class="title">未验收数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.checkYesPNum }}</div>
                <div class="title">已验收数量</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="flex">
        <!-- ---------------new---------------- -->
        <div class="mode" @click="gotopage('website-parts-shop-sales')">
          <div class="title">配件销售单统计</div>
          <div class="flex head">
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.saveSalesPNum }}</div>
                <div class="title">保存数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.submitSalesPgNum }}</div>
                <div class="title">提交数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.payNoTakeSalesPgNum }}</div>
                <div class="title">已支付数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.cancelTakeSalesPgNum }}</div>
                <div class="title">已取消数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.okTakeSalesPgNum }}</div>
                <div class="title">已完成数量</div>
              </div>
            </div>
            <div class="tab">
              <div class="text">
                <div class="num">{{ collectData.ycSalesPgNum }}</div>
                <div class="title">订单异常数量</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="flex">
        <!-- ---------------new---------------- -->
        <div class="mode">
          <div class="title">师傅新件返还统计</div>
          <div class="flex head">
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'SAVE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bcNewNum }}</div>
                <div class="title">保存数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'SUBMIT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tjNewNum }}</div>
                <div class="title">提交数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'REJECT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bhNewNum }}</div>
                <div class="title">驳回数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'AGREE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tgNewNum }}</div>
                <div class="title">通过数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'WAIT_REVIEW', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.dfhNewNum }}</div>
                <div class="title">待复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'REVIEWED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yfhkNewNum }}</div>
                <div class="title">已复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'NOTREFUND', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.wwfhNewNum }}</div>
                <div class="title">未返还数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-worker-refund', '单据状态', 'REFUNDED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yyfhNewNum }}</div>
                <div class="title">已返还数量</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="flex">
        <!-- ---------------new---------------- -->
        <div class="mode">
          <div class="title">师傅旧件返还统计</div>
          <div class="flex head">
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'SAVE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bcOldNum }}</div>
                <div class="title">保存数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'SUBMIT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tjOldNum }}</div>
                <div class="title">提交数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'REJECT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bhOldNum }}</div>
                <div class="title">驳回数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'AGREE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tgOldNum }}</div>
                <div class="title">通过数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'WAIT_REVIEW', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.dfhOldNum }}</div>
                <div class="title">待复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'REVIEWED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yfhkOldNum }}</div>
                <div class="title">已复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'NOTREFUND', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.wwfhOldNum }}</div>
                <div class="title">未返还数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-old-parts-worker-refund', '单据状态', 'REFUNDED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yyfhOldNum }}</div>
                <div class="title">已返还数量</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="flex">
        <!-- ---------------new---------------- -->
        <div class="mode">
          <div class="title">新件转销售统计</div>
          <div class="flex head">
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'SAVE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bcNewSaleNum }}</div>
                <div class="title">保存数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'SUBMIT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tjNewSaleNum }}</div>
                <div class="title">提交数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'REJECT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bhNewSaleNum }}</div>
                <div class="title">驳回数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'AGREE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tgNewSaleNum }}</div>
                <div class="title">通过数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'WAIT_REVIEW', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.dfhNewSaleNum }}</div>
                <div class="title">待复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'REVIEWED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yfhkNewSaleNum }}</div>
                <div class="title">已复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'NOTREFUND', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.wwfhNewSaleNum }}</div>
                <div class="title">未返还数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-new-parts-to-sales', '单据状态', 'REFUNDED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yyfhNewSaleNum }}</div>
                <div class="title">已返还数量</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="flex">
        <!-- ---------------new---------------- -->
        <div class="mode">
          <div class="title">保外新件转销售统计</div>
          <div class="flex head">
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'SAVE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bcNewInnerNum }}</div>
                <div class="title">保存数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'SUBMIT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tjNewInnerNum }}</div>
                <div class="title">提交数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'REJECT', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.bhNewInnerNum }}</div>
                <div class="title">驳回数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'AGREE', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.tgNewInnerNum }}</div>
                <div class="title">通过数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'WAIT_REVIEW', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.dfhNewInnerNum }}</div>
                <div class="title">待复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'REVIEWED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yfhkNewInnerNum }}</div>
                <div class="title">已复核数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'NOTREFUND', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.wwfhNewInnerNum }}</div>
                <div class="title">未返还数量</div>
              </div>
            </div>
            <div class="tab" @click="gotopage('website-outside-new-parts-to-sales', '单据状态', 'REFUNDED', 'flag')">
              <div class="text">
                <div class="num">{{ collectData.yyfhNewInnerNum }}</div>
                <div class="title">已返还数量</div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </template>
  </div>
</template>

<script>
import { materialPeiJianCount } from '@/api/dataCount.js'
export default {
  data() {
    return {
      collectData: {}
    }
  },
  created() {
    this.refreshData()
  },
  methods: {
    refreshData() {
      materialPeiJianCount().then(res => {
        console.log(res.data)
        this.collectData = res.data
      })
    },
    gotopage(name, pageName = '', pageCode = '', pageType = '-') {
      if (pageCode) {
        this.$router.push({
          name: name,
          params: {
            pageName: pageName,
            pageType: pageType,
            pageCode: pageCode
          }
        })
      } else {
        this.$router.push({
          name: name
        })
      }
    }
  }
}
</script>

<style scoped lang="scss">
.dashboard_container {
  background: #f5f5f5;
  padding: 20px;
  min-height: calc(100vh - 86px);
  box-sizing: border-box;

  .refresh {
    display: flex;
    justify-content: space-between;
    align-items: center;
    // text-align: right;
    margin-bottom: 10px;

    span {
      cursor: pointer;
    }

    i {
      font-weight: bold;
      margin-left: 4px;
      cursor: pointer;
    }
  }

  .flex {
    display: flex;
    margin-bottom: 10px;
  }

  .flex_asb {
    display: flex;
    justify-content: space-between;
  }

  .mode {
    flex: 1;
    padding: 10px;
    margin-right: 10px;
    background-color: #ffffff;
    border-radius: 10px;

    .title {
      font-weight: bold;
    }

    .head {
      padding-top: 12px !important;
      margin: 0 !important;
      margin-bottom: 0 !important;
    }

    .opacity {
      opacity: 0;
    }

    .tab {
      display: flex;
      align-items: center;
      flex: 1;
      cursor: pointer;

      .text {
        margin: 0 10px;

        .title {
          color: #999999;
          font-size: 12px;
          margin-top: 8px;
        }

        .num {
          font-size: 22px;
          font-weight: bold;
        }
      }

      .img {
        width: 46px;
        height: 46px;
        margin-left: 20px;
      }
    }

    .child {
      border-right: 1px solid #dddddd;

      .text {
        .title {
          margin-top: 8px;
          margin-bottom: 0;
        }
      }
    }

    .child:last-child {
      border-right: none;
    }
  }

  .mode:last-child {
    margin-right: 0;
  }

  .container_bottom {
    width: 100%;
    height: 350px;
    padding: 10px;
    background-color: #ffffff;
    margin-top: 10px;
    border-radius: 10px;
  }
}
</style>
