<template>
	<view class="container-box">
		<navigation-bar-vue title="急招券" style="width: 100%;" background-color="#ffffff"
			title-color="#000000"></navigation-bar-vue>
		<view class="content">
			<view class="content-body">
				<image class="huojian" src="@/static/mine/coupon/huojian.png" mode="aspectFit"></image>
				<view class="coupon-box">
					<view class="left-top">
						<view class="left-space"></view>
						<image src="@/static/mine/auth/dian.png" mode="aspectFit"></image>
						<view style="padding-bottom: 20rpx;">获取更多</view>
						<view class="bg-img">加速特权</view>
					</view>
					<view class="content-img">
						<image src="@/static/mine/coupon/quan.png" mode="aspectFit"></image>
					</view>
					<view class="bottom-content">
						<view class="top-text">剩余<text>{{ coupon }}</text>张</view>
						<view class="button-dom" @click="goMyCoupon(0)">去获取</view>
					</view>

				</view>
			</view>
			<view class="item-field" style="align-items: center;">
				<!--				<view class="my-suggest-dom" @click="viewRichText()">-->
				<!--					<text>了解急招券</text>-->
				<!--					<uni-icons type="right" color="#363636" size="14"></uni-icons>-->
				<!--				</view>-->
				<view class="my-suggest-dom" @click="goMyCoupon(1)">
					<text>购买记录</text>
					<uni-icons type="right" color="#363636" size="14"></uni-icons>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import navigationBarVue from '@/components/navigation/navigationBar.vue';
	import {
		getMemberCoupon
	} from '@/api/business/member.js'
	export default {
		components: {
			navigationBarVue
		},
		data() {
			return {
				globalConfig: getApp().globalData.config,
				coupon: 0
			}
		},
		onLoad(options) {},
		onShow() {
			this.initMyCoupon()
		},
		methods: {
			initMyCoupon() {
				getMemberCoupon().then(res => {
					this.coupon = res.data
				})
			},
			viewRichText() {
				this.$tab.navigateTo(
					`/pages/common/richview/index?title=${this.globalConfig.appInfo.agreements[5].title}&code=${this.globalConfig.appInfo.agreements[5].code}`
				)
			},
			goMyCoupon(index) {
				this.$tab.navigateTo(
					`/pages/mine/coupon/my-coupon?index=${index}&coupon=` + this.coupon
				)
			}
		}
	}
</script>

<style lang="scss">
	.container-box {
		padding-top: calc(90rpx + var(--status-bar-height));
		border-top: 1rpx solid #F4F4F4;
		background-color: white;
		width: 100%;
		color: #363636;
		font-size: 30rpx;
		height: 100%;
		display: flex;
		flex-direction: column;
		align-items: self-start;
		justify-content: center;
		position: relative;

		.content {
			border-top: 1rpx solid #F4F4F4;
			height: calc(100vh - var(--status-bar-height) - var(--window-bottom) - 95rpx);
			overflow-y: scroll;
			width: 100%;
			background-color: #F2F2F2;
			border-radius: 20rpx;
			display: flex;
			flex-direction: column;
			align-items: self-start;
			justify-content: start;
			position: relative;

			.content-body {
				width: 100%;
				padding: 60rpx 30rpx 20rpx 30rpx;
				display: flex;
				flex-direction: column;
				align-items: self-start;
				justify-content: start;
				position: relative;

				.huojian {
					width: 100rpx;
					height: 180rpx;
					z-index: 99;
					position: absolute;
					top: -10rpx;
					left: 40rpx;
				}

				.coupon-box {
					width: 100%;
					background-image: url("/static/mine/coupon/bg.png");
					background-repeat: no-repeat;
					background-size: 100% 100%;
					border-radius: 20rpx;
					padding-bottom: 30rpx;
					display: flex;
					flex-direction: column;
					align-items: self-start;
					justify-content: start;
					position: relative;

					.left-top {
						width: 100%;
						padding: 30rpx 0;
						display: flex;
						align-items: center;
						justify-content: start;
						font-weight: bold;
						font-size: 34rpx;

						.bg-img {
							padding-bottom: 20rpx;
							background-image: url('/static/mine/auth/xiantiao.png');
							background-repeat: no-repeat;
							background-position: bottom right;
							background-size: 100% 50%;
						}

						.left-space {
							width: 200rpx;
						}

						image {
							width: 30rpx;
							height: 30rpx;
							margin-bottom: 20rpx;
							margin-right: 10rpx;
						}

					}

					.content-img {
						width: 100%;
						height: 200rpx;
						margin-bottom: 20rpx;

						image {
							width: 100%;
							height: 100%;
						}
					}

					.bottom-content {
						width: 90%;
						margin: 0 auto;
						border-top: 1rpx solid #FB2B43;
						border-top-style: dashed;
						display: flex;
						flex-direction: column;
						align-items: self-start;
						justify-content: start;

						.top-text {
							width: 100%;
							display: flex;
							align-items: center;
							justify-content: center;
							padding: 30rpx 0;

							text {
								color: #FB2B43;
								padding: 0 10rpx;
							}
						}

						.button-dom {
							width: 100%;
							display: flex;
							align-items: center;
							justify-content: center;
							padding: 20rpx 0;
							background-image: linear-gradient(to right, #F9605A, #FB2B43);
							color: white;
							border-radius: 40rpx;
							font-size: 33rpx;
						}
					}
				}
			}

			.item-field {
				width: 100%;
				display: flex;
				align-items: self-start;
				justify-content: center;

				.my-suggest-dom {
					margin: 0 30rpx;
					display: flex;
					align-items: center;
					justify-content: center;
					font-size: 24rpx;
					margin-top: 20rpx;
				}
			}
		}
	}
</style>