<template>
  <div class="warehousingAuditDetail-wrap">
    <a-page-header :ghost="false" @back="handleBack" >
      <!-- 自定义的二级文字标题 -->
      <template slot="subTitle">
        <a id="warehousingAuditDetail-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
      </template>
      <!-- 操作区，位于 title 行的行尾 -->
      <template slot="extra">
        <a-button key="2" id="warehousingAuditDetail-preview-btn">打印预览</a-button>
        <a-button key="1" type="primary" id="warehousingAuditDetail-print-btn">快速打印</a-button>
      </template>
    </a-page-header>
    <!-- 内容 -->
    <a-page-header title="单号：CG2021010100001" ></a-page-header>
    <!-- 基础信息 -->
    <a-card :bordered="false" class="warehousingAuditDetail-cont">
      <a-collapse :activeKey="['1']">
        <a-collapse-panel key="1" header="基础信息">
          <a-descriptions :column="3">
            <a-descriptions-item label="供应商">箭冠营销中心</a-descriptions-item>
            <a-descriptions-item label="入库时间">箭冠营销中心</a-descriptions-item>
            <a-descriptions-item label="采购单号">箭冠营销中心</a-descriptions-item>
          </a-descriptions>
          <a-descriptions :column="3" bordered>
            <a-descriptions-item label="采购总款数">2</a-descriptions-item>
            <a-descriptions-item label="采购总数量">20</a-descriptions-item>
            <a-descriptions-item label="采购总成本">￥120.36</a-descriptions-item>
            <a-descriptions-item label="入库总款数">3</a-descriptions-item>
            <a-descriptions-item label="入库总数量">4</a-descriptions-item>
            <a-descriptions-item label="入库总成本">￥11.2</a-descriptions-item>
          </a-descriptions>
        </a-collapse-panel>
      </a-collapse>
    </a-card>
    <!-- 入库明细 -->
    <a-card :bordered="false" class="warehousingAuditDetail-cont">
      <a-collapse :activeKey="['1']">
        <a-collapse-panel key="1" header="入库明细">
          <!-- 列表 -->
          <s-table
            class="sTable"
            ref="table"
            size="default"
            :rowKey="(record) => record.id"
            :columns="columns"
            :data="loadData"
            bordered>
            <!-- 采购数量 -->
            <template slot="purchaseNum" slot-scope="text, record">
              <span>{{record.purchaseNum}}</span>
            </template>
            <!-- 缺货数量 -->
            <template slot="outOfStockNum" slot-scope="text, record">
              <span>{{record.outOfStockNum}}</span>
            </template>
          </s-table>
        </a-collapse-panel>
      </a-collapse>
    </a-card>
  </div>
</template>

<script>
  import { STable, VSelect } from '@/components'
  export default{
    components: { STable, VSelect },
    data(){
      return{
        // 表头
        columns: [
          { title: '序号', dataIndex: 'no', align: 'center' },
          { title: '产品编码', dataIndex: 'creatDate', align: 'center' },
          { title: '产品名称', dataIndex: 'custName', align: 'center' },
          { title: '原厂编码', dataIndex: 'totalP', align: 'center' },
          { title: '采购数量', scopedSlots: { customRender: 'purchaseNum' }, align: 'center' },
          { title: '入库数量', scopedSlots: { customRender: 'purchasesNum' }, align: 'center' },
          { title: '成本价', dataIndex: 'totalNums', align: 'center' },
          { title: '单位', dataIndex: 'mementPay', align: 'center' },
          { title: '入库小计', dataIndex: 'shDate', align: 'center' },
          { title: '仓库', dataIndex: 'shDaste', align: 'center' },
          { title: '仓位', dataIndex: 'shsDate', align: 'center' },
        ],
        // 加载数据方法 必须为 Promise 对象
        loadData: parameter => {
          this.disabled = true
          // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
          //   const data = res.data
          //   const no = (data.pageNo - 1) * data.pageSize
          //   for (var i = 0; i < data.list.length; i++) {
          //     data.list[i].no = no + i + 1
          //   }
          //   this.disabled = false
          //   return data
          // })
          const _this = this
          return new Promise(function(resolve, reject){
            const data = {
              pageNo: 1,
              pageSize: 10,
              list: [
                { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
              ],
              count: 10
            }
            const no = (data.pageNo - 1) * data.pageSize
            for (var i = 0; i < data.list.length; i++) {
              data.list[i].no = no + i + 1
            }
            _this.disabled = false
            resolve(data)
          })
        },
      }
    },
    methods: {
      //  返回列表
      handleBack(){
        this.$router.push({ path: '/financialManagement/warehousingAudit/list'})
      },
    }
  }
</script>

<style lang="less">
  .warehousingAuditDetail-cont{
    margin-bottom: 15px;
  }
</style>
