liushui.vue 6.74 KB
<template>
  <div>
    <a-modal :title="title" :width="1200" :centered="true" :visible="visible" :confirmLoading="confirmLoading" @ok="handleSubmit1" @cancel="handleCancel1" cancelText="关闭" style="top:20px;" :maskClosable="false" class="scoped-person">
      <a-table class="modal-liushui-height" ref="table" bordered size="middle" rowKey="id" :columns="columns" :dataSource="dataSource" :pagination="ipaginations" :scroll="{ x: 800 }" :defaultExpandAllRows="true" @change="handleTableChangeMixin">
      </a-table>
    </a-modal>
  </div>
</template>

<script>
import { ModalPageMixin } from '@/mixins/ModalPageMixin'
import {
  queryCreditTransEnterprisePage,
  queryCreditTransLegalPersonPage,
  queryCreditTransPersonalPage
} from '@/api/configApi'
export default {
  name: 'liushui',
  mixins: [ModalPageMixin],
  data () {
    return {
      visible: false,
      title: '',
      confirmLoading: false,
      transType: JSON.parse(sessionStorage.getItem('CREDIT_TRANS_TYPE')), // 业务操作
      transDirection: JSON.parse(sessionStorage.getItem('CREDIT_TRANS_DIRECTION')) || [], // 额度(增/减)
      dbfundApproval: JSON.parse(sessionStorage.getItem('FUND_APPROVAL')),
      columns: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          width: '100px',
          align: 'center',
          //   fixed: 'left',
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '业务交易流水号',
          align: 'center',
          width: 200,
          dataIndex: 'transNo'
        },
        // {
        //   title: '身份证号',
        //   align: 'center',
        //   width: 200,
        //   dataIndex: 'username'
        // },

        {
          title: '产品名称',
          align: 'center',
          width: 100,
          dataIndex: 'productName'
        },
        {
          title: '业务线额度(元)',
          align: 'center',
          width: 100,
          dataIndex: 'creditAmount',

        },
        {
          title: '可用额度(元)',
          align: 'center',
          width: 100,
          dataIndex: 'creditAmount1',
          customRender: function (t, r, index) {
            return Number(r.creditAmount) - Number(r.creditAmountUsed) - (Number(r.creditAmountFloat) || 0)
          }
        },
        {
          title: '已使用额度(元)',
          align: 'center',
          width: 100,
          dataIndex: 'creditAmountUsed'
          // customRender: function(t, r, index) {
          //   return formatAmount((t/100).toFixed(2),2)
          // }
        },
        {
          title: '在途',
          align: 'center',
          width: 100,
          dataIndex: 'creditAmountFloat',

        },
        {
          title: '冻结金额(元)',
          align: 'center',
          width: 100,
          dataIndex: 'creditAmountFloat',

        },
        {
          title: '交易金额(元)',
          align: 'center',
          width: 100,
          dataIndex: 'transAmount'
          //  customRender: function(t, r, index) {
          //  return formatAmount((t/100).toFixed(2),2)
          // }
        },
        {
          title: '额度(增/减)',
          align: 'center',
          width: 100,
          dataIndex: 'transDirection',
          customRender: (t, r, index) => {
            for (var i = 0; i < this.transDirection.length; i++) {
              if (t == this.transDirection[i].name) {
                return this.transDirection[i].title
              }
            }
            return '暂无'
          }
        },
        {
          title: '业务操作',
          align: 'center',
          width: 100,
          dataIndex: 'transType',
          customRender: (t, r, index) => {
            for (var i = 0; i < this.transType.length; i++) {
              if (t == this.transType[i].name) {
                return this.transType[i].title
              }
            }
            return '暂无'
          }
        },
        {
          title: '附言',
          align: 'center',
          width: 100,
          dataIndex: 'transNote'
        },
        {
          title: '资金方',
          align: 'center',
          width: 100,
          dataIndex: 'fundName',
          // customRender: (t, r, index) => {
          //   for (var i = 0; i < this.dbfundApproval.length; i++) {
          //     if (t == this.dbfundApproval[i].name) {
          //       return this.dbfundApproval[i].title
          //     }
          //   }

          // }

        },
        {
          title: '发生时间',
          align: 'center',
          width: 200,
          dataIndex: 'transTime',

        },

      ],
      model: {
        value: 1,
        value1: 2
      },

      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 }
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 }
      },
    }
  },
  created () {
    console.log('created')
  },

  methods: {
    edit (record, type) {
      this.current = 1;
      this.pageSize = 10;
      this.record = record
      this.type = type
      this.pageLoad();
      this.visible = true
    },
    pageLoad () {
      let _p = {
        pageNo: this.ipaginations.current,
        pageSize: this.ipaginations.pageSize,
        params: { creditAmountId: this.record.id }
      }
      if (this.type == 1) {
        queryCreditTransPersonalPage(_p).then(res => {
          if (res.status.statusCode == 0) {
            this.dataSource = res.result.records
            this.ipaginations.total = Number(res.result.total);
          } else {
            this.$message.warning(res.status.statusReason)
          }
        })
      } else if (this.type == 2) {
        queryCreditTransEnterprisePage(_p).then(res => {
          if (res.status.statusCode == 0) {
            this.dataSource = res.result.records
            this.ipaginations.total = Number(res.result.total);
          } else {
            this.$message.warning(res.status.statusReason)
          }
        })
      } else if (this.type == 3) {
        queryCreditTransLegalPersonPage(_p).then(res => {
          if (res.status.statusCode == 0) {
            this.dataSource = res.result.records
            this.ipaginations.total = Number(res.result.total);
          } else {
            this.$message.warning(res.status.statusReason)
          }
        })
      }
    },
    onChange () { },

    close () {
      //  console.log(111)
      this.$emit('queren')
      this.visible = false

    },
    handleSubmit1 () {
      // 触发表单验证
      this.visible = false
      this.$emit('queren')
    },
    handleCancel1 () {
      this.close()
    }
  }
}
</script>
<style>
.scoped-person .ant-modal-footer {
  display: none;
}
.modal-liushui-height {
  max-height: 600px;
  min-height: 600px;
}
</style>