commonBankAccountTable.vue 3.48 KB
<template>
  <div>
    <a-card :title="title" :bordered="false">
      <div>
        <a-table ref="table" size="middle" bordered :columns="bankData" :dataSource="privateBankAccountList" :pagination="false" :loading="loading" :rowKey="record => record.id" @change="handleTableChange">
          <!-- 字符串超长截取省略号显示-->
          <span slot="esContent" slot-scope="text">
            <j-ellipsis :value="text" :length="10" />
          </span>
        </a-table>
      </div>
    </a-card>

  </div>
</template>
<script>
import { JeecgListMixin } from '@/mixins/CoreListMixin'
import { deleteCollCusBankAccount } from '@/api/configApi'

export default {
  name: 'commonBankAccountTable',
  mixins: [JeecgListMixin],
  props: {
    userType: {
      type: Number,
      default: null,
    },
    privateBankAccountList:{
      type:Array,
      default:()=>{
        return [];
      }
    },
    customerNo:{
      type:String,
      default:''
    }
  },
  data () {
    return {
      title:'',
      titleModal:'',
      bankData: [
        {
          title: '序号',
          dataIndex: '',
          key: 'rowIndex',
          align: 'center',
          width: 60,
          customRender: function (t, r, index) {
            return parseInt(index) + 1
          }
        },
        {
          title: '开户行名称',
          align: 'center',
          width: '100px',
          dataIndex: 'bankName'
        },
        {
          title: '账户名',
          align: 'center',
          dataIndex: 'bankCardName'
        },
        {
          title: '银行卡号',
          align: 'center',
          dataIndex: 'bankCardNoView'
        },
        {
          title: '银行预留手机号',
          align: 'center',
          dataIndex: 'bankCardPhoneView'
        },
        // {
        //   title: '银行卡类别',
        //   align: 'center',
        //   dataIndex: 'bankCardType',
        //   customRender: function (t, r, index) {
        //     return t == 1 ? '借记卡' : ''
        //   }
        // },
      ],
      disableMixinCreated:true,
    }
  },
  created () {
    console.log(this.userType)
    switch (this.userType) {
      case 1:
        this.titleModal = '个人银行账户信息'
        this.title = '个人银行账户信息'
        break;
      case 2:
        this.titleModal = '企业银行账户信息'
        this.title = '法定代表人银行账户信息'
        break;
      case 3:
        this.titleModal = '企业法人银行账户信息'
        this.title = '法定代表人银行账户信息'
        break;
    }
  },
  methods: {
    handleAddModal (title) {
      this.$refs.commonBankAccountModal.add(this.customerNo)
      this.$refs.commonBankAccountModal.title = title ? title : '新增'
      this.$refs.commonBankAccountModal.disableSubmit = false
    },
    handleAddModalEdit(title,record){
      this.$refs.commonBankAccountModal.edit(record)
      this.$refs.commonBankAccountModal.title = title ? title : '修改'
      this.$refs.commonBankAccountModal.disableSubmit = false
    },
     handleDelete(record){
      console.log(record)
      let _p = {'id':record.id}
      deleteCollCusBankAccount(_p).then(res=>{
        if (res.status.statusCode == 0) {
          this.$emit('editReload');
          this.$message.success(res.status.statusReason)
        } else {
          this.$message.warning(res.status.statusReason)
        }
      })
    },
    commonBankAccountModalOk () {
      this.$emit('editReload');
    },
  }
}
</script>
<style>
</style>