Commit 109da684 authored by 黄媛媛's avatar 黄媛媛
parents 484ecf7d 41ff4587
......@@ -397,7 +397,10 @@
//优惠券的有限时间
let expirationDate = (res.data.expirationDate).split('T')[0].replace(/-/g, '.');
RushbuyTime = expirationDate;
let RushbuyTime = {
RushbuyTime: expirationDate,
}
localStorage.RushbuyTime = JSON.stringify(RushbuyTime)
$('.img_bg_p2').html('有效期截止:' + expirationDate)
} else {
......
......@@ -63,21 +63,122 @@
<script type="text/javascript" src="../js/layer/layer.js"></script>
<script type="text/javascript" src="../js/mian.js"></script>
<script>
let RushbuyTime = JSON.parse(localStorage.RushbuyTime)
$(
function(){
$('#RushbuyTime').html(`有效期截止:` + RushbuyTime)
$('#RushbuyTime').html(`有效期截止:` + RushbuyTime.RushbuyTime)
setTimeout(function(){
$('.box').addClass('move')
}, 500)
}
)
let buyIf = {}
// if (localStorage.buyInfo) {
// buyIf = localStorage.buyInfo
// }else {
// window.location.href = 'https://activity.oytour.com/html/GT_activities.html';
// }
if (localStorage.buyInfo) {
buyIf = JSON.parse(localStorage.buyInfo)
}else {
window.location.href = 'https://activity.oytour.com/html/GT_activities.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: 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 = {
'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);
}
}
});
</script>
</body>
......
......@@ -264,105 +264,114 @@ $.fn.dataStatistics = function(options) {
if (options.count != 0) { //判断是可以抢购
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) {
let buyInfo = {
redemptionPrice: options.price,
couponId: options.couponId,
// var timer3 = setInterval(()=>{ //1,需要timer2的定时器走完了 才走timer3的定时器
}
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) {
//
// 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);
}
}
});
// // 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);
// }
// }
// });
} else {
let data = {
......
let locationName = window.location.hostname;
let RushbuyTime = '2019-11-14';
function getApiUrl() {
let url = {
urlPost: "https://reborn.oytour.com/api/common/post",
......
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