<style>
.InternalAccounting .el-collapse-item__header {
  background-color: #e3e3e3;
  color: #333333 !important;
  padding-left: 20px;
  height: 40px;
  line-height: 40px;
  border-radius: 4px;
}
.InternalAccounting .el-collapse-item__arrow {
  line-height: 40px;
}
.InternalAccounting .el-collapse-item__wrap {
  background-color: transparent;
  padding: 20px 0;
}
.InternalAccounting .OrderList {
  width: 250px;
  height: 336px;
  background-color: #fff;
  margin: 20px 20px 20px 0;
  float: left;
  position: relative;
  border-radius: 4px;
}
.InternalAccounting .OrderList:before,
.InternalAccounting .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%;
}
.InternalAccounting .OrderList:after {
  -webkit-transform: rotate(3deg);
  transform: rotate(3deg);
  left: auto;
  right: 3px;
}
.InternalAccounting .OrderList .content {
  cursor: pointer;
  position: relative;
  z-index: 2;
  height: 100%;
  font-size: 13px;
  border-radius: 4px;
  text-align: center;
  background: #fff;
}
.InternalAccounting .topImg {
  width: 100%;
  height: 158px;
  position: relative;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  overflow: hidden;
  text-align: center;
}
.InternalAccounting .monthDiv {
  position: absolute;
  width: 80px;
  height: 80px;
  top: 20px;
  left: 85px;
  border-radius: 50%;
  border: 6px solid #ededed;
  background-color: #ffffff;
  line-height: 70px;
}
.InternalAccounting .monNum {
  font-size: 35px;
}
.InternalAccounting .mon {
  font-size: 12px;
}
.InternalAccounting .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;
}
.InternalAccounting .commonDiv {
  width: 85%;
  border-bottom: 1px dashed #e3e3e3;
  margin: auto;
  font-size: 14px;
}
.InternalAccounting .comTitle {
  color: #333333;
  float: left;
  margin: 15px 0 10px 0;
}
.InternalAccounting .numList {
  float: right;
  font-weight: bold;
  margin: 15px 0 10px 0;
}
.InternalAccounting .income {
  color: #32cc8a;
}
.InternalAccounting .outcome {
  color: #e85252;
}
.InternalAccounting {
  margin-top: 30px;
}
.InternalAccounting .is-active .el-collapse-item__header {
  background-color: #e85252;
  color: #fff !important;
}
.InternalAccounting .weijie {
  font-weight: bold;
}
.InternalAccounting ._weijieImg {
  position: absolute;
  z-index: 2018;
  bottom: 40px;
  right: 45px;
}
.InternalAccounting .nocursor{cursor: default!important;}
.InternalAccounting .hotel_box{min-height: 500px;}
</style>
<template>
  <div class="flexOne InternalAccounting">
       <div class="hotel_box" v-loading="loading">
            <el-collapse v-model="activeNames">
            <el-collapse-item :title="item.YearStr+'年核算账单'" 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('RestauranAccountingDetail',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>
                        <div class="commonDiv clearfix">
                            <span class="comTitle">{{$t('restaurant.res_income')}}：</span>
                            <span class="numList income" v-if="items.MonthStr>0">￥{{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 income" v-if="items.MonthStr>0">￥{{items.Profit}}</span>
                        </div>
                        <img v-if="items.MonthStr==0" class="_weijieImg" src="../../assets/img/bills.png" alt="">
                    </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_GetInteriorAccountingList",
        msg,
        res => {
          this.loading = false;
          if (res.data.resultCode == 1) {
            this.dateInfo = res.data.data;
            this.dateInfo.forEach(x => {
              x.YearStr = x.YearStr.toString();
            });
          } else {
          }
        },
        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>

