<template>
	<view class="configPopup">
		<uv-popup ref="popup" :round="30" 
		:safeAreaInsetBottom="false"
		:customStyle="{height: '50vh'}">
			<view class="content">
				<view class="title">今日签到获取积分</view>
				
				<view class="un">{{ priceMap.sign_points }}</view>
				
				<view class="uni-color-btn"
				@click="submit">
					签到
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
	import { mapState } from 'vuex'
	export default {
		data() {
			return {
				
			}
		},
		computed : {
			...mapState(['headInfo', 'priceMap']),
		},
		mounted() {
			if(uni.getStorageSync('token')){
				this.getTodaySign()
			}
		},
		methods: {
			submit(){
				this.$api('sign', res => {
					if(res.code == 200){
						uni.showToast({
							title: '签到成功',
							icon: 'none'
						})
						this.$refs.popup.close()
					}
				})
			},
			getTodaySign(){
				this.$api('getTodaySign', res => {
					if(res.result){
						this.$refs.popup.open()
					}
				})
			},
		}
	}
</script>

<style scoped lang="scss">
	.configPopup {
		.content{
			padding: 30rpx 20rpx;
			text-align: center;
			overflow: scroll;
			height: 100%;
			width: 640rpx;
			box-sizing: border-box;
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			.title{
				font-size: 30rpx;
				font-weight: 900;
			}
			.un{
				background-color: $uni-color;
				color: #fff;
				width: 200rpx;
				height: 200rpx;
				border-radius: 50%;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 50rpx;
				font-weight: 900;
				margin-top: 50rpx;
			}
			.uni-color-btn{
				width: 80%;
				margin-top: 180rpx;
			}
		}
	}
</style>
