<template>
	<view>
		<view class="item">
			<view class="item-one">兑换成功</view>
			<view class="item-two">商品已成功兑换，当前盲豆余额：{{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:2,
					url: '/packagePrize/prize/index'
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.item {
		text-align: center;

		&-one {
			margin-top: 450rpx;
			color: #F9822C;
			font-size: 40rpx;
			line-height: 60rpx;
		}

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

		&-three {
			margin-top: 78rpx;
			width: 540rpx;
			height: 84rpx;
			line-height: 78rpx;
			background-color: #F9822C;
			border: 2rpx solid #F9822C;
			color: #fff;
			font-size: 34rpx;
		}

		&-four {
			margin-top: 34rpx;
			width: 536rpx;
			height: 80rpx;
			line-height: 74rpx;
			background-color: #fff;
			border: 2rpx solid #bbb;
			font-size: 34rpx;
			color: #333;
		}
	}
</style>
