<template>
  <div class="storage">
    <ul class="list-unstyled">
      <li v-for="item in listData" v-if="handleItem === 0">
        <div class="linetext">{{switchType === 'INBOUND' ? '入库单号' : '出库单号'}}： <span v-text="item.inOutId || '-'">21324</span></div>
        <div class="linetext">{{switchType === 'INBOUND' ? '卖家名称' : '买家名称'}}： <span v-text="item.affiliatedEnterprise || '-'">21324</span></div>
        <div class="linetext">类型： <span v-text="setFilterType(item.opertatorType)">21324</span></div>
        <div class="linetext">录入人： <span v-text="item.operaterUserName || '-'">21324</span></div>
        <div class="linetext">录入时间： <span v-text="item.createTime ? baseUtils.formatDate(new Date(item.createTime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
        <div class="look-btn">
          <span @click="loadAllInfo(item.id, 0)">查看更多</span>
        </div>
      </li>
      <li v-for="item in listData" v-if="handleItem === 2">
        <div class="linetext">{{switchType === 'INBOUND' ? '入库单号' : '出库单号'}}： <span>系统自动生成</span></div>
        <div class="linetext">{{switchType === 'INBOUND' ? '发货单' : '订单号'}}： <span v-text="item.orderid || '-'">21324</span></div>
        <div class="linetext">{{switchType === 'INBOUND' ? '卖家名称' : '买家名称'}}： <span v-text="item.buyentername || item.buyerentername || item.buyername || '-'">21324</span></div>
        <div class="linetext">录入人： <span v-text="item.sellername || '-'">21324</span></div>
        <div class="linetext">录入时间： <span v-text="item.createtime ? baseUtils.formatDate(new Date(item.createtime), 'yyyy-MM-dd hh:mm:ss') : '-'">21324</span></div>
        <div class="look-btn">
          <span @click="loadAllInfo(item, 1)" v-text="switchType === 'INBOUND' ? '收货入库' : '发货出库'"></span>
        </div>
      </li>
    </ul>
  </div>
</template>
<script>
  export default {
    props: {
      handleItem: {
        type: Number,
        default: 0
      },
      listData: {
        type: Array,
        default: []
      },
      switchType: {
        type: String,
        default: 'INBOUND'
      }
    },
    methods: {
      setFilterType (type) {
        let bound = ''
        if(type === 'OTHER_INBOUND') {
          bound = '其他入库'
        } else if(type === 'OTHER_OUTBOUND'){
          bound = '其他出库'
        } else if (type === 'PURCHASE_INBOUND') {
          bound = '采购入库'
        } else if(type === 'SELL_OUTBOUND') {
          bound = '销售出库'
        } else {
          bound = '全部类型'
        }
        return bound
      },
      loadAllInfo (type, i) {
        if(i === 0) {
          this.$router.push('/mobile/center/vendor/outOfStorage/' + type)
        } else if(i === 1){
          if(this.switchType === 'INBOUND') {
            this.$router.push(`/mobile/center/vendor/outOfStorage/purchase/${type.id}?type=INBOUND`)
          } else {
            this.$router.push(`/mobile/center/vendor/outOfStorage/purchase/${this.baseUtils.enidfilter(type.purchaseid)}?type=OUTBOUND`)
          }
        }
      }
    }
  }
</script>
<style lang="scss" scoped>
  $base-color: #3f84f6;
  .storage{
    ul{
      li{
        padding: 0.24rem 0.24rem;
        background: #fff;
        margin-bottom:.2rem;
        .linetext{
          color:#666;
          line-height: .6rem;
          overflow: hidden;
          -o-text-overflow: ellipsis;
          text-overflow: ellipsis;
          white-space: nowrap;
          span{
            color:#333;
          }
        }
        .look-btn{
          padding: 0.2rem 0;
          border-top: 1px solid #d3d3d3;
          text-align: center;
        }
      }
    }
  }
</style>
