Commit 3c089c3f authored by Mac's avatar Mac

登录的逻辑修改

parent 236ef2b0
This diff is collapsed.
......@@ -8,6 +8,7 @@ $.fn.dataStatistics = function(options) {
couponId: 0, //订单id
platform: 'app',
count: 0,
login:true,
}, options || {});
var ths = this; //解决this指向问题
......@@ -79,6 +80,10 @@ $.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");
// layer.msg('优惠券被抢光了!')
}
......@@ -143,11 +148,29 @@ $.fn.dataStatistics = function(options) {
if (nownumber > 0) {
let num = nownumber - res.data.repertory; // 算出动画执行的次数
nownumber = res.data.repertory; // 算出现在的数字
// let num = 475 ; // 算出动画执行的次数
// nownumber = 0; // 算出现在的数字
// let num = 10 ; // 算出动画执行的次数
// // nownumber = 900; // 算出现在的数字
if (num > 0) {
run(num)
if(num> 5){
$('.digit_set').empty()
clearInterval(timer2);
$('.dataStatistics').dataStatistics({
max: nownumber,
min: nownumber,
len: 4,
add: true,
price: res.data.redemptionPrice,
couponId: res.data.couponId,
platform: options.platform,
login:options.login,
count: res.data.count, //判断是否可以抢购 0为不可以
}); //刚进入页面不执行动画
}else {
run(num)
}
}
if (nownumber == 0) {
Activityendtime = res.data.expirationDate.replace('T', ' ').replace(/-/g, '/');
......@@ -171,6 +194,10 @@ $.fn.dataStatistics = function(options) {
$('.img_btn').css("background-image", "url(../images/nobuy_btn.png)");
$('.img_btn p').html('活动结束')
$('.box_content_t').hide()
$('.dataStatistics').css('display', "none");
$('.deta_replace').css('display', "flex");
$('#notice').css('display', "block");
$('.notice_img').css('display', "block");
clearInterval(timer2); //活动结束 清楚定时器
} else {
if (nownumber > 0) {
......@@ -193,6 +220,10 @@ $.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");
}
......@@ -216,26 +247,33 @@ $.fn.dataStatistics = function(options) {
$('.img_btn').click(function() {
if ($('.img_btn p').css('color') == 'rgb(224, 50, 52)') { //判断按钮是否可以点击
if(options.login == true){
if (options.count != 0) { //判断是可以抢购
var loadingFlag;
var loadingFlag;
if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'showHud', 'message': '抢购中...' }));
}
if (options.platform == 'H5') {
loadingFlag= layer.msg('抢购中...', { icon: 16, shade: 0.01,shadeClose:false,time:60000 });
}
window.postMessage(JSON.stringify({'action': 'showHud', 'message': '抢购中...'}));
}
if (options.platform == 'H5') {
loadingFlag = layer.msg('抢购中...', {icon: 16, shade: 0.01, shadeClose: false, time: 60000});
}
$.ajax({
type: "POST",
url: `${getApiUrl().urlJava}api/appActivity/PanicBuyingCoupon`,
contentType: "application/json",
data: getJavaData({ redemptionPrice: options.price, couponId: options.couponId, productName: '印象之旅-200元线路产品优惠券' }),
async: false,
success: function(res) {
data: getJavaData({
redemptionPrice: options.price,
couponId: options.couponId,
productName: '印象之旅-200元线路产品优惠券'
}),
async: false,
success: function (res) {
if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'dismissHud' }));
}
if (options.platform == 'H5') {
layer.close(loadingFlag);
window.postMessage(JSON.stringify({'action': 'dismissHud'}));
}
if (options.platform == 'H5') {
layer.close(loadingFlag);
}
if (res.resultCode === 1) {
......@@ -270,11 +308,11 @@ $.fn.dataStatistics = function(options) {
data.sProductName = title;
data.productId = res.data.couponId;
data.dTotalPrice = res.data.preferPrice;
wx.miniProgram.getEnv(function(res) {
wx.miniProgram.getEnv(function (res) {
window.wx.miniProgram.navigateTo({
url: `/pages/Home/pay/pay?data=` + JSON.stringify(data),
});
});
});
} else if (options.platform == 'H5') {
let userInfo = getLocalStorage()
let data = {};
......@@ -293,7 +331,7 @@ $.fn.dataStatistics = function(options) {
} else {
if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'showToast', 'message': res.message }));
window.postMessage(JSON.stringify({'action': 'showToast', 'message': res.message}));
} else {
layer.msg(res.message)
}
......@@ -303,15 +341,16 @@ $.fn.dataStatistics = function(options) {
}
},
error: function(res) {
error: function (res) {
console.log(options.platform)
if (options.platform == 'app') {
window.postMessage(JSON.stringify({ 'action': 'dismissHud' }));
} else if(options.platform == 'H5'){
layer.close(loadingFlag);
window.postMessage(JSON.stringify({'action': 'dismissHud'}));
} else if (options.platform == 'H5') {
layer.close(loadingFlag);
}
}
});
} else {
let data = {
'action': 'jump', // showToast->一个提示信息 showHud->一个黑色的loading
......@@ -325,6 +364,9 @@ $.fn.dataStatistics = function(options) {
}
}
}else {
window.location.href = 'https://activity.oytour.com/html/login.html'
}
} else {
if ($('.img_btn p').text() == '活动结束') {
if (options.platform == 'app') {
......
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