<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :md="5" :sm="8">
            <a-form-item label="订单编号">
              <j-input placeholder="请输入订单编号" v-model="queryParam.propertyName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="5" :sm="8">
            <a-form-item label="状态">
              <j-input placeholder="请选择状态" v-model="queryParam.propertyName"></j-input>
            </a-form-item>
          </a-col>
          <a-col :md="7" :sm="10">
            <a-form-item label="订单时间">
              <a-range-picker @change="onChangeData" />
            </a-form-item>
          </a-col>
          <span style="float: left;overflow: hidden;" class="table-page-search-submitButtons">
            <a-col :md="5" :sm="24">
              <a-button type="primary" @click="searchQuery">查询</a-button>
              <a-button style="margin-left: 8px" @click="searchReset">重置</a-button>
            </a-col>
          </span>
        </a-row>
      </a-form>
    </div>
    <!-- table区域-begin -->
    <div>
      <a-table ref="table" size="middle" :scroll="{x:true}" 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 type="primary" @click="propertyDetails()">详情</a>
          <a type="primary" @click="toReconciliation(record)" style="margin-left: 10px;">申请结算</a>
        </span>
      </a-table>

    </div>
    <!-- table区域-end -->
    <a-modal centered title="申请结算" :visible="visibleReconciliation" :confirm-loading="confirmLoading" @ok="handleOk"
      @cancel="handleCancel">
      <a-form>
        <a-row>
          <a-col :span="24">
            <a-form-model-item label="结算总金额" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyName"
              style="width: 100%;margin-bottom: 10px;">
              <a-input v-model="model.propertyName" placeholder="结算总金额"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="结算日期" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyName"
              style="width: 100%;margin-bottom: 10px;">
              <a-input v-model="model.propertyName" placeholder="结算日期"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="结算方式" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyName"
              style="width: 100%;margin-bottom: 10px;">
              <a-input v-model="model.propertyName" placeholder="结算方式"></a-input>
            </a-form-model-item>
          </a-col> <a-col :span="24">
            <a-form-model-item label="选择银行卡" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyName"
              style="width: 100%;margin-bottom: 10px;">
              <a-input v-model="model.propertyName" placeholder="选择银行卡"></a-input>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="结算明细" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyName"
              style="width: 100%;margin-bottom: 10px;">
              <a>查看明细</a>
            </a-form-model-item>
          </a-col>
          <a-col :span="24">
            <a-form-model-item label="备注" :labelCol="labelCol" :wrapperCol="wrapperCol" prop="propertyName"
              style="width: 100%;">
              <a-textarea v-model="model.propertyName" :auto-size="{ minRows: 4, maxRows: 6 }" />
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form>
    </a-modal>
  </a-card>
</template>

<script>
import { auditPropertyApi, freezeOrPropertyApi } from '@/api/api'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JThirdAppButton from '../../components/jeecgbiz/thirdApp/JThirdAppButton.vue'

const columns = [
  {
    title: '结算单号',
    dataIndex: 'id',
    key: 'id',
    align: 'center',
  },
  {
    title: '提交时间',
    dataIndex: 'reconciliationBeginDate',
    key: 'reconciliationBeginDate',
    align: 'center',
  },
  {
    title: '提交人',
    dataIndex: 'creditCode',
    key: 'creditCode',
    align: 'center',
  },
  {
    title: '结算总金额',
    dataIndex: 'reconciliationAmount',
    key: 'reconciliationAmount',
    align: 'center',
  },

  {
    title: '账单数量',
    dataIndex: 'reconciliationEndDate',
    key: 'reconciliationEndDate',
    align: 'center',
  },
  {
    title: '结算方式',
    dataIndex: 'companyAuditStatus',
    key: 'companyAuditStatus',
    align: 'center',
  },
  {
    title: '结算状态',
    dataIndex: 'auditStatus',
    key: 'auditStatus',
    align: 'center',
  },
  {
    title: '备注',
    dataIndex: 'empowerCommunityNum',
    key: 'empowerCommunityNum',
    align: 'center',
  },
  {
    title: '操作',
    dataIndex: 'action',
    scopedSlots: { customRender: 'action' },
    align: 'center',
    fixed: 'right',
    width: 150,
  },
]

export default {
  components: { JThirdAppButton },
  name: 'PermissionListAsync',
  mixins: [JeecgListMixin],
  data() {
    return {
      model: {},
      labelCol: {
        xs: { span: 24 },
        sm: { span: 6 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 16 },
      },
      columns: columns,
      loading: false,
      url: {
        list: '/property-central/property/communityReconciliation/list',
      },
      dataSource: [
        {
          id: 'JD239423',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2023-01-01',
          reconciliationEndDate: '5',
          reconciliationAmount: '345.23',
          updateTime: '2023-04-05',
          empowerCommunityNum: 'admin',
          auditStatus: '审核通过',
          companyAuditStatus: '待审核',
        },
        {
          id: 'JD453454',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2023-04-06',
          reconciliationEndDate: '2023-06-03',
          reconciliationAmount: '1345.45',
          updateTime: '2023-05-05',
          empowerCommunityNum: 'admin',
          auditStatus: '审核通过',
          companyAuditStatus: '审核通过',
        },
        {
          id: 'JD567454',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2023-02-05',
          reconciliationEndDate: '2023-02-23',
          reconciliationAmount: '34234',
          updateTime: '2023-02-06',
          empowerCommunityNum: 'admin',
          auditStatus: '待审核',
          companyAuditStatus: '待审核',
        },
        {
          id: 'KF343455',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2022-11-01',
          reconciliationEndDate: '2023-01-03',
          reconciliationAmount: '34',
          updateTime: '2023-06-07',
          empowerCommunityNum: 'admin',
          auditStatus: '审核通过',
          companyAuditStatus: '审核通过',
        },
        {
          id: 'KD435345',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2022-01-21',
          reconciliationEndDate: '2022-10-03',
          reconciliationAmount: '654',
          updateTime: '2023-05-06',
          empowerCommunityNum: 'admin',
          auditStatus: '待审核',
          companyAuditStatus: '待审核',
        },
        {
          id: 'LG345352',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2022-01-10',
          reconciliationEndDate: '2022-02-03',
          reconciliationAmount: '897.98',
          updateTime: '2023-05-08',
          empowerCommunityNum: 'admin',
          auditStatus: '待审核',
          companyAuditStatus: '待审核',
        },
        {
          id: 'MG345354',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2023-01-04',
          reconciliationEndDate: '2023-06-03',
          reconciliationAmount: '234',
          updateTime: '2023-05-05',
          empowerCommunityNum: 'admin',
          auditStatus: '审核通过',
          companyAuditStatus: '待审核',
        },
        {
          id: 'LB345353',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2023-02-01',
          reconciliationEndDate: '2023-05-03',
          reconciliationAmount: '1000',
          updateTime: '2023-04-04',
          empowerCommunityNum: 'admin',
          auditStatus: '审核通过',
          companyAuditStatus: '待审核',
        },
        {
          id: 'LC234234',
          creditCode: '汉江之星小区',
          propertyName: '2000',
          reconciliationBeginDate: '2023-01-23',
          reconciliationEndDate: '5',
          reconciliationAmount: '3443',
          updateTime: '2023-01-02',
          empowerCommunityNum: 'admin',
          auditStatus: '审核通过',
          companyAuditStatus: '审核通过',
        },
      ],
      visibleReconciliation: false,
      confirmLoading: false,
    }
  },
  methods: {
    propertyDetails(type, id) {
      this.$router.push({
        path: '/benefiting/SettlementDetails?id=' + id + '&type=' + type,
      })
    },

    onChangeData(date, dateString) {
      if (dateString.length > 0) {
        this.queryParam.createTime_begin = dateString[0]
        this.queryParam.createTime_end = dateString[1]
      } else {
        this.queryParam.createTime_begin = ''
        this.queryParam.createTime_end = ''
      }
    },
    //申请对账
    toReconciliation(record) {
      this.visibleReconciliation = true
    },
    handleOk(e) {
      this.ModalText = 'The modal will be closed after two seconds'
      this.confirmLoading = true
      setTimeout(() => {
        this.visibleReconciliation = false
        this.confirmLoading = false
      }, 2000)
    },
    handleCancel(e) {
      console.log('Clicked cancel button')
      this.visibleReconciliation = false
    },
    loadData() {
      console.log('不请求')
    },
  },
}
</script>
<style scoped>
@import '~@assets/less/common.less';
</style>