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
ccbikai(👎🏻🍜)
8 years ago
Commit
3c00faf75d2f9301c173b87732d9094004bc92d3
1 parent
7fa9dba4
收券需求传入 code 和 uid
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
2 deletions
apps/home/models/coupons.js
apps/product/controllers/search.js
apps/product/models/search.js
public/js/product/search/list.js
apps/home/models/coupons.js
View file @
3c00faf
...
...
@@ -18,6 +18,7 @@ const couponData = (params) => {
elem
.
bestowLink
=
helpers
.
urlFormat
(
'/product/index/index'
,
{
coupon_id
:
elem
.
couponId
,
coupon_code
:
elem
.
couponCode
,
title
:
'优惠活动商品'
,
intro_text
:
`以下商品可使用【
$
{
elem
.
couponDetailInfomation
}
】优惠券`
}
...
...
apps/product/controllers/search.js
View file @
3c00faf
...
...
@@ -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 @
3c00faf
...
...
@@ -178,7 +178,7 @@ const _searchGoods = (params) => {
}
// 个人中心优惠券立即使用 - 商品列表
if
(
params
.
coupon_id
)
{
if
(
params
.
coupon_id
||
params
.
coupon_code
)
{
method
=
'app.search.coupon'
;
}
...
...
public/js/product/search/list.js
View file @
3c00faf
...
...
@@ -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