<template>
  <div class="detail-container">
    <el-page-header @back="goBack" :content="listItem ? '编辑':'新增'"></el-page-header>

    <div class="main-title">
      <div class="title">置换订单信息</div>
    </div>

    <el-form ref="mainForm" :model="mainForm" label-width="100px" size="small" label-position="left">
      <el-row :gutter="20">
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="订单号" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入订单号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8" style="height: 51px;">
          <el-form-item label="单据日期" prop="date">
            <el-date-picker
              v-model="mainForm.date"
              type="date"
              value-format="yyyy-MM-dd"
              style="width: 100%;"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="品类" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入品类"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="销售政策编号" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入销售政策编号"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="销售政策" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入销售政策"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="销售政策说明" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入销售政策说明"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="工程登录编码" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入工程登录编码"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="附件" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入附件"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="12" :lg="8">
          <el-form-item label="业务员" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入业务员"></el-input>
          </el-form-item>
        </el-col>
        <el-col :xs="24" :sm="24" :lg="24">
          <el-form-item label="备注" prop="warehouse">
            <el-input v-model="mainForm.remark" placeholder="请输入备注"></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>

    <div class="main-title">
      <div class="title">货品信息</div>
      <div>
        <el-button type="primary" size="small">检查库存</el-button>
      </div>
      
    </div>

    <div class="table" style="margin-top: 20px">
      <el-table :data="detailData.kingDeeTransferItems" element-loading-text="Loading" border fit highlight-current-row stripe max-height="400">
        <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
        <el-table-column align="center" label="销售类型" prop="materialNumber" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="产品编码" prop="materialName" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="产品名称" prop="model" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="规格型号" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="单位" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="单价" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="订单金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="返利使用比例" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="返利金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="格力折扣" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="现金钱包" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="实付金额" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="原订单数量" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="备注" prop="qty" min-width="160" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="总仓库" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
        <el-table-column align="center" label="仓库状态" prop="qty" min-width="100" show-overflow-tooltip></el-table-column>
      </el-table>
    </div>
    
    <div class="page-footer">
      <div class="footer" :class="classObj">
        <el-button type="primary" @click="clickSubmitForm">保 存</el-button>
        <el-button type="primary" @click="clickSubmitForm">提交审核</el-button>
        <el-popconfirm title="确定关闭吗？" @onConfirm="goBack" style="margin-left: 10px;">
          <el-button slot="reference">关 闭</el-button>
        </el-popconfirm>
      </div>
    </div>

  </div>
</template>

<script>
import { getDetail } from "@/api/supply/displace";

export default {
  name: 'DisplaceForm',
  componentName: 'DisplaceForm',
  props: ['listItem'],
  data() {
    return {
      detailData: {},
      mainForm: {

      },
    }
  },

  computed: {
    sidebar() {
      return this.$store.state.app.sidebar
    },
    classObj() {
      return {
        hideSidebar: !this.sidebar.opened,
        openSidebar: this.sidebar.opened
      }
    },
  },

  created() {
    this.getDetail();
  },

  methods: {
    // 返回列表
    goBack() {
      this.$emit('backListFormDetail');
    },

    // 获取详情
    getDetail() {
      getDetail({id: this.listItem.id}).then(res => {
        this.detailData = res.data;
      })
    },

    clickSubmitForm() {

    },
  }
}
</script>

<style scoped lang="scss">
  .detail-container {
    width: 100%;
    height: 100%;
  }
  .main-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    height: 60px;
    border-bottom: 1px solid #DCDFE6;
    margin-bottom: 20px;
    .title {
      font-size: 16px;
      font-weight: 600;
      padding-left: 10px;
    }
  }
</style>