<template>
  <!-- 详情预托书  回显所有信息-->
  <div id="editPreBookDrawer">
    <a-drawer
      title="详情"
      width="89%"
      placement="right"
      :closable="true"
      :visible="visible"
      @close="handleCancel">
      <!-- 主表信息 展示-->
      <a-card :bordered="true">
        <div class="table-page-search-wrapper">
          <a-form-model layout="inline" ref="form" :model="preBook">
            <a-row :gutter="24">
              <a-col :md="6" :sm="8">
                <a-form-model-item label="托书日期" prop="bookDate">
                  2022-03-15
                  <!-- <a-date-picker
                    placeholder="请选择托书日期"
                    style="width:100%;"
                    :format="dateFormat"
                    v-model="preBook.bookDate"
                  /> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="托书号" prop="bookNum">
                  <!-- <a-input placeholder="请输入托书号" v-model="preBook.bookNum"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="12" :sm="12">
                <a-form-model-item label="外销发票号码" prop="exportInvoiceNo">
                  <!-- <a-input placeholder="请输入外销发票号码" v-model="preBook.exportInvoiceNo"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="经营单位" prop="businessUnit">
                  <!-- <a-input placeholder="请输入经营单位" v-model="preBook.businessUnit"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="经营单位地址" prop="businessUnitAdd">
                  <!-- <a-select placeholder="请选择经营单位地址" v-model="preBook.businessUnitAdd">
                    <a-select-option value="">请选择</a-select-option>
                    <a-select-option :value="0">客户1</a-select-option>
                    <a-select-option :value="1">客户2</a-select-option>
                    <a-select-option :value="2">客户3</a-select-option>
                  </a-select> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="进仓/装柜日期" prop="inLoadDate">
                  <!-- <a-date-picker
                    placeholder="请选择进仓/装柜日期"
                    style="width:100%;"
                    :format="dateFormat"
                    v-model="preBook.inLoadDate"
                  /> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="最终船期" prop="finalShipDate">
                  <!-- <a-input placeholder="请输入最终船期" v-model="preBook.finalShipDate"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="收货人" prop="consignee">
                  <!-- <a-input placeholder="请输入收货人" v-model="preBook.consignee"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="收货人地址" prop="consigneeAdd">
                  <!-- <a-select placeholder="请选择收货人地址" v-model="preBook.consigneeAdd">
                    <a-select-option value="">请选择</a-select-option>
                    <a-select-option value="0">收货人1</a-select-option>
                    <a-select-option value="1">收货人2</a-select-option>
                    <a-select-option value="2">收货人3</a-select-option>
                  </a-select> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="通知方" prop="notifying">
                  <!-- <a-input placeholder="请输入通知方" v-model="preBook.notifying"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="通知方地址" prop="notifyingAdd">
                  <!-- <a-input placeholder="请输入通知方地址" v-model="preBook.notifyingAdd"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="贸易国别" prop="tradeCountry">
                  <!-- <a-input placeholder="请输入贸易国别" v-model="preBook.tradeCountry"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="运抵国别" prop="arriveCountry">
                  <!-- <a-input placeholder="请输入运抵国别" v-model="preBook.arriveCountry"></a-input> -->
                </a-form-model-item>
              </a-col>
              <a-col :md="6" :sm="8">
                <a-form-model-item label="出口口岸" prop="exportPort">
                  <!-- <a-input placeholder="请输入出口口岸" v-model="preBook.exportPort"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="目的港" prop="destinationport">
                  <!-- <a-input placeholder="请输入目的港" v-model="preBook.destinationport"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="收汇方式" prop="collectionMethod">
                  <!-- <a-input placeholder="请输入收汇方式" v-model="preBook.collectionMethod"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="成交方式" prop="soldType">
                  <!-- <a-input placeholder="请输入成交方式" v-model="preBook.soldType"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="金额" prop="money">
                  <!-- <a-input placeholder="请输入金额" v-model="preBook.money"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="人民币" prop="RMB">
                  <!-- <a-input placeholder="请输入人民币" v-model="preBook.RMB"></a-input> -->
                </a-form-model-item>
              </a-col>

              <a-col :md="6" :sm="8">
                <a-form-model-item label="美元" prop="dollar">
                  <!-- <a-input placeholder="请输入美元" v-model="preBook.dollar"></a-input> -->
                </a-form-model-item>
              </a-col>
            </a-row>
          </a-form-model>
        </div>
      </a-card>

      <!--子表 -->
      <a-card :bordered="true" style="marginTop:10px;">
        <a-spin :spinning="confirmLoading">
          <a-form-model ref="formRef">
            <a-table
              bordered
              rowKey="id"
              :columns="columns"
              :data-source="data"
              :loading="loading"
              :pagination="ipagination"
              :scroll="{ x: 1500 }"
              @change="handleTableChange"
            >
            </a-table>
          </a-form-model>
        </a-spin>

        <!-- 人民币、美金 -->
        <a-row style="marginTop:10px;marginBottom:50px;padding:10px;">
          <div class="purchase-order-table" style="width:48%;marginRight:4%;float:left;">
            <h6 class="table-title">人民币</h6>
            <a-table
              :row-key="record => record.id"
              :loading="loading"
              :columns="CNYColumns"
              :data-source="CNYData"
              bordered
              :pagination="false"
            >
            </a-table>
          </div>

          <div class="purchase-order-table" style="width:48%;float:right;">
            <h6 class="table-title">美金</h6>
            <a-table
              :row-key="record => record.id"
              :loading="loading"
              :columns="USDColumns"
              :data-source="USDData"
              bordered
              :pagination="false"
            >
            </a-table>
          </div>
        </a-row>
      </a-card>
    </a-drawer>
  </div>
</template>

<script>
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import JEllipsis from '@/components/jeecg/JEllipsis'
import moment from 'moment'

export default {
  name: 'DetailsPreBookDrawer', //  详情 预托书
  computed: {},
  mixins: [JeecgListMixin],
  components: { JEllipsis, moment },
  data() {
    return {
      // 表头
      columns: [
        {
          title: '英文名称',
          dataIndex: 'englishName',
          width: 120,

          fixed: 'left',
          className: 'replacecolor'
        },
        {
          title: '款号',
          dataIndex: 'styleNum',
          width: 120,

          fixed: 'left',
          className: 'replacecolor'
        },
        {
          title: '小po号',
          dataIndex: 'smallPoNum',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '数量',
          dataIndex: 'quantity',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '箱数',
          dataIndex: 'boxedNum',
          width: 90,

          className: 'replacecolor'
        },

        {
          title: '毛重',
          dataIndex: 'roughWeigh',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '净重',
          dataIndex: 'suttle',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '体积',
          dataIndex: 'volume',
          width: 160,

          className: 'replacecolor'
        },
        {
          title: '分销点',
          dataIndex: 'distributionPoint',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '集装箱代号',
          dataIndex: 'containerCode',
          width: 120,
          scopedSlots: { customRender: 'containerCode' },
          className: 'replacecolor'
        },

        {
          title: '集装箱号',
          dataIndex: 'containerNo',
          width: 120,
          scopedSlots: { customRender: 'containerNo' },
          className: 'replacecolor'
        },
        {
          title: '单价',
          dataIndex: 'price',
          width: 120,

          className: 'replacecolor'
        },
        //         {
        //   title: '创建时间',
        //   dataIndex: 'createTime',
        //   align: 'center',
        //   sorter: true,
        //   customRender: text => {
        //     return moment(text).format('YYYY-MM-DD')
        //   }
        // },
        {
          title: '预发货日期',
          dataIndex: 'scheduledShipDate',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '业务员',
          dataIndex: 'salesman',
          width: 120,

          className: 'replacecolor'
        },

        {
          title: '业务部门',
          dataIndex: 'operatingDepartment',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '采购/委外订单号',
          dataIndex: 'purchaseAboardOrderNum',
          width: 160,

          className: 'replacecolor'
        },

        {
          title: '采购/委外工厂',
          dataIndex: 'purchaseAboardFactory',
          width: 160,

          className: 'replacecolor'
        }
      ],
      data: [{}, {}],
      CNYColumns: [
        {
          title: '货代',
          dataIndex: 'CNYfreighForward',
          width: 20,
          className: 'replacecolor'
        },
        {
          title: '金额',
          dataIndex: 'CNYmoney',
          width: 20,
          className: 'replacecolor'
        },
        {
          title: '项目列',
          dataIndex: 'CNYProjectList',
          width: 90,
          scopedSlots: { customRender: 'CNYProjectList' },
          className: 'replacecolor'
        }
      ],
      CNYData: [{ CNYmoney: '487576,87', CNYProjectList: '项目列test1' }],

      USDColumns: [
        {
          title: '货代',
          dataIndex: 'USDfreighForward',
          width: 20,
          className: 'replacecolor'
        },
        {
          title: '金额',
          dataIndex: 'USDmoney',
          width: 20,
          className: 'replacecolor'
        },
        {
          title: '项目列',
          dataIndex: 'USDProjectList',
          width: 90,
          scopedSlots: { customRender: 'USDProjectList' },
          className: 'replacecolor'
        }
      ],
      USDData: [{ USDmoney: '7576,17', CNYProjectList: '项目列test2' }],

      loading: false, // 表格加载
      preBook: {},
      confirmLoading: false,
      visible: false,
      dateFormat: 'YYYY-MM-DD'
    }
  },
  created() {},
  methods: {
    // 抽屉 取消
    handleCancel() {
      console.log('点击抽屉取消')
      this.close()
    },

    close() {
      this.$emit('close')
      this.visible = false
      this.$refs.form.resetFields()
    },

    // ------------------------------------------
    modalFormOk() {},
    aa() {}
  },

  mounted() {}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.less';
@import '~@assets/less/overwriter.less';
/deep/ .ant-table-thead > tr > th {
  text-align: center;
  // font-weight: 700;
}
/deep/ .ant-table-tbody {
  text-align: center;
}
// /deep/ th.replacecolor {
//   background-color: #ccc;
// }

// 抽屉里的card样式
/deep/ .ant-drawer-content {
  background-color: #f0f2f5;
}
/deep/ .ant-drawer-body {
  padding: 10px;
}
</style>
