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
zzzzzzz
9 years ago
Commit
b74e6d5588322c8d8ded5ab7909eac8d59fcbd4f
1 parent
88b4cb38
商品详情
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
38 deletions
apps/product/models/detail.js
apps/product/models/intro.js
apps/product/models/detail.js
View file @
b74e6d5
...
...
@@ -12,7 +12,7 @@ const comment = require('./consult-comment');
const
api
=
global
.
yoho
.
API
;
const
helpers
=
global
.
yoho
.
helpers
;
const
SINGLE_TICKETS_SKN
=
51335912
;
// 展览票
const
SINGLE_TICKETS_SKN
=
51335912
;
// 展览票
/**
* 获取用户数据信息
...
...
@@ -163,7 +163,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest
.
loginUrl
=
helpers
.
urlFormat
(
'/signin.html'
,
params
);
}
// 商品促销短语
(app不确定)
// 商品促销短语
if
(
origin
.
salesPhrase
)
{
dest
.
goodsSubtitle
=
origin
.
salesPhrase
;
}
...
...
@@ -219,10 +219,10 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 商品价格
let
goodsPrice
=
{
currentPrice
:
origin
.
format
Market
Price
currentPrice
:
origin
.
format
SalesPrice
===
'0'
?
origin
.
formatMarketPrice
:
origin
.
formatSales
Price
};
if
(
origin
.
formatMarketPrice
!==
origin
.
formatSalesPrice
)
{
if
(
origin
.
format
SalesPrice
!==
'0'
&&
origin
.
format
MarketPrice
!==
origin
.
formatSalesPrice
)
{
goodsPrice
.
previousPrice
=
origin
.
formatMarketPrice
;
}
...
...
@@ -234,13 +234,18 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
}
// VIP 商品价格
if
(
origin
.
vip
Prices
)
{
if
(
origin
.
vip
)
{
let
vipList
=
[];
let
levelList
=
{
银卡
:
1
,
金卡
:
2
,
白金
:
3
};
_
.
forEach
(
origin
.
vip
Prices
,
function
(
value
)
{
_
.
forEach
(
origin
.
vip
,
function
(
value
)
{
vipList
.
push
({
level
:
value
.
vipLevel
,
text
:
value
.
vipPrice
,
level
:
levelList
[
value
.
caption
],
text
:
value
.
price
,
currentLevel
:
(
value
.
vipLevel
===
vipLevel
)
});
});
...
...
@@ -275,30 +280,10 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
dest
.
feedbacks
.
consultsUrl
=
helpers
.
urlFormat
(
'/product/detail/consultform'
,
consultParams
);
}
// 商品评价
dest
.
feedbacks
.
commentsNum
=
0
;
if
(
origin
.
commentBoWrapper
)
{
dest
.
feedbacks
.
commentsNum
=
origin
.
commentBoWrapper
.
commentTotal
;
let
commentList
=
[];
_
.
forEach
(
origin
.
commentBoWrapper
.
commentBoList
,
function
(
value
)
{
commentList
.
push
({
userName
:
value
.
nickName
,
desc
:
`
$
{
value
.
colorName
}
/${value.sizeName}`
,
content
:
value
.
content
?
value
.
content
:
''
,
time
:
value
.
createTime
});
});
dest
.
feedbacks
.
comments
=
commentList
;
dest
.
feedbacks
.
commentsUrl
=
helpers
.
urlFormat
(
'/product/detail/comments'
,
{
product_id
:
origin
.
productId
,
total
:
dest
.
feedbacks
.
commentsNum
});
}
dest
.
feedbacks
.
commentsUrl
=
helpers
.
urlFormat
(
'/product/detail/comments'
,
{
product_id
:
origin
.
productId
,
});
// 品牌信息
if
(
origin
.
brand
)
{
...
...
@@ -325,6 +310,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
}
colorStorageNum
=
0
;
// 商品分组
if
(
value
.
imagesList
)
{
_
.
forEach
(
value
.
imagesList
,
function
(
good
)
{
...
...
@@ -359,7 +345,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
};
allSizeList
[
sizeName
]
=
(
allSizeList
[
sizeName
]
===
null
||
typeof
allSizeList
[
sizeName
]
===
'undefined'
)
?
build
:
typeof
allSizeList
[
sizeName
]
===
'undefined'
)
?
build
:
allSizeList
[
sizeName
];
colorStorageNum
+=
parseInt
(
size
.
storageNumber
,
10
);
...
...
@@ -401,6 +387,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
colorGroup
[
i
]
=
{
color
:
[]
};
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
_
.
forEach
(
colorList
,
(
colorArr
)
=>
{
let
tempColorArr
=
_
.
cloneDeep
(
colorArr
);
...
...
@@ -438,7 +425,6 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
// 商品图:多个
console
.
log
(
goodsGroup
);
if
(
goodsGroup
.
length
>
1
)
{
let
bannerList
=
[];
...
...
@@ -464,9 +450,9 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
numInCart
:
0
,
goodsInstore
:
origin
.
storageSum
};
let
soldOut
=
(
origin
.
storageSum
===
0
)
||
(
origin
.
status
===
0
||
totalStorageNum
===
0
);
//status
let
soldOut
=
(
origin
.
storageSum
===
0
)
||
(
totalStorageNum
===
0
);
// status
let
notForSale
=
origin
.
attribute
===
2
;
// 显示加入购物车链接
if
(
!
soldOut
&&
!
notForSale
)
{
_
.
orderBy
(
colorGroup
);
...
...
@@ -486,7 +472,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => {
if
(
origin
.
isLimitBuy
)
{
// 是否开售
let
isBeginSale
=
(
origin
.
saleStatus
!==
null
&&
typeof
origin
.
saleStatus
!==
'undefined'
&&
origin
.
saleStatus
===
1
);
origin
.
saleStatus
===
1
);
// 限购商品有关的展示状态
let
showStatus
=
1
;
...
...
@@ -663,7 +649,6 @@ let getProductData = (data) => {
consults
:
_
.
take
(
info
[
3
],
2
)
});
}
return
finalResult
;
});
...
...
apps/product/models/intro.js
View file @
b74e6d5
...
...
@@ -348,7 +348,7 @@ let getintroIntro = (data) => {
result
=
result
(
'#productDesc'
);
return
result
.
html
(
).
replace
(
/<img src=/g
,
'<img class="lazy" src="data:image/gif;'
+
return
(
result
.
html
()
||
''
).
replace
(
/<img src=/g
,
'<img class="lazy" src="data:image/gif;'
+
'base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw=="'
+
' data-original='
).
replace
(
/<img border="0" src=/g
,
'<img border="0" class="lazy" '
+
'src="data:image/gif;base64,'
+
...
...
Please
register
or
login
to post a comment