<style>
.TicketAccounting .el-collapse-item__header {
  background-color: #e3e3e3;
  color: #333333 !important;
  padding-left: 20px;
  height: 40px;
  line-height: 40px;
  border-radius: 4px;
}
.TicketAccounting .el-collapse-item__arrow {
  line-height: 40px;
}
.TicketAccounting .el-collapse-item__wrap {
  background-color: transparent;
  padding: 20px 0;
}
.TicketAccounting .OrderList {
  width: 250px;
  height: 336px;
  background-color: #fff;
  margin: 20px 20px 20px 0;
  float: left;
  position: relative;
  border-radius: 4px;
}
.TicketAccounting .OrderList:before,
.TicketAccounting .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%;
}
.TicketAccounting .OrderList:after {
  -webkit-transform: rotate(3deg);
  transform: rotate(3deg);
  left: auto;
  right: 3px;
}
.TicketAccounting .OrderList .content {
  cursor: pointer;
  position: relative;
  z-index: 2;
  height: 100%;
  font-size: 13px;
  border-radius: 4px;
  text-align: center;
  background: #fff;
}
.TicketAccounting .topImg {
  width: 100%;
  height: 158px;
  position: relative;
  border-top-left-radius: 5px;
  border-top-right-radius: 5px;
  overflow: hidden;
  text-align: center;
}
.TicketAccounting .monthDiv {
  position: absolute;
  width: 80px;
  height: 80px;
  top: 20px;
  left: 85px;
  border-radius: 50%;
  border: 6px solid #ededed;
  background-color: #ffffff;
  line-height: 70px;
}
.TicketAccounting .monNum {
  font-size: 35px;
}
.TicketAccounting .mon {
  font-size: 12px;
}
.TicketAccounting .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;
}
.TicketAccounting .commonDiv {
  width: 85%;
  border-bottom: 1px dashed #e3e3e3;
  margin: auto;
  font-size: 14px;
}
.TicketAccounting .comTitle {
  color: #333333;
  float: left;
  margin: 15px 0 10px 0;
}
.TicketAccounting .numList {
  float: right;
  font-weight: bold;
  margin: 15px 0 10px 0;
}
.TicketAccounting .income {
  color: #32cc8a;
}
.TicketAccounting .outcome {
  color: #e85252;
}
.TicketAccounting {
  margin-top: 30px;
}
.TicketAccounting .is-active .el-collapse-item__header {
  background-color: #e85252;
  color: #fff !important;
}
.TicketAccounting .weijie {
  font-weight: bold;
}
.TicketAccounting ._weijieImg {
  position: absolute;
  z-index: 2018;
  bottom: 50px;
  right: 45px;
}
.TicketAccounting .nocursor{cursor: default!important;}
.TicketAccounting .hotel_box{min-height: 500px;}
</style>
<template>
  <div class="flexOne TicketAccounting">
       <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="goDetails(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_GetAirTicketAccountingList",
        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 => {}
      );
    },
    goDetails(item, items) {
      if (items.MonthStr != 0) {
        this.goUrl("TicketAccountingDetails", item, items);
      }
    },
    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
          }
        });
      }
    }
  },
  mounted() {
    this.getList();
  }
};
</script>

