<template>
  <a-modal
    :title="title"
    :width="width"
    :visible="visible"
    :bodyStyle="bodyStyle"
    :confirmLoading="confirmLoading"
    :footer="null"
    @cancel="handleCancel"
    cancelText="关闭">
    <a-spin :spinning="confirmLoading">
      <a-form :form="form">
        <a-form-item label=" " :colon="false" :labelCol="labelCol" :wrapperCol="wrapperCol">
          {{userNames}}等{{list.length}}人{{desc}}。
        </a-form-item>
        <a-form-item label=" " :colon="false" :labelCol="labelCol" :wrapperCol="wrapperCol">
          <a @click="checkList" style="font-size: 16px">查看名单</a>
        </a-form-item>

      </a-form>
    </a-spin>
    <HlgPaymentErrorPeopleListModal ref="errorPeopleListModal"></HlgPaymentErrorPeopleListModal>
    <div class="drawer-bootom-button" v-show="!disableSubmit">
      <a-button class="ant-btn"  @click="handleCancel">取消</a-button>
      <a-button class="ant-btn ant-btn-primary" style="margin-left: 8px"  @click="handleOk">继续付款</a-button>
    </div>
  </a-modal>
</template>

<script>

  import { httpAction } from '@/api/manage'
  import pick from 'lodash.pick'
  import JDate from '@/components/jeecg/JDate'
  import HlgPaymentErrorPeopleListModal from './HlgPaymentErrorPeopleListModal'

  export default {
    name: 'HlgPaymentErrorModal',
    components: {
      JDate,
      HlgPaymentErrorPeopleListModal
    },
    data() {
      return {
        form: this.$form.createForm(this),
        title: '操作',
        width: 600,
        bodyStyle: {
          paddingTop: '20px',
          paddingBottom:'50px',
        },
        visible: false,
        model: {},
        labelCol: {
          xs: { span: 24 },
          sm: { span: 5 }
        },
        wrapperCol: {
          xs: { span: 24 },
          sm: { span: 16 }
        },
        list:[],//人数数组
        desc:'',
        userNames:'',//姓名拼接
        confirmLoading: false,
        disableSubmit:false,
        url: {

        }

      }
    },
    created() {
    },
    methods: {
      add() {
        this.edit({})
      },
      edit(record) {
        this.list = record.list;
        let userNames = '';
        for(var i = 0;i< record.list.length; i++){
          if(i < 5){
            if(i === 0){
              userNames = record.list[i].userName;
            }else{
              userNames +=  ',' + record.list[i].userName;
            }
          }
        }
        this.userNames = userNames;
        this.visible = true
      },
      close() {
        this.$emit('close')
        this.visible = false
      },
      //继续付款
      handleOk() {
        this.$emit('ok')
        this.visible = false
      },
      handleCancel() {
        this.close()
      },
      checkList() {
        this.$refs.errorPeopleListModal.edit({ list: this.list })
        this.$refs.errorPeopleListModal.title = '查看名单'
        this.$refs.errorPeopleListModal.disableSubmit = false
      }
    }
  }
</script>
<style>
  .drawer-bootom-button {
    position: absolute;
    bottom: -8px;
    width: 100%;
    border-top: 1px solid #e8e8e8;
    padding: 10px 16px;
    text-align: right;
    left: 0;
    background: #fff;
    border-radius: 0 0 2px 2px;
  }
</style>