<template>
  <div id="index">
    <el-container id="horContainer" direction="horizontal">
      <app-sidebar/>
      <el-container id="verContainer" direction="vertical">
        <el-header id="app-header" height="auto">
          <app-navbar/>
          <app-tagsView/>
        </el-header>
        <el-main id="app-main">
          <app-pageView/>
          <!-- <link-kefu></link-kefu> -->
          <Shortcut/>
        </el-main>
      </el-container>
    </el-container>
    <el-dialog title="开票信息确认" :visible.sync="isShow" :before-close="companyInfoClose">
      <company_info_confirm ref="companyInfo" :companyInfo="this"/>
      <div slot="footer" class="customer">
        <el-button class="invoice_button" type="primary" v-on:click="companyInfoEdit">确 定</el-button>
        <el-button class="invoice_button" type="primary" v-on:click="companyInfoCancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import Sidebar from '@/layout/Sidebar'
import NavBar from '@/layout/NavBar'
import TagsView from '@/layout/TagsView'
import CompanyInfoConfirm from '@/components/companyInfoConfirm/companyInfoConfirm'
import cache from '@/utils/cache'
import Shortcut from '@/components/Shortcut'
// import LinkKeFu from "@/components/LinkKeFu";

export default {
  name: 'index',
  components: {
    'app-sidebar': Sidebar,
    'app-navbar': NavBar,
    'app-tagsView': TagsView,
    'company_info_confirm': CompanyInfoConfirm,
    Shortcut
    // 'link-kefu': LinkKeFu
  },
  data() {
    return {
      isShow: false
    }
  },
  mounted() {
    let company = JSON.parse(cache.getSession('company'))
    console.log(company)
    if (company) {
      if (!company.hasConfirm) {
        this.isShow = true
      }
    }
    this.$notify.info({
      title: '温馨提示',
      message: '打印发票汇总表请到发票查询下的发票资料查询中进行打印',
      offset: 0,
      duration: 180000,
      position: 'bottom-right'
    })
  },
  methods: {
    // 开票信息确认
    companyInfoEdit() {
      this.$refs.companyInfo.entEditSave()
    },
    // 确认信息关闭前确认
    companyInfoClose(done) {
      this.$confirm('确认关闭开票信息确认吗？')
          .then(_ => {
            done()
          })
          .catch(_ => {
          })
    },
    // 确认信息取消
    companyInfoCancel() {
      this.$confirm('确认关闭开票信息确认吗？')
          .then(_ => {
            this.isShow = false
          })
          .catch(_ => {
          })
    },
    // 确认信息隐藏
    companyInfoShow() {
      this.isShow = false
      location.reload()
    }
  }
}
</script>
<style lang='stylus'>
#index {
  position: relative;
  width: 100%;
  height: 100%;

  #horContainer {
    height: 100%;
  }

  #verContainer {
    position: relative;
    height: 100%;
    transition: width 0.28s;
  }

  #app-header {
    position: relative;
    width: 100%;
    padding: 0;
    background-color: #fff;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.12), 0 0 3px 0 rgba(0, 0, 0, 0.04);
    z-index: 1000;
  }

  #app-main {
    position: relative;
    width: 100%;
    background: #fff;
    overflow: inherit;
  }
}
</style>
