<template>
	<view class="center">
		<view class="info">
			<view class="avatar"></view>
			<view class="name">城攻闪拓</view>
		</view>
		<view class="bottom" @click="bd()">绑定店铺</view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
import { interceptor } from '@/utils/loginUtils';
import { setLeader } from '@/api/coupon.js';
export default {
	data() {
		return {
			id: ''
		};
	},
	computed: {
		...mapState(['userInfo', 'orderInfo', 'hasLogin'])
	},
	onLoad(option) {
		if (!this.hasLogin) {
			interceptor();
		} else {
			this.id = option.scene;
			this.loadData();
		}
	},
	methods: {
		bd() {
			setLeader(
				{
					fuck: this.userInfo.uid,
					fuck_name: 'setLeader'
				},
				this.id
			).then(e => {
				this.$api.msg('加入成功');
				setTimeout(function() {
					uni.switchTab({
						url: '/pages/index/index'
					});
				}, 1000);
			});
		}
	}
};
</script>

<style lang="scss">
.avatar {
	margin: 20rpx auto 0;
	width: 120rpx;
	height: 120rpx;
	border-radius: 50%;
	image {
		width: 100%;
		height: 100%;
		border-radius: 50%;
	}
}
.name {
	margin-top: 10rpx;
	text-align: center;
	font-size: 30rpx;
	font-family: PingFang SC;
	font-weight: 500;
}
.bottom {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 100rpx;
	margin: 0 auto;
	width: 560rpx;
	background: linear-gradient(90deg, #fe6f61 0%, #ff4343 100%);
	color: #ffffff;
	text-align: center;
	padding: 26rpx 0rpx;
	border-radius: 50rpx;
}
</style>
