Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
阿达
9 years ago
Commit
8b96fe09c5065c7ebbc0b253fef5ff5a9bd217dd
1 parent
359d2f14
订单列表增加倒计时
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
100 additions
and
0 deletions
static/js/me/order.js
static/sass/me/_order.css
template/m.yohobuy.com/partials/me/order/order.phtml
static/js/me/order.js
View file @
8b96fe0
...
...
@@ -34,6 +34,67 @@ var orderHammer,
$reaMask
=
$
(
'.reason-mask'
),
reasonSwiper
;
// 减少计时
function
downCount
(
item
)
{
var
hoursItem
=
item
.
find
(
'.hours'
);
var
difference
=
hoursItem
.
text
(),
// difference of dates
interval
;
/**
* Main downCount function that calculates everything
*/
function
countdown
()
{
// basic math variables
var
_second
=
1000
,
_minute
=
_second
*
60
,
_hour
=
_minute
*
60
,
_day
=
_hour
*
24
,
days
,
hours
,
minutes
,
seconds
;
// calculate dates
days
=
Math
.
floor
(
difference
/
_day
),
hours
=
Math
.
floor
((
difference
%
_day
)
/
_hour
),
minutes
=
Math
.
floor
((
difference
%
_hour
)
/
_minute
),
seconds
=
Math
.
floor
((
difference
%
_minute
)
/
_second
);
// fix dates so that it will show two digets
days
=
(
String
(
days
).
length
>=
2
)
?
days
:
'0'
+
days
;
hours
=
(
String
(
hours
).
length
>=
2
)
?
hours
:
'0'
+
hours
;
minutes
=
(
String
(
minutes
).
length
>=
2
)
?
minutes
:
'0'
+
minutes
;
seconds
=
(
String
(
seconds
).
length
>=
2
)
?
seconds
:
'0'
+
seconds
;
// set to DOM
item
.
removeClass
(
'hide'
);
hoursItem
.
text
(
'剩余'
+
hours
+
':'
+
minutes
+
':'
+
seconds
);
difference
-=
1000
;
if
(
difference
<
0
)
{
clearInterval
(
interval
);
// stop timer
return
;
}
}
if
(
difference
!==
''
&&
difference
>
0
)
{
interval
=
setInterval
(
countdown
,
1000
);
// start
}
}
// 初始化时间
function
setTime
()
{
$
(
'.orders'
).
each
(
function
()
{
var
item
=
$
(
this
).
find
(
'.count-down'
);
if
(
!
$
(
this
).
hasClass
(
'hide'
))
{
downCount
(
item
);
}
});
}
//加载订单
function
getOrders
(
option
)
{
var
opt
=
{
...
...
@@ -82,6 +143,7 @@ function getOrders(option) {
inAjax
=
false
;
show
&&
loading
.
hideLoadingMask
();
setTime
();
}
});
}
...
...
static/sass/me/_order.css
View file @
8b96fe0
...
...
@@ -121,6 +121,36 @@
border
:
none
;
margin-left
:
20px
;
}
.count-down
{
list-style
:
none
;
padding
:
0
;
display
:
inline-block
;
text-align
:
right
;
font-size
:
24px
;
color
:
#b0b0b0
;
float
:
left
;
margin-left
:
30px
;
margin-top
:
20px
;
.count-down-icon
{
margin-top
:
-8px
;
font-size
:
30px
;
}
&
.hide
{
display
:
none
;
}
li
{
display
:
inline-block
;
}
li
span
{
font-size
:
24px
;
line-height
:
24px
;
}
}
}
}
...
...
template/m.yohobuy.com/partials/me/order/order.phtml
View file @
8b96fe0
...
...
@@ -26,6 +26,14 @@
{{#if unpaid}}
<div class="order-opt">
<ul class="count-down">
<li>
<span class="iconfont count-down-icon"></span>
</li>
<li>
<span class="hours">{{leftTime}}</span>
</li>
</ul>
<span class="btn cancel">取消订单</span>
{{#if payUrl}}
<a class="locHref" href="{{payUrl}}">
...
...
Please
register
or
login
to post a comment