<template>
  <a-spin :spinning="confirmLoading">
    <a-form :form="form">

      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="24">

            <a-col :md="6" :sm="8">
              <a-form-item label="批次单号">
                <a-input placeholder="请输入批次单号"  v-model="queryParam.paymentCode"></a-input>
              </a-form-item>
            </a-col>
            <a-col :md="6" :sm="8">
            <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
              <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
              <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              <!--<a @click="handleToggleSearch" style="margin-left: 8px">-->
              <!--{{ toggleSearchStatus ? '收起' : '展开' }}-->
              <!--<a-icon :type="toggleSearchStatus ? 'up' : 'down'"/>-->
              <!--</a>-->
            </span>
            </a-col>

          </a-row>
        </a-form>
      </div>
      <!-- 查询区域-END -->


      <!-- 操作按钮区域 -->


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


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

        <span slot="action" slot-scope="text, record">
            <a v-has="'hcwinvoice:viewpaymentDetail'" @click="paymentDetail(record)" >创客付款单</a>
        </span>

        </a-table>
      </div>



    </a-form>
  </a-spin>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import { httpAction, getAction,deleteAction } from '@/api/manage'

  export default {
    name: "HlwInvoiceManageModalForm",
    mixins:[JeecgListMixin, mixinDevice],
    components: {

    },
    data () {
      return {
        form: this.$form.createForm(this),
        validatorRules:{},
        title:"操作",
        bodyStyle: {
          padding: '0',
          height: (window.innerHeight * 0.66) + 'px',
          'overflow-y': 'auto'
        },
        modelStyle: {
          width: '76%',
          style: { top: '20px' },
          fullScreen: false
        },
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 },
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 },
        },
        confirmLoading: false,
        description: 'HlwInvoiceManageModalForm管理',
        // 表头
        columns: [
          {
            title:'批次单号',
            align:"center",
            dataIndex: 'paymentCode',
          },
          {
            title:'任务名称',
            align:"center",
            dataIndex: 'requirementName'
          },
          {
            title:'企业名称',
            align:"center",
            dataIndex: 'companyName'
          },
          {
            title:'服务商',
            align:"center",
            dataIndex: 'subcontractorName'
          },
          {
            title:'付款人数',
            align:"center",
            dataIndex: 'paymentNumber'
          },
          {
            title:'创客佣金',
            align:"center",
            dataIndex: 'payment'
          },
          {
            title:'服务费',
            align:"center",
            dataIndex: 'serviceFee',
          },
          {
            title:'付款总金额',
            align:"center",
            dataIndex: 'totalPayment',
          },
          {
            title:'任务单号',
            align:"center",
            dataIndex: 'requirementCode',
          },
          {
            title: '操作',
            dataIndex: 'action',
            align:"center",
            fixed:"right",
            width:147,
            scopedSlots: { customRender: 'action' }
          }
        ],
        url: {
          list: "/wisdom/hlwInvoice/paymentList",
        },
        dictOptions:{},
      }
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    created () {
      this.loadData(1)
    },
    methods: {
      initDictConfig(){
      },
      edit (record) {
        this.form.resetFields();
        this.model = Object.assign({}, record);
        this.visible = true;
      },
      loadData(arg) {
        if (!this.url.list) {
          this.$message.error('请设置url.list属性!')
          return
        }
        //加载数据 若传入参数1则加载第一页的内容
        if (arg === 1) {
          this.ipagination.current = 1
        }
        var params = this.getQueryParams();//查询条件
        params.id=this.$route.query.id;
        this.loading = true
        getAction(this.url.list, params).then((res) => {
          if (res.success) {
            this.dataSource = res.result.records
            this.ipagination.total = res.result.total
          }
          this.loading = false
        })
      },

      handleOk () {
        this.$emit('ok');
        this.close()
      },
      handleCancel () {
        this.$emit('ok');
        this.close()
      },
      close() {
        this.visible = false
      },
      paymentDetail(record){
        record.paymentId=record.id
        this.$router.push({ path: '/wisdom/hlwInvoice/add',query:{record:JSON.stringify(record) }})
      }



    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>