<template>
  <div class="namePhone">
    <div class="uForm">
      <div class="uName">
        <u-input v-model="username" type="text" placeholder="姓名" :maxlength="10" />
        <u-input v-model="userphone" type="number" placeholder="手机号" :maxlength="11" />
        <div class="line"></div>
      </div>
    </div>
    <div class="btn" @click="removeMe">
      <img src="https://cdn.cunwuyun.cn/wxmp/pingchang/del.png" alt="">
    </div>
  </div>
</template>

<script>
export default {
  props: {
    name: String,
    phone: String,
    index: Number,
  },
  computed: {
    username: {
      get() {
        return this.name;
      },
      set(val) {
        this.$emit("update:name", val);
      },
    },
    userphone: {
      get() {
        return this.phone;
      },
      set(val) {
        this.$emit("update:phone", val);
      },
    },
  },
  methods: {
    removeMe() {
      this.$emit("delCountHandle", this.index);
    },
  },
}
</script>

<style lang="scss" scoped>
.namePhone {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  margin-bottom: 10px;

  .uForm {
    width: calc(100% - 60px);
    background: #EFF5FA;
    border-radius: 8px;
    .uName {
      display: flex;
      align-items: center;
      height: 96px;
      line-height: 96px;
      position: relative;
      h4 {
        width: 200px;
        text-align: center;
      }
      u-input {
        width: 100%;
        padding-left: 20px;
        box-sizing: border-box;
      }
      .line {
        position: absolute;
        left: 310px;
        top: 18px;
        width: 3px;
        height: 64px;
        background: #BACBDA;
      }
    }
  }
  .btn {
    width: 60px;
    text-align: center;
    img {
      width: 32px;
      height: 32px;
    }
  }
}
</style>