<template>
  <div>
    <a-affix>
      <a-page-header
        :ghost="false"
        @back="() => $router.go(-1)"
      >
        <template slot="subTitle">
          <a href="javascript:;" @click="() => $router.go(-1)">返回列表</a>
          <a-button size="small" type="danger" style="margin-left:50px" key="1">
            销售导出
          </a-button>
        </template>
        <template slot="extra">
          <a-button key="4">
            打印预览
          </a-button>
          <a-button key="5" type="primary">
            快速打印
          </a-button>
        </template>
        <a-descriptions size="small" :column="4">
          <a-descriptions-item label="客户名称">
            张三的
          </a-descriptions-item>
          <a-descriptions-item label="客户地址">
            山西省太原市阿斯加德法律静安寺水电费
          </a-descriptions-item>
          <a-descriptions-item label="支付方式">
            货到付款
          </a-descriptions-item>
          <a-descriptions-item label="收款方式">
            现金
          </a-descriptions-item>
          <a-descriptions-item label="联系手机">
            13709146191
          </a-descriptions-item>
          <a-descriptions-item label="联系电话">
            13709146191
          </a-descriptions-item>
          <a-descriptions-item label="备注">
            备注备注备注备注备注
          </a-descriptions-item>
          <a-descriptions-item label="退货单号">
            34242sdf234234
          </a-descriptions-item>
          <a-descriptions-item label="审核状态">
            未审核
          </a-descriptions-item>
          <a-descriptions-item label="完结状态">
            未完结
          </a-descriptions-item>
        </a-descriptions>
      </a-page-header>
    </a-affix>

    <a-card size="small" :bordered="false" class="pages-wrap">
      <!-- alert -->
      <a-alert type="info">
        <div slot="message">
          <div>
            <span>总款数：1；</span>
            <span>总数量：6；</span>
            <span>废品数量：3；</span>
          </div>
          <div>
            <span>退货总金额：11；</span>
            <span>折扣金额：8；</span>
            <span>折扣：0.00%；</span>
            <span>折后金额：0.00；</span>
          </div>
        </div>
      </a-alert>
      <!-- 列表 -->
      <s-table
        class="sTable"
        ref="table"
        size="default"
        :rowKey="(record) => record.id"
        :columns="columns"
        :data="loadData"
        :scroll="{ x: 1500, y: 300 }"
        bordered>
      </s-table>
    </a-card>
  </div>
</template>

<script>
import { STable, VSelect } from '@/components'
export default {
  name: 'SalesDetail',
  components: {
    STable,
    VSelect
  },
  data () {
    return {
      disabled: false,
      // 表头
      columns: [
        {
          title: '序号',
          dataIndex: 'no',
          align: 'center',
          width: 100
        },
        {
          title: '产品编码',
          dataIndex: 'salerNo',
          align: 'center'
        },
        {
          title: '产品名称',
          dataIndex: 'storeNo',
          align: 'center'
        },
        {
          title: '原厂编码',
          dataIndex: 'custName',
          align: 'center'
        },
        {
          title: '售价',
          dataIndex: 'totalNums',
          align: 'center'
        },
        {
          title: '折后售价',
          dataIndex: 'totalPrice',
          align: 'center'
        },
        {
          title: '退货数量',
          dataIndex: 'payType',
          align: 'center'
        },
        {
          title: '废品数量',
          dataIndex: 'shDate',
          align: 'center'
        },
        {
          title: '入库数量',
          dataIndex: 'status',
          align: 'center'
        },
        {
          title: '退货金额小计',
          dataIndex: 'isJj',
          align: 'center'
        },
        {
          title: '折扣金额',
          dataIndex: 'status',
          align: 'center'
        },
        {
          title: '折后退货金额小计',
          dataIndex: 'status',
          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', productNum: 'jgqp11111111111', productName: '产品1', productOldNum: 'jgqp111123545', productBrand: '箭冠品牌', productType: '产品分类1', inventoryNum: '5', inventoryMoney: '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)
        })
      }
    }
  }
}
</script>

<style lang="less">
  .pages-wrap{
    margin-top: 15px;
    .sTable{
      margin-top: 15px;
    }
  }
</style>
