<template>
	<view class="content">
		<view class="row b-b flex">
			<text class="tit">上级UID</text>
			<input class="input" v-model="uid" type="number" placeholder-class="placeholder" placeholder="请输入上级UID" />
		</view>
		<view class="submit-box flex">
			<view class="submit" @click="bind">绑定上级</view>
		</view>

	</view>
</template>

<script>
	import {
		spread
	} from '@/api/user.js';
	export default {
		data() {
			return {
				uid: ''
			}
		},
		onLoad(opt) {

		},
		onShow() {

		},
		onReachBottom() {

		},
		onReady() {

		},
		methods: {
			bind() {
				if(this.uid == '') {
					return this.$api.msg('请输入上级UID')
				}
				spread({
					puid: this.uid
				}).then(res => {
					uni.showToast({
						title:'绑定成功',
						duration:2000
					});
					setTimeout(()=> {
						uni.navigateBack()
					},1500)
				})
			}
		}
	}
</script>

<style lang="scss">
	.row {
		background: #fff;
		padding: 42rpx 25rpx;
		font-size: 30rpx;
		color: #333333;

		image {
			width: 80rpx;
			height: 80rpx;
			border-radius: 50%;
		}

		.input {
			text-align: right;
			color: #333333;
		}
	}

	.submit-box {
		display: flex;
		flex-direction: column;
		padding-top: 157rpx;

		.submit {
			margin: 40rpx auto;
			width: 560rpx;
			background-color: #F75022;
			color: #FFFFFF;
			text-align: center;
			padding: 26rpx 0rpx;
			border-radius: 50rpx;
		}

		.dl {
			background-color: #FFFFFF;
			color: #F75022;
		}
	}
</style>
