<!-- 应收实收分析 -->
<template>
  <view class="container">
    <view class="table">
      <view class="table-box">
        <TableRanking :loading="loading" :tableTh="tableTh" :tableData="tableData" padding="0" :isScroll="true" />
      </view>
    </view>
  </view>
</template>

<script>
import TableRanking from '@/components/tableRanking.vue';
export default {
  components: {
    TableRanking
  },
  props: {
    tableTh: {
      type: Array,
      default: () => {
        return [
          {
            field: '时间',
            width: 130,
            key: 'statisTime'
          },
          {
            field: '应收金额(元)',
            width: 80,
            key: 'payAmount'
          },
          {
            field: '实收金额(元)',
            width: 80,
            key: 'realAmount'
          },
          {
            field: '逃费金额(元)',
            width: 80,
            key: 'runawayAmount'
          },
          {
            field: `“一分钱停车”减免`,
            width: 120,
            key: 'oneAmount'
          },
          {
            field: '“八折停车”减免',
            width: 110,
            key: 'eightAmount'
          },
          {
            field: '欠费金额(元)',
            width: 80,
            key: 'amtOwe'
          },
          {
            field: '退款金额(元)',
            width: 80,
            key: 'backAmount'
          }
        ];
      }
    }
  },
  data() {
    return {
      currentDate: [],
      tableData: {
        list: []
      },
      params: {
        reportType: 2,
        queryDate: '',
        title: ''
      },
      loading: false
    };
  },
  methods: {
    tabClick(item) {
      this.tabCurName = item.value;
      this.getReallyReceivableList();
    },
    getData(obj) {
      this.params = obj;
      this.getReallyReceivableList();
    },
    getReallyReceivableList() {
      this.loading = true;
      uni.$u.api.statisticalReportApi.getReallyReceivableListApi(this.params).then((res) => {
        if (res.code === 200) {
          this.tableData.list = res.data.itemList;
        }
        this.loading = false;
      });
    }
  }
};
</script>

<style lang="scss" scoped>
@import './../../styles/report.scss';
</style>
