<template>
	<view class="container">
		<view class="item">
			<view class="item-one">兑换成功</view>
			<view class="item-two">已成功兑换商品，去商城看看吧</view>
			<view class="item-twotwo">当前盲豆余额：{{coinNum}}</view>
			<button class="item-three" @click="toCore()">去商城看看</button>
			<button class="item-four" @click="toPrize()">进入仓库</button>
		</view>
	</view>
</template>

<script>
	import $http from '@/utils/request.js'
	export default {
		data() {
			return {
				coinNum:'',
			}
		},
		onShow() {
			this.getBean()
		},
		methods: {
			getBean() {
				uni.showLoading({
					title: '加载中'
				});
				$http.post('/api/v1/mp/user/mine/init', {}).then(res => {
					uni.hideLoading();
					if (res.code == 0) {
						this.coinNum = res.data.coinNum
					}
				}).catch(() => {
					uni.hideLoading();
				})
			},
			toCore() {
				uni.switchTab({
					url: '/pages/core/index'
				})
			},
			toPrize() {
				uni.navigateBack({
					delta: 1
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.container {
		height: 100vh;
	}
	.item {
		text-align: center;

		&-one {
			margin-top: 400rpx;
			color: #F9822C;
			font-size: 40rpx;
			line-height: 40rpx;
			font-weight: bold;
		}

		&-two {
			margin-top: 32rpx;
			color: #333;
			font-size: 26rpx;
			line-height: 26rpx;
		}
		
		&-twotwo {
			margin-top: 32rpx;
			color: #999999;
			font-size: 26rpx;
			font-weight: 500;
			line-height: 26rpx;
		}


		&-three {
			margin: 54rpx;
			width: 600rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			background: #F9822C;
			border-radius: 44rpx;
			color: #fff;
			font-size: 34rpx;
		}

		&-four {
			margin: 54rpx;
			width: 600rpx;
			height: 88rpx;
			line-height: 88rpx;
			text-align: center;
			border: 1px solid #F9822C;
			background: #fff;
			color: #F9822C;
			border-radius: 44rpx;
			font-size: 34rpx;
		}
	}
</style>
