<template>
  <div class="eibs-tab">
    <c-list-search @form-reset="handleReset('paramsForm')" @form-search="handleSearch">
      <template v-slot="searchSlot">
        <el-form class="m-table-search-form" ref="paramsForm" label-position="right" label-width="110px" size="small">
          <el-row>
            <c-col :span="8">
              <el-form-item label="Register Reference" style="width: 100%">
                <c-input v-model="model.fidOwnref" maxlength="16"></c-input>
              </el-form-item>
            </c-col>
            <c-col :span="8">
              <el-form-item label="Date of Creation" prop="opndatfrom" style="width: 100%">
                <c-col :span="11">
                  <c-date-picker type="date" v-model="model.opndatfrom" placeholder="请选择起始日期" value-format="yyyy-MM-dd"
                    style="width: 100%"></c-date-picker>
                </c-col>
                <c-col :span="2" style="text-align: center">
                  <label style="display: inline-block; width: 100%">-</label>
                </c-col>
                <c-col :span="11">
                  <c-date-picker type="date" v-model="model.opndatto" placeholder="请选择截止日期" style="width: 100%"
                    value-format="yyyy-MM-dd"></c-date-picker>
                </c-col>
              </el-form-item>
            </c-col>
            <c-col :span="8">
              <el-form-item label="Business brief information" style="width: 100%">
                <c-input v-model="model.fidNam" maxlength="40"></c-input>
              </el-form-item>
            </c-col>
          </el-row>
          <el-row v-show="searchSlot.searchToggle">
            <c-col :span="8">
              <el-form-item label="Invoice Amount">
                <c-col :span="17">
                  <c-select v-model="model.fidgrp.cbs.max.cur" dbCode="curtxt"> </c-select>
                </c-col>
                <c-col :span="6" :offset="1">
                  <c-input-currency :currency="model.fidgrp.cbs.max.cur" v-model="model.fidgrp.cbs.max.amt"
                    style="width: 100%"></c-input-currency>
                </c-col>
              </el-form-item>
            </c-col>
            <c-col :span="8">
              <el-form-item label="Open Amount">
                <c-col :span="17">
                  <c-select v-model="model.fidgrp.cbs.opn1.cur" dbCode="curtxt"> </c-select>
                </c-col>
                <c-col :span="6" :offset="1">
                  <c-input-currency :currency="model.fidgrp.cbs.opn1.cur" v-model="model.fidgrp.cbs.opn1.amt"
                    style="width: 100%"></c-input-currency>
                </c-col>
              </el-form-item>
            </c-col>
            <!-- <c-col :span="8">
              <el-form-item label="Date of Creation" style="width: 100%">
                <c-date-picker type="date" v-model="model.fidgrp.rec.credat" style="width: 100%"
                  value-format="yyyy-MM-dd"></c-date-picker>
              </el-form-item>
            </c-col> -->
            <c-col :span="8">
              <el-form-item label="Buyer Ref.">
                <c-input v-model="model.buyref" maxlength="16"></c-input>
              </el-form-item>
            </c-col>
            <c-col :span="8">
              <el-form-item label="Ex-Factoror">
                <c-input v-model="model.exfref" maxlength="16"></c-input>
              </el-form-item>
            </c-col>
          </el-row>
        </el-form>
      </template>
    </c-list-search>

    <c-col :span="24" style="margin-top: 10px; margin-bottom: 10px">
      <c-button class="medium_bcs" size="medium" type="primary" style="margin-bottom: 5px" title="TRTOPN"
        @click="toTrtopn">
        {{ $t("factoring.进口发票转让") }}
      </c-button>
    </c-col>

    <div style="height: 90%">
      <c-col :span="24">
        <el-tabs v-model="activeTab" class="y-tabs">
          <el-tab-pane :label="$t('factoring.保理信息')" name="le">
            <el-table :data="stmData.data" :columns="stmData.columns" v-loading="load" style="width: 100%" size="small"
              :border="true" height="calc(100vh - 480px)" :highlight-current-row="true">
              <el-table-column v-for="(item, key) in stmData.columns" :key="key" :label="$t('factoring.' + item.label)"
                :prop="item.prop" :min-width="item.width"></el-table-column>
              <el-table-column fixed="right" :label="$t('other.操作')" width="240px">
                <template slot-scope="scope">
                  <c-button style="margin-left: 5px" size="small" type="text" @click="getButtons(scope.row)">
                    {{ $t("buttons.处理") }}
                  </c-button>
                </template>
              </el-table-column>
            </el-table>
            <el-pagination layout="total, sizes, prev, pager, next, jumper" :total="Number(pagination.total)"
              :page-size="pagination.pageSize" :current-page.sync="pagination.pageNum" @size-change="handleSizeChange"
              @current-change="handleCurrentChange">
            </el-pagination>
          </el-tab-pane>
        </el-tabs>
      </c-col>
      <!-- 点击处理弹框 -->
      <el-dialog v-dialogDrag v-if="handleVisible" :visible.sync="handleVisible" :title="$t('factoring.交易列表')">
        <c-bus-navbar trnName="fitsei" :model="codes.rowList"
          @onChoose="onChoose"></c-bus-navbar>
      </el-dialog>
    </div>
  </div>
</template>
<script>
import event from "../event";

export default {
  inject: ["root"],
  props: ["model", "codes"],
  mixins: [event],
  data() {
    return {
      curinr: "",
      ownref: "",
      activeTab: "le",
      load: false,
      stmData: {
        columns: [
          {
            label: "Invoice Reference",
            prop: "ownref",
            width: "180px",
          },
          {
            label: "Business brief information",
            prop: "nam",
            width: "180px",
          },
          {
            label: "Date of Creation",
            prop: "credat",
            width: "180px",
          },
          {
            label: "cur",
            prop: "cur",
            width: "180px",
          },
          {
            label: "amt",
            prop: "amt",
            width: "180px",
          },
          {
            label: "Buyer Ref",
            prop: "buyref",
            width: "180px",
          },
          {
            label: "Ex-Factoror",
            prop: "exfref",
            width: "180px",
          },
        ],
        data: [
          // {
          //   ownref: "FI3500242131AA",
          //   amt: "950",
          //   opnamt: "2024-03-01",
          //   credat: "2024-03-03",
          //   buyref: "2000377770-001",
          //   exfref: "2000466660-001",
          // },
          // {
          //   ownref: "FI3500242132AA",
          //   amt: "900",
          //   opnamt: "2024-03-02",
          //   credat: "2024-03-03",
          //   buyref: "2000377770-002",
          //   exfref: "2000466660-002",
          // },
          // {
          //   ownref: "FI3500242133AA",
          //   amt: "980",
          //   opnamt: "2024-03-03",
          //   credat: "2024-03-03",
          //   buyref: "2000377770-003",
          //   exfref: "2000466660-003",
          // },
        ],
        navcodeList: [
          {
            code: "fitpay",
            isDisplay: "Y",
            label: "进口买方付款",
            title: "",
          },
          {
            code: "trfopn",
            isDisplay: "Y",
            label: "供应商融资新建",
            title: "",
          },
        ]
      },

      pagination: {
        pageNum: 1,
        pageSize: 10,
        total: 0,
      },
      // 处理
      handleVisible: false,
    };
  },

  methods: {},
  mounted: function () { },
};
</script>
<style>
.pagination-box {
  width: 100%;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 10px;
  background: #fff;
  margin-top: 5px;
}

.btn-group-wrap {
  max-height: 200px;
  width: 100%;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.btn-item {
  margin-bottom: 10px;
  margin-right: 10px;
}

.medium_bcs {
  border-radius: 5px;
}
</style>