<template>
	<view class="content">
		<!-- <view class="ad-view"><ad unit-id="adunit-edf130ab482cfb31"></ad></view> -->
		<view class="wrap">
			<image class="w_left" src="../../static/supprt/star.png" mode="aspectFit"></image>
			<view class="w_center_l">
				<view>打榜送出300票</view>
				<view v-if="votes.giveVotes">已完成{{votes.giveVotes}}/300票</view>
				<view v-else>已完成0/300票</view>
			</view>
			<view class="w_center_r"><image src="../../static/supprt/xin.png" mode="aspectFill"></image>+20</view>
			<view @tap="giveVotesLink" class="w_right">{{text}}</view>
		</view>
		<view class="ad-view">
			<ad unit-id="adunit-f9252fa1e8324ea1" ad-type="video" ad-theme="white"></ad>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				votes:'',
				text:"去送票"
			};
		},
		onLoad() {
			this.getUserInfo();
		},
		methods:{
			//获取用户信息
			getUserInfo(){
				this.request({
					url:this.path+'/api/xyb/star/customerInfo',
					success:(res)=>{
						let d = res.data;
						this.votes = d.data;
						if(this.votes>299){
							this.text = '领取加票'
						}
					}
				})
			},
			giveVotesLink(){
				if(this.votes.giveVotes > 299){
					// uni.showToast({
					// 	title:"添加客服微信，为您加票，更有专属加票渠道哦！",
					// 	icon:"none"
					// });
					this.request({
						url:this.path+'/api/xyb/star/getMuch',
						data:{
							typeId:4,
							much:20
						},
						success:(res)=>{
							let d = res.data;
							if(d.code == 0){
								uni.showToast({
									title:"奖励20票！",
									icon:"none"
								})
							}
						}
					})
				}else{
					uni.navigateBack();
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
.content{
	background-color: #1fc8db;
	background-image: linear-gradient(#5680E6 0%,#1fc8db 51%,#2cb5e8 75%,#9fb8ad 100%);
	width: 100vw;
	height: 100vh;
	overflow: hidden;
	box-sizing: border-box;
	.ad-view{
		padding: 30rpx;
		box-sizing: border-box;
	}
	.wrap{
		background-color: #FFFFFF;
		border-radius: 30rpx;
		margin: 30rpx;
		display: flex;
		align-items: center;
		justify-content: space-around;
		padding: 30rpx;
		.w_center_l{
			view:nth-child(1){
				font-size: 26rpx;
			}
			view:nth-child(2){
				font-size: 22rpx;
				color: grey;
			}
		}
		.w_left{
			width: 100rpx;
			height: 100rpx;
		}
		.w_center_r{
			display: flex;
			align-items: center;
			justify-content: center;
			image{
				width: 40rpx;
				height: 40rpx;
			}
		}
		.w_right{
			width: 120rpx;
			padding: 10rpx 15rpx;
			border-radius: 30rpx;
			color: #FFFFFF;
			font-size: 24rpx;
			text-align: center;
			background-image: linear-gradient(141deg,#5680E6,#9fb8ad);
		}
	}
}
</style>
