Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
沈志敏
2016-11-24 11:54:01 +0800
Commit
873b1d337c29934469f71965d543f2d6894cce35
1 parent
305d7708
fix bug
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
67 additions
and
43 deletions
apps/product/models/detail.js
public/hbs/product/detail/infodata.hbs
public/js/cart/chose-panel.js
public/js/common/helpers/isY.js
public/js/product/new-detail.page.js
apps/product/models/detail.js
View file @
873b1d3
...
...
@@ -958,7 +958,7 @@ let _getPromotionInfo = (skn) => {
*/
let
_getFavorite
=
(
productId
,
uid
)
=>
{
if
(
!
uid
)
{
return
Promise
.
resolve
(
{}
);
return
Promise
.
resolve
(
false
);
}
return
singleAPI
.
get
(
'favorite'
,
{
method
:
'app.favorite.isFavoriteNew'
,
...
...
@@ -969,7 +969,7 @@ let _getFavorite = (productId, uid) => {
return
result
.
data
;
}
return
{}
;
return
false
;
});
};
...
...
@@ -1489,7 +1489,7 @@ const _cartCount = (uid, shoppingKey) => {
}
return
count
;
}
return
Promise
.
resolve
(
0
)
;
return
0
;
});
};
...
...
public/hbs/product/detail/infodata.hbs
View file @
873b1d3
{{#
cartInfo
}}
<div
class=
"chose-panel"
>
<div
class=
"main"
>
<div
class=
"infos"
>
<div
class=
"infos
{{#if
@root
.
tickets
}}
tickets-info
{{/if}}
"
>
<div
class=
"basic-info"
>
{{#
each
thumbs
}}
{{#if
@first
}}
<img
class=
"thumb"
src=
"
{{
img
}}
"
>
{{/if}}
<img
class=
"thumb
{{#
unless
@first
}}
hide
{{/
unless
}}
"
src=
"
{{
img
}}
"
>
{{/
each
}}
<div
class=
"text-info"
>
<p
class=
"name"
>
{{
name
}}
</p>
<p
class=
"price"
>
<span
class=
"sale-price"
>
{{
salePrice
}}
</span>
<span
class=
"market-price data-bind"
></span>
{{#if
price
}}
<span
class=
"sale-price"
>
{{
salePrice
}}
</span>
<span
class=
"market-price"
>
{{
price
}}
</span>
{{else}}
{{#
isY
isSecKill
}}
<span
class=
"sale-price"
>
{{
salePrice
}}
</span>
<span
class=
"market-price"
>
{{
salePrice
}}
</span>
{{else}}
<span
class=
"sale-price no-price"
>
{{
salePrice
}}
</span>
{{/
isY
}}
{{/if}}
</p>
</div>
</div>
<div
class=
"chose-items"
>
<div
class=
"color-list block-list"
>
<span
class=
"name"
>
颜色
</span>
<ul
id=
""
data-index=
""
class=
"size-row clearfix "
>
<li
class=
"block"
data-num=
""
>
</li>
</ul>
<span
class=
"name"
>
{{#if
@root
.
tickets
}}
日期
{{else}}
颜色
{{/if}}
</span>
{{#
each
colors
}}
<ul
id=
"
{{
id
}}
"
data-index=
"
{{
@index
}}
"
class=
"size-row clearfix
{{#
unless
@first
}}
hide
{{/
unless
}}
"
>
{{#
each
color
}}
<li
class=
"block
{{#if
chosed
}}
chosed
{{/if}}
{{#
unless
colorNum
}}
zero-stock
{{/
unless
}}
"
data-num=
"
{{
colorNum
}}
"
>
{{
name
}}
</li>
{{/
each
}}
</ul>
{{/
each
}}
</div>
<div
class=
"size-list block-list"
>
<span
class=
"name"
>
尺码
</span>
<ul
class=
"size-row clearfix"
>
<li
class=
"block "
data-num=
""
data-id=
""
data-skuid=
""
>
</li>
</ul>
<div
class=
"size-list block-list
{{#if
@root
.
single
}}
hide
{{/if}}
"
>
<span
class=
"name"
>
{{#if
@root
.
tickets
}}
区域
{{else}}
尺码
{{/if}}
</span>
{{#
each
sizes
}}
<ul
class=
"size-row clearfix
{{#
unless
@first
}}
hide
{{/
unless
}}
"
>
{{#
each
size
}}
<li
class=
"block
{{#if
chosed
}}
chosed
{{/if}}
{{#
unless
sizeNum
}}
zero-stock
{{/
unless
}}
"
data-num=
"
{{
sizeNum
}}
"
data-id=
"
{{
id
}}
"
data-skuid=
"
{{
skuId
}}
"
>
{{
name
}}
</li>
{{/
each
}}
</ul>
{{/
each
}}
</div>
<div
class=
"num"
>
<span
class=
"name"
>
数量
</span>
<div
class=
"clearfix"
>
<a
class=
"btn btn-minus"
href=
"javascript:void(0);"
>
<span
class=
"iconfont "
>

</span>
<span
class=
"iconfont
{{#if
promotionId
}}
disabled
{{/if}}
"
>

</span>
</a>
<input
id=
"good-num"
class=
"good-num disabled"
type=
"text"
value=
"1"
disabled=
"true"
>
<a
class=
"btn btn-plus"
href=
"javascript:void(0);"
>
<span
class=
"iconfont "
>

</span>
<span
class=
"iconfont
{{#if
promotionId
}}
disabled
{{/if}}
"
>

</span>
</a>
</div>
<span
class=
"left-num"
></span>
<input
id=
"left-num"
type=
"hidden"
value=
"0"
>
<input
id=
"limitNum"
type=
"hidden"
value=
""
>
<input
id=
"limitNum"
type=
"hidden"
value=
"
{{
limit
}}
"
>
</div>
</div>
</div>
<div
class=
"btn-wrap"
>
<button
id=
"chose-btn-sure"
class=
"btn btn-sure"
></button>
<button
id=
"chose-btn-sure"
class=
"btn btn-sure"
>
{{#if
@root
.
tickets
}}
立即购买
{{else}}
加入购物车
{{/if}}
</button>
</div>
</div>
<input
id=
"promotionId"
type=
"hidden"
value=
""
>
<input
id=
"single"
type=
"hidden"
value=
""
>
<input
id=
"promotionId"
type=
"hidden"
value=
"
{{
promotionId
}}
"
>
<input
id=
"single"
type=
"hidden"
value=
"
{{
@root
.
single
}}
"
>
</div>
<div
class=
"cart-bar"
>
{{#
unless
@root
.
wap
.
common
.
removeCartCount
}}
...
...
public/js/cart/chose-panel.js
View file @
873b1d3
...
...
@@ -178,12 +178,13 @@ function checkColorSizeNum() {
function
show
(
html
,
cb
)
{
if
(
html
)
{
$chosePanel
.
html
(
html
);
if
(
$
(
'#promotionId'
).
val
()
!==
''
)
{
disableNumEdit
();
}
init
();
}
if
(
$
(
'#promotionId'
).
val
()
!==
''
)
{
disableNumEdit
();
}
$
(
'.chose-panel'
).
show
();
$num
=
$
(
'#good-num'
);
cbFn
=
cb
;
...
...
@@ -558,7 +559,7 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
$chosed
=
$
(
'.block-list>ul>li.chosed'
);
if
(
$chosed
.
length
===
2
&&
$chosed
.
closest
(
'.zero-stock'
).
length
===
0
)
{
isSecKills
=
$
(
'.seckill-time'
).
length
;
// 秒杀标记
isSecKills
=
$
(
'.seckill-time'
).
length
;
// 秒杀标记
productSku
=
$curSizeBlock
.
data
(
'skuid'
);
promotionId
=
$
(
'#promotionId'
).
val
();
...
...
@@ -591,12 +592,12 @@ $yohoPage.on('touchstart', '.btn-minus', function() {
url
=
'/cart/index/modify'
;
}
else
if
(
limitProductCode
)
{
isSecKills
=
$
(
'.seckill-time'
).
length
;
// 秒杀标记
isSecKills
=
$
(
'.seckill-time'
).
length
;
// 秒杀标记
$
(
this
).
css
(
'background-color'
,
'#ccc'
).
removeAttr
(
'id'
);
// 当前面板选择的是限购商品
url
=
$
(
'#limitProductPay'
).
val
()
+
'?limitproductcode='
+
limitProductCode
+
'&sku='
+
productSku
+
'&skn='
+
skn
+
'&buy_number='
+
buyNumber
;
productSku
+
'&skn='
+
skn
+
'&buy_number='
+
buyNumber
;
removePannel
();
...
...
public/js/common/helpers/isY.js
0 → 100644
View file @
873b1d3
/**
* 判断是否是Y,应对接口经常返回Y/N做boolean
* @param string value
*/
module
.
exports
=
function
(
value
,
options
)
{
if
(
value
===
'Y'
)
{
return
options
.
fn
(
this
);
}
else
{
return
options
.
inverse
(
this
);
}
};
...
...
public/js/product/new-detail.page.js
View file @
873b1d3
var
$
=
require
(
'yoho-jquery'
),
Swiper
=
require
(
'yoho-swiper'
),
tip
=
require
(
'../plugin/tip'
),
chosePanel
=
require
(
'../common/chose-panel'
),
dialog
=
require
(
'../plugin/dialog'
),
dbClass
=
'data-bind'
;
dialog
=
require
(
'../plugin/dialog'
);
var
dbClass
=
'data-bind'
;
require
(
'../common'
);
...
...
@@ -31,7 +31,9 @@ var infoDataHbs = require('product/detail/infodata.hbs');
var
priceDataHbs
=
require
(
'product/detail/pricedata.hbs'
);
var
renderInfo
=
function
(
data
)
{
if
(
!
data
)
{
return
;
}
if
(
!
data
)
{
return
;
}
// 商品价格
if
(
data
.
goodsPrice
)
{
...
...
@@ -63,8 +65,6 @@ var renderInfo = function(data) {
return
false
;
});
},
200
);
}
else
{
chosePanel
(
data
);
}
};
...
...
@@ -73,6 +73,7 @@ var getInfoData = function() {
var
productId
=
$
(
'#productId'
).
val
();
var
goodsId
=
$
(
'#goodsId'
).
val
();
var
productSkn
=
$
(
'#productSkn'
).
val
();
if
(
productId
&&
(
goodsId
||
productSkn
))
{
$
.
ajax
({
type
:
'POST'
,
...
...
@@ -91,6 +92,7 @@ var getInfoData = function() {
// var regProSeckill = /\/product\/seckill\/pro_([\d]+)_([\d]+)/;
var
thisHref
=
window
.
location
.
href
;
var
thisRefer
=
document
.
referrer
;
if
(
!
regSeckill
.
test
(
thisRefer
))
{
if
(
data
.
isSecKill
===
'Y'
&&
(
reg
.
test
(
thisHref
)
||
regPro
.
test
(
thisHref
)))
{
window
.
location
.
replace
(
'/product/seckill/show_'
+
$
(
'#productSkn'
).
val
()
+
'.html'
);
...
...
@@ -136,6 +138,8 @@ var getInfoData = function() {
rightBtnText
:
'打开Yoho!Buy有货APP'
}
},
function
()
{
var
appUrl
=
$
(
'input[name="limitCodeUrl"]'
).
val
();
ifr
=
document
.
createElement
(
'iframe'
);
ifr
.
src
=
appUrl
;
ifr
.
style
.
display
=
'none'
;
...
...
Please
register
or
login
to post a comment