<!--
 * @Date: 2023-07-10 17:16:57
 * @LastEditTime: 2024-01-29 17:21:42
 * @Description: content
-->
<template>
	<uni-popup ref="_coupon_pop" type="center" maskBackgroundColor="rgba(0,0,0,0.9)">
		<view class="_coupon_pop common_bg" :style="bj">
			<view style="height:20rpx;">
			</view>
			<view style="height:240rpx;display: flex;">
				<view style="flex: 1;">

				</view>
				<view style="flex: 3;display: flex;justify-content: center;align-items: center;">
					<image v-if="ruleData!=null" :src="ruleData.level_img" style="width:237.5rpx;height:237.5rpx;">
					</image>
				</view>
				<view style="text-align: right;flex: 1;">
					<image :src="$img1('image/pop/guanbi.png')" @click="close" style="width:50rpx;height:50rpx;">
					</image>
				</view>
			</view>
			<view
				style="color: #fff;text-align: center;font-size:40rpx;padding-top:10rpx;padding-bottom: 10rpx;height:64rpx;">
				恭喜抽中贵重赏品！赠送<text style="color: #A664FF;" v-if="ruleData!=null">{{ruleData.level_text}}</text>
			</view>
			<view style="height:60rpx;">

			</view>
			<view
				style=" display: flex; align-items: center; justify-content: center; position: relative; margin-top: 50rpx;">
				<image @click="fenxiang()" :src="$img1('image/pop/')"
					style="width: 528.47rpx; height:101rpx; position: absolute;">
				</image>
				<button v-if="!isH5"
					style="width: 528.47rpx;height:101rpx;position: absolute; background-color: transparent;"
					open-type="share" :data-item="item" @click.stop></button>
			</view>
		</view>
	</uni-popup>
</template>

<script>
	export default {
		props: {
			noticeCheck: {
				type: Boolean,
				default: false
			}
		},

		data() {
			var isH5 = false;
			// #ifdef H5
			isH5 = true;
			// #endif
			var bj = this.$img1('image/pop/di.png');
			return {
				isOpen: false,
				isH5,
				ruleData: null,
				todayHide: false,
				bj: {
					background: "url('" + bj + "') no-repeat",
					backgroundSize: "100%"
				}
			}
		},
		onShareAppMessage(e) {
			var item = this.getData();
			return item;
		},
		mounted() {
			console.log(this.noticeCheck)
		},

		methods: {
			close() {
				this.$refs._coupon_pop.close()
				this.isOpen = false;
			},
			getfengxiaodata() {
				if (this.isOpen) {
					return this.getData();
				}
				return null;
			},
			getData() {
				const userInfo = uni.getStorageSync('userinfo')
				var data = {
					title: `快来领取${userInfo.nickname}分享的${this.ruleData.num}赏币的${this.ruleData.title}`,
					imageUrl: this.ruleData.level_img,
					path: '/pages/user/index' +
						this.$c.qs({
							ou_coupon_id: this.ruleData.id
						})
				}
				console.log(data);
				return data;
			},
			fenxiang() {
				if (!this.isH5) {
					return;
				}
				var data = this.getData();
				console.log(data);
				this.$c.$fenxiang(data.title, '', data.path, data.imageUrl);
			},
			open(opt) {
				this.ruleData = opt
				this.$refs._coupon_pop.open();
				this.isOpen = true;
			},


		}
	}
</script>

<style lang="scss">
	._coupon_pop {
		width: 690.28rpx;
		height: 587.5rpx;
		box-sizing: border-box;
		padding: 0 20rpx 0;
		background: #3B3941;
		border-radius: 30rpx;
		background-size: 100%;

	}
</style>