Browse Source

双十一watero,活动页面,支持秒杀,限时购的时间互动

wangxiaoming 5 years ago
parent
commit
a657bc6dce

+ 98 - 25
watero/20191023.html

@@ -97,10 +97,20 @@
 		
 		<div class="ms_class ul_class" style="height: 210px;padding-top:5px ;">
 			<ul>
-				<li style="width: 48%;"><img style="margin-left: 3%;height: 205px;" src="images/20191024/ms_before.jpg" /></li>
-				<li style="width: 48%;"><img style="margin-left: 5%;height: 205px;" src="images/20191024/ms_before_zp.jpg" /></li>
+				<li style="width: 48%;margin-left: 1%;">
+					<img id="ms_01" style="display: none;height: 205px;" src="images/20191024/ms_before.jpg" />
+					<img id="ms_02" style="display: none;height: 205px;" class="mui-media-object to_new_slt"  src="images/20191024/ms_after_02.jpg">
+					<img id="ms_03" style="display: none;height: 205px;" class="mui-media-object"  src="images/20191024/ms_after_03.jpg">
+				</li>
+				<li style="width: 48%;margin-left: 1%;">
+					<img id="xs_01" style="display: none;height: 205px;" src="images/20191024/ms_before_zp.jpg" />
+					<img id="xs_02" style="display: none;height: 205px;" class="mui-media-object to_new_xs" src="images/20191024/ms_after_zp.jpg">
+				</li>
 			</ul>
-			<div style="position: relative;display: block; top: -104px; left: 20%; font-weight: bold; color: #FF666B;    width: 80px; height: 20px; float: left;" id="endDate">23:59:59</div>
+			<div style="position: relative; top: -104px; left: 20%; font-weight: bold; color: #FF666B;width: 80px; height: 20px; float: left;">
+				<div id="sj_01" style="display: none;" >23:59:59</div>
+				<div id="sj_02" style="display: none;" >23:59:59</div>
+			</div>
 		</div>
 		
 		<div class="slogan_class ul_class" style="height: 53px;padding-top:0px ;margin-top: 10px;">
@@ -210,6 +220,7 @@
 	<script>
 		var clickdate = JSON.parse(localStorage.getItem('clickdate'));
 		mui.ready(function() {
+			calculatingTime();
 			//springFestivalPop();
 			marquee_Show();
 			getCartNum();
@@ -255,6 +266,16 @@
 		$(document).on('tap', '.go_web_shop2', function() {
 			location.href = 'chanpin_list.html?proType=16';
 		});
+	
+		mui('body').on('tap', '.to_new_slt', function() {
+		    mui.openWindow({
+		        url: 'chanpin_details.html?productId=86&colorId=71'
+		    })
+		});
+		mui('body').on('tap', '.to_new_xs', function() {
+		   	location.href = 'chanpin_list.html?proType=1';
+		});
+		
 		$(document).on('tap', '.coupon_class>ul>li', function() {
 			var couponId = this.getAttribute("couponId");
 			$.ajax(base_path + '/coupon/receive_coupon_end?dates=' + new Date().getTime(), {
@@ -312,30 +333,44 @@
 		/**
 		 * 
 		 */
-		var endDate = new Date(2019,10,10,00,00,00);	//秒杀
-		var endDate = new Date(2019,10,10,00,00,00);	//限时购
+		var msStartDate = new Date(2019,10,10,00,00,00);	//秒杀
+		var msEndDate = new Date(2019,10,11,00,00,00);	//秒杀结束
+		var limitPurchaseDate = new Date(2019,10,11,11,00,00);	//限时购
+		// var msStartDate = new Date(2019,09,28,18,20,00);	//秒杀
+		// var msEndDate = new Date(2019,09,28,17,21,00);	//秒杀结束
+		// var limitPurchaseDate = new Date(2019,09,28,17,00,00);	//限时购
 		function calculatingTime(){
-			 var newdate = new Date();//获取当前时间
-			  var dateDiff = endDate.getTime() - newdate;//时间差的毫秒数
-			  var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数
-			  var leave1=dateDiff%(24*3600*1000)  //计算天数后剩余的毫秒数
-			  var hours=Math.floor(leave1/(3600*1000))//计算出小时数
-			  var allHours = hours + dayDiff*24;	//计算总小时数
-			  //计算相差分钟数
-			  var leave2=leave1%(3600*1000)  //计算小时数后剩余的毫秒数
-			  var minutes=Math.floor(leave2/(60*1000))//计算相差分钟数
-			  //计算相差秒数
-			  var leave3=leave2%(60*1000)   //计算分钟数后剩余的毫秒数
-			  var seconds=Math.round(leave3/1000)
-			  //console.log("总小时:"+ allHours +";相差天数:"+dayDiff+";小时:"+hours+";分钟"+minutes+";秒数"+seconds);
-			  
-			  if(minutes < 10){
-				  minutes = "0"+minutes;
+			  var jetLag = getJetLag(msStartDate);
+			  if(jetLag.dateDiff > 0){	//未开始
+				   $("#sj_01").show();
+				   $("#ms_01").show();
+				   $("#sj_01").text(jetLag.allHours+":"+jetLag.minutes+":"+jetLag.seconds)
+			  }else{
+				  //已开始
+				  $("#ms_01").hide();
+				  $("#sj_01").hide();
+				  
+				  var msEndJetLeg = getJetLag(msEndDate);
+				  if(msEndJetLeg.dateDiff >= 0){	//已开始
+					  $("#ms_02").show();
+					  $("#sj_02").show();
+					  $("#sj_02").text(msEndJetLeg.allHours+":"+msEndJetLeg.minutes+":"+msEndJetLeg.seconds)
+				  }else{	//一结束
+					  $("#ms_02").hide();
+					  $("#ms_03").show();
+					  $("#sj_02").hide();
+				  }
 			  }
-			  if(seconds < 10){
-				  seconds = "0"+seconds;
-			  }
-			  $("#endDate").text(allHours+":"+minutes+":"+seconds)
+			  
+			   var lPDjetLag = getJetLag(limitPurchaseDate);
+			   if(lPDjetLag.dateDiff > 0){
+				   $("#xs_01").show();
+				   $("#xs_02").hide();
+			   }else{
+				   $("#xs_01").hide();
+				   $("#xs_02").show();
+			   }
+			  
 		}
 		$(document).ready(function() {
 			//一秒刷新一次显示时间 
@@ -343,6 +378,44 @@
 				calculatingTime();
 			},1000)
 		 })
+		 
+		 function getJetLag(scfDate){
+			 var newdate = new Date();//获取当前时间
+			 var dateDiff = scfDate.getTime() - newdate;//时间差的毫秒数
+			 var dayDiff = Math.floor(dateDiff / (24 * 3600 * 1000));//计算出相差天数
+			 var leave1=dateDiff%(24*3600*1000)  //计算天数后剩余的毫秒数
+			 var hours=Math.floor(leave1/(3600*1000))//计算出小时数
+			 var allHours = hours + dayDiff*24;	//计算总小时数
+			 //计算相差分钟数
+			 var leave2=leave1%(3600*1000)  //计算小时数后剩余的毫秒数
+			 var minutes=Math.floor(leave2/(60*1000))//计算相差分钟数
+			 //计算相差秒数
+			 var leave3=leave2%(60*1000)   //计算分钟数后剩余的毫秒数
+			 var seconds=Math.round(leave3/1000)
+			 //console.log("总小时:"+ allHours +";相差天数:"+dayDiff+";小时:"+hours+";分钟"+minutes+";秒数"+seconds);
+			
+			if(hours < 10){
+			  hours = "0"+hours;
+			}
+			if(allHours < 10){
+			  allHours = "0"+allHours;
+			}
+			if(minutes < 10){
+			  minutes = "0"+minutes;
+			}
+			if(seconds < 10){
+			  seconds = "0"+seconds;
+			}
+			
+			var jetLag = new Object();
+			jetLag.dateDiff = dateDiff;
+			jetLag.dayDiff = dayDiff;
+			jetLag.hours = hours;
+			jetLag.allHours = allHours;
+			jetLag.minutes = minutes;
+			jetLag.seconds = seconds;
+			return jetLag;
+		 }
 	</script>
 
 </html>

+ 67 - 67
watero/clearing.html

@@ -94,7 +94,7 @@
 					<label>订单备注</label>
 					<input style="font-size: 12px" type="text" placeholder="(选填:特殊要求,可以在此备注)" id="textarea">
 				</div>
-			</div>
+  			</div>
 		</li>
 		<li class="mui-table-view-cell" style="padding: 0;margin: 0;display: none;">
 			<div class="mui-input-group">
@@ -191,7 +191,7 @@
     var exchangeColorId='';
     var t1=0,t2=0,all_t=0;
     var user38Interests=2;
-    var isSpell=getParam('isSpell');
+    var isSpell=2;	//不能拼单
     var orderId=getParam('orderId');
     var isSpellstr='';
     var productId='';
@@ -382,23 +382,23 @@
                     for(let i = 0; i < dt.data.cartItems.length; i++) {
                     	pro_all_count+=dt.data.cartItems[i].cartNum;
                     	// 购物车小计,分--元
-                        let total = dt.data.cartItems[i].cartNum * dt.data.cartItems[i].productPrice / 100; 
+                        let total = dt.data.cartItems[i].cartNum * dt.data.cartItems[i].productDiscount / 100; 
                         let pro_color = switchcolor(dt.data.cartItems[i].cartColorId);
                         let colorImg = switchColorImg(dt.data.cartItems[i].cartColorId);
                         let cartProductId = dt.data.cartItems[i].cartProductId;
                         let colorId=dt.data.cartItems[i].cartColorId;
-                        let productPrice = dt.data.cartItems[i].productPrice;
+                        let productDiscount = dt.data.cartItems[i].productDiscount;
                             if(isSpell==1){
                             	total = dt.data.cartItems[i].cartNum * dt.data.cartItems[i].colorSpellAmount / 100; 
                             	if(this.productIsSpell==2){
-                            		 productPrice=dt.data.cartItems[i].colorSpellAmount;
+                            		 productDiscount=dt.data.cartItems[i].colorSpellAmount;
                             	}else{
-                            		 productPrice=dt.data.cartItems[i].productPrice;
+                            		 productDiscount=dt.data.cartItems[i].productDiscount;
                             	}
                             }
                         total = total.toFixed(2); // 保留两位小数    
                         let num = dt.data.cartItems[i].cartNum;
-                        if (dt.data.cartItems[i].productPrice / 100 == 3280) {
+                        if (dt.data.cartItems[i].productDiscount / 100 == 3280) {
                             liNote = liNote +
                                 "<li class='mui-table-view-cell mui-media'>" +
                                 "<a>" +
@@ -407,7 +407,7 @@
                                 "<div class='wt-space gwc_tit'>" + dt.data.cartItems[i].productName + "</div>" +
                                 "<div><small class='mui-h6'>" + dt.data.cartItems[i].productColor + " x "+dt.data.cartItems[i].cartNum+"</small></div>"+
                                 "</div>" +
-                                "<div class='price_sp cl-gwc' id='product-" + cartProductId + "' price='" + productPrice + "'>¥" + total + "</div>"+
+                                "<div class='price_sp cl-gwc' id='product-" + cartProductId + "' price='" + productDiscount + "'>¥" + total + "</div>"+
                                 "</a>" +
                                 "</li>";
                             cNum = cNum + num ;
@@ -421,7 +421,7 @@
                                 "<div class='wt-space gwc_tit'>" + dt.data.cartItems[i].productName + "</div>" +
                                 "<div><small class='mui-h6'>" + dt.data.cartItems[i].productColor + " x "+dt.data.cartItems[i].cartNum+"</small></div>"+
                                 "</div>" +
-                                "<div class='price_sp cl-gwc' id='product-" + cartProductId + "' price='" + productPrice + "'>¥" + total + "</div>"+
+                                "<div class='price_sp cl-gwc' id='product-" + cartProductId + "' price='" + productDiscount + "'>¥" + total + "</div>"+
                                 "</a>" +
                                 "</li>";
                         }
@@ -499,25 +499,25 @@
                     } else {
                         if(yhq_type == 1) {
                 	
-                	if(accDiv(payTotal, 100)>=enough){
-                    if(yhq_val > usePayMoney) {
-                        yhq_check.removeAttr("checked");
-                        yhq_val = 0;
-                        mui.alert(' ', '当前优惠券不可用', function() {});
-                    }
-                    $("#yhq_name").html(yhq_check.prev().html());
-                    $("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
-                    $("#accSub,#accSub>div:first-child").show();
-                    console.log(usePayMoney)
-                    $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
-                    $(".dhq-last-add").hide();
-                    exchangeColorId='';
-                   }else{
-                   	   yhq_check.removeAttr("checked");
-                        yhq_val = 0;
-                        mui.alert(' ', '当前商品金额不满足使用条件', function() {});
-                   }
-                }else if(yhq_type == 3){
+							if(accDiv(payTotal, 100)>=enough){
+							if(yhq_val > usePayMoney) {
+								yhq_check.removeAttr("checked");
+								yhq_val = 0;
+								mui.alert(' ', '当前优惠券不可用', function() {});
+							}
+							$("#yhq_name").html(yhq_check.prev().html());
+							$("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
+							$("#accSub,#accSub>div:first-child").show();
+							console.log(usePayMoney)
+							$("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
+							$(".dhq-last-add").hide();
+							exchangeColorId='';
+						   }else{
+							   yhq_check.removeAttr("checked");
+								yhq_val = 0;
+								mui.alert(' ', '当前商品金额不满足使用条件', function() {});
+						   }
+						}else if(yhq_type == 3){
                             if(yhq_val > (usePayMoney - ipt_balance)) {
                                 yhq_check.removeAttr("checked");
                                 yhq_val = 0;
@@ -548,14 +548,14 @@
                                 $("#user-pay-money-span").html(usePayMoney);
                             }
                         }else {
-                    yhq_val = accSub(usePayMoney, Math.floor(accMul(yhq_check.val(), usePayMoney) * 100) / 100);
-                    $("#yhq_name").html(yhq_check.prev().html());
-                    $("#yhq_price").html("- ¥"+yhq_val);
-                    $("#accSub,#accSub>div:first-child").show();
-                    $(".dhq-last-add").hide();
-                    $("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
-                    exchangeColorId='';
-                }
+							yhq_val = accSub(usePayMoney, Math.floor(accMul(yhq_check.val(), usePayMoney) * 100) / 100);
+							$("#yhq_name").html(yhq_check.prev().html());
+							$("#yhq_price").html("- ¥"+yhq_val);
+							$("#accSub,#accSub>div:first-child").show();
+							$(".dhq-last-add").hide();
+							$("#user-pay-money-span").html((usePayMoney - yhq_val - ipt_balance).toFixed(2));
+							exchangeColorId='';
+						}
                     }
                     $("#pro-count").text(pro_all_count);//总件数
                 } else {
@@ -794,17 +794,17 @@
             } else {
                 if(yhq_type == 1) {
                 	if(accDiv(payTotal, 100)>=enough){
-                    if(yhq_val > usePayMoney) {
-                        yhq_check.removeAttr("checked");
-                        yhq_val = 0;
-                        mui.alert(' ', '当前优惠券不可用', function() {});
-                    }
-                    $("#yhq_name").html(yhq_check.prev().html());
-                    $("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
-                    $("#accSub,#accSub>div:first-child").show();
-                    $("#user-pay-money-span").html((accDiv(payTotal, 100) -yhq_val- ipt_balance).toFixed(2));
-                    $(".dhq-last-add").hide();
-                    exchangeColorId='';
+						if(yhq_val > usePayMoney) {
+							yhq_check.removeAttr("checked");
+							yhq_val = 0;
+							mui.alert(' ', '当前优惠券不可用', function() {});
+						}
+						$("#yhq_name").html(yhq_check.prev().html());
+						$("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
+						$("#accSub,#accSub>div:first-child").show();
+						$("#user-pay-money-span").html((accDiv(payTotal, 100) -yhq_val- ipt_balance).toFixed(2));
+						$(".dhq-last-add").hide();
+						exchangeColorId='';
                    }else{
                    	   yhq_check.removeAttr("checked");
                         yhq_val = 0;
@@ -812,26 +812,26 @@
                    }
                 }else if(yhq_type == 3){
                 	if(yhq_id==10000){
-                    if(yhq_val > (usePayMoney - ipt_balance)) {
-                        $("input[couponid=10000]:checked").removeAttr("checked");
-                        yhq_val = 0;
-                        mui.alert(' ', '当前优惠券不可用', function() {});
-                    }
-                    $("#yhq_name").html($("input[couponid=10000]:checked").prev().html());
-                    $("#yhq_price").html("免费兑换1支T1或T2滤芯");
-                    $("#accSub,#accSub>div:first-child").show();
-                    $(".dhq-last-add").show();
-                    console.log(yhq_val)
-                    if($(".dhq-last-add").length>0){
-                        yhq_val = 0;
-					}
-                  }else if(yhq_id==10001){
-                   	  $("#yhq_name").html(yhq_check.prev().html());
-                   	  $("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
-                   	  $("#accSub,#accSub>div:first-child").show();
-                   	  $(".dhq-last-add").hide();
-                   	  exchangeColorId='';
-                   }
+						if(yhq_val > (usePayMoney - ipt_balance)) {
+							$("input[couponid=10000]:checked").removeAttr("checked");
+							yhq_val = 0;
+							mui.alert(' ', '当前优惠券不可用', function() {});
+						}
+						$("#yhq_name").html($("input[couponid=10000]:checked").prev().html());
+						$("#yhq_price").html("免费兑换1支T1或T2滤芯");
+						$("#accSub,#accSub>div:first-child").show();
+						$(".dhq-last-add").show();
+						console.log(yhq_val)
+						if($(".dhq-last-add").length>0){
+							yhq_val = 0;
+						}
+					  }else if(yhq_id==10001){
+						  $("#yhq_name").html(yhq_check.prev().html());
+						  $("#yhq_price").html("- ¥"+parseInt(yhq_val).toFixed(2));
+						  $("#accSub,#accSub>div:first-child").show();
+						  $(".dhq-last-add").hide();
+						  exchangeColorId='';
+					   }
                     //$("#user-pay-money-span").html((usePayMoney -yhq_val- ipt_balance).toFixed(2));
 				} else {
                     yhq_val = accSub(usePayMoney, Math.floor(accMul(yhq_check.val(), usePayMoney) * 100) / 100);

BIN
watero/images/20191024/ms_after_02.jpg


BIN
watero/images/20191024/ms_after_03.jpg


+ 1 - 1
watero/js/main.js

@@ -1,7 +1,7 @@
 var domanUrl = "//" + window.location.host,
-//	path="//test.iamberry.com",
 	path="//test.iamberry.com",
     base_path= path +"/watero/wechat",
+	html_path = "/static-iamberry/watero",
     marquee = '';
 mui.each(document.querySelectorAll('#footer-bar .mui-tab-item'), function(index, el) {
     el.addEventListener('tap', function() {

+ 2 - 0
watero/js/page/chanpin_details.js

@@ -256,9 +256,11 @@ $(document).on('tap', '.mui-bar-tab .div-btn-buy-cart,.mui-bar-tab .div-btn-buy-
 			$(".my-picker>.mui-table .buy-box").removeClass("mui-hidden");
 			if(th.hasClass("div-btn-buy-cart")) {
 				btnTap = 'addCart';
+				$(".buy-box").find("button").removeClass("my-btn-buy-know").addClass("my-btn-add-cart");
 				cartStatus = null;
 			} else {
 				btnTap = 'buyknow';
+				$(".buy-box").find("button").removeClass("my-btn-add-cart").addClass("my-btn-buy-know");
 				cartStatus = 1;
 				console.log(btnTap)
 			}

+ 1 - 1
watero/js/page/chanpin_list.js

@@ -166,7 +166,7 @@ mui.each(document.querySelectorAll('.tab-with-chanpin-list .mui-control-item'),
         }
         var href=location.href;
         if(href.indexOf("proType")>0){
-        	history.pushState("", "产品列表",'//'+location.host+'/wateroWechat/chanpin_list.html?proType='+proType);
+        	history.pushState("", "产品列表",'//'+location.host+ html_path +'/chanpin_list.html?proType='+proType);
         }
         $('.my-tab-view-pull').empty();
         mui('#pullrefresh_chanpin_list').pullRefresh().refresh(true);