Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
SURPRISED
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
华国豪
SURPRISED
Commits
b4095d84
Commit
b4095d84
authored
5 years ago
by
Mac
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改跟团游优惠券的逻辑和样式
parent
c3a2ca0a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
131 additions
and
57 deletions
+131
-57
GT_activities.css
css/GT_activities.css
+12
-1
GT_activities.html
html/GT_activities.html
+57
-36
jquery.dataStatistics.js
js/jquery.dataStatistics.js
+62
-20
No files found.
css/GT_activities.css
View file @
b4095d84
...
...
@@ -162,4 +162,15 @@ p{
width
:
0.81rem
;
height
:
0.65rem
;
}
.box_title_2
{
width
:
90%
;
display
:
flex
;
flex-direction
:
row
;
align-items
:
center
;
justify-content
:
center
;
margin-left
:
5%
;
}
.box_title_2
p
{
font-size
:
0.20rem
;
color
:
#FFFFFF
;
}
This diff is collapsed.
Click to expand it.
html/GT_activities.
css.
html
→
html/GT_activities.html
View file @
b4095d84
...
...
@@ -43,8 +43,10 @@
</div>
<div
class=
"box_content"
>
<div
class=
"margin_T"
style=
"margin-top:1.94rem;"
></div>
<div
class=
"margin_T"
style=
"margin-top:1.90rem;"
></div>
<div
class=
"box_title_2"
>
<p></p>
</div>
<div
class=
"box_content_t"
>
<p
class=
"t_name"
id=
"t1"
></p>
<p
class=
"t_name"
id=
"p"
></p>
...
...
@@ -74,10 +76,11 @@
</div>
<div
class=
"explain"
>
<p>
使用说明
</p>
<p>
1、9.9元现金抢购价值200元的现金抵用券;
</p>
<p>
2、仅限跟团游活动使用;
</p>
<p>
3、该券有效期截止2019年11月14日 00:00:00
</p>
<p></p>
<!-- <p>使用说明 </p>-->
<!-- <p>1、9.9元现金抢购价值200元的现金抵用券; </p>-->
<!-- <p>2、仅限跟团游活动使用; </p>-->
<!-- <p>3、该券有效期截止2019年11月14日 00:00:00 </p>-->
</div>
</div>
...
...
@@ -112,25 +115,20 @@
async
:
false
,
success
:
function
(
res
)
{
if
(
res
.
resultCode
===
1
)
{
let
num
=
res
.
data
.
couponCount
-
res
.
data
.
couponReceiveCount
;
//优惠券总共数量
// let num = 0; //优惠券总共数量
let
num
=
res
.
data
.
repertory
;
//优惠券总共数量
// let num = 1; //优惠券总共数量
$
(
'.explain p'
).
html
(
'使用说明'
+
'<br/>'
+
res
.
data
.
instructions
);
$
(
'.dataStatistics'
).
dataStatistics
({
max
:
num
,
min
:
num
,
len
:
3
,
add
:
true
});
//刚进入页面不执行动画
if
(
res
.
data
.
count
==
0
){
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_btn p'
).
html
(
'9.9元抢购'
)
}
else
{
$
(
".received_img"
).
attr
(
"src"
,
"../images/received@3x.png"
);
$
(
'.img_btn p'
).
html
(
'去使用'
)
}
let
activityStartDate
=
new
Date
(
res
.
data
.
activityStartDate
).
getTime
();
//活动开始时间
let
activityEndDate
=
new
Date
(
res
.
data
.
activityEndDate
).
getTime
();
//活动结束时间
let
activityStartDate
=
new
Date
(
res
.
data
.
activityStartDate
).
getTime
();
// let activityStartDate = new Date('2019-10-25T15:04:00').getTime();
// let activityEndDate = new Date('2019-11-05T17:39:00').getTime(); //活动结束时间
// let activityStartDate = new Date('2019-11-06T10:37:10').getTime();
let
nowDate
=
new
Date
().
getTime
();
//现在时间
let
nowDate
=
new
Date
().
getTime
();
//判断当前时间是否到了抢购时间
if
(
activityStartDate
>=
nowDate
){
//没到抢购时间 显示抢购的具体时间
$
(
'#t1'
).
html
(
'抢购时间:'
);
...
...
@@ -145,25 +143,14 @@
$
(
'#t3'
).
html
(
'月'
);
$
(
'#t4'
).
html
(
'日'
);
$
(
'#t5'
).
html
(
'点整'
);
$
(
'.img_btn p'
).
html
(
'9.9
元抢购'
);
$
(
'.img_btn p'
).
html
(
res
.
data
.
redemptionPrice
+
'
元抢购'
);
$
(
'.img_btn'
).
css
(
"background-color"
,
"#CCCCCC"
);
$
(
'.img_btn p'
).
css
(
"color"
,
"#FFFFFF"
);
var
time
=
setInterval
(
setTimer2
,
1000
);
}
else
{
// 到了抢购的时间显示距离结束时间的倒计时
end
=
res
.
data
.
activityEndDate
;
$
(
'#t1'
).
html
(
'结束倒计时:'
)
}
function
setTimer2
()
{
var
time
=
setInterval
(
setTimer2
,
1000
);
//计时器
$
(
".received_img"
).
attr
(
"src"
,
""
);
let
nowTime
=
new
Date
().
getTime
();
if
(
nowTime
>=
activityStartDate
){
window
.
location
.
reload
()
clearInterval
(
time
)
}
}
if
(
(
new
Date
().
getTime
())
>
new
Date
(
res
.
data
.
expirationDate
).
getTime
()){
else
if
(
nowDate
>
activityEndDate
){
// 活动时间已过
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_bg_M'
).
css
(
"background-image"
,
"url(../images/MJ_200@3x.png)"
);
...
...
@@ -172,12 +159,46 @@
$
(
'.img_btn p'
).
html
(
'活动结束'
)
$
(
'.box_content_t'
).
hide
()
$
(
'.img_btn'
).
css
(
"background-color"
,
"#CCCCCC"
);
}
else
{
// 到了抢购的时间显示距离结束时间的倒计时
end
=
res
.
data
.
activityEndDate
;
if
(
num
>
0
){
$
(
'#t1'
).
html
(
'结束倒计时:'
)
if
(
res
.
data
.
count
!=
0
){
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_btn p'
).
html
(
res
.
data
.
redemptionPrice
+
'元抢购'
);
}
else
{
$
(
'.img_btn p'
).
html
(
'去使用'
);
$
(
".received_img"
).
attr
(
"src"
,
"../images/received@3x.png"
);
}
}
else
{
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_bg_M'
).
css
(
"background-image"
,
"url(../images/MJ_200@3x.png)"
);
$
(
'.img_bg_M p'
).
css
(
"color"
,
"#CCCCCC"
);
$
(
'.img_btn p'
).
css
(
"color"
,
"#FFFFFF"
);
$
(
'.img_btn p'
).
html
(
'活动结束'
)
$
(
'.box_content_t'
).
hide
()
$
(
'.img_btn'
).
css
(
"background-color"
,
"#CCCCCC"
);
}
}
function
setTimer2
()
{
let
nowTime
=
new
Date
().
getTime
();
if
(
nowTime
>=
activityStartDate
){
window
.
location
.
reload
()
clearInterval
(
time
)
}
}
//优惠券的有限时间
let
expirationDate
=
(
res
.
data
.
expirationDate
).
split
(
'T'
)[
0
].
replace
(
/-/g
,
'.'
);
$
(
'.img_bg_p2'
).
html
(
'有效期截止:'
+
expirationDate
)
}
...
...
This diff is collapsed.
Click to expand it.
js/jquery.dataStatistics.js
View file @
b4095d84
...
...
@@ -54,8 +54,8 @@ $.fn.dataStatistics = function(options){
//初始化---------------------------------------end
//执行
var
difference
=
0
;
//
全局的
执行次数
var
nownumber
=
options
.
min
;
//
全局的现在数字
var
difference
=
0
;
//执行次数
var
nownumber
=
options
.
min
;
//
优惠券数量
var
Activityendtime
=
''
;
//活动结束时间
function
run
(
diff
){
if
(
diff
){
...
...
@@ -72,19 +72,21 @@ $.fn.dataStatistics = function(options){
if
(
difference
<
1
)
{
clearInterval
(
timer1
);
if
(
nownumber
==
0
){
//优惠券没有的时候处理
clearInterval
(
timer2
);
//清楚定时器
if
(
(
new
Date
().
getTime
())
>
new
Date
(
'2019-10-25T15:04:00'
).
getTime
()){
clearInterval
(
timer2
);
//优惠券用完 清楚定时器
layer
.
msg
(
'活动结束'
)
}
else
{
layer
.
msg
(
'优惠券被抢光了!'
)
}
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_bg_M'
).
css
(
"background-image"
,
"url(../images/MJ_200@3x.png)"
);
$
(
'.img_bg_M p'
).
css
(
"color"
,
"#CCCCCC"
);
$
(
'.img_btn p'
).
css
(
"color"
,
"#FFFFFF"
);
$
(
'.img_btn p'
).
html
(
'活动结束'
)
$
(
'.box_content_t'
).
hide
()
$
(
'.img_btn'
).
css
(
"background-color"
,
"#CCCCCC"
);
layer
.
msg
(
'优惠券被抢光了!'
)
}
return
false
;
console
.
info
(
'结束'
)
}
difference
--
;
...
...
@@ -136,8 +138,8 @@ $.fn.dataStatistics = function(options){
success
:
function
(
res
)
{
if
(
res
.
resultCode
===
1
)
{
if
(
nownumber
>
0
){
let
num
=
nownumber
-
(
res
.
data
.
couponCount
-
res
.
data
.
couponReceiveCount
)
;
// 算出动画执行的次数
nownumber
=
res
.
data
.
couponCount
-
res
.
data
.
couponReceiveCount
;
// 算出现在的数字
let
num
=
nownumber
-
res
.
data
.
repertory
;
// 算出动画执行的次数
nownumber
=
res
.
data
.
repertory
;
// 算出现在的数字
if
(
num
>
0
){
run
(
num
)
...
...
@@ -145,15 +147,51 @@ $.fn.dataStatistics = function(options){
if
(
nownumber
==
0
){
Activityendtime
=
res
.
data
.
expirationDate
;
}
if
(
res
.
data
.
count
==
0
){
let
activityStartDate
=
new
Date
(
res
.
data
.
activityStartDate
).
getTime
();
let
activityEndDate
=
new
Date
(
res
.
data
.
activityEndDate
).
getTime
();
let
nowDate
=
new
Date
().
getTime
();
if
(
activityStartDate
>=
nowDate
){
//活动还没开始
clearInterval
(
timer2
);
}
else
if
(
nowDate
>=
activityEndDate
){
//活动结束
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_btn p'
).
html
(
'9.9元抢购'
)
$
(
'.img_bg_M'
).
css
(
"background-image"
,
"url(../images/MJ_200@3x.png)"
);
$
(
'.img_bg_M p'
).
css
(
"color"
,
"#CCCCCC"
);
$
(
'.img_btn p'
).
css
(
"color"
,
"#FFFFFF"
);
$
(
'.img_btn'
).
css
(
"background-color"
,
"#CCCCCC"
);
$
(
'.img_btn p'
).
html
(
'活动结束'
)
$
(
'.box_content_t'
).
hide
()
clearInterval
(
timer2
);
//活动结束 清楚定时器
}
else
{
if
(
nownumber
>
0
){
if
(
res
.
data
.
count
!=
0
){
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_btn p'
).
html
(
res
.
data
.
redemptionPrice
+
'元抢购'
)
}
else
{
$
(
".received_img"
).
attr
(
"src"
,
"../images/received@3x.png"
);
$
(
'.img_btn p'
).
html
(
'去使用'
)
}
}
else
{
$
(
".received_img"
).
attr
(
"src"
,
""
);
$
(
'.img_bg_M'
).
css
(
"background-image"
,
"url(../images/MJ_200@3x.png)"
);
$
(
'.img_bg_M p'
).
css
(
"color"
,
"#CCCCCC"
);
$
(
'.img_btn p'
).
css
(
"color"
,
"#FFFFFF"
);
$
(
'.img_btn p'
).
html
(
'活动结束'
)
$
(
'.box_content_t'
).
hide
()
$
(
'.img_btn'
).
css
(
"background-color"
,
"#CCCCCC"
);
}
}
else
{
$
(
".received_img"
).
attr
(
"src"
,
"../images/received@3x.png"
);
$
(
'.img_btn p'
).
html
(
'去使用'
)
}
}
...
...
@@ -167,10 +205,10 @@ $.fn.dataStatistics = function(options){
$
(
'.img_btn'
).
click
(
function
()
{
if
(
$
(
'.img_btn p'
).
css
(
'color'
)
==
'rgb(224, 50, 52)'
){
//判断按钮是否可以点击
if
(
$
(
'.img_btn p'
).
text
()
==
'9.9元抢购'
){
//判断是否9.9元抢购 点击
可以抢购
if
(
$
(
'.img_btn p'
).
text
()
!=
'活动结束'
||
$
(
'.img_btn p'
).
text
()
!=
'去使用'
){
//判断是
可以抢购
$
.
ajax
({
type
:
"POST"
,
url
:
`
${
getApiUrl
().
urlJava
}
api/appActivity/
rushPurchaseByUid
`
,
url
:
`
${
getApiUrl
().
urlJava
}
api/appActivity/
PanicBuyingCoupon
`
,
contentType
:
"application/json"
,
data
:
getJavaA
({},
token
),
async
:
false
,
...
...
@@ -198,11 +236,15 @@ $.fn.dataStatistics = function(options){
}
else
{
layer
.
msg
(
'去使用优惠券'
)
}
}
else
{
if
(
$
(
'.img_btn p'
).
text
()
==
'活动结束'
){
layer
.
msg
(
'活动已结束'
)
layer
.
msg
(
'活动还未开始'
)
}
else
{
layer
.
msg
(
'活动还未开始'
)
}
}
})
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment