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
yyq
9 years ago
Commit
dba601cf8b79aa8635bd47501f1c4a635583eaa2
1 parent
348d5b4f
为你优选
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
262 additions
and
225 deletions
apps/product/controllers/detail.js
apps/product/models/detail.js
apps/product/models/preference.js
apps/product/views/action/detail/preference.hbs
apps/product/views/partial/product/detail/recommend-content.hbs
public/scss/product/detail/_comments-consults.css
public/scss/product/detail/_detail.css
public/scss/product/detail/_recommend-for-you.css
apps/product/controllers/detail.js
View file @
dba601c
...
...
@@ -70,14 +70,13 @@ exports.intro = (req, res) => {
*/
exports
.
preference
=
(
req
,
res
)
=>
{
preference
({
productskn
:
req
.
params
.
productskn
,
yhchannel
:
req
.
params
.
yhchannel
,
brandId
:
req
.
params
.
brandId
productskn
:
req
.
query
.
productSkn
,
yhchannel
:
1
,
brandId
:
req
.
query
.
brandId
}).
then
((
result
)
=>
{
res
.
render
(
'detail/preference'
,
{
result
:
result
,
res
.
render
(
'detail/preference'
,
Object
.
assign
({
layout
:
false
});
}
,
result
)
);
});
};
...
...
apps/product/models/detail.js
View file @
dba601c
...
...
@@ -288,11 +288,9 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => {
// 品牌信息
if
(
origin
.
brand
)
{
let
extra
=
`
?
productSkn
=
$
{
origin
.
erpProductId
}
&
brandId
=
$
{
origin
.
brand
.
id
}
`
;
dest
.
preferenceUrl
=
helpers
.
urlFormat
(
'/product/detail/preference'
,
{
productSkn
:
origin
.
erpProductId
,
brandId
:
origin
.
brand
.
id
});
dest
.
preferenceUrl
=
`
/
product
/
detail
/
preference$
{
extra
}
`
;
}
dest
.
productSkn
=
origin
.
erpProductId
;
...
...
apps/product/models/preference.js
View file @
dba601c
...
...
@@ -7,12 +7,41 @@
'use strict'
;
const
_
=
require
(
'lodash'
);
const
productProcess
=
require
(
`
$
{
global
.
utils
}
/product-process`
)
;
const
api
=
global
.
yoho
.
API
;
const
helpers
=
global
.
yoho
.
helpers
;
const
_formatProduct
=
(
data
)
=>
{
let
list
=
[];
_
.
forEach
(
data
,
function
(
value
)
{
if
(
!
value
.
product_skn
||
!
value
.
goods_list
||
!
value
.
goods_list
.
length
)
{
return
;
}
value
.
goodsId
=
value
.
goods_list
[
0
].
goods_id
;
let
goods
=
{
salePrice
:
value
.
sales_price
?
value
.
sales_price
:
''
,
price
:
value
.
market_price
?
value
.
market_price
:
''
,
url
:
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
value
.
product_id
}
_$
{
value
.
goodsId
}
/${value.cn_alphabet}.html`
)
,
thumb
:
value
.
default_images
,
name
:
value
.
product_name
};
// 市场价和售价一样,则不显示市场价
if
(
goods
.
salePrice
===
goods
.
price
)
{
goods
.
price
=
false
;
}
list
.
push
(
goods
);
});
return
list
;
};
module
.
exports
=
(
data
)
=>
{
let
finalResult
;
let
finalResult
=
{}
;
return
api
.
get
(
''
,
{
method
:
'h5.preference.Search'
,
...
...
@@ -20,9 +49,8 @@ module.exports = (data) => {
yhchannel
:
data
.
yhchannel
,
brandId
:
data
.
brandId
}).
then
(
result
=>
{
if
(
!
_
.
isEmpty
(
result
)
&&
result
.
code
===
200
)
{
// 为你优选数据处理,接口没有数据,待处理,待验证
finalResult
=
productProcess
.
processProductList
(
result
.
data
);
if
(
result
)
{
finalResult
.
recommendList
=
_formatProduct
(
result
);
}
return
finalResult
;
...
...
apps/product/views/action/detail/preference.hbs
View file @
dba601c
{{>
product
/
detail
/
recommend-for-you
}}
\ No newline at end of file
{{>
product
/
detail
/
recommend-content
}}
\ No newline at end of file
...
...
apps/product/views/partial/product/detail/recommend-content.hbs
0 → 100644
View file @
dba601c
<div
class=
"title"
>
为您优选新品
</div>
<div
id=
"swiper-recommend"
class=
"swiper-container"
>
<div
class=
"swiper-wrapper swiper-wrapper-recommend"
>
{{#
recommendList
}}
<a
class=
"swiper-slide"
href=
"
{{
url
}}
"
>
<img
class=
"swiper-lazy img-box"
data-src=
"
{{
image
thumb
299
388
}}
"
>
<div
class=
"sale-name"
>
{{
name
}}
</div>
<div
class=
"price"
>
<span
class=
"sale-price
{{^
price
}}
no-price
{{/
price
}}
"
>
¥
{{
salePrice
}}
</span>
{{#
price
}}
<span
class=
"old-price"
>
¥
{{
.
}}
</span>
{{/
price
}}
</div>
<div
class=
"swiper-lazy-preloader"
></div>
</a>
{{/
recommendList
}}
</div>
</div>
\ No newline at end of file
...
...
public/scss/product/detail/_comments-consults.css
View file @
dba601c
...
...
@@ -256,203 +256,3 @@
margin-top
:
20px
;
}
}
.good-detail-page
{
.feedback-list
{
padding-top
:
30px
;
margin-bottom
:
30px
;
background-color
:
#f0f0f0
;
.nav-tab
{
width
:
100%
;
height
:
60px
;
padding
:
10px
0
;
background-color
:
#fff
;
border-top
:
1px
solid
$
borderC
;
border-bottom
:
1px
solid
$
borderC
;
}
.comment-nav
,
.consult-nav
{
box-sizing
:
border-box
;
float
:
left
;
width
:
50%
;
height
:
60px
;
line-height
:
60px
;
font-size
:
28px
;
text-align
:
center
;
color
:
$
subFontC
;
&.focus
{
color
:
#000
;
}
}
.comment-nav
{
border-right
:
1px
solid
#ccc
;
}
.content-main
{
background-color
:
#fff
;
border-bottom
:
1px
solid
$
borderC
;
}
.content-main.comment-content-main
{
.user-name
{
font-size
:
24px
;
line-height
:
62px
;
color
:
$
mainFontC
;
padding-left
:
28px
;
padding-right
:
18px
;
}
.goods-spec
,
.comment-time
{
font-size
:
24px
;
line-height
:
62px
;
}
.detail-content
{
font-size
:
24px
;
line-height
:
62px
;
color
:
$
mainFontC
;
padding-left
:
28px
;
padding-right
:
18px
;
}
.goods-spec
,
.comment-time
{
font-size
:
24px
;
line-height
:
62px
;
}
.detail-content
{
font-size
:
28px
;
line-height
:
36px
;
}
.goods-spec
,
.detail-content
{
color
:
$
mainFontC
;
}
.detail-content
,
.comment-time
{
padding-left
:
28px
;
}
.detail-content
{
padding-right
:
28px
;
padding-left
:
28px
;
}
.detail-content
{
padding-right
:
28px
;
}
.comment-time
{
color
:
#c1c1c1
;
}
}
.content-main.consult-content-main
{
padding-right
:
28px
;
padding-left
:
28px
;
padding-top
:
20px
;
padding-bottom
:
20px
;
.question
{
font-size
:
24px
;
color
:
$
mainFontC
;
span
{
display
:
block
;
float
:
left
;
font-size
:
inherit
;
padding-right
:
15px
;
}
p
{
overflow
:
hidden
;
}
}
.time
{
font-size
:
22px
;
color
:
$
subFontC
;
}
.answer
{
font-size
:
24px
;
line-height
:
36px
;
color
:
$
subFontC
;
margin-top
:
14px
;
span
{
display
:
block
;
float
:
left
;
font-size
:
inherit
;
color
:
$
mainFontC
;
padding-right
:
15px
;
}
p
{
overflow
:
hidden
;
}
}
}
.content-main.no-item
{
height
:
200px
;
line-height
:
200px
;
color
:
#e0e0e0
;
font-size
:
16
PX
;
text-align
:
center
;
span
{
display
:
inline-block
;
font-size
:
16
PX
;
padding-right
:
5
PX
;
}
}
.comment-content-footer
,
.consult-content-footer
{
display
:
block
;
min-height
:
88px
;
text-align
:
center
;
background-color
:
#fff
;
border-bottom
:
1px
solid
$
borderC
;
line-height
:
88px
;
font-size
:
28px
;
color
:
#b0b0b0
;
.iconfont
{
font-size
:
inherit
;
}
}
.content.hide
{
display
:
none
;
}
.nodata
{
height
:
88px
;
font-size
:
28px
;
line-height
:
88px
;
background-color
:
#fff
;
padding
:
0
28px
;
border-top
:
1px
solid
$
borderC
;
border-bottom
:
1px
solid
$
borderC
;
.go-consult
{
float
:
right
;
color
:
$
subFontC
;
span
{
font-size
:
28px
;
}
}
}
}
}
...
...
public/scss/product/detail/_detail.css
View file @
dba601c
...
...
@@ -490,6 +490,203 @@ $basicBtnC: #eb0313;
}
}
.feedback-list
{
padding-top
:
30px
;
margin-bottom
:
30px
;
background-color
:
#f0f0f0
;
.nav-tab
{
width
:
100%
;
padding
:
10px
0
;
background-color
:
#fff
;
border-top
:
1px
solid
$
borderC
;
border-bottom
:
1px
solid
$
borderC
;
}
.comment-nav
,
.consult-nav
{
box-sizing
:
border-box
;
float
:
left
;
width
:
50%
;
height
:
60px
;
line-height
:
60px
;
font-size
:
28px
;
text-align
:
center
;
color
:
$
subFontC
;
&.focus
{
color
:
#000
;
}
}
.comment-nav
{
border-right
:
1px
solid
#ccc
;
}
.content-main
{
background-color
:
#fff
;
border-bottom
:
1px
solid
$
borderC
;
}
.content-main.comment-content-main
{
.user-name
{
font-size
:
24px
;
line-height
:
62px
;
color
:
$
mainFontC
;
padding-left
:
28px
;
padding-right
:
18px
;
}
.goods-spec
,
.comment-time
{
font-size
:
24px
;
line-height
:
62px
;
}
.detail-content
{
font-size
:
24px
;
line-height
:
62px
;
color
:
$
mainFontC
;
padding-left
:
28px
;
padding-right
:
18px
;
}
.goods-spec
,
.comment-time
{
font-size
:
24px
;
line-height
:
62px
;
}
.detail-content
{
font-size
:
28px
;
line-height
:
36px
;
}
.goods-spec
,
.detail-content
{
color
:
$
mainFontC
;
}
.detail-content
,
.comment-time
{
padding-left
:
28px
;
}
.detail-content
{
padding-right
:
28px
;
padding-left
:
28px
;
}
.detail-content
{
padding-right
:
28px
;
}
.comment-time
{
color
:
#c1c1c1
;
}
}
.content-main.consult-content-main
{
padding-right
:
28px
;
padding-left
:
28px
;
padding-top
:
20px
;
padding-bottom
:
20px
;
.question
{
font-size
:
24px
;
color
:
$
mainFontC
;
span
{
display
:
block
;
float
:
left
;
font-size
:
inherit
;
padding-right
:
15px
;
}
p
{
overflow
:
hidden
;
}
}
.time
{
font-size
:
22px
;
color
:
$
subFontC
;
}
.answer
{
font-size
:
24px
;
line-height
:
36px
;
color
:
$
subFontC
;
margin-top
:
14px
;
span
{
display
:
block
;
float
:
left
;
font-size
:
inherit
;
color
:
$
mainFontC
;
padding-right
:
15px
;
}
p
{
overflow
:
hidden
;
}
}
}
.content-main.no-item
{
height
:
200px
;
line-height
:
200px
;
color
:
#e0e0e0
;
font-size
:
16
PX
;
text-align
:
center
;
span
{
display
:
inline-block
;
font-size
:
16
PX
;
padding-right
:
5
PX
;
}
}
.comment-content-footer
,
.consult-content-footer
{
display
:
block
;
min-height
:
88px
;
text-align
:
center
;
background-color
:
#fff
;
border-bottom
:
1px
solid
$
borderC
;
line-height
:
88px
;
font-size
:
28px
;
color
:
#b0b0b0
;
.iconfont
{
font-size
:
inherit
;
}
}
.content.hide
{
display
:
none
;
}
.nodata
{
height
:
88px
;
font-size
:
28px
;
line-height
:
88px
;
background-color
:
#fff
;
padding
:
0
28px
;
border-top
:
1px
solid
$
borderC
;
border-bottom
:
1px
solid
$
borderC
;
.go-consult
{
float
:
right
;
color
:
$
subFontC
;
span
{
font-size
:
28px
;
}
}
}
}
/*
底部固定栏
*/
...
...
public/scss/product/detail/_recommend-for-you.css
View file @
dba601c
...
...
@@ -3,6 +3,7 @@
border-top
:
1px
solid
#e0e0e0
;
border-bottom
:
1px
solid
#e0e0e0
;
background
:
#fff
;
font-size
:
12px
;
.title
{
color
:
#444
;
...
...
@@ -15,19 +16,15 @@
padding
:
30px
0
20px
;
width
:
100%
;
.swiper-wrapper
{
padding
:
0
30px
;
}
.swiper-slide
{
float
:
left
;
padding
:
0
10px
;
margin
:
0
10px
;
width
:
156px
;
&:first-child
{
padding-left
:
30px
;
}
&
:last-child
{
padding-right
:
30px
;
}
img
{
width
:
100%
;
height
:
208px
;
...
...
Please
register
or
login
to post a comment