<template>
  <j-modal
    :title="title"
    :width="modelStyle.width"
    :visible="visible"
    :bodyStyle="bodyStyle"
    :confirmLoading="confirmLoading"
    @ok="handleOk"
    @cancel="handleCancel"
    cancelText="关闭">
    <template slot="footer">
      <a-button type="primary" @click="handleOk">
        关闭
      </a-button>
    </template>
    <a-spin :spinning="confirmLoading">
      <a-card :bordered="false">

        <!-- 操作按钮区域 -->
        <div class="table-operator">

        </div>

        <!-- table区域-begin -->
        <div>

          <a-table
            ref="table"
            size="middle"
            bordered
            rowKey="id"
            :columns="columns"
            :dataSource="dataSource"
            :pagination="ipagination"
            :loading="loading"
            @change="handleTableChange">

          </a-table>
        </div>
      </a-card>
    </a-spin>
  </j-modal>
</template>

<script>

  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { httpAction,getAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import JDate from '@/components/jeecg/JDate'  


  export default {
    name: "HlwDutyApplyModal",
    mixins: [JeecgListMixin],
    components: { 
      JDate,
    },
    data () {
      return {
        form: this.$form.createForm(this),
        title:"",
        bodyStyle: {
          padding: '0',
          height: (window.innerHeight * 0.62) + 'px',
          'overflow-y': 'auto'
        },
        modelStyle: {
          width: '76%',
          style: { top: '10px' },
          fullScreen: false
        },
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        // 表头
        columns: [
          {
            title: '姓名',
            align: 'left',
            dataIndex: 'userName'
          },
          {
            title: '手机号',
            align: 'left',
            dataIndex: 'phone'
          },
          {
            title: '身份证号',
            align: 'left',
            dataIndex: 'idcardNumber'
          },
          {
            title: '银行卡号',
            align: 'left',
            dataIndex: 'cardNumber'
          },
          {
            title: '银行名称',
            align: 'left',
            dataIndex: 'eacbnk',
            customRender: function(text, record) {
              return record.bnkflg === 'Y' ? '招商银行' : text
            }
          },
          {
            title: '开户地',
            align: 'left',
            dataIndex: 'rcveaa',
            customRender: function(text, record) {
              return text ? text : '--'
            }
          },
          {
            title: '到账金额',
            align: 'left',
            dataIndex: 'netPayment'
          }
        ],
        url: {
          dutyUser: "/wisdom/hlwDutyApply/dutyUser",
        }
      }
    },
    created () {
    },
    methods: {
      resetData() {
        this.model = {};
      },
      add () {
        this.edit({});
      },
      edit (record) {
        this.resetData();
        this.model = Object.assign({}, record)
        this.visible = true;
        this.loadData(1)
      },
      loadData(arg) {
        if (!this.url.dutyUser) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }
        var params = this.getQueryParams()//查询条件
        params.id = this.model.id
        this.loading = true
        getAction(this.url.dutyUser, params).then((res) => {
          console.log(res)
          if (res.success) {
            this.dataSource = res.result.records
            this.ipagination.total = res.result.total
          }
          if (res.code === 510) {
            this.$message.warning(res.message)
          }
          this.loading = false
        })
      },
      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.close()
      },
      handleCancel () {
        this.close()
      },
      
    }
  }
</script>