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
郝肖肖
8 years ago
Commit
60cda76bf494dc250c91e5285d56b014f81bedab
1 parent
5bde690c
品牌优惠券
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
37 additions
and
30 deletions
apps/product/controllers/list.js
apps/product/models/list.js
apps/product/router.js
public/js/product/shop/shop-coupon.js
public/scss/product/search/_list.css
public/scss/product/shop/_shop-index-coupon.css
apps/product/controllers/list.js
View file @
60cda76
...
...
@@ -486,6 +486,8 @@ const userCoupon = (req, res, next) => {
let
cryptCouponId
=
crypto
.
decrypt
(
''
,
req
.
body
.
couponID
);
let
uid
=
req
.
body
.
uid
||
req
.
user
.
uid
;
let
isApp
=
req
.
body
.
app_version
||
req
.
body
.
appVersion
||
false
;
let
data
=
{};
if
(
uid
)
{
listModel
.
receiveCoupon
(
...
...
@@ -496,32 +498,19 @@ const userCoupon = (req, res, next) => {
return
;
}).
catch
(
next
);
}
else
{
data
.
code
=
4401
;
// 401错误已经被接口占用
let
refer
=
req
.
get
(
'referer'
);
let
toUrl
=
helpers
.
urlFormat
(
'/signin.html'
,
{
refer
:
refer
});
if
(
req
.
yoho
.
isApp
!==
'false'
)
{
let
toUrl
=
refer
+
'&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'
+
refer
+
if
(
isApp
)
{
toUrl
+=
'&openby:yohobuy={"action":"go.weblogin","params":{"jumpurl":{"url":"'
+
refer
+
'","param":{}},"requesturl":{"param":{"method":"app.promotion.getCoupon","couponId":"'
+
cryptCouponId
+
'"},"url":"'
+
_
.
get
(
global
,
'yoho.API.ApiUrl'
,
''
)
+
'"},"priority":"Y"}}'
;
res
.
json
({
code
:
4401
,
url
:
toUrl
});
}
else
{
res
.
json
({
code
:
4401
,
url
:
helpers
.
urlFormat
(
'/signin.html'
,
{
refer
:
refer
})
});
cryptCouponId
+
'"},"url":"'
+
_
.
get
(
global
,
'yoho.API.ApiUrl'
,
''
)
+
'"},"priority":"Y"}}'
;
}
data
.
url
=
toUrl
;
res
.
json
(
data
);
}
};
/**
...
...
@@ -554,14 +543,14 @@ const getShopCouponsList = (req, res, next) => {
*/
const
getBrandCouponsList
=
(
req
,
res
,
next
)
=>
{
let
uid
=
req
.
query
.
uid
||
req
.
user
.
uid
;
let
shopId
=
req
.
query
.
shop
Id
;
let
brandId
=
req
.
query
.
brand
Id
;
let
param
=
{};
if
(
uid
)
{
param
.
uid
=
uid
;
}
param
.
shop_id
=
shop
Id
;
param
.
brand_id
=
brand
Id
;
listModel
.
brandCouponsList
(
param
).
then
(
result
=>
{
res
.
json
(
result
);
...
...
@@ -579,5 +568,6 @@ module.exports = {
baseShopFav
,
shopCategory
,
userCoupon
,
getShopCouponsList
getShopCouponsList
,
getBrandCouponsList
};
...
...
apps/product/models/list.js
View file @
60cda76
...
...
@@ -877,7 +877,23 @@ const brandCouponsList = (params) => {
let
shopCoupons
=
[];
let
couPonstatus
;
console
.
log
(
result
,
'===='
);
if
(
result
.
data
&&
result
.
data
.
coupons
)
{
_
.
forEach
(
result
.
data
.
coupons
,
value
=>
{
couPonstatus
=
parseInt
(
value
.
status
,
10
);
if
(
couPonstatus
===
1
||
couPonstatus
===
3
)
{
shopCoupons
.
push
({
validity
:
value
.
couponValidity
,
id
:
crypto
.
encryption
(
''
,
value
.
coupon_id
+
''
),
name
:
value
.
coupon_name
,
pic
:
value
.
coupon_pic
,
money
:
parseInt
(
value
.
money
,
10
),
status
:
couPonstatus
===
1
});
}
});
}
return
{
couponsOne
:
shopCoupons
.
length
<=
1
,
coupons
:
shopCoupons
...
...
apps/product/router.js
View file @
60cda76
...
...
@@ -127,6 +127,7 @@ router.get('/index/baseShopFav', list.baseShopFav);
router
.
get
(
'/index/category'
,
list
.
shopCategory
);
router
.
post
(
'/index/userCoupon'
,
list
.
userCoupon
);
router
.
get
(
'/index/getShopCouponsList'
,
list
.
getShopCouponsList
);
router
.
get
(
'/index/getBrandCouponsList'
,
list
.
getBrandCouponsList
);
// 店铺介绍
router
.
get
(
'/index/intro'
,
list
.
shopIntro
);
...
...
public/js/product/shop/shop-coupon.js
View file @
60cda76
...
...
@@ -6,7 +6,6 @@ require('../../common');
var
shopCoupon
=
{};
console
.
log
(
$
(
'.shop-id'
).
val
(),
$
(
'.shop-id'
).
val
()
===
''
,
'==='
);
shopCoupon
=
{
common
:
{
appVersion
:
window
.
queryString
.
app_version
||
window
.
queryString
.
appVersion
,
...
...
@@ -22,9 +21,9 @@ shopCoupon = {
var
that
=
this
,
_url
=
location
.
protocol
+
'//m.yohobuy.com'
;
if
(
that
.
common
.
shopId
===
''
)
{
_url
=
'/product/index/getBrandCouponsList'
;
_url
+
=
'/product/index/getBrandCouponsList'
;
}
else
{
_url
=
'/product/index/getShopCouponsList'
;
_url
+
=
'/product/index/getShopCouponsList'
;
}
$
.
ajax
({
...
...
@@ -64,8 +63,9 @@ shopCoupon = {
$
.
ajax
({
method
:
'POST'
,
url
:
location
.
protocol
+
'//m.yohobuy.com
/product/index/userCoupon'
,
url
:
'
/product/index/userCoupon'
,
data
:
{
appVersion
:
$self
.
common
.
appVersion
,
couponID
:
code
,
uid
:
$self
.
common
.
uid
},
...
...
public/scss/product/search/_list.css
View file @
60cda76
...
...
@@ -151,7 +151,7 @@
bottom
:
0
;
background
:
rgba
(
0
,
0
,
0
,
0.3
);
padding
:
88px
0
;
z-index
:
1
;
z-index
:
1
0
;
overflow
:
auto
;
.brand-intro
{
...
...
public/scss/product/shop/_shop-index-coupon.css
View file @
60cda76
...
...
@@ -85,7 +85,7 @@
.coupon-left
.coupon-left-name
{
font-size
:
18px
;
width
:
150px
;
height
:
45
px
;
height
:
50
px
;
line-height
:
24px
;
padding-top
:
2px
;
overflow
:
hidden
;
...
...
Please
register
or
login
to post a comment