<template>
  <!-- 详情 发运明细 全部回显-->
  <a-card :bordered="false">
    <a-drawer
      title="详情"
      width="89%"
      placement="right"
      :closable="true"
      :visible="visible"
      @close="handleCancel">
      <!-- 主表信息 展示-->
      <div class="table-page-search-wrapper">
        <a-form-model layout="inline" ref="form" :model="detailsShipDet">
          <!-- 主表信息 填写-->
          <a-row :gutter="24">
            <a-col :md="6" :sm="8">
              <a-form-model-item label="单据号" prop="orderNum">
                <!-- <a-input v-model="detailsShipDet.orderNum"></a-input> -->
                132fr34
              </a-form-model-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-model-item label="单据日期" prop="billDate">
                2022-04-21
                <!-- <a-date-picker :format="dateFormat" style="width:100%;" v-model="detailsShipDet.billDate" /> -->
              </a-form-model-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-model-item label="客户" prop="customer">
                chenc
                <!-- <a-input v-model="detailsShipDet.customer"></a-input> -->
              </a-form-model-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-model-item label="预发货日期" prop="scheduledShipDate">
                2022-04-28
                <!-- <a-date-picker :format="dateFormat" style="width:100%;" v-model="detailsShipDet.scheduledShipDate" /> -->
              </a-form-model-item>
            </a-col>

            <a-col :md="6" :sm="8">
              <a-form-model-item label="预完工日期" prop="scheduledDoneDate">
                2022-04-26
                <!-- <a-date-picker :format="dateFormat" style="width:100%;" v-model="detailsShipDet.scheduledDoneDate" /> -->
              </a-form-model-item>
            </a-col>

            <a-col :md="18" :sm="18">
              <a-form-model-item label="备注" prop="note">
                务必按时发货，紧急
                <!-- <a-input v-model="detailsShipDet.note"></a-input> -->
              </a-form-model-item>
            </a-col>
          </a-row>
        </a-form-model>
      </div>

      <!-- 子表 :model="form" -->
      <a-spin :spinning="confirmLoading">
        <a-form-model ref="formRef">
          <a-table
            bordered
            rowKey="id"
            size="middle"
            :columns="columns"
            :data-source="data"
            :loading="loading"
            :pagination="ipagination"
            :scroll="{ x: 1500 }"
            @change="handleTableChange"
          >
          </a-table>
        </a-form-model>
      </a-spin>
    </a-drawer>
  </a-card>
</template>

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

export default {
  name: 'DetailsShipDetDrawer', // 详情 发运明细 抽屉
  mixins: [JeecgListMixin],
  components: { JEllipsis, moment },
  data() {
    let ellipsis = (v, l = 20) => <j-ellipsis value={v} length={l} /> // 省略
    return {
      id: '',
      // 表头
      columns: [
        {
          title: '账套',
          dataIndex: 'accountSet',
          width: 120,
          fixed: 'left',
          className: 'replacecolor'
        },
        {
          title: '订单号',
          dataIndex: 'orderNum',
          width: 120,
          fixed: 'left',
          className: 'replacecolor'
        },
        {
          title: '款号',
          dataIndex: 'styleNum',
          // scopedSlots: { customRender: 'styleNum' },
          fixed: 'left',
          width: 180,
          className: 'replacecolor'
        },
        // {
        //   title: '创建时间',
        //   dataIndex: 'createTime',
        //   align: 'center',
        //   sorter: true,
        //   customRender: text => {
        //     return moment(text).format('YYYY-MM-DD')
        //   }
        // },
        {
          title: '订单日期',
          dataIndex: 'orderDate',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '业务类型',
          dataIndex: 'businessType',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '客户订单',
          dataIndex: 'customerOrder',
          width: 120,

          className: 'replacecolor'
        },
        {
          title: '小po',
          dataIndex: 'smallPo',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: 'Pack Id',
          dataIndex: 'packId',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '订单数据',
          dataIndex: 'orderData',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '订单剩余数量',
          dataIndex: 'orderRemaQuantity',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '发货数量',
          dataIndex: 'shipQuantity',
          // scopedSlots: { customRender: 'shipQuantity' },
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '是否TC功能',
          dataIndex: 'isTC',
          width: 90,
          // scopedSlots: { customRender: 'isTC' },
          className: 'replacecolor'
        },
        {
          title: '物料成分',
          dataIndex: 'materialComposition',
          // scopedSlots: { customRender: 'materialComposition' },
          width: 140,
          className: 'replacecolor'
        },

        {
          title: '销售类型',
          dataIndex: 'saleType',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '客户简称',
          dataIndex: 'customerShortName',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '客户名称',
          dataIndex: 'customerName',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '汇率',
          dataIndex: 'exchangeRate',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '整单合计',
          dataIndex: 'wholeSingleCombined',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '销售部门',
          dataIndex: 'salesDepartment',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '业务员',
          dataIndex: 'salesman',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '币种',
          dataIndex: 'currency',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '品牌方',
          dataIndex: 'brand',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '第三方',
          dataIndex: 'thirdParty',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '定金比例(%)',
          dataIndex: 'depositRate',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '定金',
          dataIndex: 'deposit',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '协同路线',
          dataIndex: 'collaborativeRoute',
          width: 120,
          className: 'replacecolor'
        },

        {
          title: '付款条件',
          dataIndex: 'paymentClause',
          width: 160,
          customRender: t => ellipsis(t),
          className: 'replacecolor'
        },
        {
          title: '最终客户',
          dataIndex: 'finalCustomer',
          width: 120,
          className: 'replacecolor'
        },
        {
          title: '订单备注',
          dataIndex: 'orderNote',
          width: 160,
          customRender: t => ellipsis(t),
          className: 'replacecolor'
        },

        {
          title: '价格备注',
          dataIndex: 'priceNote',
          width: 160,
          customRender: t => ellipsis(t),
          className: 'replacecolor'
        },
        {
          title: '订单变更说明',
          dataIndex: 'orderChangeDesc',
          width: 160,
          customRender: t => ellipsis(t),
          className: 'replacecolor'
        }
      ],

      data: [
        {
          orderNum: 'AA002200001',
          smallPo: '008',
          // shipQuantity: '',
          // isTC: '',
          paymentClause: '定金达到50%定金达到50%定金达到50%定金达到50%定金达到50%定金达到50%'
        },
        {}
      ],

      detailsShipDet: [], // 详情 发运明细
      visible: false,
      confirmLoading: false,
      dateFormat: 'YYYY-MM-DD'
    }
  },
  created() {},

  methods: {
    // 抽屉 取消
    handleCancel() {
      console.log('点击抽屉取消')
      this.close()
    },
    close() {
      this.$emit('close')
      this.visible = false
    }
  },
  computed: {},
  mounted() {}
}
</script>
<style lang="less" scoped>
@import '~@assets/less/common.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;
// }
</style>
