<template>
  <div class="hone-content-box">
    <a-row :gutter="24">
      <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
        <div class="statistics">
          <div class="icon" style="background-color:#1890ff;"><a-icon type="home" /></div>
          <!-- <img class="icon" src="~@/assets/guaz.png" alt=""> -->
          <div>
            <p style="color:#666;margin-bottom:5px;">关联小区数量</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">{{pageForm.roomNum}}</p>
            <span v-if="pageForm.roomNum > 0"><a-icon type="arrow-up"
                                                                 color="#1890ff" />{{ pageForm.pageForm }}</span>
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
        <div class="statistics">
          <div class="icon" style="background-color:#7262fd;"><a-icon type="bar-chart" /></div>
          <div>
            <p style="color:#666;margin-bottom:5px;">累积交易金额</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">¥{{pageForm.roomNum}}</p>
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
        <div class="statistics">
          <div class="icon" style="background-color:#ffaa00;"><a-icon type="bar-chart" /></div>
          <div>
            <p style="color:#666;margin-bottom:5px;">待对账金额</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">¥{{pageForm.buildingNum}}</p>
          </div>
        </div>
      </a-col>
      <a-col :sm="24" :md="12" :xl="6" :style="{ marginBottom: '24px' }">
        <div class="statistics">
          <div class="icon" style="background-color:#52c41a;"><a-icon type="pay-circle" /></div>
          <div>
            <p style="color:#666;margin-bottom:5px;">待结算金额</p>
            <p style="margin-bottom:0;color:#333;font-size:28px;line-height:1;">¥{{pageForm.propertyYearFee}}</p>
          </div>
        </div>
      </a-col>
    </a-row>

    <a-row :gutter="24">
      <a-col :sm="24" :md="24" :xl="24" :style="{ marginBottom: '24px' }">
        <div class="quick t-box">
          <h3 class="box-title">快捷方式</h3>
          <div class="todo-list">
            <div class="item" @click="toQuick(1)"><a-icon type="qrcode" />
              <p>商铺二维码</p>
            </div>
            <div class="item" @click="toQuick(2)"><a-icon type="user-add" />
              <p>申请退款</p>
            </div>
            <div class="item" @click="toQuick(3)"><a-icon type="home" />
              <p>申请结算</p>
            </div>
            <div class="item" @click="toQuick(4)"><a-icon type="user" />
              <p>申请对账</p>
            </div>
          </div>
        </div>
      </a-col>
    </a-row>
    <index-chart></index-chart>
    <a-modal :visible="visible" title="商铺二维码" @ok="handleOk">
      <a-space>


      </a-space>
    </a-modal>
  </div>
</template>

<script>
import IndexChart from './IndexChart'
import Bar from '@/components/chart/Bar'
import Pie from '@/components/chart/Pie'
import { homeDataStatistics } from '@/api/api'

// const barData = []
// for (let i = 0; i < 12; i += 1) {
//   barData.push({
//     x: `${i + 1}月`,
//     y: 1000,
//   })
// }
export default {
  name: 'Analysis',
  components: {
    IndexChart,
    Bar,
    Pie,
  },
  data() {
    return {
      pageForm: {},
      loading: true,
      payData: [],
      typeCode: 'SFLX00001',
      noticeTitle: '',
      noticeContent: '',
      visible: false,
    }
  },
  created() {
    this.onDetail()
  },
  methods: {
    async onDetail(typeCode) {
      let { result } = await homeDataStatistics({ typeCode: typeCode })
      this.pageForm = { ...result }
      this.loading = !this.loading
    },
    toQuick(type) {
      if (type == 1) {
       this.clickQRcode()
      } else if (type == 2) {
        this.$router.push({
          path: '/information/owner',
        })
      } else if (type == 3) {
        this.$router.push({
          path: '/information/house',
        })
      } else if (type == 4) {
        this.$router.push({
          path: '/information/worker',
        })
      }
    },
    clickQRcode() {
      this.visible=true
    },
    handleOk (){
      this.visible=false
    }


  },
}
</script>
<style lang="less" scoped>
.hone-content-box {
  padding: 10px;
  .statistics {
    // flex: none;
    background: #fff;
    width: 100%;
    height: 90px;
    box-sizing: border-box;
    border: 1px solid #e0dfdf;
    display: flex;
    align-items: center;
    padding-left: 20px;
    .icon {
      width: 60px;
      height: 60px;
      border-radius: 60px;
      margin-right: 12px;
      display: flex;
      text-align: center;
      align-items: center;
      justify-content: center;
      .anticon {
        font-size: 32px;
        color: #ffffff;
      }
    }
  }

  .pay-box {
    display: flex;
    .left-box {
      flex: none;
      width: 50%;
    }
  }
}
.t-box {
  background: #fff;
  padding: 15px;
  border: 1px solid #e0dfdf;
}
.box-title {
  font-weight: bold;
  margin-bottom: 15px;
  display: inline-block;
  padding-left: 10px;
  border-left: 3px solid #1890ff;
  height: 20px;
  line-height: 20px;
}
.pay-cost {
  height: 380px;
}
.announcement {
  height: 220px;
  .title {
    .ant-btn {
      float: right;
      margin-left: 10px;
    }
  }
  ul {
    padding-left: 5px;
    li {
      list-style-type: none;
      height: 30px;
      line-height: 30px;
      display: flex;
      justify-content: space-between;
      a {
        color: #666;
        width: 80%;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
      }
    }
  }
}
.salesCard {
  height: 380px;
}
.extra-type {
  a {
    margin-right: 20px;
  }
}
.number {
  width: 80%;
  margin: 0 10%;
  display: flex;
  justify-content: space-evenly;
  p {
    font-size: 14px;
    margin: 0;
  }
}
.to-do {
  height: 220px;
  .todo-list {
    padding: 0 10px;
    margin-top: 15px;
    .item {
      display: flex;
      justify-content: space-between;
    }
  }
}
.quick {
  height: 165px;
  .todo-list {
    display: flex;
    justify-content: space-evenly;
    margin-top: 20px;
    .item {
      margin: 0 10px;
      display: flex;
      flex-direction: column;
      text-align: center;
      cursor: pointer;
      .anticon {
        font-size: 40px;
        color: #007dff;
      }
      p {
        margin-top: 8px;
      }
    }
  }
}
.notice-content{
  word-break: break-all;
  /deep/ img{
    width: 100%;
    height: auto;
  }
}
</style>