Commit cde87b7b authored by 华国豪's avatar 华国豪 🙄
parents 9229e081 90e8345c
This diff is collapsed.
...@@ -9,6 +9,9 @@ $.fn.dataStatistics = function(options) { ...@@ -9,6 +9,9 @@ $.fn.dataStatistics = function(options) {
platform: 'app', platform: 'app',
count: 0, count: 0,
login:true, login:true,
activityStartDate:0,
activityEndDate:0,
nowDate:0
}, options || {}); }, options || {});
var ths = this; //解决this指向问题 var ths = this; //解决this指向问题
...@@ -60,6 +63,7 @@ $.fn.dataStatistics = function(options) { ...@@ -60,6 +63,7 @@ $.fn.dataStatistics = function(options) {
var difference = 0; //执行次数 var difference = 0; //执行次数
var nownumber = options.min; //优惠券数量 var nownumber = options.min; //优惠券数量
var Activityendtime = ''; //活动结束时间 var Activityendtime = ''; //活动结束时间
let nodisplay = false;
function run(diff) { function run(diff) {
if (diff) { if (diff) {
difference = diff difference = diff
...@@ -71,7 +75,6 @@ $.fn.dataStatistics = function(options) { ...@@ -71,7 +75,6 @@ $.fn.dataStatistics = function(options) {
clearInterval(timer2); //优惠券用完 清楚定时器 clearInterval(timer2); //优惠券用完 清楚定时器
// $(".received_img").attr("src", ""); // $(".received_img").attr("src", "");
$('.img_bg_M').css("background-image", "url(../images/MJ_200@3x.png)"); $('.img_bg_M').css("background-image", "url(../images/MJ_200@3x.png)");
$('.img_bg_p1').css("color", "#CCCCCC"); $('.img_bg_p1').css("color", "#CCCCCC");
...@@ -80,10 +83,13 @@ $.fn.dataStatistics = function(options) { ...@@ -80,10 +83,13 @@ $.fn.dataStatistics = function(options) {
$('.img_btn p').html('活动结束') $('.img_btn p').html('活动结束')
$('.box_content_t').hide() $('.box_content_t').hide()
$('.img_btn').css("background-image", "url(../images/nobuy_btn.png)"); $('.img_btn').css("background-image", "url(../images/nobuy_btn.png)");
$('.dataStatistics').css('display', "none"); if(nodisplay == true){ //显示活动预告
$('.deta_replace').css('display', "flex"); $('.dataStatistics').css('display', "none");
$('#notice').css('display', "block"); $('.deta_replace').css('display', "flex");
$('.notice_img').css('display', "block"); $('#notice').css('display', "block");
$('.notice_img').css('display', "block");
}
// layer.msg('优惠券被抢光了!') // layer.msg('优惠券被抢光了!')
} }
...@@ -139,17 +145,16 @@ $.fn.dataStatistics = function(options) { ...@@ -139,17 +145,16 @@ $.fn.dataStatistics = function(options) {
var timer2 = setInterval(() => { var timer2 = setInterval(() => {
$.ajax({ $.ajax({
type: "POST", type: "POST",
url: `${getApiUrl().urlJava}api/appActivity/getUserPurchaseTime`, url: `${getApiUrl().urlJava}api/appActivity/getCurrentActivity`,
contentType: "application/json", contentType: "application/json",
data: getJavaData({}), data: getJavaData({couponId:options.couponId}),
async: false, async: false,
success: function(res) { success: function(res) {
if (res.resultCode === 1) { if (res.resultCode === 1) {
nodisplay = true
if (nownumber > 0) { if (nownumber > 0) {
let num = nownumber - res.data.repertory; // 算出动画执行的次数 let num = nownumber - res.data.repertory; // 算出动画执行的次数
nownumber = res.data.repertory; // 算出现在的数字 nownumber = res.data.repertory; // 算出现在的数字
// let num = 10 ; // 算出动画执行的次数
// // nownumber = 900; // 算出现在的数字
if (num > 0) { if (num > 0) {
if(num> 5){ if(num> 5){
...@@ -160,11 +165,13 @@ $.fn.dataStatistics = function(options) { ...@@ -160,11 +165,13 @@ $.fn.dataStatistics = function(options) {
min: nownumber, min: nownumber,
len: 4, len: 4,
add: true, add: true,
price: res.data.redemptionPrice, price: options.price,
couponId: res.data.couponId, couponId: options.couponId,
platform: options.platform, platform: options.platform,
login:options.login, login:options.login,
count: res.data.count, //判断是否可以抢购 0为不可以 count: options.count, //判断是否可以抢购 0为不可以
activityStartDate:options.activityStartDate,
activityEndDate:options.activityEndDate,
}); //刚进入页面不执行动画 }); //刚进入页面不执行动画
}else { }else {
...@@ -178,23 +185,26 @@ $.fn.dataStatistics = function(options) { ...@@ -178,23 +185,26 @@ $.fn.dataStatistics = function(options) {
min: nownumber, min: nownumber,
len: 4, len: 4,
add: true, add: true,
price: res.data.redemptionPrice, price: options.price,
couponId: res.data.couponId, couponId: options.couponId,
platform: options.platform, platform: options.platform,
login:options.login, login:options.login,
count: res.data.count, //判断是否可以抢购 0为不可以 count: options.count, //判断是否可以抢购 0为不可以
activityStartDate:options.activityStartDate,
activityEndDate:options.activityEndDate,
}); //刚进入页面不执行动画 }); //刚进入页面不执行动画
} }
if (nownumber == 0) { if (nownumber == 0) {
Activityendtime = res.data.expirationDate.replace('T', ' ').replace(/-/g, '/'); Activityendtime = res.data.expirationDate.replace('T', ' ').replace(/-/g, '/');
} }
options.count = res.data.count; // options.count = res.data.count;
let activityStartDate = new Date(res.data.activityStartDate.replace('T', ' ').replace(/-/g, '/')).getTime(); let activityStartDate = options.activityStartDate;
let activityEndDate = new Date(res.data.activityEndDate.replace('T', ' ').replace(/-/g, '/')).getTime(); let activityEndDate = options.activityEndDate;
let nowDate = new Date(res.data.currentTime.replace('T', ' ').replace(/-/g, '/')).getTime(); //服务器时间 let nowDate = new Date(res.data.currentTime.replace(/-/g, '/')).getTime(); //服务器时间
// let nowDate = options.nowDate; //服务器时间
if (activityStartDate >= nowDate) { //活动还没开始 if (activityStartDate >= nowDate) { //活动还没开始
clearInterval(timer2); clearInterval(timer2);
...@@ -215,7 +225,7 @@ $.fn.dataStatistics = function(options) { ...@@ -215,7 +225,7 @@ $.fn.dataStatistics = function(options) {
clearInterval(timer2); //活动结束 清楚定时器 clearInterval(timer2); //活动结束 清楚定时器
} else { } else {
if (nownumber > 0) { if (nownumber > 0) {
if (res.data.count != 0) { if (options.count != 0) {
// $(".received_img").attr("src", ""); // $(".received_img").attr("src", "");
$('.img_btn p').html('立即抢购') $('.img_btn p').html('立即抢购')
} else { } else {
...@@ -239,7 +249,6 @@ $.fn.dataStatistics = function(options) { ...@@ -239,7 +249,6 @@ $.fn.dataStatistics = function(options) {
$('.notice_img').css('display', "block"); $('.notice_img').css('display', "block");
} }
} }
} else { } else {
...@@ -283,6 +292,8 @@ $.fn.dataStatistics = function(options) { ...@@ -283,6 +292,8 @@ $.fn.dataStatistics = function(options) {
} }
if (options.platform == 'app') { if (options.platform == 'app') {
window.postMessage(JSON.stringify(data)); window.postMessage(JSON.stringify(data));
}else if(options.platform == 'H5'){
window.location.href = 'https://activity.oytour.com/html/downloadApp.html'
} }
} }
......
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