Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYPC
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
2
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
xuqi
9 years ago
Commit
7abb0acf1211c3c2efedc308e57a00fdf6fabd78
1 parent
e6d23944
cart checkbox logic
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
18 deletions
static/js/cart/cart.js
static/js/cart/cart.js
View file @
7abb0ac
...
...
@@ -5,6 +5,7 @@
*/
var
$
=
require
(
'jquery'
),
ellipsis
=
require
(
'mlellipsis'
),
Hammer
=
require
(
'yoho.hammer'
);
var
chosePanel
=
require
(
'./chose-panel'
),
...
...
@@ -15,21 +16,33 @@ var $cartContent = $('.cart-content'),
cartType
=
$
(
'#cartType'
).
val
(),
hasShowCartPresellTip
=
false
;
var
$cartContentShow
=
$cartContent
.
not
(
'.hide'
);
var
navHammer
,
advanceBuyHammer
,
freebieHammer
,
switchChose
=
false
;
require
(
'../product/recommend-for-you'
);
require
(
'./good'
);
ellipsis
.
init
();
function
cartContentShow
()
{
return
$cartContent
.
not
(
'.hide'
);
}
function
mlellipsisHiddenNames
()
{
cartContentShow
().
find
(
'.shopping-cart-good .name'
).
each
(
function
()
{
this
.
mlellipsis
(
2
);
});
switchChose
=
true
;
}
function
hasChecked
()
{
return
$cartContentShow
.
find
(
'
.icon-cb-checked'
).
length
>
0
?
true
:
false
;
return
cartContentShow
().
find
(
'.cart-goods
.icon-cb-checked'
).
length
>
0
?
true
:
false
;
}
function
shouldSelectGift
()
{
var
$freebie
=
$cartContentShow
.
find
(
'.freebie'
);
var
$freebie
=
cartContentShow
()
.
find
(
'.freebie'
);
if
(
$freebie
.
length
<=
0
)
{
return
false
;
...
...
@@ -70,16 +83,12 @@ function showChooseGifDialog() {
rightBtnText
:
'去选择'
}
},
function
()
{
window
.
location
.
href
=
$cartContentShow
.
find
(
'.freebie > a'
).
attr
(
'href'
);
window
.
location
.
href
=
cartContentShow
()
.
find
(
'.freebie > a'
).
attr
(
'href'
);
},
function
()
{
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
cartType
;
});
}
require
(
'./good'
);
//lazyLoad($('img.lazy'));
if
(
typeof
window
.
cookie
===
'function'
&&
'y'
===
window
.
cookie
(
'_hasShowCartPresellTip'
))
{
$
(
'#presell-tip'
).
removeClass
(
'show'
).
addClass
(
'hide'
);
hasShowCartPresellTip
=
true
;
...
...
@@ -91,9 +100,9 @@ if ('advance' === cartType) {
$cartContent
.
toggleClass
(
'hide'
);
$
(
'#common-cart-nav'
).
removeClass
(
'active'
);
$
(
'#presell-cart-nav'
).
addClass
(
'active'
);
$
(
'.shopping-cart-good .name'
).
each
(
function
()
{
this
.
mlellipsis
(
2
);
});
mlellipsisHiddenNames
();
$
(
window
).
trigger
(
'scroll'
);
}
if
(
$
(
'.cart-nav'
).
length
>
0
)
{
...
...
@@ -119,13 +128,8 @@ if ($('.cart-nav').length > 0) {
//切换普通商品和预售商品购物车显示
$cartContent
.
toggleClass
(
'hide'
);
$cartContentShow
=
$cartContent
.
not
(
'.hide'
);
if
(
switchChose
===
false
)
{
$cartContentShow
.
find
(
'.shopping-cart-good .name'
).
each
(
function
()
{
this
.
mlellipsis
(
2
);
});
switchChose
=
true
;
mlellipsisHiddenNames
();
}
//trigger lazyload
...
...
Please
register
or
login
to post a comment