Commit 8a2aeebe authored by Mac's avatar Mac

1

parent c570ecb4
......@@ -47,7 +47,7 @@ p{
/*font-weight: bold;*/
}
.box_title .box_limit{
width: 2.2rem;
width: 2.6rem;
margin: 0.2rem auto;
display: flex;
flex-direction: row;
......@@ -174,3 +174,65 @@ p{
font-size: 0.26rem;
color: #FFFFFF;
}
#notice{
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
background: #000000;
opacity: 0.6;
z-index: 100;
display: none;
}
.notice_img{
width: 2.66rem;
height: 3.18rem;
position: absolute;
left: 0;
top: 0;
background-image: url(../images/notice.png);
background-size: 100% 100%;
background-repeat: no-repeat;
z-index: 999;
margin-top: 1.55rem;
margin-left: 0.56rem;
opacity: 1;
display: none;
}
.notice_img img{
width: 1.99rem;
height: 0.63rem;
margin-left: 0.3rem;
}
.notice_name{
font-size: 0.16rem;
color: #FFFFFF;
text-align: center;
margin-top: 0;
}
.notice_content,.notice_content2{
font-size: 0.10rem;
color: #FFFFFF;
text-align: center;
width: 94%;
margin-left: 3%;
line-height: 0.2rem;
}
.c_close{
width: 1.2rem;
height: 0.35rem;
border-radius: 0.06rem;
background: #F9ED37;
display: flex;
align-items: center;
justify-content: center;
margin: 0.4rem auto;
}
.c_close p{
font-size: 0.16rem;
color: #9B0612;
}
......@@ -68,7 +68,7 @@ transform: perspective(400px) rotateX(90deg); }
100% {
transform: perspective(400px) rotateX(0deg); } }
.dataStatistics {color: #FFFFFF;font-family: "Helvetica Neue", Helvetica, sans-serif;font-size: 0.54rem;font-weight: bold;line-height: 0.7rem;height: 0.7rem; margin: 0 auto;width: 1.6rem;float: left;display: flex;flex-direction: row;justify-content: space-between}
.dataStatistics {color: #FFFFFF;font-family: "Helvetica Neue", Helvetica, sans-serif;font-size: 0.54rem;font-weight: bold;line-height: 0.7rem;height: 0.7rem; margin: 0 auto;width: 2rem;float: left;display: flex;flex-direction: row;justify-content: space-between}
.dataStatistics .seperator {vertical-align: top;margin: 0 -20px;display: inline; }
.dataStatistics .seconds,.dataStatistics .minutes,.dataStatistics .hours,.dataStatistics .days {height: 100%;display: inline; }
......
......@@ -32,6 +32,7 @@
<div class="dataStatistics">
<div class="digit_set"></div>
<div class="digit_set"></div>
<div class="digit_set"></div>
<div class="digit_set set_last"></div>
......@@ -83,9 +84,21 @@
<!-- <p>3、该券有效期截止2019年11月14日 00:00:00 </p>-->
</div>
</div>
<div id="notice">
</div>
<div class="notice_img">
<img src="../images/notice_2.png" alt="">
<p class="notice_name"></p>
<p class="notice_content"></p>
<p class="notice_content2"></p>
<div class="c_close">
<p>我知道了</p>
</div>
</div>
</div>
<!--<script type="text/javascript" src="js/countdown.js"></script>-->
<script type="text/javascript" src="../js/md5.js"></script>
<script type="text/javascript" src="../js/mian.js"></script>
......@@ -94,7 +107,7 @@
<script type="text/javascript" src="../js/layer/layer.js"></script>
<script>
let href = 'http://activity.oytour.com/html/Appmd/draw.html?customerId=1549&accountId=1182&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzE5NzA5MDUuMCwiZXhwIjoxNTc0NTYyOTA1LjAsInVzZXJJbmZvIjp7InVpZCI6IjExODIiLCJyZXF1ZXN0RnJvbSI6M319.vlAcXCx4C_0KOmfLm4cLRxU28gTHmuMK6jgJtwjsSPM&secretKey=5d5e16254bd741c486fe2b83b42171d2';
let href = 'http://activity.oytour.com/html/Appmd/draw.html?customerId=1549&accountId=1182&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpYXQiOjE1NzE5NzA5MDUuMCwiZXhwIjoxNTc0NTYyOTA1LjAsInVzZXJJbmZvIjp7InVpZCI6IjExODIiLCJyZXF1ZXN0RnJvbSI6M319.vlAcXCx4C_0KOmfLm4cLRxU28gTHmuMK6jgJtwjsSPM&secretKey=5d5e16254bd741c486fe2b83b42171d2&platform=App';
// let href = window.location.href;
let param = href.split('?')[1].split("&") ? href.split('?')[1].split("&") : null;
......@@ -105,8 +118,10 @@
token: param[2].split('=')[1],
secretKey: param[3].split('=')[1],
}
let platform = param[4].split('=')[1] //获取从哪里跳过来的
var end = '';
var startTime = '';
localStorage.userInfo = JSON.stringify(userInfo)
......@@ -121,19 +136,24 @@
if (res.resultCode === 1) {
let num = res.data.repertory ; //优惠券总共数量
// let num = 1; //优惠券总共数量
// let num = 5000; //优惠券总共数量
$('.box_title_2 p').html(res.data.redemptionPrice +'元抢购');
$('.box_title h5').html(res.data.remark);
$('.explain p').html('使用说明'+ '<br/>' + res.data.instructions );
$('.dataStatistics').dataStatistics({
max:num,
min:num,
len:3,
len:4,
add:true,
price:res.data.redemptionPrice,
couponId:res.data.couponId
couponId:res.data.couponId,
platform:platform,
}); //刚进入页面不执行动画
......@@ -141,9 +161,8 @@
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 activityEndDate = new Date('2019-11-05T17:39:00').getTime(); //活动结束时间
// let activityStartDate = new Date('2019-11-06T10:37:10').getTime();
// let activityStartDate = new Date('2019/11/06T10:37:10').getTime();
// let activityEndDate = new Date('2019-11-08T17:23:00').getTime(); //活动结束时间
//判断当前时间是否到了抢购时间
if(activityStartDate >= nowDate){ //没到抢购时间 显示抢购的具体时间
......@@ -162,8 +181,11 @@
$('.img_btn p').html(res.data.redemptionPrice + '元抢购');
$('.img_btn').css("background-color", "#CCCCCC");
$('.img_btn p').css("color","#FFFFFF");
var time = setInterval(setTimer2, 1000); //计时器
// var time = setInterval(setTimer2, 1000); //计时器
$(".received_img").attr("src","");
let time =activityStartDate - nowDate;
console.log(time)
runtime()
}
else if( nowDate > activityEndDate){ // 活动时间已过
......@@ -176,8 +198,28 @@
$('.box_content_t').hide()
$('.img_btn').css("background-color", "#CCCCCC");
let nextActivity = res.data.nextActivity;
if(nextActivity !=null){
$('#notice').css('display',"block");
$('.notice_img').css('display',"block");
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];
$('.notice_name').html('亲爱的' + nextActivity.userName );
$('.notice_content').html('下期活动将于' + year+ '年'+ month+ '月' + day+ '日零点开始。');
$('.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()
}
}else{ // 到了抢购的时间显示距离结束时间的倒计时
startTime = res.data.currentTime.replace('T',' ').replace(/-/g,'/');
end = res.data.activityEndDate.replace('T',' ').replace(/-/g,'/');
if(num > 0){
$('#t1').html('结束倒计时:')
......@@ -207,12 +249,24 @@
}
function setTimer2() {
let nowTime = new Date().getTime();
if(nowTime >= activityStartDate){
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,'.');
......@@ -255,7 +309,7 @@
if (!plus) {
//服务器现在的时间(这里只是测试,就用浏览器时间代替)
startTime = new Date();
startTime = new Date(startTime);
//活动截止时间endTime(预先给定的值)
// end = end;
endTime = new Date(end);
......@@ -285,6 +339,7 @@
$('#p3').html(second)
if (plus <= 1) {
clearInterval(id);
window.location.reload()
}
}
//每秒循环一次,刷新活动截止时间与当前时间的时间差
......@@ -292,9 +347,16 @@
var id = setInterval(setTimer, 1000);
}
function runtime(){
}
$('.c_close').click(function () {
$('#notice').css('display',"none");
$('.notice_img').css('display',"none");
})
</script>
</body>
......
......@@ -4,9 +4,10 @@ $.fn.dataStatistics = function(options){
max : 500, //初始数值
min : 0, //最大数字
time : 60000, //时长
len:6, //数字是几位数
len:4, //数字是几位数
price:0, //金额
couponId:0, //订单id
platform:'App',
},options || {});
var ths = this;//解决this指向问题
......@@ -77,7 +78,7 @@ $.fn.dataStatistics = function(options){
$('.img_btn p').html('活动结束')
$('.box_content_t').hide()
$('.img_btn').css("background-color", "#CCCCCC");
layer.msg('优惠券被抢光了!')
// layer.msg('优惠券被抢光了!')
}
......@@ -170,7 +171,6 @@ $.fn.dataStatistics = function(options){
$('.img_btn p').html('活动结束')
$('.box_content_t').hide()
clearInterval(timer2); //活动结束 清楚定时器
} else {
if(nownumber > 0){
if(res.data.count != 0){
......@@ -195,9 +195,13 @@ $.fn.dataStatistics = function(options){
}
}else {
clearInterval(timer2); //没有优惠券 清楚定时器
}
}else {
clearInterval(timer2); //没有优惠券 清楚定时器
}
},
error: function (res) {
......@@ -209,7 +213,10 @@ $.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() != '去使用'){ //判断是可以抢购
window.postMessage(JSON.stringify({'action' : 'showHud', 'message' : '抢购中...'}));
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showHud', 'message' : '抢购中...'}));
}
$.ajax({
type: "POST",
url: `${getApiUrl().urlJava}api/appActivity/PanicBuyingCoupon`,
......@@ -217,10 +224,15 @@ $.fn.dataStatistics = function(options){
data: getJavaA({redemptionPrice:options.price,couponId:options.couponId}, token),
async: false,
success: function (res) {
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
}
if (res.resultCode === 1) {
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : res.message}));
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : res.message}));
}else {
layer.msg(res.message)
}
var timer3 = setInterval(()=>{ //1,需要timer2的定时器走完了 才走timer3的定时器
nownumber = nownumber -1;
......@@ -240,16 +252,27 @@ $.fn.dataStatistics = function(options){
'backKey':'reload'
}
}
window.postMessage(JSON.stringify(data));
if(options.platform == 'App'){
window.postMessage(JSON.stringify(data));
}
}else {
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : res.message}));
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : res.message}));
}else {
layer.msg(res.message)
}
window.location.reload()
}
},
error: function (res) {
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
console.log(options.platform)
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
}else {
}
layer.msg(res.message)
}
......@@ -260,10 +283,18 @@ $.fn.dataStatistics = function(options){
}
}else {
if($('.img_btn p').text() == '活动结束'){
layer.msg('活动已结束')
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : '活动已结束'}));
}else {
layer.msg('活动已结束')
}
window.location.reload()
}else {
layer.msg('活动还未开始')
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