<template>
<view class="bind">
	<u-notice-bar :text="text1"></u-notice-bar>
	<view class="logo">
		<image src="/static/image/logo254.png" mode="widthFix"></image>
	</view>
	<view class="info">
		<text>推荐人账号</text>
		<u--input
			 border="bottom"
			v-model="value"
		></u--input>
	</view>
	<view class="bindBtn" @click="bingHandle">
		绑 定
	</view>
	<u-toast ref="uToast"></u-toast>
</view>
</template>

<script>
import {bindInvitor} from '@/common/api.js'
export default{
	data(){
		return{
			text1:'温馨提示：为了您的权益请尽快绑定推荐人，只可绑定一次请谨慎操作，如不了解可联系工作人员。',
			value:''
		}
	},
	methods:{
		bingHandle(){
			if(!this.value){
				this.$refs.uToast.show({
					message:'请输入推荐人'
				})
				return;
			}
			bindInvitor({mobile:this.value}).then(res=>{
				if(res.code==1){
					this.$refs.uToast.show({
						message:'绑定成功'
					})
					uni.switchTab({
						url:"/pages/my/my"
					})
				}
			})
		}
	}
}
</script>

<style lang="scss" scoped>
.bind{
	min-height: calc(100vh - 90rpx);
	
	.logo{
		text-align: center;
		margin-top:70rpx;
		image{
			width:40%;
			height:auto;
		}
	}
	.info{
		display: flex;
		margin-top:30rpx;
		align-items: center;
		justify-content: center;
		padding:0 44rpx;
		&>text{
			margin-right:20rpx;
		}
	}
	.bindBtn{
		background-color: $base;
		width:70%;
		margin:50rpx auto;
		color:#ffffff;
		padding:20rpx;
		text-align: center;
		border-radius: 10rpx;
	}
}
</style>