浏览代码

添加100优惠券以及修改新人券的业务逻辑

wangxiaoming 7 年之前
父节点
当前提交
30a2277d16
共有 8 个文件被更改,包括 245 次插入10 次删除
  1. 37 3
      tooth/clearing.html
  2. 10 1
      tooth/coupon_list.html
  3. 二进制
      tooth/images/ProductManual.jpg
  4. 二进制
      tooth/images/coupon_hunderd.jpg
  5. 二进制
      tooth/images/fulishe_1.jpg
  6. 二进制
      tooth/images/pro-hong.jpg
  7. 175 0
      tooth/welfare-service-hundred.html
  8. 23 6
      tooth/welfare-service.html

文件差异内容过多而无法显示
+ 37 - 3
tooth/clearing.html


+ 10 - 1
tooth/coupon_list.html

@@ -92,7 +92,16 @@
 									} else if(this.couponType == 2) { //减免率
 										couponReduceHtml += '<span>' + (this.couponReduce / 100).toFixed(1) + '</span>折';
 									}
-									li.innerHTML = '<img width="100%" src="' + src + '" /><div class="fixed-box"><div class="table"><div class="left-cell"><span class="tit">' + this.couponName + '</span><p class="time">使用条件:满' + (this.couponConsumeEnough / 100).toFixed(0) + '元可用</p><span class="condition">有效期至:' + this.couponUseEndDate + '</span></div><div class="right-cell"><div class="money">' + couponReduceHtml + '</div></div></div></div';
+									
+									/*使用条件*/
+									var couponConsumeEnoughHtml = '满'+(this.couponConsumeEnough / 100).toFixed(0)+'元可用'
+									if(this.couponId == 20000){
+										couponConsumeEnoughHtml = '会员购买刷头使用';
+									}else if(this.couponId == 30000){
+										couponConsumeEnoughHtml = '购买牙刷使用';
+									}
+									
+									li.innerHTML = '<img width="100%" src="' + src + '" /><div class="fixed-box"><div class="table"><div class="left-cell"><span class="tit">' + this.couponName + '</span><p class="time">使用条件:' + couponConsumeEnoughHtml + '</p><span class="condition">有效期至:' + this.couponUseEndDate + '</span></div><div class="right-cell"><div class="money">' + couponReduceHtml + '</div></div></div></div';
 									table.appendChild(li);
 								});
 							} else {

二进制
tooth/images/ProductManual.jpg


二进制
tooth/images/coupon_hunderd.jpg


二进制
tooth/images/fulishe_1.jpg


二进制
tooth/images/pro-hong.jpg


+ 175 - 0
tooth/welfare-service-hundred.html

@@ -0,0 +1,175 @@
+<!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" />
+		<script type="text/javascript" src="//res.wx.qq.com/open/js/jweixin-1.1.0.js"></script>
+		<script type="text/javascript">
+			// 屏蔽分享
+			window.hiddenAllWechatMenu = true;
+		</script>
+	</head>
+	<body>
+			<div class="mui-content">
+					<img src="images/coupon_hunderd.jpg" style="margin: 5%;width: 90%;"/>
+					<div style="text-align: center;    margin-bottom: 20px;">
+					<button type="button" class="my-btn-receive  fulishe"  style="width: 168px;height: 38px;padding: 0px;">立即领取</button>
+					<!--<div class="mui-content-padded">
+						<h6>你的笑容,我来守护右上角点击,分享给好友,守护他/她的笑容</h6>
+					</div>-->
+					</div>
+			</div>
+			<!-- 加载ing begin-->
+		<div class="loading covers">
+			<div class="loading-bj"></div>
+			<p>正在加载...</p>
+		</div>
+		<!-- 加载ing end -->
+	<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="js/wechat-utils-1.0.js"></script>-->
+	<script type="text/javascript">
+		
+	window.addEventListener('pageshow', function(e) {
+			// 通过persisted属性判断是否存在 BF Cache
+			if(e.persisted) {
+				location.reload();
+			}
+		});
+			
+	var notReceive=null;	//先判断是否领取过
+	
+	mui.ready(function(){
+		
+		var newDate = new Date();
+		var limitedDate = new Date(2018, 3, 23, 0, 0, 0, 0);	//2018.4.23
+		if(newDate > limitedDate){
+			mui.alert("活动已过期!", function() {
+				location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
+			});
+			return false;
+		}
+		
+		console.log("页面加载完毕");
+		$(".loading").hide().css("opacity", "0");//隐藏(正在加载...)
+		
+//		var src = location.href;
+//			src = "https://s.iamberry.com/soodo/wechat/welfare-service.html";
+//			window.wxFriend = {
+//					"appId": "",
+//					"imgUrl": 'https://s.iamberry.com/soodo/wechat/images/indexShare.jpg',
+//					"link": src,
+//					"desc": '让你的齿龄停留在18岁',
+//					"title": "【soodo上朵】柔性声波电动牙刷,赠送您100元现金券",
+//					"netError": "您的网络异常,请刷新重试!如多次刷新无效,请向我们反应 ~",
+//					"shareTimeSuccess": "分享成功",
+//					"shareTimeCancel": "已取消分享",
+//					"shareAppSuccess": "分享成功!",
+//					"shareAppCancel": "已取消分享"
+//			};
+//		
+	});	 
+	mui('body').on('tap', '.fulishe', function(event) {
+		if(notReceive){
+			addAewPeople();
+		}else{
+			mui.openWindow({
+					url: 'pro-list.html'
+			});
+		}
+	});
+	
+	mui('body').on('tap', '.goToShopping', function(event) {
+		location.href="pro-details.html?colorId=44";
+	});
+	
+	
+	
+		$.ajax(base_path + '/wechat/coupon/isReceive?dates=' + new Date().getTime(), {
+					data: {
+						couponId : 30000		//优惠券类型id
+					},// ajax参数 没有则不写
+					dataType: 'json',
+					xhrFields: {
+						withCredentials: true
+					},
+					crossDomain: true,
+					type: 'get',
+					timeout: 15000,
+					success: function(dt) {
+						if(dt.isRedirect) {//先判断isRedirect,然后跳转redirectURL
+							location.href = dt.redirectURL;
+						} else {
+							if(dt.status) {//判断接口返回状态status
+								notReceive=1;
+							} else {
+								if(dt.resultCode == "501"){
+									mui.alert("活动已过期!", function() {
+										location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
+									});
+									return false;
+								}else{
+									$(".fulishe").text("已领取 去下单");	
+								}
+							}
+						}
+					},
+					error: function(xhr, type, errorThrown) {
+						console.log(xhr);
+						mui.alert("领取现金券失败!网络错误");
+					}
+				});
+	
+	//领取新人现金券
+	function addAewPeople(){
+			
+			if(notReceive){
+				$.ajax(base_path + '/wechat/coupon/receive_coupon?dates=' + new Date().getTime(), {
+				data: {
+					couponId : 30000		//优惠券类型id
+				},// ajax参数 没有则不写
+				dataType: 'json',
+				xhrFields: {
+					withCredentials: true
+				},
+				crossDomain: true,
+				type: 'get',
+				timeout: 15000,
+				success: function(dt) {
+					if(dt.isRedirect) {//先判断isRedirect,然后跳转redirectURL
+						location.href = dt.redirectURL;
+					} else {
+						if(dt.status) {//判断接口返回状态status
+							mui.alert("领取成功!");	
+							notReceive=null;
+							$(".fulishe").text("已领取 去下单");
+						} else {
+							if(dt.resultCode == "501"){
+								mui.alert("活动已过期!", function() {
+									location.href = "index.html?dates=" + new Date().getTime(); // 前往首页
+								});
+								return false;
+							}else{
+								mui.alert("领取失败!");
+							}
+						}
+					}
+				},
+				error: function(xhr, type, errorThrown) {
+					console.log(xhr);
+					mui.alert("领取新人现金券失败!网络错误");
+				}
+			});
+			}
+			
+		}
+	</script>
+	</body>
+</html>

+ 23 - 6
tooth/welfare-service.html

@@ -40,9 +40,9 @@
 	</head>
 	<body>
 			<div class="mui-content">
-					<img src="images/fulishe_1.jpg" style="margin: 5%;width: 90%;"/>
+					<img class="fulishe" src="images/fulishe_1.jpg" style="margin: 5%;width: 90%;"/>
 					<div style="text-align: center;    margin-bottom: 20px;">
-					<button type="button" class="my-btn-receive  fulishe"  style="width: 168px;height: 38px;padding: 0px;">立即领取</button>
+					<!--<button type="button" class="my-btn-receive  fulishe"  style="width: 168px;height: 38px;padding: 0px;">立即领取</button>-->
 					<!--<div class="mui-content-padded">
 						<h6>你的笑容,我来守护右上角点击,分享给好友,守护他/她的笑容</h6>
 					</div>-->
@@ -127,7 +127,15 @@
 							if(dt.status) {//判断接口返回状态status
 								notReceive=1;
 							} else {
-								$(".fulishe").text("已领取 去下单");
+								if(dt.resultCode == "505"){
+									mui.alert("需要成为会员才能领取该优惠券", function() {
+										location.href = "my-center.html?dates=" + new Date().getTime(); // 前往个人中心
+									});
+								}else{
+									mui.alert("已经领取该优惠券了,去下单", function() {
+										location.href = "pro-list.html?dates=" + new Date().getTime(); // 前往产品列表
+									});
+								}
 							}
 						}
 					},
@@ -155,11 +163,20 @@
 						location.href = dt.redirectURL;
 					} else {
 						if(dt.status) {//判断接口返回状态status
-							mui.alert("领取成功!");	
 							notReceive=null;
-							$(".fulishe").text("已领取 去下单");
+							mui.alert("领取成功,去下单", function() {
+								location.href = "pro-list.html?dates=" + new Date().getTime(); // 前往产品列表
+							});
+							return false;
+							//$(".fulishe").text("已领取 去下单");
 						} else {
-							mui.alert("领取失败!");
+							if(dt.resultCode == "505"){
+								mui.alert("需要成为会员才能领取该优惠券", function() {
+									location.href = "my-center.html?dates=" + new Date().getTime(); // 前往个人中心
+								});
+							}else{
+								mui.alert("领取失败!");
+							}
 						}
 					}
 				},