<template>
  <div class="card-content">
    <div class="tag" v-if='data.showTag'>
      <span>我推荐</span>
    </div>
    <div class="card-top flex-h">
      <div class="flex-h">
        <img :src="data.Headimgurl" alt="">
        <div>
          <span>姓名：{{data.Name}}</span>
          <span>手机号:{{data.Phone}}</span>
        </div>
      </div>
      <div>
        <div @click="record">领取记录</div>
        <div @click="history">历史备注</div>
      </div>
    </div>
    <div class="card-bottom">
      <span>备注：{{data.Remark}}</span>
      <span @click="remark">+ 添加备注</span>
    </div>
  </div>
</template>

<script>
import inv from '../../common/icon/inv.png'
export default {
  name: 'myCard',
  data () {
    return {
      inv
    }
  },
  props: {
    data: {
      type: Object,
      default: () => { }
    }
  },
  methods: {
    record () {
      this.$emit('record', this.data)
    },
    remark () {
      this.$emit('remark', this.data)
    },
    history () {
      this.$emit('history', this.data)
    }
  }
}
</script>

<style lang="scss" scoped>
.card-content {
  box-shadow: 0px 2px 0.1rem 0px rgba(193, 204, 217, 0.5);
  border-radius: 0.08rem;
  overflow: hidden;
  margin-bottom: 0.2rem;
  position: relative;
  .tag {
    position: absolute;
    top: 0;
    left: 0;
    transform: rotate(-45deg);
    width: 0.8rem;
    height: 0.8rem;
    top: -0.42rem;
    left: -0.42rem;
    background: linear-gradient(
      138deg,
      rgba(255, 149, 41, 1) 0%,
      rgba(255, 63, 41, 1) 100%
    );
    span {
      position: absolute;
      bottom: 2px;
      left: 50%;
      transform: translateX(-50%);
      color: #fff;
      font-size: .12rem;
      width: 100%;
      text-align: center;
    }
  }
  .card-top {
    padding: 0.3rem 0.1rem;
    > div:nth-of-type(1) {
      align-items: center;
      img {
        width: 0.5rem;
        height: 0.5rem;
        border-radius: 50%;
        padding-right: 0.2rem;
      }
      div {
        span {
          display: block;
          padding: 0.02rem 0;
        }
      }
    }
    > div:nth-of-type(2) {
      display: flex;
      flex-flow: column nowrap;
      align-items: center;
      justify-content: center;
      flex: 1;
      padding-left: 0.15rem;
      div {
        color: #fc6243;
        font-size: 0.12rem;
        padding: 0.02rem 0.15rem;
        border: 1px solid #fc6243;
        border-radius: 20px;
        margin: 0.05rem 0;
      }
    }
  }
  .card-bottom {
    background: #f2f2f2;
    display: flex;
    padding: 0.15rem;
    justify-content: space-between;
    align-items: center;
    span:nth-of-type(1) {
      color: #323645;
      width: 2.3rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    span:nth-of-type(2) {
      color: #909090;
    }
  }
}
</style>
