index.html
9.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<!DOCTYPE html >
<html>
<head>
<meta charset="UTF-8">
<title>{$redname}</title>
<include file="public/header"/>
<link rel="stylesheet" href="__STATIC__/css/redbag.css?v=2018031001" type="text/css">
<body>
<div class="redware" style="padding-bottom: 0;">
<div class="ofn">由{$tpshop_config['shop_info_store_title']}发起抢红包</div>
<a class="redbag_ware" href="javascript:void(0);">
<img class="redbag_btn" src="__STATIC__/images/redbag/redbag_btn.png" alt="">
</a>
<div style="position: relative">
<img class="redbagtit" src="__STATIC__/images/redbag/indexbot.png" alt="">
<div class="itmeboxwz">离活动开始时间还有</div>
<ul class="timeboxware" id="fday">
<li><img class="timebox" src="__STATIC__/images/redbag/timebox.png" alt=""><span class="num" id="day">00天</span></li>
<li><img class="timebox" src="__STATIC__/images/redbag/timebox.png" alt=""><span class="num" id="hour">00时</span></li>
<li><img class="timebox" src="__STATIC__/images/redbag/timebox.png" alt=""><span class="num" id="mini">00分</span></li>
<li><img class="timebox" src="__STATIC__/images/redbag/timebox.png" alt=""><span class="num" id="sec">00秒</span></li>
</ul>
</div>
</div>
</body>
<script>
var Tday = new Array();
var daysms = 24 * 60 * 60 * 1000
var hoursms = 60 * 60 * 1000
var Secondms = 60 * 1000
var microsecond = 1000
var DifferHour = -1
var DifferMinute = -1
var DifferSecond = -1
function clock11(key) {
var time = new Date()
var hour = time.getHours()
var minute = time.getMinutes()
var second = time.getSeconds()
var timevalue = "" + ((hour > 12) ? hour - 12 : hour)
timevalue += ((minute < 10) ? ":0" : ":") + minute
timevalue += ((second < 10) ? ":0" : ":") + second
timevalue += ((hour > 12 ) ? " PM" : " AM")
var convertHour = DifferHour
var convertMinute = DifferMinute
var convertSecond = DifferSecond
var Diffms = Tday[key].getTime() - time.getTime()
DifferHour = Math.floor(Diffms / daysms)
Diffms -= DifferHour * daysms
DifferMinute = Math.floor(Diffms / hoursms)
Diffms -= DifferMinute * hoursms
DifferSecond = Math.floor(Diffms / Secondms)
Diffms -= DifferSecond * Secondms
var dSecs = Math.floor(Diffms / microsecond)
if (convertHour != DifferHour) e = "<li><img class='timebox' src='__STATIC__/images/redbag/timebox.png' alt=''><span class='num' id='day'>" + DifferHour + "天</span></li>";
if (convertMinute != DifferMinute) f ="<li><img class='timebox' src='__STATIC__/images/redbag/timebox.png' alt=''><span class='num' id='day'>" + DifferMinute + "时</span></li>";
if (convertSecond != DifferSecond) g = "<li><img class='timebox' src='__STATIC__/images/redbag/timebox.png' alt=''><span class='num' id='day'>" + DifferSecond + "分</span></li>";
h = "<li><img class='timebox' src='__STATIC__/images/redbag/timebox.png' alt=''><span class='num' id='day'>" + dSecs + "秒</span></li>";
if (DifferHour > 0) { e = e}
else { e = '' }
document.getElementById(key).innerHTML = e + f + g + h;
}
</script>
<script type="text/javascript">
$(function () {
var k_rednum={$k_rednum};
var getwks={$wks};
var gethdend="{$hdend}";
//
if (gethdend==0) {
if (getwks == 1) {
Tday['fday'] = new Date('{$red_res.start_time|date="Y/m/d H:i:s",###}');
$(".itmeboxwz").html("离活动开始时间还有");
} else {
Tday['fday'] = new Date('{$red_res.end_time|date="Y/m/d H:i:s",###}');
$(".itmeboxwz").html("离活动结束时间还有");
}
window.setInterval(function () {
clock11('fday');
}, 1000);
}
//页面层
$(".redbag_ware").click(function () {
if (getwks==1)
{
layer.open({content: "活动未开始!", time: 1});
return false;
}
var getredid="{$red_res.id}";
var getk_rednum1="{$k_rednum1}";
var getstoid="{$stoid}";
if (gethdend==1)
{
layer.open({content: "活动已结束或未启用!", time: 1});
return false;
}
if (getk_rednum1==1)
{
layer.open({
type: 1,
content: '<div class="layhb"> <img class="hbtit" src="__STATIC__/images/redbag/hbtit2.png" alt=""><div class="msg">来晚了,红包总金额已抢空</div><a href="/index.php/mobile/Redbag/redrec/stoid/'+getstoid+'/rec_id/'+getredid+'.html"><div class="go">看看大家的手气></div></a></div>',
anim: 'up',
style: 'position:fixed; top:15%; left:50%; margin-left:-160px; width:320px; height: auto; padding:10px 0; border:none;background-color:rgba(255,255,255,0);'
});
return false;
}
if (k_rednum==0)
{
layer.open({
type: 1,
content: '<div class="layhb"> <img class="hbtit" src="__STATIC__/images/redbag/hbtit2.png" alt=""><div class="msg">手慢了,红包抢完了</div><a href="/index.php/mobile/Redbag/redrec/stoid/'+getstoid+'/rec_id/'+getredid+'.html"><div class="go">看看大家的手气></div></a></div>',
anim: 'up',
style: 'position:fixed; top:15%; left:50%; margin-left:-160px; width:320px; height: auto; padding:10px 0; border:none;background-color:rgba(255,255,255,0);'
});
return false;
}
if (k_rednum==2)
{
layer.open({
type: 1,
content: '<div class="layhb"> <img class="hbtit" src="__STATIC__/images/redbag/hbtit2.png" alt=""><div class="msg">您抢红包的次数已用完</div><a href="/index.php/mobile/Redbag/redrec/stoid/'+getstoid+'/rec_id/'+getredid+'.html"><div class="go">看看大家的手气></div></a></div>',
anim: 'up',
style: 'position:fixed; top:15%; left:50%; margin-left:-160px; width:320px; height: auto; padding:10px 0; border:none;background-color:rgba(255,255,255,0);'
});
return false;
}
if (getredid<=0)
{
layer.open({content: "参数有误,无法抢红包!", time: 1});
return false;
}
layer.open({type:2});
$.ajax({
type: "GET",
dataType: 'json',
url: "/index.php?m=Mobile&c=Redbag&a=robred&stoid=" + getstoid+"&redid="+getredid,
success: function (data) {
layer.closeAll();
if(data.code==1) {
var usermoney=data.usermoney;
var rec_id=data.frombillid;
var getbgimg="__STATIC__/images/redbag/hbtit.png";
var getanurl='<a href="/index.php/mobile/Redbag/redlist/stoid/'+getstoid+'/rec_id/'+rec_id+'.html"><img class="srhb" src="__STATIC__/images/redbag/srhb.png" alt=""></a>';
if (usermoney==0)
{
getbgimg="__STATIC__/images/redbag/hbtit2.png";
getanurl='<a href="/index.php/mobile/Redbag/index/stoid/'+getstoid+'/rec_id/'+rec_id+'.html"><img class="srhb" src="__STATIC__/images/redbag/srhb2.png" alt=""></a>';
usermoney="";
}
layer.open({
type: 1,
content: '<div class="layhb"> <img class="hbtit" src="'+getbgimg+'" alt="">'+getanurl+'<div class="price">'+usermoney+'</div></div>',
anim: 'up',
style: 'position:fixed; top:15%; left:50%; margin-left:-160px; width:320px; height: auto; padding:10px 0; border:none;background-color:rgba(255,255,255,0);'
});
}else if (data.code==-2){
layer.open({
type: 1,
content: '<div class="layhb"> <img class="hbtit" src="__STATIC__/images/redbag/hbtit2.png" alt=""><div class="msg">'+data.msg+'</div><a href="/index.php/mobile/Redbag/redrec/stoid/'+getstoid+'/rec_id/'+getredid+'.html"><div class="go">看看大家的手气></div></a></div>',
anim: 'up',
style: 'position:fixed; top:15%; left:50%; margin-left:-160px; width:320px; height: auto; padding:10px 0; border:none;background-color:rgba(255,255,255,0);'
});
setTimeout(function () {
location.href=location.href;
},2000);
//layer.open({content:data.msg,time:1});
}
else
{
layer.open({
type: 1,
content: '<div class="layhb"> <img class="hbtit" src="__STATIC__/images/redbag/hbtit2.png" alt=""><div class="msg">'+data.msg+'</div><a href="/index.php/mobile/Redbag/redrec/stoid/'+getstoid+'/rec_id/'+getredid+'.html"><div class="go">看看大家的手气></div></a></div>',
anim: 'up',
style: 'position:fixed; top:15%; left:50%; margin-left:-160px; width:320px; height: auto; padding:10px 0; border:none;background-color:rgba(255,255,255,0);'
});
}
},
error: function () {
layer.open({content:'网络繁忙,请重试',time:1});
}
})
})
})
</script>
</html>