<template>
  <div class="goodsAllocationSet-page">
    <a-spin :spinning="spinning" tip="Loading...">
      <a-page-header :ghost="false" :backIcon="false" class="goodsAllocationSet-baseInfo" >
        <template slot="subTitle">
          <a href="javascript:;" @click="handleBack"><a-icon type="left"></a-icon> 返回列表</a>
          <span style="margin: 0 15px;color: #666;">货架名称：{{ '西安车领主常青二路数字货架' }}</span>
        </template>
      </a-page-header>
      <!-- 额度统计 授信结算类型 显示-->
      <a-card size="small" :bordered="false" style="margin-bottom: 10px;">
        <a-collapse :activeKey="['1']">
          <a-collapse-panel key="1" header="额度统计">
            <a-descriptions size="small" :column="4">
              <a-descriptions-item label="授信额度">
                <a-statistic :precision="2" :value="112893" ><template #prefix>￥</template></a-statistic>
              </a-descriptions-item>
              <a-descriptions-item label="待结金额">
                <a-statistic :precision="2" :value="112893" ><template #prefix>￥</template></a-statistic>
              </a-descriptions-item>
              <a-descriptions-item label="冻结金额">
                <a-statistic :precision="2" :value="112893" ><template #prefix>￥</template></a-statistic>
              </a-descriptions-item>
              <a-descriptions-item label="可用额度">
                <a-statistic :precision="2" :value="112893" ><template #prefix>￥</template></a-statistic>
              </a-descriptions-item>
            </a-descriptions>
          </a-collapse-panel>
        </a-collapse>
      </a-card>
      <a-card :bordered="false" size="small" class="goodsAllocationSet-baseInfo">
        <div ref="tableSearch" class="table-page-search-wrapper">
          <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
            <a-row :gutter="15">
              <a-col :xl="6" :lg="6" :md="12" :sm="24">
                <a-form-item label="下单时间">
                  <a-range-picker v-model="time" :format="dateFormat" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD"/>
                </a-form-item>
              </a-col>
              <a-col :xl="6" :lg="6" :md="12" :sm="24">
                <a-form-item label="取货时间">
                  <a-range-picker v-model="time" :format="dateFormat" allowClear :disabledDate="disabledDate" format="YYYY-MM-DD"/>
                </a-form-item>
              </a-col>
              <a-col :xl="6" :lg="6" :md="12" :sm="24">
                <a-form-item label="取货单编号">
                  <a-input placeholder="请输入取货单编号"/>
                </a-form-item>
              </a-col>
              <a-col :xl="6" :lg="6" :md="6" :sm="6" >
                <a-button type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="outboundOrderList-refresh" >查询</a-button>
                <a-button style="margin-left: 8px" @click="resetSearchForm" :disabled="disabled" id="outboundOrderList-reset">重置</a-button>
              </a-col>
            </a-row>
          </a-form>
        </div>
        <a-alert type="info" style="margin:10px 0">
          <div slot="message" style="display: flex;align-items: center;padding: 2px 0;">
            共<strong>25</strong>条记录；
            待结算金额合计￥<strong>40000.00</strong>
          </div>
        </a-alert>
        <s-table
          class="sTable fixPagination"
          ref="table"
          size="small"
          rowKey="id"
          :showPagination="false"
          :columns="columns"
          :data="loadData"
          :defaultLoadData="false"
          bordered>
          <template slot="name" slot-scope="text, record">
            <a-input allowClear placeholder="请输入货位号" v-if="isEdit" style="width: 80%;"/>
            <span v-if="!isEdit">{{ record.name }}</span>
          </template>
        </s-table>
      </a-card>
      <!-- 导入货位模板 -->
      <!-- <importHuoweiModal :openModal="openModal" @close="openModal=false"></importHuoweiModal> -->
    </a-spin>
  </div>
</template>

<script>
import { commonMixin } from '@/utils/mixin'
import { STable, VSelect } from '@/components'
import { getPowerUserList } from '@/api/power-user.js'
// import importHuoweiModal from './importHuoweiModal.vue'
export default {
  components: { STable, VSelect, commonMixin },
  data () {
    return {
      spinning: false,
      disabled: false,
      isEdit: false, // 货位号是否为编辑
      openModal: false, // 货位模板弹窗初始状态
      formItemLayout: {
        labelCol: { span: 6 },
        wrapperCol: { span: 16 }
      },
      time: [],
      form: {
        isEnable: '',
        name: '',
        phone: '',
        loginName: '',
        sex: undefined,
        loginFlag: '', // 状态
        roleNames: undefined, // 角色
        productMsg: '', // 图片
        remarks: ''
      },
      // 表头
      columns: [
        { title: '序号', dataIndex: 'no', width: '4%', align: 'center' },
        { title: '取货时间', dataIndex: 'name', width: '11%', align: 'center', scopedSlots: { customRender: 'name' } },
        { title: '订单编号', dataIndex: 'createDate', width: '13%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '货位号', dataIndex: '', width: '18%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
        { title: '产品编码', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '产品名称', width: '9%', align: 'center', customRender: function (text) { return text || '--' }, ellipsis: true },
        { title: '产品售价', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '下单数量', width: '9%', align: 'center', customRender: function (text) { return text || '--' } },
        { title: '合计金额', width: '9%', align: 'center', customRender: function (text) { return text || '--' } }
      ],
      // 加载数据方法 必须为 Promise 对象
      loadData: parameter => {
        this.spinning = true
        return getPowerUserList(Object.assign(parameter)).then(res => {
          let data
          if (res.status == 200) {
            data = res.data
            const no = (data.pageNo - 1) * data.pageSize
            for (let i = 0; i < data.list.length; i++) {
              const _item = data.list[i]
              _item.no = no + i + 1
              _item.loginFlag = _item.loginFlag + '' === '1'
            }
          }
          this.spinning = false
          return data
        })
      }
    }
  },
  mounted () {
    this.$refs.table.refresh()
  },
  methods: {
    handleBack () {
      this.$router.go(-1)
    },
    // 重置
    resetSearchForm () {}
  }
}
</script>

<style lang="less">
  .goodsAllocationSet-page{
    position: relative;
    height: 100%;
    padding-bottom: 51px;
    box-sizing: border-box;
    .goodsAllocationSet-baseInfo{
      margin-bottom: 10px;
    }
    .bzj-collapse{
      margin-top: 10px;
      .ant-collapse-content-box{
        padding: 10px !important;
      }
    }

  }
</style>
