<style>
.HotelAccounting .el-collapse-item__header {
  background-color: #e3e3e3;
  color: #333333 !important;
  padding-left: 20px;
  height: 40px;
  line-height: 40px;
  border-radius: 4px;
}
.HotelAccounting .el-collapse-item__arrow {
  line-height: 40px;
}
.HotelAccounting .el-collapse-item__wrap {
  background-color: transparent;
  padding: 20px 0;
}
.HotelAccounting .OrderList {
  width: 250px;
  height: 336px;
  background-color: #fff;
  margin: 20px 20px 20px 0;
  float: left;
  position: relative;
  border-radius: 4px;
}
.HotelAccounting .OrderList:before,
.HotelAccounting .OrderList:after {
  content: "";
  position: absolute;
  -webkit-transform: rotate(-3deg);
  transform: rotate(-3deg);
  bottom: 13px;
  box-shadow: 0 15px 5px rgba(0, 0, 0, 0.3);
  height: 20px;
  left: 3px;
  max-width: 300px;
  width: 40%;
}
.HotelAccounting .OrderList:after {
  -webkit-transform: rotate(3deg);
  transform: rotate(3deg);
  left: auto;
  right: 3px;
}
.HotelAccounting .OrderList .content {
  cursor: pointer;
  position: relative;
  z-index: 2;
  height: 100%;
  font-size: 13px;
  border-radius: 4px;
  text-align: center;
  background: #fff;
}
.HotelAccounting .topImg {
  width: 100%;
  height: 158px;
  position: relative;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  overflow: hidden;
  text-align: center;
}
.HotelAccounting .monthDiv {
  position: absolute;
  width: 80px;
  height: 80px;
  top: 20px;
  left: 85px;
  border-radius: 50%;
  border: 6px solid #ededed;
  background-color: #ffffff;
  line-height: 70px;
}
.HotelAccounting .monNum {
  font-size: 35px;
}
.HotelAccounting .mon {
  font-size: 12px;
}
.HotelAccounting .dayList {
  width: 140px;
  height: 25px;
  background-color: rgba(255, 255, 255, 0.8);
  position: absolute;
  bottom: 15px;
  font-size: 12px;
  text-align: center;
  line-height: 25px;
  border-radius: 20px;
  left: 55px;
}
.HotelAccounting .commonDiv {
  width: 85%;
  border-bottom: 1px dashed #e3e3e3;
  margin: auto;
  font-size: 14px;
}
.HotelAccounting .comTitle {
  color: #333333;
  float: left;
  margin: 15px 0 10px 0;
}
.HotelAccounting .numList {
  float: right;
  font-weight: bold;
  margin: 15px 0 10px 0;
}
.HotelAccounting .incomebus {
  color: #32cc8a;
}
.HotelAccounting .outcome {
  color: #e85252;
}
.HotelAccounting {
  margin-top: 30px;
}
.HotelAccounting .is-active .el-collapse-item__header {
  background-color: #e85252;
  color: #fff !important;
}
.HotelAccounting .weijie {
  font-weight: bold;
}
.HotelAccounting .billImg {
  position: absolute;
  right: 40px;
  bottom: 40px;
}
.HotelAccounting .nocursor {
  cursor: default !important;
}
.HotelAccounting .hotel_box{min-height: 500px;}
</style>
<template>
  <div class="flexOne HotelAccounting">
       <div class="hotel_box" v-loading="loading">
            <el-collapse v-model="activeNames">
            <el-collapse-item :title="item.YearStr+$t('restaurant.res_AnnualAccounts')" v-for="(item,index) in dateInfo" :name="index+1" :key="index"> 
                <div class="OrderList" v-for="items in dateInfo[index].SubList" :key="items.subCode">
                    <div class="content" @click="goUrl('BusAccountInfo',item,items)" :class="{'nocursor':items.MonthStr==0}">
                        <div class="topImg">
                            <img src="../../assets/img/internalAccount.png">
                            <div class="monthDiv" v-if="items.MonthStr>0">
                                <span class="monNum">{{items.MonthStr}}</span><span class="mon">{{$t('pub.month')}}</span>
                            </div>
                            <div class="monthDiv" v-else>
                                <span class="weijie">{{$t('restaurant.res_OutStandingBills')}}</span>
                            </div>
                            <div class="dayList" v-if="items.MonthStr>0">
                                {{items.StartTime}}{{$t('restaurant.res_To')}}{{items.EndTime}}
                            </div>
                            <div class="dayList" v-else>
                                {{$t('restaurant.res_ContainsAll')}}
                            </div>
                        </div>
                        <img v-if="items.MonthStr==0" class="billImg" src="../../assets/img/bills.png">
                        <div class="commonDiv clearfix">
                            <span class="comTitle">{{$t('restaurant.res_income')}}：</span>
                            <span class="numList incomebus">￥{{items.TotalPrice}}</span>
                        </div>
                        <div class="commonDiv clearfix">
                            <span class="comTitle">{{$t('restaurant.res_outcome')}}：</span>
                            <span class="numList outcome" v-if="items.MonthStr>0">￥{{items.CostPrice}}</span>
                        </div>
                        <div class="commonDiv clearfix">
                            <span class="comTitle profit">{{$t('restaurant.res_profit')}}：</span>
                            <span class="numList incomebus" v-if="items.MonthStr>0">￥{{items.Profit}}</span>
                        </div>
                    </div>
                </div>
            </el-collapse-item>
            </el-collapse>
       </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      activeNames: 1,
      loading: false,
      dateInfo: ""
    };
  },
  methods: {
    getList() {
      this.loading = true;
      let msg = {};
      this.apipost(
        "dmcindex_get_GetBusAccountingList",
        msg,
        res => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.dateInfo = res.data.data;
            this.dateInfo.forEach(x => {
              x.YearStr = x.YearStr.toString();
            });
          }
        },
        err => {}
      );
    },
    goUrl(path, item, items) {
      if (items.MonthStr > 0) {
        this.$router.push({
          path: path,
          query: {
            YearStr: item.YearStr,
            MonthStr: items.MonthStr,
            TotalPrice: items.TotalPrice,
            CostPrice: items.CostPrice,
            Profit: items.Profit,
            blank:'y',tab:'核算详情'
          }
        });
      }
    }
  },
  mounted() {
    this.getList();
  }
};
</script>

