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
1c1508e96445f6f6e2fd16721c470fdd1ccab23c
1 parent
f36280e7
购物车修改
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
35 deletions
static/js/cart/chose-panel.js
static/js/cart/good.js
static/js/cart/chose-panel.js
View file @
1c1508e
...
...
@@ -124,6 +124,11 @@ function changeGoodImgWhenClickColor() {
}
}
function
resetHasSelectedNum
()
{
$allChoseItems
.
find
(
'.num .left-num'
).
html
(
'剩余'
+
1
+
'件'
);
$leftNum
.
val
(
1
);
}
init
();
$yohoPage
.
on
(
'touchstart'
,
'.chose-panel'
,
function
(
e
)
{
...
...
@@ -212,6 +217,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 修改颜色时修改商品图片
changeGoodImgWhenClickColor
();
// 颜色切换时, 重置已经选择的商品数量
//resetHasSelectedNum();
}).
on
(
'touchstart'
,
'.size-list .block'
,
function
()
{
var
$this
=
$
(
this
),
index
,
...
...
@@ -263,6 +271,9 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 重置颜色块的样式
resetColorZeroStock
(
$siblingBlock
);
// 颜色尺码时, 重置已经选择的商品数量
//resetHasSelectedNum();
});
$yohoPage
.
on
(
'touchstart'
,
'.btn-minus'
,
function
()
{
...
...
static/js/cart/good.js
View file @
1c1508e
...
...
@@ -41,25 +41,14 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
id
=
$good
.
data
(
'id'
);
var
goodsList
=
[],
goodInfo
=
{},
isSelected
=
true
;
if
(
$this
.
hasClass
(
'icon-cb-checked'
))
{
isSelected
=
true
;
}
else
{
isSelected
=
false
;
}
goodInfo
=
{};
goodInfo
.
goods_type
=
cartType
;
goodInfo
.
selected
=
isSelected
?
'N'
:
'Y'
;
goodInfo
.
selected
=
$this
.
hasClass
(
'icon-cb-checked'
)
?
'N'
:
'Y'
;
goodInfo
.
product_sku
=
id
;
goodInfo
.
buy_number
=
$good
.
find
(
'.count'
).
eq
(
0
).
text
().
trim
().
replace
(
'×'
,
''
);
goodsList
.
push
(
new
GoodInfo
(
goodInfo
));
$
.
ajax
({
type
:
'post'
,
url
:
'select'
,
...
...
@@ -92,8 +81,8 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
rightBtnText
:
'确定'
}
},
function
()
{
var
id
=
$this
.
closest
(
'.shopping-cart-good'
).
data
(
'id'
);
var
count
=
$this
.
data
(
'count'
);
var
id
=
$this
.
closest
(
'.shopping-cart-good'
).
data
(
'id'
),
count
=
$this
.
data
(
'count'
);
$
.
ajax
({
method
:
'post'
,
...
...
@@ -119,7 +108,6 @@ $('.cart-goods').on('touchstart', '.checkbox', function() {
tip
.
show
(
'网络异常'
);
});
});
});
function
requestUpdateAllGoodsCheckStatus
(
theGoods
,
successHandeler
)
{
...
...
@@ -140,7 +128,7 @@ function requestUpdateAllGoodsCheckStatus(theGoods, successHandeler) {
tip
.
show
(
res
.
message
);
}
},
error
:
function
(
err
)
{
error
:
function
()
{
tip
.
show
(
'网络异常'
);
},
complete
:
function
()
{
...
...
@@ -196,26 +184,9 @@ function bottomCheckBoxHandeler(isSelected, type, handlerAfterTouch) {
requestUpdateAllGoodsCheckStatus
(
goodsList
,
handlerAfterTouch
);
}
//是否要全选
function
willBeSelected
(
$this
)
{
var
isSelected
=
true
;
if
(
$this
.
hasClass
(
'icon-cb-checked'
))
{
isSelected
=
true
;
}
else
{
isSelected
=
false
;
}
return
isSelected
;
}
//全选按钮点击事件
$selectAllBtn
.
on
(
'touchend'
,
function
()
{
var
$this
=
$
(
this
);
bottomCheckBoxHandeler
(
willBeSelected
(
$this
),
cartType
,
didUpdateAllGoodsCheckStatus
);
bottomCheckBoxHandeler
(
$
(
this
).
hasClass
(
'icon-cb-checked'
),
cartType
,
didUpdateAllGoodsCheckStatus
);
});
$
(
'.down'
).
on
(
'touchend'
,
function
()
{
...
...
Please
register
or
login
to post a comment