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
5e42f707505ea6caf42852a3c7e28bb920fd7dd9
1 parent
3646ee10
chose panel logic
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
static/js/shopping-cart/chose-panel.js
static/js/shopping-cart/chose-panel.js
View file @
5e42f70
/**
* 购物车选择尺寸、颜色和数量面板
* 显示时构造当前商品信息的HTML插入yoho-page;消失则是直接清除HTML
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/21
*/
...
...
@@ -9,6 +10,8 @@ var Handlebars = require('yoho.handlebars');
var
$page
=
$
(
'.yoho-page'
);
var
$num
;
var
tpl
;
//读取partials
...
...
@@ -25,6 +28,51 @@ function show(data) {
var
html
=
tpl
(
data
);
$page
.
append
(
html
);
$num
=
$
(
'#good-num'
);
}
//移除当前Panel
function
remove
()
{
$
(
'.chose-panel'
).
remove
();
}
$
(
'.yoho-page'
).
delegate
(
'.chose-panel'
,
'touchstart'
,
function
(
e
)
{
var
$cur
=
$
(
e
.
target
);
if
(
$cur
.
closest
(
'.main'
).
length
>
0
)
{
return
;
}
//点击蒙版消失
remove
();
}).
delegate
(
'#chose-btn-sure'
,
'touchstart'
,
function
()
{
//确定
}).
delegate
(
'.block'
,
'touchstart'
,
function
()
{
//尺寸颜色点选
var
$this
=
$
(
this
);
if
(
$this
.
hasClass
(
'.chosed'
)
||
$this
.
hasClass
(
'disable'
))
{
return
;
}
$this
.
siblings
(
'.chosed'
).
removeClass
(
'chosed'
);
$this
.
addClass
(
'chosed'
);
}).
delegate
(
'.btn-minus'
,
'touchstart'
,
function
()
{
var
num
=
+
$num
.
val
();
if
(
num
===
1
)
{
return
;
}
$num
.
val
(
num
-
1
);
}).
delegate
(
'.btn-plus'
,
'touchstart'
,
function
()
{
var
num
=
+
$num
.
val
();
//TODO:库存数验证
$num
.
val
(
num
+
1
);
});
exports
.
show
=
show
;
\ No newline at end of file
...
...
Please
register
or
login
to post a comment