index.vue 4.92 KB
<template>
  <div class="out_main">
    <!-- <div class="base-info-index"> -->
    <div class="top_baceInfo">
      <img class="sign_icon" src="../../assets/scrm_base_info_icon_one.png" />
      <div class="info_widget">
        <div style="display: flex">
          <div class="title_text">
            {{ blocInfo.merchantName }}
            <span class="min_text">(商户号:{{ blocInfo.merchantNo }})</span>
          </div>
          <GLButton type="primary" :size="size" @click="editInfo" fn="修改企业信息">编辑</GLButton>
          <!-- <el-button type="primary" :size="size" @click="editInfo">修改企业信息</el-button> -->
        </div>

        <div class="sec_title_text dr_top_1">
          <span>关联企微:{{ blocInfo.entmicroName || '--' }}</span>
          <div v-if="blocInfo.entmicroName" class="auth_btn" :class="accountLevel != 4 ? 'auth_btn_cp' : ''">已授权</div>
        </div>
        <div v-if="accountLevel == 1" class="min_text dr_top_1">所属企业:--</div>
        <div v-if="accountLevel != 1" class="min_text dr_top_1">所属企业:{{ blocInfo.parentName }}</div>
        <div v-if="blocInfo.channelId == 2" class="min_text">商户SAP编码:{{ blocInfo.sapCode ? blocInfo.sapCode : '--' }}</div>
        <div v-if="accountLevel == 4" class="min_text">企微员工:{{ blocInfo.entMicroEmployeeCount }}人</div>
      </div>
    </div>
    <blocModule :bloc="blocInfo" :list.sync="storesList" v-if="accountLevel != 4"></blocModule>
    <shopModule :bloc="blocInfo" v-if="accountLevel == 4"></shopModule>
    <!-- </div> -->
  </div>
</template>

<script>
import shopModule from './shop.vue'
import blocModule from './bloc.vue'
// import { merchantInfo } from '../../api/modules/baseinfoApi'
export default {
  name: 'index',
  components: {
    shopModule,
    blocModule
  },
  data() {
    return {
      platform: 1, //1 集团  2 门店
      accountLevel: 1, //1-工厂;2-省代;3-市代;4-门店
      blocInfo: {
        merchantName: ''
      },
      storesList: []
    }
  },
  created() {
    //this.$globalState.accountLevel
    const { session } = this.$globalState
    this.platform = session.merchantModel
    this.loginInfo = session
    this.accountLevel = session.accountLevel
    this.getBlocData()
  },
  methods: {
    getBlocData() {
      let para = {
        merchantId: this.loginInfo.merchantId
      }
      this.$apis.baseInfo.merchantInfo(para).then(res => {
        this.blocInfo = res
        if (res.stores) {
          this.storesList = res.stores.map(item => {
            item.date = `${this.dateFormat(item.starttime, 'YYYY.MM.DD')}--${this.dateFormat(item.endtime, 'YYYY.MM.DD')}`
            return item
          })
        }
      })
    },
    dateFormat: function(dateTime, format = 'yyyy-MM-dd') {
      const date = new Date(dateTime)
      const config = {
        YYYY: date.getFullYear(),
        MM: date.getMonth() + 1, //getMonth() 方法根据本地时间返回指定日期的月份(从 0 到 11)
        DD: date.getDate(),
        HH: date.getHours(),
        mm: date.getMinutes(),
        ss: date.getSeconds()
      }
      for (const key in config) {
        format = format.replace(key, config[key])
      }
      return format
    },
    editInfo() {
      this.$router.push({ path: '/baseInfo/editInfo' })
    }
  }
}
</script>
<style lang="scss" scoped>
.out_main {
  box-sizing: border-box;
  height: 100%;
  // margin: 0 20px 64px 40px;
  background: #fff;
  // box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
  // min-height: calc(100vh - 144px);
}
.base-info-index {
  width: 100%;
  height: calc(100vh - 144px);
  background: #fff;
  // box-shadow: 0px 10px 20px 0px rgba(88, 80, 255, 0.1);
  overflow: hidden;
  overflow-y: scroll;
}
.out_main::-webkit-scrollbar {
  height: 1px;
  width: 8px;
}
.out_main::-webkit-scrollbar-thumb {
  background: #e9e8ff;
  border-radius: 7px;
}
.top_baceInfo {
  width: 100%;
  box-sizing: border-box;
  padding: 40px 40px 0 40px;
  display: flex;
  .sign_icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
  }
  .info_widget {
    margin-left: 15px;
    width: 100%;
    .title_text {
      color: #333333;
      font-size: 16px;
      font-weight: 500;
      width: 100%;
    }
    .min_text {
      color: #999999;
      font-size: 12px;
      line-height: 20px;
    }
    .sec_title_text {
      color: #333333;
      font-size: 14px;
      font-weight: 400;
      .auth_btn {
        width: 48px;
        height: 20px;
        text-align: center;
        line-height: 20px;
        border-radius: 1px;
        border: 1px solid rgba(44, 202, 116, 0.35);
        font-size: 12px;
        font-weight: 400;
        color: #2cca74;
        display: inline-block;
        margin-left: 16px;
      }
      .auth_btn_cp {
        color: #2cca74;
        background: rgba(44, 202, 116, 0.06);
        border-radius: 2px;
        border: 1px solid rgba(44, 202, 116, 0.35);
      }
    }
    .dr_top_1 {
      margin-top: 8px;
    }
  }
}
</style>