<template>
  <div class="sigin">
    <div class="cal">输入邀请码获取特定礼包</div>
    <div class="si_input">
      <u-input
        v-model="inviteCode"
        type="text"
        aria-placeholder="
        请输入推荐码/手机号"
      />
    </div>
    <div class="si_bottom">
      <button class="btn" @click="head">绑定推荐码</button>
    </div>
    <u-toast ref="uToast" />
  </div>
</template>

<script>
import { inviteCode } from "@/api/point.js";

export default {
  data() {
    return {
      resfn: "",
      ImageUrl: "",
      inviteCode: "",
    };
  },
  mounted() {
    // this.getmy();
  },
  methods: {
    head() {
      if (this.inviteCode == "") {
        this.$refs.uToast.show({
          title: "请输入邀请码",
          type: "error",
        });
      } else {
        inviteCode(this.inviteCode).then((res) => {
          console.log(res);
          if (res.data.code == 200) {
            this.$refs.uToast.show({
              title: "绑定成功",
              type: "success",
            });
            // this.$message.success('');
            // this.$router.push({ path: "/home" });
          } else {
            this.$message.error(res.data.message);
            this.$refs.uToast.show({
              title: res.data.message,
              type: "error",
            });
          }
        });
      }
      // return false;
    },
  },
};
</script>
<style lang="scss" scoped>
.sigin {
  width: 100%;
  height: 25vh;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
}
.si_input {
  width: 70%;
  margin: 0 auto;
  text-align: center;
}
.si_bottom {
  width: 70%;
  margin: 0 auto;
  text-align: center;
}
.cal {
  width: 70%;
  margin: 0 auto;
  text-align: center;
  font-size: 20px;
}
.btn {
  background: #fe3c3c;
}
</style>
