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