<template>
  <div>
    <van-nav-bar
      @click-left="onClickLeft"
      @click-right="onClickRight"
      style="background-color: #1989fa"
    >
      <template #title>
        <van-col style="color: #ffffff">缴费记录</van-col>
      </template>
      <template #left>
        <i
          class="fa fa-arrow-circle-left"
          aria-hidden="true"
          style="color: #ffffff; font-size: 18px"
        ></i>
      </template>
      <template #right>
        <van-icon name="replay" size="18" color="#ffffff" />
      </template>
    </van-nav-bar>

    <van-list
      v-model="loading"
      :finished="finished"
      finished-text="已显示所有数据"
      @load="Getfdc_pm_revfare"
    >
      <van-cell
          v-for="item in listdata"
          :key="item.farerowid"

          border
        >
          <template #default>

            <van-row class="borderTop">
              <van-col span="24">
                <van-row>
                  <van-col span="5" class="title1">业主</van-col>
                  <van-col span="19">{{ item.ownername }}</van-col>
                </van-row>
                 <van-row>
                  <van-col span="5" class="title1">房屋</van-col>
                  <van-col span="19">{{ item.hname }}</van-col>
                </van-row>
               <van-row>
                  <van-col span="5" class="title1">费用类型</van-col>
                  <van-col span="19" >{{item.billitemname}}</van-col>
                </van-row>
                 <van-row>
                  <van-col span="5" class="title1">缴费金额</van-col>
                  <van-col span="19" >{{item.nrevmny}}元</van-col>
                </van-row>
                <van-row>
                  <van-col span="5" class="title1">费用时间</van-col>
                  <van-col span="19">{{ item.dbdate }}至{{item.dedate}}</van-col>
                </van-row>

              </van-col>

            </van-row>
          </template>
        </van-cell>
    </van-list>
  </div>
</template>

<script>
// eslint-disable-next-line camelcase
import { Getfdc_pm_revfare } from '@/common/api/loginApi.js'
export default {
  name: 'login',
  data () {
    return {
      listdata: [], // 欠费信息
      radio: '', // 单选框

      loading: false,
      finished: false
    }
  },
  created: function () {
    console.info('created')
    // console.info(this.$util);
    this.$util.persistLogin(this)
  },
  methods: {
    Getfdc_pm_revfare: function () {
      var that = this
      let phone = that.$store.state.data.tel
      if (that.$util.isEmpty(phone)) {
        that.$router.push('/')
        return
      }
      Getfdc_pm_revfare(phone).then((res) => {
        console.info('Getfdc_pm_revfare', res)
        if (!res.isSuccess) {
          that.$toast(res.errMsg)
          return
        }
        res.data.forEach(function (item, index, array) {
          item.dbdate = that.$util.getDate(item.dbdate)
          item.dedate = that.$util.getDate(item.dedate)
          that.$set(that.listdata, index, item)
        })
        that.loading = false
        that.finished = true
      })
    },
    // 单选按钮点击事件
    jiaofei: function (event, id) {
      // console.info("click1 event", event);
      // console.info("click1 value", id);
      // console.info("click1", e.target.innerText);
      this.$toast('缴费业务未开通')
    },
    onClickLeft () {
      // this.$toast('返回')
      console.info('left')
      this.$router.go(-1)
    },
    onClickRight () {
      this.$router.go(0)
    }
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.title1 {
  color: #999;
}
.value1 {
  color: #999;
  font-size: 18px;
}
</style>
