<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>领取代金券</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<meta name="apple-mobile-web-app-capable" content="yes">
		<meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="css/mui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/iconfont.css" />
		<link rel="stylesheet" type="text/css" href="css/main.css" />
	</head>

	<body style="background: #fff;overflow-x: hidden;">
		<div class="loading-bg">
			<div class="mui-loading">
				<div class="mui-spinner">
				</div>
				&nbsp;&nbsp;加载中...
			</div>
		</div>
		<div class="mui-content" style="background: #fff;">
			<div class="share-voucher-bg">
			</div>
			<div class="share-voucher-logo">
					<img src="images/2019081307.png" />
			</div>
				<ul class="vip-voucher-list" style="background: transparent;position: absolute;left: 0;top: 180px;">
					<li>
						<div class="mui-table">
							<div class="mui-table-cell mui-col-xs-4 table-middle mui-text-center">
								¥<span id="coupon-aomunt">0</span>
								<!--<div class="left-badge">数量:5张 </div>-->
							</div>
							<div class="mui-table-cell mui-col-xs-8 table-middle mui-text-center">
								<div class="voucher-tit" id="coupon-name">净水机专用代金券</div>
								<div class="date">有效期 90 天</div>
							</div>
						</div>
					</li>
				</ul>	
			<button type="button" class="mui-btn btn-share-know-voucher">立即领取</button>	
			<div class="mui-text-center">
				<br /><br /><br />
				<img style="width: 140px;-webkit-user-select:all;" src="images/2019081308.png" />
				<div class="cl-red">长按识别 关注Aiberle公众号</div>
				<br />
				<p>领取成功后,可在公众号“我的-券包”查看<br>在Aiberle爱贝源微信商城,购买代金券指定产品即可减免此代金券的票面金额</p>
			</div>
		</div>
		<script type="text/javascript" src="js/mui.min.js"></script>
		<script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>
		<script type="text/javascript" src="js/main.js"></script>
		<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
		<script type="text/javascript" src="//s.iamberry.com/aiberle/wechat/js/wechat-utils-1.0.js"></script>
		<script type="text/javascript">
			//ready 参考mui官方文档	
			var couponId = getParam("couponId");
			var isGive = true;
			mui.ready(function() {
				$('.loading-bg').hide();
				ajax("post", "/wechat/welfare/getCoupon", {"time":new Date().getTime(), "id":couponId}, function(res) {
					isGive = (res.data.couponIsGive==1);
					$("#coupon-aomunt").text(new Number(res.data.couponReduce/100));
					$("#coupon-name").text(res.data.couponName);
				});
				/* 注册分享 */
				init_share();
			});
			function init_share() {
				window.wxFriend.imgUrl='https://s.iamberry.com/aiberle/wechat/images/welfare_share.jpg';
			    window.wxFriend.link=location.href;
			    window.wxFriend.desc="代金券可直接抵现,请尽快领取使用。";
			    window.wxFriend.title="亲测好用,快领券买有优惠!";
				getConfig();
			}
			//跳转产品列表
			mui('body').on('tap', '.btn-share-know-voucher', function() {
				if (!isGive) {
					mui.toast('此优惠券已经被其他好友领取了(您可关注公众号联系客服 或 联系好友再分享)');
					return;
				}
				ajax("post", "/wechat/welfare/drawShareCoupon", {"time":new Date().getTime(), "id":couponId}, function(res) {
					if (res.status) {
						location.href="coupon_list.html";
					} else {
						mui.toast('领取失败(自己不可领取  或 优惠券已过期)');
					}
				});
			});
		</script>
	</body>

</html>