Commit 577e3de9 authored by Mac's avatar Mac

parent 41ff4587
......@@ -339,7 +339,7 @@
let time = ((activityStartDate - nowDate) / 1000).toFixed(0);
runtime(time)
} else if (nowDate > activityEndDate) { // 活动时间已过
} else if (nowDate > activityEndDate || res.data.activityIsEnding == 1) { // 活动时间已过
// $(".received_img").attr("src", "");
$('.img_bg_M').css("background-image", "url(../images/MJ_200@3x.png)");
......@@ -391,14 +391,14 @@
}
}
//优惠券的有限时间
let expirationDate = (res.data.expirationDate).split('T')[0].replace(/-/g, '.');
let title = $('.img_bg_p1').text()
let RushbuyTime = {
RushbuyTime: expirationDate,
title:title,
}
localStorage.RushbuyTime = JSON.stringify(RushbuyTime)
$('.img_bg_p2').html('有效期截止:' + expirationDate)
......
......@@ -62,6 +62,8 @@
<script type="text/javascript" src="../js/md5.js"></script>
<script type="text/javascript" src="../js/layer/layer.js"></script>
<script type="text/javascript" src="../js/mian.js"></script>
<script type="text/javascript" src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
<script>
let RushbuyTime = JSON.parse(localStorage.RushbuyTime)
......@@ -79,107 +81,106 @@
}else {
window.location.href = 'https://activity.oytour.com/html/GT_activities.html';
}
$('.anniu').click(function () {
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});
}
$.ajax({
type: "POST",
url: `${getApiUrl().urlJava}api/appActivity/PanicBuyingCoupon`,
contentType: "application/json",
data: getJavaData({
redemptionPrice: buyIf.redemptionPrice,
couponId: buyIf.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);
}
if (res.resultCode === 1) {
// var timer3 = setInterval(()=>{ //1,需要timer2的定时器走完了 才走timer3的定时器
//
// nownumber = nownumber -1;
// run(1)
// clearInterval(timer3) //2,执行动画之后清除timer3
// },difference*1000)
let title = '印象之旅-200元线路产品优惠券';
let data = {
var loadingFlag;
if (buyIf.platform == 'app') {
window.postMessage(JSON.stringify({'action': 'showHud', 'message': '抢购中...'}));
}
if (buyIf.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: buyIf.redemptionPrice,
couponId: buyIf.couponId,
productName: '印象之旅-200元线路产品优惠券'
}),
async: false,
success: function (res) {
if (buyIf.platform == 'app') {
window.postMessage(JSON.stringify({'action': 'dismissHud'}));
}
if (buyIf.platform == 'H5') {
layer.close(loadingFlag);
}
if (res.resultCode === 1) {
'action': 'jump', // showToast->一个提示信息 showHud->一个黑色的loading
'page': 'payment',
'pageData': {
'couponId': res.data.couponId,
'title': title,
'price': res.data.preferPrice,
'backType': 'reload',
'data': res.data
}
}
if (options.platform == 'app') {
window.postMessage(JSON.stringify(data));
}
// 跳转到支付
else if (options.platform == 'xcx') {
// window.postMessage(JSON.stringify(data));
let data = {};
data.sOrderNo = res.data.id;
data.sProductName = title;
data.productId = res.data.couponId;
data.dTotalPrice = res.data.preferPrice;
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 = {};
data.sOrderNo = res.data.id;
data.sProductName = title;
data.productId = res.data.couponId;
data.dTotalPrice = res.data.preferPrice;
data.customerId = userInfo.customerId;
let title = '印象之旅-200元线路产品优惠券';
let data = {
sessionStorage.setItem("payInfo", JSON.stringify(data));
//window.location.href = 'https://127.0.0.1:5500/html/pay.html';
//window.location.href = 'http://192.168.0.117:5500/html/pay.html';
window.location.href = 'https://activity.oytour.com/html/pay.html';
}
'action': 'jump', // showToast->一个提示信息 showHud->一个黑色的loading
'page': 'payment',
'pageData': {
'couponId': res.data.couponId,
'title': title,
'price': res.data.preferPrice,
'backType': 'reload',
'data': res.data,
'goBack':'1',
'cardInfo' : {
title : RushbuyTime.title,
date : RushbuyTime.RushbuyTime,
}
}
}
if (buyIf.platform == 'app') {
window.postMessage(JSON.stringify(data));
}
// 跳转到支付
else if (buyIf.platform == 'xcx') {
// window.postMessage(JSON.stringify(data));
let data = {};
data.sOrderNo = res.data.id;
data.sProductName = title;
data.productId = res.data.couponId;
data.dTotalPrice = res.data.preferPrice;
wx.miniProgram.getEnv(function (res) {
window.wx.miniProgram.navigateTo({
url: `/pages/Home/pay/pay?data=` + JSON.stringify(data),
});
});
} else if (buyIf.platform == 'H5') {
let userInfo = getLocalStorage()
let data = {};
data.sOrderNo = res.data.id;
data.sProductName = title;
data.productId = res.data.couponId;
data.dTotalPrice = res.data.preferPrice;
data.customerId = userInfo.customerId;
sessionStorage.setItem("payInfo", JSON.stringify(data));
//window.location.href = 'https://127.0.0.1:5500/html/pay.html';
//window.location.href = 'http://192.168.0.117:5500/html/pay.html';
window.location.href = 'https://activity.oytour.com/html/pay.html';
}
} else {
if (options.platform == 'app') {
window.postMessage(JSON.stringify({'action': 'showToast', 'message': res.message}));
} else {
layer.msg(res.message)
}
layer.msg(res.message)
// window.location.reload()
} else {
if (buyIf.platform == 'app') {
window.postMessage(JSON.stringify({'action': 'showToast', 'message': res.message}));
} else {
layer.msg(res.message)
}
layer.msg(res.message)
}
},
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.location.reload()
}
},
error: function (res) {
console.log(buyIf.platform)
if (buyIf.platform == 'app') {
window.postMessage(JSON.stringify({'action': 'dismissHud'}));
} else if (buyIf.platform == 'H5') {
layer.close(loadingFlag);
}
}
});
})
</script>
</body>
</html>
......@@ -198,7 +198,7 @@ $.fn.dataStatistics = function(options) {
if (activityStartDate >= nowDate) { //活动还没开始
clearInterval(timer2);
} else if (nowDate >= activityEndDate) { //活动结束
} else if (nowDate >= activityEndDate || res.data.activityIsEnding == 1) { //活动结束
// $(".received_img").attr("src", "");
$('.img_bg_M').css("background-image", "url(../images/MJ_200@3x.png)");
......@@ -257,121 +257,21 @@ $.fn.dataStatistics = function(options) {
});
}, (difference + 5) * 1000) //5s请求一次接口
$('.img_btn').click(function() {
if ($('.img_btn p').css('color') == 'rgb(224, 50, 52)') { //判断按钮是否可以点击
if(options.login == true){
if (options.count != 0) { //判断是可以抢购
let buyInfo = {
redemptionPrice: options.price,
couponId: options.couponId,
platform:options.platform,
}
localStorage.buyInfo = JSON.stringify(buyInfo)
// window.location.href = 'https://activity.oytour.com/html/GT_activities.html';
window.location.href = './Rushbuy.html' ;
// 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});
// }
// $.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) {
// if (options.platform == 'app') {
// window.postMessage(JSON.stringify({'action': 'dismissHud'}));
// }
// if (options.platform == 'H5') {
// layer.close(loadingFlag);
// }
// if (res.resultCode === 1) {
//
// // var timer3 = setInterval(()=>{ //1,需要timer2的定时器走完了 才走timer3的定时器
// //
// // nownumber = nownumber -1;
// // run(1)
// // clearInterval(timer3) //2,执行动画之后清除timer3
// // },difference*1000)
//
// let title = '印象之旅-200元线路产品优惠券';
// let data = {
//
// 'action': 'jump', // showToast->一个提示信息 showHud->一个黑色的loading
// 'page': 'payment',
// 'pageData': {
// 'couponId': res.data.couponId,
// 'title': title,
// 'price': res.data.preferPrice,
// 'backType': 'reload',
// 'data': res.data
// }
// }
// if (options.platform == 'app') {
// window.postMessage(JSON.stringify(data));
// }
// // 跳转到支付
// else if (options.platform == 'xcx') {
// // window.postMessage(JSON.stringify(data));
// let data = {};
// data.sOrderNo = res.data.id;
// data.sProductName = title;
// data.productId = res.data.couponId;
// data.dTotalPrice = res.data.preferPrice;
// 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 = {};
// data.sOrderNo = res.data.id;
// data.sProductName = title;
// data.productId = res.data.couponId;
// data.dTotalPrice = res.data.preferPrice;
// data.customerId = userInfo.customerId;
//
// sessionStorage.setItem("payInfo", JSON.stringify(data));
// //window.location.href = 'https://127.0.0.1:5500/html/pay.html';
// //window.location.href = 'http://192.168.0.117:5500/html/pay.html';
// window.location.href = 'https://activity.oytour.com/html/pay.html';
// }
//
//
// } else {
// if (options.platform == 'app') {
// window.postMessage(JSON.stringify({'action': 'showToast', 'message': res.message}));
// } else {
// layer.msg(res.message)
// }
// layer.msg(res.message)
//
// // window.location.reload()
//
// }
// },
// 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.location.href = 'https://activity.oytour.com/html/Rushbuy.html';
// window.location.href = './Rushbuy.html' ;
} else {
let data = {
......
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