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
梁志锋
9 years ago
Commit
088997b5426fb71e39ee3247d20c6176d54889da
1 parent
7ab492a7
加价购链接改成hammer
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
19 deletions
static/js/cart/cart.js
static/js/cart/chose-panel.js
static/js/cart/cart.js
View file @
088997b
...
...
@@ -14,6 +14,8 @@ var chosePanel = require('./chose-panel'),
var
$cartContent
=
$
(
'.cart-content'
);
var
navHammer
,
advanceBuyHammer
,
freebieHammer
,
cartType
=
$
(
'#cartType'
).
val
();
var
hasChecked
=
$
(
'.cart-content:not(.hide) .icon-cb-checked'
).
length
>
0
?
true
:
false
;
//是否有选中商品
...
...
@@ -56,13 +58,27 @@ if ($('.cart-nav').length > 0) {
},
3000
);
}
$
(
'.advance-buy'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/cart/index/advanceBuy?cartType='
+
cartType
;
});
if
(
$
(
'.advance-buy'
).
length
>
0
)
{
advanceBuyHammer
=
new
Hammer
(
document
.
getElementsByClassName
(
'advance-buy'
)[
0
]);
advanceBuyHammer
.
on
(
'tap'
,
function
(
e
)
{
window
.
location
.
href
=
'/cart/index/advanceBuy?cartType='
+
cartType
;
});
}
$
(
'.freebie'
).
on
(
'touchend'
,
function
()
{
window
.
location
.
href
=
'/cart/index/gift?cartType='
+
cartType
;
});
if
(
$
(
'.freebie'
).
length
>
0
)
{
freebieHammer
=
new
Hammer
(
document
.
getElementsByClassName
(
'freebie'
)[
0
]);
freebieHammer
.
on
(
'tap'
,
function
(
e
)
{
window
.
location
.
href
=
'/cart/index/gift?cartType='
+
cartType
;
});
}
//$('.advance-buy').on('touchend', function() {
// window.location.href = '/cart/index/advanceBuy?cartType=' + cartType;
//});
//
//$('.freebie').on('touchend', function() {
// window.location.href = '/cart/index/gift?cartType=' + cartType;
//});
$
(
'.btn-balance'
).
on
(
'touchend'
,
function
()
{
if
(
$
(
'.low-stocks'
).
length
>
0
)
{
...
...
@@ -78,8 +94,6 @@ $('.btn-balance').on('touchend', function() {
});
$
(
'.chose'
).
on
(
'touchend'
,
function
()
{
//var id = $(this).closest('.gift-advance-good').data('id');
chosePanel
.
show
();
});
...
...
static/js/cart/chose-panel.js
View file @
088997b
...
...
@@ -208,11 +208,11 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
curColorIndex
=
index
;
$
(
'#good-num'
).
val
(
1
);
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor
();
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
}).
on
(
'touchstart'
,
'.size-list .block'
,
function
()
{
var
$this
=
$
(
this
),
index
,
...
...
@@ -232,11 +232,12 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$allChoseItems
.
find
(
'.num .left-num'
).
html
(
''
);
$
(
'#left-num'
).
val
(
0
);
hasChooseSize
=
false
;
curSizeIndex
=
null
;
$curSizeBlock
=
null
;
// 当前尺码不是选中状态,选中时
}
else
{
hasChooseSize
=
true
;
curGoodNum
=
$this
.
data
(
'num'
);
// 之前选中的尺码去掉勾选样式
...
...
@@ -253,18 +254,21 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
$
(
'#left-num'
).
val
(
0
);
}
if
(
curGoodNum
===
0
&&
hasChooseColor
)
{
$this
.
addClass
(
'zero-stock'
);
}
curSizeIndex
=
index
;
$curSizeBlock
=
$this
;
}
$this
.
toggleClass
(
'chosed'
);
curSizeIndex
=
index
;
$curSizeBlock
=
$this
;
$
(
'#good-num'
).
val
(
1
);
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
// 重置颜色块的样式
resetColorZeroStock
(
$siblingBlock
);
// 设置按钮的样式和文字
updateConformButtonClassAndText
();
});
$yohoPage
.
on
(
'touchstart'
,
'.btn-minus'
,
function
()
{
...
...
@@ -281,7 +285,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return
;
}
if
(
num
<
0
)
{
tip
.
show
(
'您选择的数量不能为
零
~'
);
tip
.
show
(
'您选择的数量不能为
负数
~'
);
return
;
}
...
...
@@ -295,7 +299,6 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
return
;
}
if
(
num
-
0
===
leftNum
||
0
===
leftNum
)
{
return
;
}
...
...
Please
register
or
login
to post a comment