repaymentPlanModal.vue 3.62 KB
<template>
  <a-modal title="还款计划试算" :width="800" :centered="true" :visible="visible" @cancel="handleCancel" @ok="handleSubmit" :maskClosable="false" style="top:20px;" class="scope-attachment">
    <a-table v-if="type==1" ref="table" size="middle" bordered :columns="columns" :rowKey="record => record.id" :dataSource="dataList" :pagination="false" :loading="loading">
      <!-- 字符串超长截取省略号显示-->
      <span slot="esContent" slot-scope="text">
        <j-ellipsis :value="text" :length="10" />
      </span>
    </a-table>
    <a-table v-else ref="table" size="middle" bordered :columns="columnsfenqi" :rowKey="record => record.id" :dataSource="dataList" :pagination="false" :loading="loading">
      <!-- 字符串超长截取省略号显示-->
      <span slot="esContent" slot-scope="text">
        <j-ellipsis :value="text" :length="10" />
      </span>
    </a-table>
  </a-modal>
</template>

<script>
import moment from 'moment'
export default {
  name: 'repaymentPlanModal',
  data () {
    return {
      dataList: [],
      loading: false,
      visible: false,
      type: '', // 1、分期 2、非分期
      columns: [
        {
          title: '期数',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '计划还款日',
          align: 'center',
          dataIndex: 'planTime',
          customRender: function (t, r, index) {
            return t.slice(0, 10)
          }
        },
        {
          title: '计划还款本金',
          align: 'center',
          dataIndex: 'dueMoney'
        },
        {
          title: '计划还款利息',
          align: 'center',
          dataIndex: 'totalInterest'
        },
        {
          title: '服务费',
          align: 'center',
          dataIndex: 'totalServiceFee'
        },
        {
          title: '计划还款总金额',
          align: 'center',
          dataIndex: 'totalMoney'
        },
      ],
      columnsfenqi: [
        {
          title: '期数',
          dataIndex: '',
          key: 'rowIndex',
          width: 60,
          align: 'center',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '计划还款日',
          align: 'center',
          dataIndex: 'planTime',
          customRender: function (t, r, index) {
            return t.slice(0, 10)
          }
        },
        {
          title: '计划还款本金',
          align: 'center',
          dataIndex: 'userDuePrincipalMoney'
        },
        {
          title: '计划还款利息',
          align: 'center',
          dataIndex: 'userPlanInterestMoney'
        },
        {
          title: '服务费',
          align: 'center',
          dataIndex: 'serviceFee'
        },
        {
          title: '计划还款总金额',
          align: 'center',
          dataIndex: 'userDueSumMoney'
        },
      ],
      dateFormat: 'YYYY-MM-DD',
    }
  },
  created () {

  },
  methods: {
    moment,
    edit (record, type) {
      console.log(record)
      this.type = type
      this.visible = true
      if (Object.prototype.toString.call(record) === '[object Object]') {
        this.dataList = []
        this.dataList.push(record)
      } else {
        this.dataList = record
      }
    },
    handleSubmit () {
      this.close()
    },
    handleCancel () {
      this.close()
    },
    close () {
      this.$emit('close')
      this.visible = false
    },
  }
}
</script>
<style>
</style>