<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-03-20 14:36:37
 * @LastEditors: 无尘
 * @LastEditTime: 2020-06-30 16:17:54
 -->
<template>
  <div class="my-customer-wrap common-set-wrap">
    <!-- <nav-crumb :navpath="navpath"> </nav-crumb> -->
    <div class="right-content">
      <div class="right-box" style="min-height: calc(100vh - 104px);">
        <div class="apps-content flex" style="min-height: calc(100vh - 104px);">
          <div class="apps-content-right">
            <div class="flex flex-space-between">
              <div class="flex flex-start">
                <div class="font-16 color-303133 w-140 line-h-32">好办使用详情</div>
                <div role="alert" class="el-alert el-alert-tip el-alert--info flex flex-align-start">
                  <i class="el-alert__icon el-icon-info font-12 color-2f54eb"></i>
                  <div class="el-alert__content">
                    <span class="el-alert__title color-606266 font-14">数据更新截至于昨日。今日数据需要隔天上午8点后进行查看。</span>
                  </div>
                </div>
              </div>
              <div class="my-customer-brand">
                <span class="font-14 color-606266 ">切换商户</span
                ><el-select class="p-l-10" v-model="activeBrand" placeholder="请选择" @change="changeSelect">
                  <el-option v-for="item in brandListData" :key="item.enterpriseId" :label="item.enterpriseName" :value="item.enterpriseId"> </el-option>
                </el-select>
              </div>
            </div>
            <div class="data-total-view m-t-20">
              <ul class="flex flex-space-between">
                <li class="data-total-cell">
                  <div class="flex">
                    <div><img src="../../assets/data/login.png" alt="" /></div>
                    <div>
                      <div class="cell-title">
                        <el-tooltip class="item" effect="dark" content="今日截至当前时间的登录人数。导购同时归属多家门店的记多人。" placement="top-start">
                          <span class="font-14 color-909399" style="cursor: pointer;padding-bottom: 2px; border-bottom: 1px dashed #2F54EB;">今日登录人数</span>
                        </el-tooltip>
                      </div>
                      <div class="font-28 color-303133 cell-value"></div>
                    </div>
                  </div>
                </li>
              </ul>
            </div>
            <div class="chart-body m-t-20"></div>

            <div class="m-t-20"></div>
          </div>
        </div>
      </div>
    </div>
    <!-- <vue-gic-footer></vue-gic-footer> -->
  </div>
</template>
<script>
import navCrumb from '@/components/nav/nav.vue';
import { getRequest, postRequest } from '@/api/api';
import errMsg from '@/common/js/error';
// import { _debounce } from '@/common/js/public';
// import showMsg from '@/common/js/showmsg';
export default {
  name: 'activeDetail',
  data() {
    return {
      // 面包屑参数
      navpath: [
        {
          name: '好办使用详情',
          path: '/enterpriseUseData'
        },
        {
          name: '激活人员明细',
          path: ''
        }
      ],
      brandListData: [],
      activeBrand: ''
    };
  },
  computed: {},
  methods: {
    /**
     * 选择品牌
     */
    changeSelect(val) {
      const that = this;
      that.brandListData.forEach(ele => {
        if (ele.enterpriseId == val) {
          that.activeBrand = ele.enterpriseId;
        }
      });
    },
    /**
     * 获取品牌
     */
    getBrandData() {
      const that = this;
      postRequest('/haoban-manage3-web/wx-enterprise-list', {})
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            if (!!resData.result && !!resData.result.length) {
              that.brandListData = resData.result;
              that.activeBrand = that.brandListData[0].enterpriseId;
            }
            return;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    },
    /**
     * 路由跳转
     */
    changeRoute(path) {
      this.$router.push(path);
    },

    /**
     * 分页---页码变化
     */
    handleSizeChange(val) {
      const that = this;
      that.currentPage = 1;
      that.pageSize = val;
      that.getTableList();
    },

    /**
     * 分页---当前页变化
     */
    handleCurrentChange(val) {
      const that = this;
      that.currentPage = val;
      that.getTableList();
    },
    /**
     * 获取列表数据
     */
    getTableList(val) {
      const that = this;
      let para = {};
      getRequest('/haoban-manage3-web/wx-enterprise-list', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1) {
            that.tableData = resData.result || [];
            return false;
          }
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  },
  watch: {
    activeBrand: function(newData, oldData) {
      const that = this;
      that.activeBrand = newData;
    },
    activeGroup: function(newData, oldData) {
      const that = this;
      that.activeGroup = newData;
    }
  },
  mounted() {
    const that = this;
    that.getTableList();
    document.documentElement.style.backgroundColor = '#f0f2f5';
  },
  destroyed() {
    document.documentElement.style.backgroundColor = '#fff';
  },
  components: {
    navCrumb
  }
};
</script>
<style type="text/less" lang="less" scoped>
.span-dot {
  display: inline-block;
  vertical-align: middle;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 3px;
  &.bg-52c41a {
    background: #52c41a;
  }
  &.bg-f5222d {
    background: #f5222d;
  }
}
.bg-82C5FF {
  background: #82c5ff;
}
.color-508CEE {
  color: #508cee;
}
.color-FF585C {
  color: #ff585c;
}
.line-h-18 {
  line-height: 18px;
}
.line-h-32 {
  line-height: 32px;
}
.tooltip-text {
  width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}
.w-140 {
  width: 140px;
}
.w-293 {
  width: 293px;
}
.w-191 {
  width: 191px;
}
.el-alert--info {
  background: rgba(240, 245, 255, 1);
  border-radius: 2px;
  border: 1px solid rgba(133, 165, 255, 1);
  -webkit-box-align: flex-start;
  -webkit-align-items: flex-start;
  -ms-flex-align: flex-start;
  align-items: flex-start;
  .el-alert__icon {
    font-size: 12px;
    padding-top: 3px;
  }
}
.my-customer-wrap {
  height: 100%;
}
.right-content {
  /*width: 100%;*/
  padding: 20px;
  min-height: calc(100% - 160px);
  .right-box {
    background: #fff;
    min-height: 500px;
    padding: 0px;
    .apps-content {
      .apps-content-right {
        width: 100%;
        padding: 20px;
        background: #fff;
        .overstore-body {
          background: #fff;
        }
        .daily-set-wrap {
          height: 100%;
          background: #fff;
        }
        .app-detail-wrap {
          height: 100%;
          background: #fff;
        }
        .common-set-wrap {
          height: 100%;
          background: #fff;
        }
      }
    }
  }
}
</style>
