<template>
  <div id="list-1">
    <van-row>
      <van-col span="24" class="main">
        <van-col span="24" class="list" v-for="(item, index) in list" :key="index">
          <van-col span="24" class="name">{{ item.patent_name }}</van-col>
          <van-col span="24" class="other">
            <van-col span="24" class="other_1">
              <span>专利号：</span>
              <span>{{ item.create_number }}</span>
            </van-col>
            <van-col span="24" class="other_1">
              <span>发送时间：</span>
              <span>{{ getDate(item.meta.createdAt) }}</span>
            </van-col>
          </van-col>
          <van-col span="24" class="btn">
            <van-button type="primary" size="small" @click="toView(item)">文件下载</van-button>
          </van-col>
        </van-col>
      </van-col>
    </van-row>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
import moment from 'moment';
export default {
  name: 'list-1',
  props: {
    list: { type: Array },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    // 详细信息
    toView(value) {
      this.$emit('toView', { data: value });
    },
    // 过滤时间
    getDate(val) {
      let newDate = moment(val).format('YYYY-MM-DD HH:mm:ss');
      if (newDate) return newDate;
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  padding: 8px 8px 0 8px;
  .list {
    background-color: #ffffff;
    margin: 0 0 10px 0;
    padding: 8px;
    border-radius: 5px;
    .name {
      font-size: 18px;
      font-weight: bold;
      margin: 0 0 5px 0;
    }
    .other {
      margin: 0 0 5px 0;
      .other_1 {
        font-size: 16px;
        margin: 0 0 5px 0;
        span:first-child {
          color: #858585;
        }
      }
    }
    .btn {
      text-align: center;
    }
  }
}
</style>
