<template>
  <div>
    <el-dialog title="费用信息" :visible.sync="dialogVisible" top="5vh" append-to-body width="80%" :before-close="handleClose">
      <span style="font-size:18px;font-weight:600;margin-left:10px;">
        <span style="color: #67C23A;margin-right: 10px;"> 应收本币:{{ form.amountDr || 0 }}元 </span>
        <span style="color: #E6A23C;margin-right: 10px;"> 应付本币:{{ form.amountCr || 0 }}元 </span>
        <span style="color: #67C23A;margin-right: 10px;"> 应收外币:{{ form.amountDrUsd || 0 }}元 </span>
        <span style="color: #E6A23C;margin-right: 10px;"> 应付外币:{{ form.amountCrUsd || 0 }}元 </span>
        <span style="color: #E6A23C;margin-right: 10px;"> 总合计:{{ form.amountSubLoc || 0 }}元 </span>
      </span>
      <avue-crud
        v-if="dialogVisible"
        :option="option"
        :data="pageData"
        ref="crud"
        :page.sync="page"
        @size-change="sizeChange"
        @current-change="currentChange"
      >
      </avue-crud>
      <span slot="footer" class="dialog-footer">
        <el-button @click="dialogVisible = false" size="mini">关 闭</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
export default {
  props: {},
  data() {
    return {
      allData: [],
      pageData: [],
      form: {},
      dialogVisible: false,
      loading: false,
      option: {
        height: "600px",
        calcHeight: 30,
        menuWidth: 60,
        tip: false,
        menu: false,
        border: true,
        addBtn: false,
        viewBtn: false,
        editBtn: false,
        delBtn: false,
        refreshBtn: false,
        header: false,
        index: true,
        align: "center",
        column: [
          {
            label: "所属公司",
            prop: "branchName",
            width: 120,
            overHidden: true
          },
          {
            label: "客户名称",
            prop: "corpCnName",
            width: 120,
            overHidden: true
          },
          {
            label: "收付",
            prop: "dc",
            width: 60,
            type: "select",
            dicData: [
              {
                label: "收",
                value: "D"
              },
              {
                label: "付",
                value: "C"
              }
            ],
            overHidden: true
          },
          {
            label: "费用名称",
            prop: "feeCnName",
            width: 80,
            overHidden: true
          },
          {
            label: "申请金额",
            prop: "currentAmount",
            width: 100,
            overHidden: true
          },
          {
            label: "币别",
            prop: "curCode",
            width: 60,
            overHidden: true
          },
          {
            label: "汇率",
            prop: "currentExrate",
            width: 80,
            overHidden: true
          },
          {
            label: "MB/L NO",
            prop: "mblno",
            width: 100,
            overHidden: true
          },
          {
            label: "HB/L NO",
            prop: "hblno",
            width: 100,
            overHidden: true
          },

          {
            label: "起运港",
            prop: "polCnName",
            width: 100,
            overHidden: true
          },
          {
            label: "目的港",
            prop: "podCnName",
            width: 80,
            overHidden: true
          },
          {
            label: "箱型箱量",
            prop: "quantityCntrDescr",
            width: 80,
            overHidden: true
          },
          {
            label: "船名",
            prop: "vesselEnName",
            width: 80,
            overHidden: true
          },
          {
            label: "航次",
            prop: "voyageNo",
            width: 80,
            overHidden: true
          },
          {
            label: "备注",
            prop: "remarks",
            width: 120,
            overHidden: true
          }
        ]
      },
      page: {
        currentPage: 1,
        total: 0,
        pageSize: 50
      }
    };
  },
  created() {},
  methods: {
    openDialog(row, list) {
      this.dialogVisible = true;
      this.form = {};
      this.allData = [];
      this.page = {
        currentPage: 1,
        total: 0,
        pageSize: 50
      };
      this.form = row;
      this.allData = list;
      this.page.total = list.length;
      this.getList();
    },
    sizeChange(val) {
      this.page.currentPage = 1;
      this.page.pageSize = val;
      this.getList();
    },
    currentChange(val) {
      this.page.currentPage = val;
      this.getList();
    },
    getList() {
      const start = (this.page.currentPage - 1) * this.page.pageSize;
      const end = start + this.page.pageSize;
      this.pageData = this.allData.slice(start, end);
    }
  }
};
</script>

<style scoped>
::v-deep#out-table .back-one {
  background: #ecf5ff !important;
  text-align: center;
  padding: 4px 0;
}

::v-deep#out-table .back-two {
  background: #ecf5ff !important;
  text-align: center;
  padding: 4px 0;
}
</style>
