<!--
 * @Descripttion: 当前组件信息
 * @version: 1.0.0
 * @Author: 无尘
 * @Date: 2019-03-20 14:36:37
 * @LastEditors: 无尘
 * @LastEditTime: 2020-08-19 17:13:01
 -->
<template>
  <div class="my-customer-wrap common-set-wrap">
    <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="overstore-tip m-b-19">
              <div role="alert" class="el-alert el-alert--info flex flex-align-center w-604">
                <i class="el-alert__icon el-icon-warning font-13 color-2f54eb"></i>
                <div class="el-alert__content">
                  <p class="el-alert__title color-303133 font-13">授权范围：展示授权商户资源组全部授权范围，包含关联企业的门店和未关联企业的门店</p>
                </div>
              </div>
            </div>
            <div class="table-condition m-b-19">
              <el-input placeholder="请输入门店名称" maxlength="50" v-model="pageParams.search" class="w-264 " style="width: 264px;" @keyup.native="toInput"> <i slot="prefix" class="el-input__icon el-icon-search"></i> </el-input>
            </div>
            <div class="m-t-20">
              <el-table class="select-table" ref="multipleTable" :data="tableData" tooltip-effect="dark" :style="{ width: '100%', minHeight: tableH }">
                <el-table-column prop="" label="门店 " show-overflow-tooltip>
                  <template slot-scope="scope">
                    <p class="gic-name color-606266">{{ scope.row.storeName || '' }}</p>
                    <p class="gic-version color-606266">{{ scope.row.storeCode || '' }}</p>
                  </template>
                </el-table-column>
                <el-table-column prop="" label="门店分组" show-overflow-tooltip>
                  <template slot-scope="scope">{{ scope.row.storeGroupName || '' }}</template>
                </el-table-column>
                <el-table-column prop="" label="绑定时间" show-overflow-tooltip>
                  <template slot-scope="scope">
                    <div class="line-18 color-606266">{{ scope.row.createTime | timeStampToYmd }}</div>
                    <div class="line-18 color-606266">{{ scope.row.createTime | timeStampToHms }}</div>
                  </template>
                </el-table-column>
              </el-table>
              <div class="block common-wrap__page text-right m-t-24" v-if="tableData.length">
                <el-pagination background @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="pageParams.pageNum" :page-sizes="[10, 20, 30]" :page-size="pageParams.pageSize" layout="total, sizes, prev, pager, next" :total="total"> </el-pagination>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!-- <vue-gic-footer></vue-gic-footer> -->
  </div>
</template>
<script>
import { getRequest } from '@/api/api';
import errMsg from '@/common/js/error';
// import { _debounce } from '@/common/js/public';
export default {
  name: 'authMerchant',
  data() {
    return {
      pageParams: {
        pageNum: 1,
        pageSize: 20,
        enterpriseId: this.$route.query.enterprise || ''
      },

      // 分页参数
      total: 0,
      tableData: [],
      addShow: false
    };
  },
  computed: {},
  methods: {
    toInput(res) {
      const that = this;
      that.pageParams.pageNum = 1;
      that.getTableList();
    },
    /**
     * 路由跳转
     *  @param {path} path
     */
    changeRoute(path) {
      this.$router.push(path);
    },

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

    /**
     * 分页---当前页变化
     *  @param {Number} val
     */
    handleCurrentChange(val) {
      const that = this;
      that.pageParams.pageNum = val;
      that.getTableList();
    },
    /**
     * 获取列表数据
     */
    getTableList(val) {
      const that = this;
      let para = { ...this.pageParams };
      getRequest('/haoban-manage3-web/bind-store-list', para)
        .then(res => {
          let resData = res.data;
          if (resData.errorCode == 1 && resData.result) {
            that.tableData = resData.result.result || [];
            this.total = resData.result.totalCount || 0;
            return false;
          }
          that.tableData = [];
          errMsg.errorMsg(resData);
        })
        .catch(function(error) {
          that.$message.error({
            duration: 1000,
            message: error.message
          });
        });
    }
  },
  watch: {},
  mounted() {
    const that = this;
    that.getTableList();
  }
};
</script>
<style type="text/scss" lang="scss" 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;
}
.m-b-19 {
  margin-bottom: 19px;
}
.tooltip-text {
  width: 100%;
  white-space: pre-wrap;
  word-break: break-all;
}
.w-293 {
  width: 293px;
}
.w-191 {
  width: 191px;
}
.w-604 {
  width: 604px;
}
.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: 0 20px 20px 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;
        }
      }
    }
  }
}

.ul-li-cell {
  .cell-img {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    height: 40px;
    border-radius: 2px;
    border: 1px solid rgba(228, 231, 237, 1);
    box-sizing: border-box;
    img {
      width: 100%;
    }
  }
  .cell-info {
    padding-left: 10px;
    box-sizing: border-box;
    .cell-info-name {
      max-width: 370px;
      height: 20px;
      line-height: 19px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .gic-name {
      width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      font-size: 14px;
      color: #303133;
      line-height: 18px;
    }
    .gic-version {
      display: inline-block;
      padding: 0 5px;
      height: 15px;
      line-height: 15px;
      margin-left: 5px;
      background: rgba(255, 241, 240, 1);
      border-radius: 2px;
      border: 1px solid rgba(255, 163, 158, 1);
      font-size: 10px;
      color: #f5222d;
    }
  }
}
</style>
