<template>
  <div id="list-1">
    <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="title">
          {{ item.phone }}
        </van-col>
        <van-col span="24" class="other">
          <van-col span="24" class="otherInfo">
            机构代码或邀请码:<span style="color: #ff0000">{{ item.code || '暂无' }}</span>
          </van-col>
          <van-col span="12" class="otherInfo">
            联系电话:<span>{{ item.name || '暂无' }}</span>
          </van-col>
          <van-col span="12" class="otherInfo">
            审核状态:<span>{{ item.status == '0' ? '待审中' : item.status == '1' ? '审核通过' : '审核拒绝' }}</span>
          </van-col>
        </van-col>
        <van-col span="24" class="btn">
          <van-button type="info" size="small" @click="toEdit(item)">修改/审核</van-button>
          <van-button type="danger" size="small" @click="toDel(item)" v-if="user.role == '1'">删除信息</van-button>
          <van-button type="info" size="small" @click="toPsd(item)">重置密码</van-button>
          <!-- <van-button type="info" size="small" @click="toPatent(item)">查看专利</van-button> -->
        </van-col>
      </van-col>
    </van-col>
  </div>
</template>

<script>
import { mapState, createNamespacedHelpers } from 'vuex';
export default {
  name: 'list-1',
  props: {
    list: { type: Array },
  },
  components: {},
  data: function () {
    return {};
  },
  created() {},
  methods: {
    toEdit(data) {
      this.$emit('toEdit', data);
    },
    toDel(data) {
      this.$emit('toDel', data);
    },
    toPatent(data) {
      this.$emit('toPatent', data);
    },
    // 重置密码
    toPsd(data) {
      this.$emit('toPsd', data);
    },
  },
  computed: {
    ...mapState(['user']),
  },
  metaInfo() {
    return { title: this.$route.meta.title };
  },
  watch: {
    test: {
      deep: true,
      immediate: true,
      handler(val) {},
    },
  },
};
</script>

<style lang="less" scoped>
.main {
  .list {
    background-color: #fff;
    margin: 0 0 8px 0;
    padding: 8px;
    border-radius: 5px;
    .title {
      font-size: 16px;
      font-weight: bold;
      margin: 0 0 5px 0;
    }
    .other {
      .otherInfo {
        font-size: 14px;
        color: #666;
        margin: 0 0 5px 0;
        span {
          color: #000;
        }
      }
    }
    .btn {
      text-align: center;
      .van-button {
        margin: 0 10px;
      }
    }
  }
}
</style>
