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
Plain Diff
Browse Files
Authored by
ccbikai(👎🏻🍜)
8 years ago
Commit
41935bf5cd30e7afa8653ea381bee6fa2da50deb
2 parents
9fac2cf4
3c00faf7
Merge branch 'feature/coupons' into release/5.7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
31 additions
and
35 deletions
apps/home/models/coupons.js
apps/home/views/action/coupons.hbs
apps/product/controllers/search.js
apps/product/models/search.js
public/hbs/home/coupons-list.hbs
public/js/product/search/list.js
apps/home/models/coupons.js
View file @
41935bf
...
...
@@ -14,16 +14,11 @@ const couponData = (params) => {
return
result
.
data
.
couponList
.
map
(
function
(
elem
)
{
delete
elem
.
id
;
elem
.
isNoLimit
=
elem
.
isNoLimit
===
'true'
;
// 全场通用
elem
.
isDiscount
=
(
`
,
$
{
elem
.
shopPriceLimits
},
`
).
indexOf
(
',1,'
)
!==
-
1
;
// 三折以下
elem
.
isLimited
=
(
`
,
$
{
elem
.
shopPriceLimits
},
`
).
indexOf
(
',2,'
)
!==
-
1
;
// 限量
elem
.
brandNameLimits
=
elem
.
brandNameLimit
&&
elem
.
brandNameLimit
.
join
(
'、'
);
elem
.
sortNameLimits
=
elem
.
sortNameLimit
&&
elem
.
sortNameLimit
.
join
(
'、'
);
if
(
status0
)
{
elem
.
bestowLink
=
helpers
.
urlFormat
(
'/product/index/index'
,
{
coupon_id
:
elem
.
couponId
,
coupon_code
:
elem
.
couponCode
,
title
:
'优惠活动商品'
,
intro_text
:
`以下商品可使用【
$
{
elem
.
couponDetailInfomation
}
】优惠券`
}
...
...
apps/home/views/action/coupons.hbs
View file @
41935bf
...
...
@@ -36,19 +36,9 @@
</div>
</div>
<div
class=
"coupon-footer hide"
>
{{#if
isNoLimit
}}
<p>
全场通用
</p>
{{/if}}
{{#if
brandNameLimits
}}
<p>
限品牌:
{{
brandNameLimits
}}
</p>
{{/if}}
{{#if
sortNameLimits
}}
<p>
限品类:
{{
sortNameLimits
}}
</p>
{{/if}}
<p>
特例商品(秒杀、限定、境外、预售
{{#if
isDiscount
}}
、3折以下
{{/if}}{{#if
isLimited
}}
、限量
{{/if}}
等)暂不支持使用优惠券。
</p>
{{#if
explains
}}
<p>
说明:
{{
explains
}}
</p>
{{/if}}
{{#
notes
}}
<p>
{{
.
}}
</p>
{{/
notes
}}
</div>
</div>
{{/
each
}}
...
...
apps/product/controllers/search.js
View file @
41935bf
...
...
@@ -249,9 +249,18 @@ const search = (req, res, next) => {
* 筛选
*/
let
filter
=
(
req
,
res
,
next
)
=>
{
res
.
header
(
'Access-Control-Allow-Origin'
,
'*'
);
let
allowOrigin
=
_
.
get
(
req
,
'headers.origin'
,
null
)
?
req
.
headers
.
origin
:
req
.
protocol
+
'://'
+
req
.
headers
.
host
;
res
.
setHeader
(
'Access-Control-Allow-Origin'
,
allowOrigin
);
res
.
setHeader
(
'Access-Control-Allow-Credentials'
,
'true'
);
let
params
=
Object
.
assign
({},
req
.
query
);
let
uid
=
req
.
user
.
uid
||
0
;
if
(
uid
)
{
params
.
uid
=
uid
;
}
searchModel
.
getFilterData
(
params
).
then
((
result
)
=>
{
res
.
render
(
'search/filter'
,
{
...
...
apps/product/models/search.js
View file @
41935bf
...
...
@@ -178,7 +178,7 @@ const _searchGoods = (params) => {
}
// 个人中心优惠券立即使用 - 商品列表
if
(
params
.
coupon_id
)
{
if
(
params
.
coupon_id
||
params
.
coupon_code
)
{
method
=
'app.search.coupon'
;
}
...
...
public/hbs/home/coupons-list.hbs
View file @
41935bf
...
...
@@ -26,20 +26,9 @@
</div>
</div>
<div
class=
"coupon-footer hide"
>
{{#if
isNoLimit
}}
<p>
全场通用
</p>
{{/if}}
{{#if
brandNameLimits
}}
<p>
限品牌:
{{
brandNameLimits
}}
</p>
{{/if}}
{{#if
sortNameLimits
}}
<p>
限品类:
{{
sortNameLimits
}}
</p>
{{/if}}
<p>
特例商品(秒杀、限定、境外、预售
{{#if
isDiscount
}}
、3折以下
{{/if}}{{#if
isLimited
}}
、限量
{{/if}}
等)暂不支持使用优惠券。
</p>
{{#if
explains
}}
<p>
说明:
{{
explains
}}
</p>
{{/if}}
{{#
notes
}}
<p>
{{
.
}}
</p>
{{/
notes
}}
</div>
</div>
{{/
each
}}
...
...
public/js/product/search/list.js
View file @
41935bf
...
...
@@ -38,6 +38,7 @@ let $input = $('#search-input').find('input[name="query"]'),
let
shopId
,
sort
,
brand
,
outlets
,
app_type
,
age_level
,
msort
,
misort
,
coin
,
app_version
,
students
,
couponId
,
searchFrom
;
let
size
,
color
,
style
,
standard
,
gender
,
price
,
p_d
,
oldquery
,
query
,
limited
,
specialoffer
,
specialsale_id
,
promotion
;
let
couponCode
;
// 默认筛选条件
let
defaultOpt
=
require
(
'common/query-param'
);
...
...
@@ -248,6 +249,7 @@ specialsale_id = getQueryString('specialsale_id');
promotion
=
getQueryString
(
'promotion'
);
students
=
getQueryString
(
'students'
);
couponId
=
getQueryString
(
'coupon_id'
);
couponCode
=
getQueryString
(
'coupon_code'
);
searchFrom
=
getQueryString
(
'from'
);
if
(
$fsgc
.
children
().
length
>
0
)
{
...
...
@@ -523,6 +525,10 @@ function search(opt) {
params
.
coupon_id
=
couponId
;
}
if
(
couponCode
)
{
params
.
coupon_code
=
couponCode
;
}
if
(
searchFrom
)
{
params
.
from
=
searchFrom
;
}
...
...
@@ -856,10 +862,17 @@ if ($brandHeader.data('isbaseshop') === true) {
pars
.
coupon_id
=
couponId
;
}
if
(
couponCode
)
{
pars
.
coupon_code
=
couponCode
;
}
$
.
extend
(
defaultOpt
,
pars
);
$
.
ajax
({
type
:
'GET'
,
url
:
location
.
protocol
+
'//m.yohobuy.com/product/search/filter'
,
xhrFields
:
{
withCredentials
:
true
},
data
:
defaultOpt
,
success
:
function
(
data
)
{
if
(
data
===
''
)
{
...
...
Please
register
or
login
to post a comment