<template>
	<view class="">
		<view class="content">
			<view class="content-top">恭喜您！兑换成功！</view>
			<image src="@/static/images/gift/success.png" mode="widthFix" class="success"></image>
			<view class="content-middle">
				消耗金额:<text style="color: #EA4A41;margin-left: 20rpx;">{{jifen}}</text>
			</view>
			<view class="content-middle">
				还剩积分:<text style="color: #EA4A41;margin-left: 20rpx;">{{user_jifen}}</text>
			</view>
			<view class="content-bottom">
				<view class="goon" @click="goHome">
					返回首页
				</view>
				<view class="check" @click="check">
					查看兑换记录
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		data() {
			return {
				totalPrice: '1830'
			}
		},
		computed: {
			userServerInfo() {
				//用户服务器信息
				return this.$store.state.userinfo;
			},
		},
		onLoad: function(option) { //option为object类型，会序列化上个页面传递的参数
			this.user_jifen = option.user_jifen
			this.jifen = option.jifen
			this.getUserInfo()
		},
		methods: {
			//获取当前用户的信息
			getUserInfo() {
				this.$u.get('/base/auth/me').then(res => {

					this.$u.vuex('vuex_user', res.data)

				})
			},
			goHome() {
				uni.switchTab({
					url: '/pages/index/index'
				})
			},
			//继续兑换
			goon() {
				uni.reLaunch({
					url: '/pages/gift/index'
				})
			},
			//兑换记录
			check() {
				uni.reLaunch({
					url: '/pages/gift/record'
				})
			}
		}
	}
</script>
<style lang="scss">
	// page{
	// 	background-color: #fff;
	// }
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;

		.success {
			width: 275px;
			height: 148px;
		}

		&-top {
			margin-top: 150rpx;
			color: #333;
			font-weight: bold;
			font-size: 36rpx;
		}

		image {
			margin-top: 30rpx;
			margin-bottom: 20px;
		}

		&-middle {
			font-size: 36rpx;
			color: #333;
			font-weight: bold;
		}

		&-bottom {
			display: flex;
			margin-top: 72rpx;

			.goon {
				width: 300rpx;
				line-height: 88rpx;
				color: #FB231F;
				border-radius: 44rpx;
				border: 2rpx #FB231F solid;
				background-color: #FFF4F3;
				text-align: center;
			}

			.check {
				width: 300rpx;
				color: #fff;
				line-height: 88rpx;
				margin-left: 40rpx;
				border-radius: 44rpx;
				background: linear-gradient(93deg, #F97C55 0%, #F44545 100%);
				text-align: center;
			}
		}
	}
</style>