Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
htoooth
8 years ago
Commit
2575d6295f0c151f11cae6949f2dba282264d81c
1 parent
ce6e74ef
fix js
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
6 deletions
apps/product/models/detail-service.js
apps/product/views/action/product/detail.hbs
public/js/product/detail.page.js
public/scss/product/_detail.css
apps/product/models/detail-service.js
View file @
2575d62
...
...
@@ -1138,6 +1138,9 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
// 秒杀商品
result
.
secKill
=
propOrigin
(
'is_secKill'
,
'N'
);
// 量贩
result
.
bundleType
=
propOrigin
(
'bundle_type'
,
0
);
let
requestApi
=
{
addition
:
_getProductAdditionInfoAsync
(
origin
),
// 预处理所有的数据
fav
:
_getProductFavoriteDataAsync
(
uid
,
result
.
productId
),
// 处理收藏喜欢数据
...
...
@@ -1392,7 +1395,7 @@ const _detailDataPkg = (origin, uid, vipLevel, cookies) => {
// 普通商品
result
.
bundle
=
{
count
:
1
,
type
:
0
type
:
result
.
bundleType
};
}
...
...
apps/product/views/action/product/detail.hbs
View file @
2575d62
...
...
@@ -456,10 +456,18 @@
</div>
<div
class=
"shoppingCar"
>
<div
class=
"shoppingCar-btn"
>
<i
class=
"iconfont"
>

</i>
<span>
加入购物车
</span>
</div>
{{#if
goodsInfo
.
soldOUt
}}
<div
class=
"shoppingCar-btn disable"
>
<i
class=
"iconfont"
>

</i>
<span>
已售罄
</span>
</div>
{{^}}
<div
class=
"shoppingCar-btn"
>
<i
class=
"iconfont"
>

</i>
<span>
加入购物车
</span>
</div>
{{/if}}
<div
class=
"shoppingCar-nav"
>
<ul>
...
...
public/js/product/detail.page.js
View file @
2575d62
...
...
@@ -41,6 +41,8 @@ var $main = $('.main'),
var
maxStock
=
-
1
;
// 记录当前选中的颜色-尺码的库存量,若为-1,代表未选择尺码
var
$maxColor
=
null
;
// 记录当前选中的颜色
var
$shoppingCarBtn
=
$
(
'.shoppingCar-btn'
);
var
SLIDETIME
=
200
;
var
colTxt
=
{
...
...
@@ -78,6 +80,21 @@ function isEmpty(el) {
return
!
$
.
trim
(
el
.
html
());
}
function
showSellOut
()
{
$shoppingCarBtn
.
addClass
(
'disable'
)
.
find
(
'i'
).
html
(
''
).
end
()
.
find
(
'span'
).
html
(
'已售罄'
);
}
function
showAddCart
()
{
$shoppingCarBtn
.
removeClass
(
'disable'
)
.
find
(
'i'
).
html
(
''
).
end
()
.
find
(
'span'
).
html
(
'加入购物车'
);
}
cartEvent
.
on
(
'selling'
,
showAddCart
);
cartEvent
.
on
(
'sellout'
,
showSellOut
);
require
(
'../plugins/slider'
);
require
(
'../common/center-slider'
);
...
...
public/scss/product/_detail.css
View file @
2575d62
...
...
@@ -947,7 +947,7 @@
margin-left
:
961px
;
}
.shoppingCar
{
.shoppingCar
{
background-color
:
#f5f5f5
;
float
:
left
;
height
:
240px
;
...
...
@@ -977,6 +977,13 @@
background
:
rgba
(
233
,
38
,
1
,
0.8
);
}
&
.disable
{
background
:
#ccc
;
border
:
1px
solid
#ccc
;
color
:
white
;
}
}
.shoppingCar-nav
{
...
...
Please
register
or
login
to post a comment