Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
王水玲
9 years ago
Commit
3736110b9674dd5ce2efbd85521d62d28c348408
1 parent
e5e13be0
商品详情页
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
24 deletions
apps/product/models/item-api.js
apps/product/models/item-handler.js
apps/product/models/item.js
apps/product/models/item-api.js
View file @
3736110
...
...
@@ -18,8 +18,8 @@ const SingleAPI = global.yoho.SingleAPI;
*/
const
getProductBaseAsync
=
(
productId
,
uid
,
skn
)
=>
{
let
params
=
{
method
:
'h5.product.data'
,
productId
:
productId
method
:
'app.product.data'
,
product_id
:
productId
};
if
(
uid
)
{
...
...
apps/product/models/item-handler.js
View file @
3736110
...
...
@@ -319,12 +319,12 @@ const setBrandBanner = (base, brand, shop) => {
*/
const
setProductData
=
base
=>
{
let
resData
=
{
id
:
base
.
i
d
,
id
:
base
.
productI
d
,
name
:
base
.
productName
,
brandName
:
_
.
has
(
base
,
'brand
.brandName'
)
?
base
.
brand
.
brandName
:
''
,
brandName
:
_
.
has
(
base
,
'brand
Info.brandName'
)
?
base
.
brandInfo
.
brandName
:
''
,
intro
:
base
.
salesPhrase
,
sellPrice
:
base
.
productPriceBo
.
salesPrice
,
marketPrice
:
base
.
productPriceBo
.
marketPrice
,
sellPrice
:
base
.
salesPrice
,
marketPrice
:
base
.
marketPrice
,
total
:
0
};
...
...
@@ -350,7 +350,7 @@ const setProductData = base => {
return
;
}
if
(
value
.
goodsI
magesList
)
{
if
(
value
.
i
magesList
)
{
group
=
{
name
:
value
.
colorName
,
title
:
`
$
{
resData
.
name
}
$
{
value
.
colorName
}
`
,
...
...
@@ -369,7 +369,7 @@ const setProductData = base => {
}
// 商品颜色列表
_
.
forEach
(
value
.
goodsI
magesList
,
function
(
subValue
)
{
_
.
forEach
(
value
.
i
magesList
,
function
(
subValue
)
{
thumbs
.
push
(
subValue
.
imageUrl
);
});
group
.
thumbs
=
thumbs
;
...
...
@@ -390,17 +390,17 @@ const setProductData = base => {
}
// 商品尺码列表
_
.
forEach
(
value
.
goodsSizeBo
List
,
function
(
subValue
)
{
_
.
forEach
(
value
.
size
List
,
function
(
subValue
)
{
let
size
=
{
name
:
subValue
.
sizeName
,
title
:
subValue
.
sizeName
,
sku
:
subValue
.
goodsSizeSkuId
,
num
:
_
.
toInteger
(
subValue
.
goodsSizeStorageNum
),
goodsId
:
subValue
.
goodsId
sku
:
subValue
.
productSku
,
num
:
_
.
toInteger
(
subValue
.
storageNumber
),
goodsId
:
value
.
goodsId
};
// 虚拟商品,增加为一件
if
(
subValu
e
.
attribute
===
3
)
{
if
(
bas
e
.
attribute
===
3
)
{
size
.
num
=
size
.
num
>
1
?
1
:
0
;
}
...
...
apps/product/models/item.js
View file @
3736110
...
...
@@ -10,9 +10,8 @@ const itemApi = require('./item-api');
const
brandApi
=
require
(
'./brand-api'
);
const
shopApi
=
require
(
'./shop-api'
);
const
itemFun
=
require
(
'./item-handler'
);
const
search
=
require
(
'./search-api'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
/**
* 根据商品基本信息获取商品品牌、材质、尺码、描述、详情等
...
...
@@ -21,10 +20,10 @@ const search = require('./search-api');
* @return { Object } 返回单个商品品牌、材质、尺码、描述、详情等信息
*/
const
_getMultiResourceByBaseInfo
=
(
base
)
=>
{
const
productId
=
base
.
id
;
const
skn
=
base
.
erpProductId
;
const
brandId
=
base
.
brandId
||
0
;
const
brandDomain
=
_
.
get
(
base
,
'brand.brandDomain'
,
false
);
const
productId
=
base
.
productId
;
const
skn
=
base
.
productSkn
;
const
brandId
=
base
.
brandInfo
.
brandId
||
0
;
const
brandDomain
=
_
.
get
(
base
,
'brandInfo.brandName'
,
false
);
const
shopId
=
base
.
shopId
||
0
;
let
apiIndex
=
{};
...
...
@@ -91,14 +90,18 @@ const getProductItemData = (params, url, uid) => {
let
resData
=
{};
let
data
=
{};
result
=
camelCase
(
result
.
data
);
// 如果status为0,即商品下架时则返回空对象
if
(
!
result
.
status
)
{
if
(
!
result
.
goodsList
[
0
].
status
)
{
return
resData
;
}
if
(
!
result
.
productName
&&
!
result
.
erpProductId
&&
!
result
.
productPriceBo
)
{
!
result
.
productSkn
&&
!
result
.
salesPrice
&&
!
result
.
marketPrice
)
{
return
resData
;
}
...
...
@@ -109,8 +112,8 @@ const getProductItemData = (params, url, uid) => {
data
.
goodInfo
=
itemFun
.
setProductData
(
result
);
// BRAND品牌简介
if
(
result
.
brand
)
{
Object
.
assign
(
data
,
itemFun
.
setBrandIntro
(
result
.
brand
));
if
(
result
.
brandInfo
)
{
Object
.
assign
(
data
,
itemFun
.
setBrandIntro
(
result
.
brandInfo
));
}
return
_getMultiResourceByBaseInfo
(
result
).
then
(
mulRes
=>
{
...
...
Please
register
or
login
to post a comment