Commit a0d56b9f authored by zhengke's avatar zhengke

2

parents 17b95f8a 2577f2c9
......@@ -7,7 +7,7 @@ $.fn.dataStatistics = function(options){
len:4, //数字是几位数
price:0, //金额
couponId:0, //订单id
platform:'app',
platform:'App',
count:0,
},options || {});
......@@ -164,8 +164,11 @@ $.fn.dataStatistics = function(options){
}else if( nowDate >= activityEndDate){ //活动结束
$(".received_img").attr("src","");
$('.img_bg_p1').css("color","#CCCCCC");
$('.img_bg_p2').css("color","#CCCCCC");
$('.img_bg_M').css("background-image","url(../images/MJ_200@3x.png)");
$(".img_bg_M").css("height", "1.46rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"none");
$('.img_bg_M p').css("color","#CCCCCC");
$('.img_btn p').css("color","#FFFFFF");
$('.img_btn').css("background-color", "#CCCCCC");
......@@ -178,16 +181,24 @@ $.fn.dataStatistics = function(options){
$(".received_img").attr("src","");
$('.img_btn p').html(res.data.redemptionPrice + '元抢购')
$(".img_bg_M").css("background-image","url(../images/M_200@3x.png)");
$(".img_bg_M").css("height", "1.46rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"none");
}else {
$(".received_img").attr("src","../images/received@3x.png");
$('.img_btn p').html('去使用')
$(".img_bg_M").css("background-image","url(../images/M_200_2.png)");
$(".img_bg_M").css("height", "2.14rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"flex");
}
}else {
$(".received_img").attr("src","");
$('.img_bg_p1').css("color","#CCCCCC");
$('.img_bg_p2').css("color","#CCCCCC");
$('.img_bg_M').css("background-image","url(../images/MJ_200@3x.png)");
$(".img_bg_M").css("height", "1.46rem");//通过设置CSS属性来设置元素的高
$('.use_oupon').css('display',"none");
$('.img_bg_M p').css("color","#CCCCCC");
$('.img_btn p').css("color","#FFFFFF");
$('.img_btn p').html('活动结束')
$('.box_content_t').hide()
......@@ -213,10 +224,10 @@ $.fn.dataStatistics = function(options){
},(difference+5)*1000) //5s请求一次接口
$('.img_btn').click(function () {
if($('.img_btn p').css('color')=='rgb(224, 50, 52)'){ //判断按钮是否可以点击
if( options.count !=0){ //判断是可以抢购
if(options.platform == 'app'){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showHud', 'message' : '抢购中...'}));
}
$.ajax({
......@@ -226,11 +237,15 @@ $.fn.dataStatistics = function(options){
data: getJavaData({redemptionPrice:options.price,couponId:options.couponId}),
async: false,
success: function (res) {
if(options.platform == 'app'){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
}
if (res.resultCode === 1) {
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : res.message}));
}else {
layer.msg(res.message)
}
var timer3 = setInterval(()=>{ //1,需要timer2的定时器走完了 才走timer3的定时器
nownumber = nownumber -1;
......@@ -247,54 +262,55 @@ $.fn.dataStatistics = function(options){
'couponId' : res.data.couponId,
'title':title,
'price':res.data.preferPrice,
'backType':'reload',
'backKey':'reload',
'data':res.data
}
}
if(options.platform == 'app'){
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 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 = 'http://127.0.0.1:5500/html/pay.html';
window.location.href = 'http://http://activity.oytour.com/html/pay.html';
}
sessionStorage.setItem("payInfo", JSON.stringify(data));
//window.location.href = 'http://127.0.0.1:5500/html/pay.html';
window.location.href = 'http://http://activity.oytour.com/html/pay.html';
}
}else {
if(options.platform == 'app'){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : res.message}));
}else {
layer.msg(res.message)
}
//window.location.reload()
window.location.reload()
}
},
error: function (res) {
console.log(options.platform)
if(options.platform == 'app'){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'dismissHud'}));
}else {
......@@ -303,33 +319,26 @@ $.fn.dataStatistics = function(options){
layer.msg(res.message)
}
});
}else { //跳转到跟团游首页
let data = {
'action' : 'jump',
'page' : 'teamWalker_2',
'pageData' : {
'backType':'pop',
}
}
if(options.platform == 'app'){
window.postMessage(JSON.stringify(data));
}
}else {
layer.msg('去使用优惠券')
}
}else {
if($('.img_btn p').text() == '活动结束'){
if(options.platform == 'app'){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : '活动已结束'}));
}else {
layer.msg('活动已结束')
}
window.location.reload()
}else {
if(options.platform == 'app'){
if(options.platform == 'App'){
window.postMessage(JSON.stringify({'action' : 'showToast', 'message' : '活动还未开始'}));
}else {
layer.msg('活动还未开始')
}
window.location.reload()
}
}
......
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