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
Lynnic
9 years ago
Commit
9f8f90fe12b42d0abca359a7c287a1b9d1f98726
1 parent
44262808
为购物车商品数量添加ajax请求 --code viewed by zhaobiao
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
5 deletions
static/js/product/detail/detail.js
static/sass/product/_detail.scss
template/m.yohobuy.com/actions/product/detail/index.phtml
static/js/product/detail/detail.js
View file @
9f8f90f
...
...
@@ -3,7 +3,7 @@
* @author: liangzhifeng<zhifeng.liang@yoho.cn>
* @date: 2015/10/20
*/
var
$
=
require
(
'jquery'
),
var
$
=
require
(
'jquery'
),
Swiper
=
require
(
'yoho.iswiper'
),
Hammer
=
require
(
'yoho.hammer'
),
lazyLoad
=
require
(
'yoho.lazyload'
);
...
...
@@ -15,6 +15,8 @@ var goodsSwiper,
var
goodsDiscountEl
=
document
.
getElementById
(
'goodsDiscount'
),
goodsDiscountHammer
=
goodsDiscountEl
&&
new
Hammer
(
goodsDiscountEl
);
var
$cart
=
$
(
'.cart-bar'
);
require
(
'./desc'
);
require
(
'./comments-consults'
);
...
...
@@ -67,6 +69,16 @@ if (goodsDiscountHammer) {
});
}
//购物车商品数量
$
.
ajax
({
type
:
'GET'
,
url
:
'/cart/index/count'
,
success
:
function
(
data
)
{
if
(
data
.
code
===
200
)
{
$cart
.
find
(
'.num-tag'
).
html
(
data
.
data
.
cart_goods_count
).
removeClass
(
'hide'
);
}
}
});
require
(
'./like'
);
...
...
static/sass/product/_detail.scss
View file @
9f8f90f
...
...
@@ -405,6 +405,9 @@ $basicBtnC:#eb0313;
border-radius
:
50%
;
color
:
#fff
;
font-size
:
pxToRem
(
24px
);
&
.hide
{
display
:
none
;
}
}
}
// .recommend-for-you {
...
...
template/m.yohobuy.com/actions/product/detail/index.phtml
View file @
9f8f90f
...
...
@@ -117,10 +117,8 @@
{
{>
product/recommend-for-you
}
}
{
{#cartInfo
}
}
<div
class=
"cart-bar"
>
{
{#if
numInCart
}
}
<span
class=
"num-tag"
>
{
{numInCart
}
}</span>
{
{/if
}
}
<div
class=
"cart-bar"
>
<span
class=
"num-tag hide"
></span>
<a
href=
"{{cartUrl}}"
class=
"num-incart iconfont"
>
62
c;</a>
{
{#if
addToCart
}
}
...
...
Please
register
or
login
to post a comment