<template>
  <div class="subPage">
    <div class="flex-h top">
      <div class="flex-item">
        <div>
          <i class="iconfont icon-qrcode"></i>
          <span>1</span>
          <span>请输入用户的手机号</span>
        </div>
      </div>
      <div class="flex-item">
        <div>
          <i class="iconfont icon-hexiao"></i>
          <span>2</span>
          <span>点击“立即核销”按钮</span>
        </div>
      </div>
    </div>
    <div>
      <div class="flex-h">
        <div class="flex-item">
          <div>
          <!-- <el-input
            placeholder="请输入手机号"
            v-model="phone"
            @input="phone=phone.replace(/\D/g,'')"
            clearable>
          </el-input> -->
          <input class="inputBorder" placeholder="请输入手机号" type="text" v-model="phone" @input="phone=phone.replace(/\D/g,'')">
          </div>
        </div>
        <el-button type="danger" @click="toVerificationList">立即核销</el-button>
      </div>
    </div>
  </div>
</template>

<script>

export default {
  name: '',
  data () {
    return {
      phone: '',
    }
  },
  mounted () {
    this.$nextTick(function () { })
  },
  methods: {
    inputPhone () {
      this.phone = this.phone.replace(/\D/g, '')
    },
    checkPhone (val) {
      return !!(/^1[34578]\d{9}$/.test(val))
    },
    toVerificationList () { // 前往核销列表
      if (this.phone !== '' && this.checkPhone(this.phone)) {
        this.$router.push({ name: 'phoneVerificationList', query: { tel: this.phone } })
      } else {
        this.$message({
          message: '手机号格式错误',
          type: 'error'
        })
      }
    },
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="scss" scoped>
@import "page.scss";
.subPage {
  > div {
    width: 100%;
    margin: 40px auto 0;
    > div {
      width: 400px;
      margin: 0 auto;
      white-space: nowrap;
      font-size: 0;
      > div {
        margin-right: 20px;
      }
    }
  }
  .inputBorder{
    width: 100%;
    display: block;
    box-sizing: border-box;
    border: 1px solid #ccc;
    line-height: 20px;
    padding: 10px 0;
    text-indent: 10px;
    border-radius: 6px;
  }
}
</style>
