<template>
	<view class="content">
	   <navigation :showBack="false">
		  Red Envelopes
		  <image src="../static/color/top_icon_ins@3x.png" mode="aspectFit" class="back" @click="back()"></image>
		
	   </navigation>
	   <view class="money">
	   	{{bo.currencySymbol}}{{k}}{{bo.amount}}
	   </view>
	   <view class="btn" @click="receive()">
	   	Continue
	   </view>
   </view>
</template>

<script>
	import api from '@/utils/api'
	import utils from '@/utils'
	import cont from "@/components/navigation/navigation.vue"
	import index from '@/utils/index.js'
	export default{
		data(){
			return{
		code:'',
		k:' ',
		ticket:'',
		bo:{},
				}
			},
		
		onLoad(i) {	
	    this.ticket=uni.getStorageSync('logInfo').data;
		this.code=i.code
		this.getRedInfo();
},
	
		
		methods:{
			back(){
				uni.switchTab({
					url:'/pages/menu/My/index'
				})
			},
			receive(){
				const post2 = api.receiveRedEnvelop({
					"ticket": uni.getStorageSync('logInfo').data,
					"code":this.code,
				})
				post2.then(res => {
					
					uni.showToast({
						title: 'Successfully',
						icon: 'success',
						duration: 2500
					})		
				
				
					})
					.catch(e => {
					uni.showToast({
						title: e,
						icon: 'none',
						duration: 2500
					})
					})
			},
		 getRedInfo(){
		
			 const post2 = api.redEnvelop({
			 	"ticket": uni.getStorageSync('logInfo').data,
			 	"code":this.code,
			 })
			 post2.then(res => {
				 this.bo=res.data;
			 	})
			 	.catch(e => {
			 	
			 	})
		 }
		
			},
		
				
	}
</script>

<style lang="scss" scoped>
page{
	height: 100%;
}
	/* #ifdef APP-PLUS  */
	.back{
		width: 42rpx;
		height: 42rpx;
		position: absolute;
		left:36rpx;
	    top: 60%;
		transform: translateY(-50%) rotate(-180deg) ;
	
	}
	  /*  #endif   */
.back{
		width: 42rpx;
		height: 42rpx;
		position: absolute;
		left:36rpx;
        top: 50%;
		transform: translateY(-50%) rotate(-180deg) ;
	
	}
.content{
	width: 100%;
	height: 100%;
	background: url('../static/bankCard/redBJ.png')no-repeat;
	background-position: center center;
	background-size: cover;
	position: relative;
}
.money{
	font-size: 100rpx;
	color: #fff;
	text-align: center;
	margin-top: 60rpx;
}
.btn{
	width: 678rpx;
	line-height: 96rpx;
	text-align: center;
	color: 28rpx;
	background-color: #EED19E;
	border-radius: 24rpx;
	position: absolute;
	bottom: 360rpx;
	left: 50%;
	transform: translateX(-50%);
}
</style>
