<!-- 优惠券弹窗 -->
<template>
	<view class="couponPopup">
		<uv-popup ref="couponPopup" 
			customStyle="background-color: transparent;"
			:z-index="999999"
		>
			<view class="couponPopup-wrapper">
				<view class="main-container" @click="toCoupon">
					<image style="width: 583rpx; height: 601rpx;" src="/pages_order/static/home/coupon.png"></image>
				</view>
			</view>
		</uv-popup>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex'
	export default {
		name: "CouponPopup",
		data() {
			return {}
		},
		mounted() {
			this.$refs.couponPopup.open()
		},
		computed: {
			...mapState(['riceInfo'])
		},
		methods: {
			//跳转优惠券页面
			toCoupon() {
				// todo
				this.$refs.couponPopup.close()
				this.$api('getRiceCoupon', res => {
					if(res.code == 200){
						uni.navigateTo({
							url: "/pages_order/mine/coupon"
						})
					}
				})
			},
			close(){
				this.$refs.couponPopup.close()
			},
		},
	}
</script>

<style lang="scss" scoped>
	.couponPopup {
		.couponPopup-wrapper {
			width: 100%;
			height: 100vh;
			display: flex;
			justify-content: center;
			align-items: center;

			.main-container {
			}
		}
	}
</style>