Commit dcd6fcba authored by Mac's avatar Mac

1

parent 8a2aeebe
......@@ -15,7 +15,6 @@ p{
#box{
width: 100%;
height: 100%;
background-color: skyblue;
background-image: url(../images/bg2@3x.png);
background-size: 100% 100%;
background-repeat: no-repeat;
......@@ -158,7 +157,7 @@ p{
.img_bg_M .received_img{
position: absolute;
right: 0.14rem;
bottom: 0.15rem;
top: 0.67rem;
width: 0.81rem;
height: 0.65rem;
}
......@@ -236,3 +235,54 @@ p{
font-size: 0.16rem;
color: #9B0612;
}
.use_oupon{
width: 3.14rem;
height: 0.4rem;
margin-top: 0.29rem;
margin-left: 0.32rem;
display: none;
flex-direction: row;
align-items: center;
justify-content: space-between;
}
.use_news{
display: flex;
flex-direction: row;
align-items: center;
}
.use_news img{
width: 0.4rem;
height: 0.4rem;
border-radius: 0.2rem;
overflow: hidden;
}
.use_news div{
height: 0.4rem;
margin-left: 0.1rem;
display: flex;
flex-direction: column;
justify-content: space-around;
}
.use_news div p:nth-child(1){
font-size: 0.12rem;
color: #111111;
}
.use_news div p:nth-child(2){
font-size: 0.1rem;
color: #888888;
width: 1.8rem;
overflow: hidden;
}
.click_use{
width: 0.8rem;
height: 0.25rem;
border:solid 1px #E03234
}
.click_use p{
font-size: 0.11rem;
color: #E03234;
text-align: center;
line-height: 0.25rem;
}
......@@ -74,14 +74,24 @@
<p></p>
</div>
<img src="" alt="" class="received_img">
<div class="use_oupon">
<div class="use_news">
<img src="../images/default_head_img.jpg" alt="">
<div>
<p>李思思</p>
<p>此处为门店信息</p>
</div>
</div>
<div class="click_use">
<p>我的优惠券</p>
</div>
</div>
</div>
<div class="explain">
<p></p>
<!-- <p>使用说明 </p>-->
<!-- <p>1、9.9元现金抢购价值200元的现金抵用券; </p>-->
<!-- <p>2、仅限跟团游活动使用; </p>-->
<!-- <p>3、该券有效期截止2019年11月14日 00:00:00 </p>-->
</div>
</div>
<div id="notice">
......@@ -121,10 +131,9 @@
let platform = param[4].split('=')[1] //获取从哪里跳过来的
var end = '';
var startTime = '';
var currentTime = '';
localStorage.userInfo = JSON.stringify(userInfo)
$.ajax({
type: "POST",
url: `${getApiUrl().urlJava}api/appActivity/getUserPurchaseTime`,
......@@ -154,6 +163,7 @@
price:res.data.redemptionPrice,
couponId:res.data.couponId,
platform:platform,
count:res.data.count, //判断是否可以抢购 0为不可以
}); //刚进入页面不执行动画
......@@ -161,9 +171,10 @@
let activityEndDate = new Date(res.data.activityEndDate.replace('T',' ').replace(/-/g,'/')).getTime(); //活动结束时间
let nowDate = new Date(res.data.currentTime.replace('T',' ').replace(/-/g,'/')).getTime(); //服务器时间
// let activityStartDate = new Date('2019/11/06T10:37:10').getTime();
// let activityStartDate = new Date('2019/11/08 17:43:50').getTime();
// let activityEndDate = new Date('2019-11-08T17:23:00').getTime(); //活动结束时间
//判断当前时间是否到了抢购时间
if(activityStartDate >= nowDate){ //没到抢购时间 显示抢购的具体时间
$('#t1').html('抢购时间:');
......@@ -181,11 +192,9 @@
$('.img_btn p').html(res.data.redemptionPrice + '元抢购');
$('.img_btn').css("background-color", "#CCCCCC");
$('.img_btn p').css("color","#FFFFFF");
// var time = setInterval(setTimer2, 1000); //计时器
$(".received_img").attr("src","");
let time =activityStartDate - nowDate;
console.log(time)
runtime()
let time =((activityStartDate - nowDate)/1000).toFixed(0);
runtime(time)
}
else if( nowDate > activityEndDate){ // 活动时间已过
......@@ -197,7 +206,6 @@
$('.img_btn p').html('活动结束')
$('.box_content_t').hide()
$('.img_btn').css("background-color", "#CCCCCC");
let nextActivity = res.data.nextActivity;
if(nextActivity !=null){
$('#notice').css('display',"block");
......@@ -206,20 +214,20 @@
let year = nexttime.split('T')[0].split('-')[0];
let month = nexttime.split('T')[0].split('-')[1];
let day = nexttime.split('T')[0].split('-')[2];
let hour = nexttime.split('T')[1].split(':')[0];
$('.notice_name').html('亲爱的' + nextActivity.userName );
$('.notice_content').html('下期活动将于' + year+ '年'+ month+ '月' + day+ '日点开始。');
$('.notice_content').html('下期活动将于' + year+ '年'+ month+ '月' + day+ '日'+hour+'点开始。');
$('.notice_content2').html('届时会有'+nextActivity.couponCount+'张价值'+nextActivity.denomination+'的折扣券等待您的抢 购(抢购价'+nextActivity.redemptionPrice+'元),请准时参加。');
// var time2 = setInterval(setTimer3, 1000); //计时器
let beforeDawn = new Date(year+'/'+month +'/'+day+' 00:00:00').getTime()
let time = beforeDawn - nowDate;
// runtime()
let time = ((beforeDawn - nowDate)/1000).toFixed(0);
runtime(time)
}
}else{ // 到了抢购的时间显示距离结束时间的倒计时
startTime = res.data.currentTime.replace('T',' ').replace(/-/g,'/');
currentTime = res.data.currentTime.replace('T',' ').replace(/-/g,'/');
end = res.data.activityEndDate.replace('T',' ').replace(/-/g,'/');
if(num > 0){
$('#t1').html('结束倒计时:')
......@@ -231,7 +239,9 @@
}else {
$('.img_btn p').html('去使用');
$(".received_img").attr("src","../images/received@3x.png");
$(".img_bg_M").css("background-image","url(../images/M_200_2.png)");
$(".img_bg_M").css("height", "2.14rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"flex");
}
}else {
......@@ -242,32 +252,13 @@
$('.img_btn p').html('活动结束')
$('.box_content_t').hide()
$('.img_btn').css("background-color", "#CCCCCC");
}
}
function setTimer2() {
if(nowDate >= activityStartDate){
window.location.reload()
clearInterval(time)
}
}
function setTimer3() {
let nextActivity = res.data.nextActivity;
let nexttime = nextActivity.activityStartDate;
let year = nexttime.split('T')[0].split('-')[0];
let month = nexttime.split('T')[0].split('-')[1];
let day = nexttime.split('T')[0].split('-')[2];
let beforeDawn = new Date(year+'/'+month +'/'+day+' 00:00:00').getTime()
let nowTime = new Date().getTime()
if(nowTime >= beforeDawn){
window.location.reload()
clearInterval(time2)
}
}
//优惠券的有限时间
let expirationDate = (res.data.expirationDate).split('T')[0].replace(/-/g,'.');
$('.img_bg_p2').html('有效期截止:'+expirationDate)
......@@ -303,13 +294,15 @@
//活动截止时间(以浏览器时间为标准)
var browserEndTime = '';
//距离活动结束还剩余的时间(以浏览器为标准)
// var plus = (new Date(end).getTime() - new Date(currentTime).getTime());
var plus = '';
//倒计时
function setTimer() {
if (!plus) {
//服务器现在的时间(这里只是测试,就用浏览器时间代替)
startTime = new Date(startTime);
startTime = new Date();
//活动截止时间endTime(预先给定的值)
// end = end;
endTime = new Date(end);
......@@ -320,7 +313,7 @@
//距离活动结束还剩余的时间,第二次以后就不需要再计算,直接自减即可
plus -= 1000;
//更新当前时间(getTime()获取时间转化成毫秒后的数值)
startTime = new Date(startTime.getTime() + 1000);
// startTime = new Date(startTime.getTime() + 1000);
}
var day = parseInt(plus / 1000 / 60 / 60 / 24);
......@@ -347,7 +340,19 @@
var id = setInterval(setTimer, 1000);
}
function runtime(){
function runtime(time){
var timer1 = setInterval(increase,1000);
function increase() {
time--;
console.log(time)
if (time<1) {
clearInterval(timer1);
window.location.reload()
return false;
}
}
}
......@@ -357,6 +362,21 @@
$('#notice').css('display',"none");
$('.notice_img').css('display',"none");
})
// 跳转到我的是优惠券
$('.click_use').click(function () {
if(platform == 'App'){
let data = {
'action' : 'jump', // showToast->一个提示信息 showHud->一个黑色的loading
'page' : 'mycoupon',
'pageData' : {
}
}
window.postMessage(JSON.stringify(data));
}
})
</script>
</body>
......
images/MJ_200@3x.png

57.2 KB | W: | H:

images/MJ_200@3x.png

29.1 KB | W: | H:

images/MJ_200@3x.png
images/MJ_200@3x.png
images/MJ_200@3x.png
images/MJ_200@3x.png
  • 2-up
  • Swipe
  • Onion skin
images/M_200@3x.png

72.5 KB | W: | H:

images/M_200@3x.png

35.7 KB | W: | H:

images/M_200@3x.png
images/M_200@3x.png
images/M_200@3x.png
images/M_200@3x.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -8,6 +8,7 @@ $.fn.dataStatistics = function(options){
price:0, //金额
couponId:0, //订单id
platform:'App',
count:0,
},options || {});
var ths = this;//解决this指向问题
......@@ -151,6 +152,7 @@ $.fn.dataStatistics = function(options){
if(nownumber == 0 ){
Activityendtime = res.data.expirationDate.replace('T',' ').replace(/-/g,'/');
}
options.count = res.data.count;
let activityStartDate = new Date(res.data.activityStartDate.replace('T',' ').replace(/-/g,'/')).getTime();
let activityEndDate = new Date(res.data.activityEndDate.replace('T',' ').replace(/-/g,'/')).getTime();
......@@ -163,6 +165,8 @@ $.fn.dataStatistics = function(options){
$(".received_img").attr("src","");
$('.img_bg_M').css("background-image","url(../images/MJ_200@3x.png)");
$(".img_bg_M").css("height", "1.46rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"none");
$('.img_bg_M p').css("color","#CCCCCC");
$('.img_btn p').css("color","#FFFFFF");
......@@ -177,14 +181,23 @@ $.fn.dataStatistics = function(options){
$(".received_img").attr("src","");
$('.img_btn p').html(res.data.redemptionPrice + '元抢购')
$(".img_bg_M").css("background-image","url(../images/M_200@3x.png)");
$(".img_bg_M").css("height", "1.46rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"none");
}else {
$(".received_img").attr("src","../images/received@3x.png");
$('.img_btn p').html('去使用')
$(".img_bg_M").css("background-image","url(../images/M_200_2.png)");
$(".img_bg_M").css("height", "2.14rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"flex");
}
}else {
$(".received_img").attr("src","");
$('.img_bg_M').css("background-image","url(../images/MJ_200@3x.png)");
$(".img_bg_M").css("height", "1.46rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"none");
$('.img_bg_M p').css("color","#CCCCCC");
$('.img_btn p').css("color","#FFFFFF");
$('.img_btn p').html('活动结束')
......@@ -212,8 +225,7 @@ $.fn.dataStatistics = function(options){
$('.img_btn').click(function () {
if($('.img_btn p').css('color')=='rgb(224, 50, 52)'){ //判断按钮是否可以点击
if( $('.img_btn p').text() != '活动结束' || $('.img_btn p').text() != '去使用'){ //判断是可以抢购
if( options.count !=0){ //判断是可以抢购
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showHud', 'message' : '抢购中...'}));
}
......@@ -239,8 +251,8 @@ $.fn.dataStatistics = function(options){
run(1)
clearInterval(timer3) //2,执行动画之后清除timer3
},difference*1000)
let title = $('.box_title_2 p').html();
let title = $('.box_title_2 p').html();
let data = {
'action' : 'jump', // showToast->一个提示信息 showHud->一个黑色的loading
......@@ -271,7 +283,7 @@ $.fn.dataStatistics = function(options){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
}else {
}
layer.msg(res.message)
......@@ -293,6 +305,7 @@ $.fn.dataStatistics = function(options){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : '活动还未开始'}));
}else {
layer.msg('活动还未开始')
}
window.location.reload()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment