<template>
  <div class="detail-container">
    <el-page-header @back="goBack" content="详情"></el-page-header>

    <div id="printMe">
      <div class="main-title">
        <div class="title">发货单信息</div>
      </div>
      <div class="diy-table-1">
        <el-row :gutter="0">
          <el-col :span="8" class="item">
            <div class="label">发货单号</div>
            <div class="value">{{detailData.retreatOrderNo}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">发货日期</div>
            <div class="value">{{detailData.shipTime}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">业务类型</div>
            <div class="value">{{detailData.type}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">销售类型</div>
            <div class="value">{{detailData.salesType}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">订单号</div>
            <div class="value">{{detailData.orderNo}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">发票号</div>
            <div class="value">{{detailData.billNumber}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">客户名称</div>
            <div class="value">{{detailData.clientName}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">销售部门</div>
            <div class="value">{{detailData.salesDep}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">业务员</div>
            <div class="value">{{detailData.salesman}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">工程编号</div>
            <div class="value">{{detailData.projectNumber}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">币种</div>
            <div class="value">{{detailData.currency}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">订单类型</div>
            <div class="value">{{detailData.orderType}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">仓库</div>
            <div class="value">{{detailData.stockName}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">发货申请单号</div>
            <div class="value">{{detailData.invoiceOrderNo}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">台账备注</div>
            <div class="value">{{detailData.iedgerRemark}}</div>
          </el-col>
          <el-col :span="16" class="item">
            <div class="label">备注</div>
            <div class="value">{{detailData.remark}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">项目名称</div>
            <div class="value">{{detailData.projectName}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">外仓印刷单号</div>
            <div class="value">{{detailData.printingSheet}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">厂工程编码</div>
            <div class="value">{{detailData.factoryNumber}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">开票日期</div>
            <div class="value">{{detailData.billingTime}}</div>
          </el-col>
          <el-col :span="16" class="item">
            <div class="label">文件编号</div>
            <div class="value">{{detailData.fileNumber}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">税率</div>
            <div class="value">{{detailData.taxRate}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">订单日期</div>
            <div class="value">{{detailData.createTime}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">制单人</div>
            <div class="value">{{detailData.createBy}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">制单时间</div>
            <div class="value">{{detailData.createTime}}</div>
          </el-col>
          <el-col :span="8" class="item">
            <div class="label">审核人</div>
            <div class="value">{{detailData.retreatOrderNo}}</div>
          </el-col>
          <el-col :span="16" class="item">
            <div class="label">审核时间</div>
            <div class="value">{{detailData.retreatOrderNo}}</div>
          </el-col>
        </el-row>
      </div>

      <div class="main-title">
        <div class="title">货品信息</div>
      </div>
      <div class="table">
        <el-table :data="detailData.retreatDocumentOrder" element-loading-text="Loading" border fit highlight-current-row stripe>
          <el-table-column align="center" label="序号" type="index" width="50"></el-table-column>
          <el-table-column align="center" label="订单号" prop="orderNumber" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="仓库名称" prop="stockName" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="产品编号" prop="productNumber" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="产品名称" prop="productName" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="规格型号" prop="specification" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="主计量" prop="unit" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="数量" prop="number" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="含税单价" prop="includedPrice" min-width="160" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="无税单价" prop="price" min-width="100" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="价税合计" prop="totalPrice" min-width="100" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="税率(%)" prop="rate" min-width="100" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="折扣额" prop="discountPrice" min-width="100" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="折扣后单价" prop="discountPrice" min-width="100" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="退补标记" prop="refund" min-width="100" show-overflow-tooltip></el-table-column>
          <el-table-column align="center" label="厂产品代码" prop="factoryNumber" min-width="100" show-overflow-tooltip></el-table-column>
        </el-table>
      </div>

    </div>
    
    <div class="page-footer">
      <div class="footer" :class="classObj">
        <el-button  type="primary" icon="el-icon-printer" v-print="printObj">打 印</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 print from 'vue-print-nb'
import { getDeliverDetail } from "@/api/supply/return";

export default {
  name: 'DeliverDetail',
  componentName: 'DeliverDetail',
  props: ['listItem'],
  directives: {
    print
  },
  data() {
    return {
      printObj: {
        id: 'printMe'
      },
      detailData: {},
    }
  },

  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() {
      getDeliverDetail({id: this.listItem.id}).then(res => {
        this.detailData = res.data;
      })
    },

  }
}
</script>

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