repaymentPlan.vue 4.97 KB
<template>
  <a-tabs defaultActiveKey="1" v-model="defaultTabKey" @change="callback" :animated="false">
    <a-tab-pane tab="借款账单" key="1">
      <a-table
        ref="table"
        size="middle"
        bordered
        :columns="columnsBorrow"
        :rowKey="(record) => record.id"
        :dataSource="dataList"
        :pagination="false"
        :loading="loading"
        style="padding-bottom: 30px"
      >
        <!-- 字符串超长截取省略号显示-->
        <span slot="esContent" slot-scope="text">
          <j-ellipsis :value="text" :length="10" />
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleDetailLook(record)">查看</a>
        </span>
      </a-table>
    </a-tab-pane>
    <a-tab-pane tab="费用账单" key="2">
      <a-table
        ref="table"
        size="middle"
        bordered
        :columns="columnsCost"
        :rowKey="(record) => record.id"
        :dataSource="dataListFee"
        :pagination="false"
        :loading="loading"
        style="padding-bottom: 30px"
      >
        <!-- 字符串超长截取省略号显示-->
        <span slot="esContent" slot-scope="text">
          <j-ellipsis :value="text" :length="10" />
        </span>
        <span slot="action" slot-scope="text, record">
          <a @click="handleDetailLook(record)">查看</a>
        </span>
      </a-table>
    </a-tab-pane>
  </a-tabs>
</template>

<script>
import { queryRepayPlan, queryFeeBillList } from '@/api/makeLoan'

export default {
  name: 'repaymentPlan',
  props: {
    orderNo: {
      type: String,
      default: null,
    },
  },
  data() {
    return {
      dataList: [],
      dataListFee: [],
      loading: false,
      visible: false,
      defaultTabKey: '1',
      dbTimePoint: JSON.parse(sessionStorage.getItem('DB_TIME_POINT')), // 收费模式
      columnsBorrow: [
        {
          title: '期数',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '计划还款日',
          align: 'center',
          dataIndex: 'planDate',
        },
        {
          title: '计划还款本金(元)',
          align: 'center',
          dataIndex: 'duePrincipalMoney',
        },
        {
          title: '计划还款利息(元)',
          align: 'center',
          dataIndex: 'dueInterestMoney',
        },
        {
          title: '计划还款本息总金额(元)',
          align: 'center',
          dataIndex: 'dueSumMoney',
        },
        {
          title: '备注',
          align: 'center',
          dataIndex: 'remark',
        },
      ],
      columnsCost: [
        {
          title: '期数',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          },
        },
        {
          title: '计划还款日',
          align: 'center',
          dataIndex: 'planDate',
        },
        {
          title: '费用名称',
          align: 'center',
          dataIndex: 'chargeName',
        },
        {
          title: '收费模式',
          align: 'center',
          dataIndex: 'timePoint',
          customRender: (t, r, index) => {
            for (var i = 0; i < this.dbTimePoint.length; i++) {
              if (t === Number(this.dbTimePoint[i].name)) {
                return this.dbTimePoint[i].title
              }
            }
          },
        },
        {
          title: '银行卡代扣手续费标识',
          align: 'center',
          dataIndex: 'bankCardDebit',
          customRender: (t, r, index) => {
            return t == 1 ? '是' : '否'
          },
        },
        {
          title: '费用金额(元)',
          align: 'center',
          dataIndex: 'remitMoney',
          customRender: (t, r, index) => {
            return this.$numMoney(t)
          },
        },
        {
          title: '备注',
          align: 'center',
          dataIndex: 'remark',
        },
      ],
    }
  },
  created() {},
  methods: {
    loadData() {
      this.dataList = []
      this.defaultTabKey = '1'
      let _p = { orderNo: this.orderNo }
      queryRepayPlan(_p).then((res) => {
        if (res.status.statusCode == 0) {
          this.dataList = res.result
        } else {
          // this.$message.warning(res.status.statusReason)
        }
      })
    },
    handleDetailLook() {},
    callback(key) {
      if (key == 1) {
        this.loadData()
      } else {
        this.loadDataFee()
      }
    },
    loadDataFee() {
      this.dataListFee = []
      let _p = { orderNo: this.orderNo }
      queryFeeBillList(_p).then((res) => {
        if (res.status.statusCode == 0) {
          this.dataListFee = res.result
        } else {
          // this.$message.warning(res.status.statusReason)
        }
      })
    },
  },
}
</script>
<style>
</style>