wangxiaoming il y a 6 ans
Parent
commit
2930a5f504
3 fichiers modifiés avec 203 ajouts et 131 suppressions
  1. 141 122
      aiberle/clearing.html
  2. 10 1
      aiberle/coupon_receive.html
  3. 52 8
      aiberle/old-for-new.html

+ 141 - 122
aiberle/clearing.html

@@ -129,12 +129,19 @@ var yhq_id='';			mui.ready(function() {
 										var yhq_str = "";
 										if(dt.data.couponItems.length > 0) {
 											$("#ul-youhuiquan").show();
-											console.log("有优惠券" + dt.data.couponItems.length + "张")
+											//console.log("有优惠券" + dt.data.couponItems.length + "张")
 											var str='';
-											mui.each(dt.data.couponItems,function(){
-												str+= '<li class="my-table-view-cell" style="opacity:.5"><div class="mui-table"><div class="mui-table-cell table-middle mui-col-xs-11">'+ this.couponName +':¥'+ ((this.couponReduce)/100).toFixed(2)+'<h6>有效期至:'+this.couponUseEndDate+'</h6></div><div class="mui-table-cell table-middle mui-col-xs-1"><input name="checkbox" val="'+(this.couponReduce/100).toFixed(2)+'" type="checkbox" class="mui-pull-left" id="'+this.couponItemId+'"/></div></div></li>';
+											mui.each(dt.data.couponItems,function(index){
+												var opacity=1,checked='checked';
+												if(index>0){
+													opacity=0.5;
+													checked='';
+												}
+												str+= '<li class="my-table-view-cell" style="opacity:'+opacity+'"><div class="mui-table"><div class="mui-table-cell table-middle mui-col-xs-11">优惠券:¥'+ ((this.couponReduce)/100).toFixed(2)+'<h6>有效期至:'+this.couponUseEndDate+'</h6></div><div class="mui-table-cell table-middle mui-col-xs-1"><input name="checkbox" val="'+(this.couponReduce/100).toFixed(2)+'" type="checkbox" '+checked+' class="mui-pull-left" id="'+this.couponItemId+'"/></div></div></li>';
 											});
-											$("body").append('<div class="my-picker"><ul class="mui-table-view mui-table-view-striped mui-table-view-condensed my-grid-view-no" style="padding: 20px 0 30px 0;overflow: scroll;max-height: 400px;">' + str + '</ul><button class="mui-btn my-btn-block my-btn-buy-know" disabled="disabled">确认使用</button></div>');
+											$("body").append('<div class="my-picker"><ul class="mui-table-view mui-table-view-striped mui-table-view-condensed my-grid-view-no" style="padding: 20px 0 30px 0;overflow: scroll;max-height: 400px;">' + str + '</ul><button class="mui-btn my-btn-block my-btn-buy-know">确认使用</button></div>');
+											
+											
 										}
 										mui.each(dt.data.cartItems,function(index){
 											var num = this.cartNum;
@@ -168,11 +175,24 @@ var yhq_id='';			mui.ready(function() {
 											wechatAddr.userTel = dt.data.addressInfo.salesAddressTel;
 											wechatAddr.postalCode = dt.data.addressInfo.salesAddressPostnum;
 										}
-										$(".count_price").text((dt.data.payTotal/100).toFixed(2));
+										
 										$("#pro-count").text(dt.data.cartItems.length);
+										if(dt.data.couponItems.length){
+											yhq_id=$("input[name=checkbox]:checked").attr('id');
+											$(".btn-youhuiquan>span").text("-¥"+$("input[name=checkbox]:checked").attr("val")).show();
+											var cout = $("input[name=checkbox]:checked").attr("val");
+											var count_price = payTotal - cout*100;
+											if(count_price <= 0) {
+												count_price = 0.0; //判断商品价格减去现金券价格若<0 则显示0
+											}
+											$(".count_price").text((count_price/100).toFixed(2));
+										}else{
+											$(".count_price").text((dt.data.payTotal/100).toFixed(2));
+										}
 									} else {
-										mui.alert(dt.message);
-										location.href = "shopping-cart.html?dates=" + new Date().getTime(); // 前往购物车
+										mui.alert(dt.message,function(){
+											location.href = "shopping-cart.html?dates=" + new Date().getTime(); // 前往购物车
+										});
 									}
 								}
 							},
@@ -257,133 +277,132 @@ var yhq_id='';			mui.ready(function() {
 	});
 	// 去支付
 	$(document).on('tap', '#go-pay', function() {
-        
-			var remark = $("#textarea").val();
-			var ch_en_num = /^[A-Za-z0-9 _\[\]\【\】\{\}\{\}\(\)\(\)\《\》\<\>\,\,\.\。\、\!\!\~\·\@\#\¥\$\%\^\…\&\—\:\:\;\;\‘\’\'\'\"\"\“\”\?\?\-\=\|\*\+\-\u4e00-\u9fa5]{0,100}$/;
-			if(ch_en_num.test(remark)){
-				console.log("备注验证通过")
-			}else{
-				mui.alert("备注格式错误!仅支持中/英文,数字,普通符号");
-				return false;
-			}
-			if(wechatAddr.status) {
-				if(isPay) {
 
-					isPay = false; // 锁定请求按钮
+		var remark = $("#textarea").val();
+		var ch_en_num = /^[A-Za-z0-9 _\[\]\【\】\{\}\{\}\(\)\(\)\《\》\<\>\,\,\.\。\、\!\!\~\·\@\#\¥\$\%\^\…\&\—\:\:\;\;\‘\’\'\'\"\"\“\”\?\?\-\=\|\*\+\-\u4e00-\u9fa5]{0,100}$/;
+		if(ch_en_num.test(remark)){
+			console.log("备注验证通过")
+		}else{
+			mui.alert("备注格式错误!仅支持中/英文,数字,普通符号");
+			return false;
+		}
+		if(wechatAddr.status) {
+			if(isPay) {
+
+				isPay = false; // 锁定请求按钮
 
-					/* 组装数据 */
-					var dataArgs = {
-						"orderAddressInfo": wechatAddr.detailInfo,
-						"orderAddressPostNum": wechatAddr.postalCode,
-						"orderAddressMoblie": wechatAddr.userTel,
-						"orderAddressName": wechatAddr.userName,
-						"cartIdStr": cartIdStr,
-						"orderIntegralNum": 0,
-						"orderUserRemark": remark,
-						"couponId": yhq_id,
-						"balancePayAmount": 0
-					};
+				/* 组装数据 */
+				var dataArgs = {
+					"orderAddressInfo": wechatAddr.detailInfo,
+					"orderAddressPostNum": wechatAddr.postalCode,
+					"orderAddressMoblie": wechatAddr.userTel,
+					"orderAddressName": wechatAddr.userName,
+					"cartIdStr": cartIdStr,
+					"orderIntegralNum": 0,
+					"orderUserRemark": remark,
+					"couponId": yhq_id,
+					"balancePayAmount": 0
+				};
 
-					$.ajax(base_path+'/wechat/order/pay', { // 提交订单,准备支付
-						data: dataArgs,
-						dataType: 'json',
-						type: 'POST',
-						xhrFields: {
-							withCredentials: true
-						},
-						crossDomain: true,
-						timeout: 15000,
-						success: function(dt) {
-	//						layer.closeAll();
+				$.ajax(base_path+'/wechat/order/pay', { // 提交订单,准备支付
+					data: dataArgs,
+					dataType: 'json',
+					type: 'POST',
+					xhrFields: {
+						withCredentials: true
+					},
+					crossDomain: true,
+					timeout: 15000,
+					success: function(dt) {
+//						layer.closeAll();
 
-							//mui.alert(dt.resultCode=="500");
-							if(dt.resultCode == "500") {
-								mui.alert(dt.message);
-								isPay = true;
-								return;
-							};
-							if(dt.data.info == "isOK") {
-								location.href = 'pay-win.html?orderId=' + dt.data.orderId + "&dates=" + new Date().getTime();
-								return;
-							};
-							var orderId=dt.data.orderId;
-							if(dt.status) {
-								var str = dt.data.info;
-								var obj = JSON.parse("{" + str + "}");
-								WeixinJSBridge.invoke('getBrandWCPayRequest', obj, function(res) {
-									//console.log(res)
-									if(res.err_msg == 'get_brand_wcpay_request:ok') {
-										$.ajax(base_path + '/wechat/order/checkOrderPaySuccess?dates=' + new Date().getTime(), {
-													data: {
-														"orderId": orderId
-													},
-													dataType: 'json',
-													xhrFields: {
-														withCredentials: true
-													},
-													crossDomain: true,
-													type: 'get',
-													timeout: 15000,
-													success: function(dataobj) {
-														if(dataobj.isRedirect) {
-															location.href = dataobj.redirectURL;
+						//mui.alert(dt.resultCode=="500");
+						if(dt.resultCode == "500") {
+							mui.alert(dt.message);
+							isPay = true;
+							return;
+						};
+						if(dt.data.info == "isOK") {
+							location.href = 'pay-win.html?orderId=' + dt.data.orderId + "&dates=" + new Date().getTime();
+							return;
+						};
+						var orderId=dt.data.orderId;
+						if(dt.status) {
+							var str = dt.data.info;
+							var obj = JSON.parse("{" + str + "}");
+							WeixinJSBridge.invoke('getBrandWCPayRequest', obj, function(res) {
+								//console.log(res)
+								if(res.err_msg == 'get_brand_wcpay_request:ok') {
+									$.ajax(base_path + '/wechat/order/checkOrderPaySuccess?dates=' + new Date().getTime(), {
+												data: {
+													"orderId": orderId
+												},
+												dataType: 'json',
+												xhrFields: {
+													withCredentials: true
+												},
+												crossDomain: true,
+												type: 'get',
+												timeout: 15000,
+												success: function(dataobj) {
+													if(dataobj.isRedirect) {
+														location.href = dataobj.redirectURL;
+													} else {
+														if(dataobj.status == true) { // 支付成功
+															location.href = "pay-win.html?orderId=" + orderId + "&dates=" + new Date().getTime();
 														} else {
-															if(dataobj.status == true) { // 支付成功
-																location.href = "pay-win.html?orderId=" + orderId + "&dates=" + new Date().getTime();
-															} else {
-																location.href = "order-details.html?orderId=" + orderId + "&dates=" + new Date().getTime(); // 前往订单详情
-															}
+															location.href = "order-details.html?orderId=" + orderId + "&dates=" + new Date().getTime(); // 前往订单详情
 														}
-													},
-													error: function(xhr, type, errorThrown) {
-														console.log(xhr);
-														isPay = true;
-														mui.alert("支付失败!网络错误");
 													}
-												});
-	//									var orderIds = {
-	//										"orderId": dt.data.orderId
-	//									};
-	//									var url =base_path+"/wechat/order/checkOrderPaySuccess";
-	//									$.getJSON(url, {
-	//										"s": new Date().getTime(),
-	//										"orderId": dt.data.orderId
-	//									}, function(data) {
-	//										if(data.status == true) { // 支付成功
-	//											location.href = "pay-win.html?orderId=" + orderIds.orderId + "&dates=" + new Date().getTime();
-	//										} else {
-	//											setTimeout("checkOrderStatus('" + dt.data.orderId + "')", 1000);
-	//										}
-	//									});
-									} else {
-										isPay = true;
-										mui.alert("支付失败!请稍后重试!", function() {
-											location.href = "order-details.html?orderId=" + orderId + "&dates=" + new Date().getTime(); // 前往订单详情
-										});
-									}
-								});
-							} else {
-								isPay = true;
-								mui.alert(dt.message);
-								location.href = "order-details.html?orderId=" + orderId + "&dates=" + new Date().getTime(); // 前往订单详情
-							}
-						},
-						error: function(xhr, type, errorThrown) {
+												},
+												error: function(xhr, type, errorThrown) {
+													console.log(xhr);
+													isPay = true;
+													mui.alert("支付失败!网络错误");
+												}
+											});
+//									var orderIds = {
+//										"orderId": dt.data.orderId
+//									};
+//									var url =base_path+"/wechat/order/checkOrderPaySuccess";
+//									$.getJSON(url, {
+//										"s": new Date().getTime(),
+//										"orderId": dt.data.orderId
+//									}, function(data) {
+//										if(data.status == true) { // 支付成功
+//											location.href = "pay-win.html?orderId=" + orderIds.orderId + "&dates=" + new Date().getTime();
+//										} else {
+//											setTimeout("checkOrderStatus('" + dt.data.orderId + "')", 1000);
+//										}
+//									});
+								} else {
+									isPay = true;
+									mui.alert("支付失败!请稍后重试!", function() {
+										location.href = "order-details.html?orderId=" + orderId + "&dates=" + new Date().getTime(); // 前往订单详情
+									});
+								}
+							});
+						} else {
 							isPay = true;
-	//						layer.closeAll();
-							mui.alert("您的网络异常,请刷新重试!");
-							return;
+							mui.alert(dt.message);
+							location.href = "order-details.html?orderId=" + orderId + "&dates=" + new Date().getTime(); // 前往订单详情
 						}
-					});
-				} else {
-					mui.alert("正在请求支付中~~请稍后!");
-					return;
-				}
+					},
+					error: function(xhr, type, errorThrown) {
+						isPay = true;
+//						layer.closeAll();
+						mui.alert("您的网络异常,请刷新重试!");
+						return;
+					}
+				});
 			} else {
-				mui.alert("请选择收货地址!");
+				mui.alert("正在请求支付中~~请稍后!");
 				return;
 			}
-     
+		} else {
+			mui.alert("请选择收货地址!");
+			return;
+		}
 	});
 	//实时监听文本框字数
 	document.getElementById("textarea").addEventListener("input", function() {

+ 10 - 1
aiberle/coupon_receive.html

@@ -48,6 +48,15 @@
 	var couponId = getParam("couponId");
 	
 	mui.ready(function() {
+		var currentDate = new Date(2019, 3, 18, 23, 59, 59, 0);
+				var newDate = new Date();
+				if(currentDate <= newDate){
+					 mui.alert("本次活动已经结束,期待您的下次参与!",'提示',function () {
+    				 	location.href = 'index.html';
+    				 });
+    				 return false;
+				}
+				
        $.ajax( base_path + '/wechat/coupon/recCouRen?dates=' + new Date().getTime(),{
                 data :{
                     couponId : couponId
@@ -65,7 +74,7 @@
                 		location.href = dt.redirectURL;
             		} else {
             			if(dt.status){
-            				 mui.alert('您已获得499元"以旧换新"现金券,该券仅支持购买W6净水机,点击确定进入微商城使用!','温馨提示',function () {
+            				 mui.alert('恭喜您已领取换新代金券,可在“会员中心—券包”查看。点击下方确定,马上换新选购吧。','温馨提示',function () {
             				 	location.href = 'pro-details.html?productId=39';
             				 });
             			}else{

+ 52 - 8
aiberle/old-for-new.html

@@ -26,7 +26,8 @@
 			.oldNew-ul li{margin: 3px 0;}
 			.link-updown{color: #666;font-size: .7rem;padding: 5px;}
 			.link-updown .mui-icon{font-size: 1.2rem;}
-			.box-content{height: 87px;overflow: hidden;}
+			.box-content{height:auto; overflow: hidden;}
+			.box-content img{width: 100%;}
 			.mui-input{font-size: .7rem;}
 			#ipt-scan::-webkit-input-placeholder{color: #999;}
 		</style>
@@ -78,7 +79,8 @@
 			    <div class="mui-content-padded">
 			   <div class="oldNew-title">活动详情</div>
 			   <div class="box-content"> 
-			   <ul class="oldNew-ul">
+			   		<img src="images/WechatIMG9.jpeg" />
+			   <!--<ul class="oldNew-ul">
 				   <li class="tt">爱贝源冲奶机以旧换新活动介绍</li>
 				   <li>1、凡是爱贝源冲奶机的客户,不论购买渠道或冲奶机好坏都可参加本次活动。</li>
 				   <li>2、用户将冲奶机按回收地址寄回。在活动页面提交快递单号,即刻发放799元折旧代金券,寄回运费统一以45元代金券形式,也发放至客户的aiberle微信公众号会员账户。</li>
@@ -89,12 +91,13 @@
 				   <li>1、折旧价值以代金券形式返还到用户账户,可在“会员中心-券包”里查看。</li>
 				   <li>2、活动时间:3月15日-4月15日,代金券超过活动期限未使用,将自动失效。</li>
 				   <li>3、用户使用抵用券购机,发货前退款,返还付款,抵用券退至该用户账号;发货后取消订单,抵用券自动作废,仅退款差额部分。</li>
-			   </ul>
+			   </ul>-->
 			   </div>
-			    <div class="mui-text-center"><span class="link-updown">展开<span class="mui-icon mui-icon-arrowdown"></span></span></div>
+			    <!--<div class="mui-text-center"><span class="link-updown">展开<span class="mui-icon mui-icon-arrowdown"></span></span></div>-->
 			   <div class="oldNew-title">物流单号</div>
 				   <div class="mui-input-row">
-					   <input type="text" class="mui-input" data-input-password="3" placeholder="请输入寄回冲奶机的物流单号或扫描条形码" id="ipt-scan"><span class="mui-icon-extra mui-icon-extra-sweep mui-active"></span>
+					   <input type="text" class="mui-input" data-input-password="3" placeholder="请输入寄回冲奶机的物流单号" id="ipt-scan">
+					   <!-- <span class="mui-icon-extra mui-icon-extra-sweep mui-active"></span> -->
 					</div>
 				<p>
 					提示:填写单号,即可领取799元的代金券和45元运费代金券,机器无法寄回的用户,请联系客服。
@@ -114,7 +117,7 @@
 		<script src="js/mui.min.js"></script>
 		<script src="js/jquery-2.1.1.min.js"></script>
 		<script src="js/main.js"></script>
-		<script src="js/wechat-utils-1.0.js"></script> 
+		<!-- <script src="js/wechat-utils-1.0.js"></script> -->
 		<script>
 			window.addEventListener('pageshow', function(e) {
 				// 通过persisted属性判断是否存在 BF Cache
@@ -123,6 +126,47 @@
 				}
 			});
 			mui.ready(function() {
+				
+				var currentDate = new Date(2019, 3, 18, 23, 59, 59, 0);
+				var newDate = new Date();
+				if(currentDate <= newDate){
+					 mui.alert("本次活动已经结束,期待您的下次参与!",'提示',function () {
+    				 	location.href = 'index.html';
+    				 });
+    				 return false;
+				}
+				
+				 $.ajax( base_path + '/wechat/coupon/isRecCouRen?dates=' + new Date().getTime(),{
+	                data :{
+	                    couponId : 20000
+	                },
+	                dataType:'json',
+	                type:'post',
+	                xhrFields: {
+						withCredentials: true
+					},
+					crossDomain: true,
+	                timeout:15000,
+	                success:function(dt){
+	                	console.log(dt);
+	                	if(dt.isRedirect) {
+	                		location.href = dt.redirectURL;
+	            		} else {
+	            			if(dt.status){
+	            				if(dt.data > 0){
+	            					 mui.alert("您已领取换新代金券,可在“会员中心—券包”查看。点击下方确定,马上换新选购吧。",'提示',function () {
+		            				 	location.href = 'pro-details.html?productId=39';
+		            				 });
+	            				}
+	            			}
+	                    }
+	                },
+	                error:function(xhr,type,errorThrown){
+	                    //异常处理;
+	                    console.log(xhr);
+	                }
+	            });
+					
 				var slider = mui("#slider");
 				slider.slider({
 					interval: 0
@@ -150,11 +194,11 @@
                 		location.href = dt.redirectURL;
             		} else {
             			if(dt.status){
-            				 mui.alert('领取成功!','提示',function () {
+            				 mui.alert('恭喜您已领取换新代金券,可在“会员中心—券包”查看。点击下方确定,马上换新选购吧。','提示',function () {
             				 	location.href = 'pro-details.html?productId=39';
             				 });
             			}else{
-            				 mui.alert(dt.message,'提示',function () {
+            				 mui.alert("您已领取换新代金券,可在“会员中心—券包”查看。点击下方确定,马上换新选购吧。",'提示',function () {
             				 	location.href = 'index.html';
             				 });
             			}