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
Plain Diff
Browse Files
Authored by
姜枫
9 years ago
Commit
70b102ed17becaa0cd2bf495464fdfc80ee5489b
2 parents
7aa4629f
cd01cf10
handle merge
Hide whitespace changes
Inline
Side-by-side
Showing
33 changed files
with
510 additions
and
111 deletions
apps/channel/controllers/index.js
apps/channel/models/channel-api.js
apps/channel/models/index.js
apps/channel/views/partial/ad-banner.hbs
apps/channel/views/partial/ad.hbs
apps/channel/views/partial/brand-img-box.hbs
apps/channel/views/partial/brand-text-box.hbs
apps/channel/views/partial/editorial.hbs
apps/channel/views/partial/new-arrival.hbs
apps/channel/views/partial/slider.hbs
apps/channel/views/partial/style-icon.hbs
apps/me/models/order.js
apps/me/models/returns.js
apps/me/views/partial/order/goods-box.hbs
apps/me/views/partial/order/table-body.hbs
apps/passport/controllers/back.js
apps/passport/controllers/bind.js
apps/passport/controllers/login.js
apps/passport/models/back-service.js
apps/passport/models/bind-api.js
apps/passport/models/login-api.js
apps/passport/models/login-service.js
apps/passport/models/passport-helper.js
apps/passport/models/reg-api.js
apps/passport/models/user-api.js
apps/passport/models/user-service.js
apps/shopping/models/order.js
config/channel-type.js
public/js/me/refund-detail.page.js
public/js/me/refund.page.js
public/js/shopping/order.page.js
public/scss/channel/_new-arrival.css
public/scss/me/order/_table.css
apps/channel/controllers/index.js
View file @
70b102e
const
model
=
require
(
'../models'
);
exports
.
index
=
(
req
,
res
)
=>
{
res
.
display
(
'index'
,
Object
.
assign
({
module
:
'channel'
,
page
:
'home'
},
model
.
getContent
()));
const
channelType
=
req
.
path
.
substring
(
1
)
||
'men'
;
model
.
getContent
(
channelType
).
then
(
result
=>
{
res
.
display
(
'index'
,
Object
.
assign
({
module
:
'channel'
,
page
:
'home'
},
result
));
});
};
...
...
apps/channel/models/channel-api.js
0 → 100644
View file @
70b102e
/**
* 频道页
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/7/26
*/
'use strict'
;
// const api = global.yoho.API;
const
api
=
global
.
yoho
.
ServiceAPI
;
const
channelMap
=
require
(
'../../../config/channel-type'
).
channelMap
;
const
getChannelDataAsync
=
type
=>
{
const
data
=
{
client_type
:
'web'
,
content_code
:
channelMap
[
type
].
code
,
gender
:
channelMap
[
type
].
gender
,
page
:
1
,
limit
:
1000
};
return
api
.
get
(
'operations/api/v5/resource/home'
,
data
,
{
cache
:
true
,
code
:
200
});
};
module
.
exports
=
{
getChannelDataAsync
};
...
...
apps/channel/models/index.js
View file @
70b102e
const
getContent
=
()
=>
{
const
content
=
{
/**
* 频道页 model
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/07/26
*/
'use strict'
;
const
channelApi
=
require
(
'./channel-api'
);
const
camelCase
=
global
.
yoho
.
camelCase
;
const
_
=
require
(
'lodash'
);
/**
* 获取slider楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const
_getSliderData
=
d
=>
{
return
{
slider
:
d
};
};
/**
* 获取BrandsAd楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const
_getBrandAdFloor
=
d
=>
{
_
.
forEach
(
d
,
data
=>
{
data
.
btnText
=
'shop now'
;
});
return
{
brandsAd
:
d
};
};
/**
* 获取new arrivals楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const
_getNewArrivals
=
d
=>
{
_
.
forEach
(
d
,
(
data
,
index
)
=>
{
if
(
index
===
0
||
index
===
d
.
length
-
1
)
{
data
.
smallImg
=
true
;
}
if
(
index
%
2
===
0
)
{
data
.
even
=
true
;
}
});
return
{
floorZh
:
'新品抢鲜看'
,
floorEn
:
'NEW ARRIVALS'
,
newArrivals
:
d
};
};
/**
* 获取classic brands楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const
_getClassicBrands
=
d
=>
{
let
brands
=
[];
let
subArr
;
let
i
=
0
;
_
.
forEach
(
d
,
(
data
,
index
)
=>
{
if
(
index
===
0
||
index
===
1
||
index
===
6
||
index
===
7
)
{
brands
.
push
({
big
:
[
d
[
index
]]
});
}
else
if
((
index
>
1
&&
index
<
6
||
index
>
7
&&
index
<
12
)
&&
index
%
2
===
0
)
{
if
(
i
<
4
)
{
subArr
=
d
.
slice
(
index
,
index
+
2
);
brands
[
i
].
small
=
subArr
;
i
+=
1
;
}
}
});
_
.
forEach
(
brands
,
(
data
,
index
)
=>
{
if
(
index
<
2
)
{
data
.
bottomSpace
=
true
;
}
if
(
index
===
1
||
index
===
3
)
{
data
.
right
=
true
;
}
});
return
{
floorZh
:
'经典品牌'
,
floorEn
:
'CLASSIC BRANDS'
,
classicBrands
:
brands
};
};
/**
* 获取潮流标志楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const
_getStyleIcon
=
d
=>
{
_
.
forEach
(
d
,
data
=>
{
data
.
btnText
=
'去看看'
;
});
return
{
floorZh
:
'潮流标志'
,
floorEn
:
'STYLE ICON'
,
styleIcon
:
d
};
};
/**
* 获取咨询楼层数据
* @param {Object} d 接口返回的楼层数据
* @return {Object} 处理之后的数据
*/
const
_getEditorial
=
d
=>
{
let
e
=
{
big
:
{},
small
:
[]
};
_
.
forEach
(
d
,
(
data
,
index
)
=>
{
if
(
index
===
0
)
{
e
.
big
=
data
;
}
else
{
e
.
small
.
push
(
data
);
}
});
_
.
forEach
(
e
.
small
,
(
data
,
index
)
=>
{
if
(
index
===
0
||
index
===
1
)
{
data
.
bottomSpace
=
true
;
}
if
(
index
===
0
||
index
===
2
)
{
data
.
rightSpace
=
true
;
}
});
return
{
floorZh
:
'资讯'
,
floorEn
:
'EDITORIAL'
,
editorial
:
e
};
};
const
floorMap
=
{
slider
:
_getSliderData
,
标题
:
_getBrandAdFloor
,
新品抢先看
:
_getNewArrivals
,
CLASSIC
:
_getClassicBrands
,
潮流标识
:
_getStyleIcon
,
EDITORIAL
:
_getEditorial
};
/**
* 获取floorMap中对应的key
* @param {String} d 含有key的字符串
* @return {String} 得到的key值
*/
const
_getKey
=
d
=>
{
let
k
=
d
.
split
(
' '
)[
0
];
return
k
;
};
/**
* 判断title类型是否为对象
* @param {Object} t title
* @return {Boolen}
*/
const
_isObjectTitle
=
t
=>
{
return
_
.
isObject
(
t
);
};
/**
* 判断是否为Banner焦点图楼层
* @param {Object} d 楼层数据
* @return {Boolen}
*/
const
_isBannerFloor
=
d
=>
{
return
d
.
templateName
===
'focus'
&&
d
.
templateIntro
===
'焦点图'
;
};
/**
* 获取用于渲染模板的数据
* @param {Object} d 接口返回的数据
* @return {Array} 模板数据数组
*/
const
_processFloorData
=
d
=>
{
let
floorList
=
[];
_
.
forEach
(
d
,
data
=>
{
let
floorTitle
;
let
floorData
;
// 处理banner
if
(
_isBannerFloor
(
data
))
{
floorData
=
floorMap
.
slider
(
data
.
data
);
// 判断标题类型
}
else
if
(
_isObjectTitle
(
data
.
data
.
title
))
{
floorTitle
=
_getKey
(
data
.
data
.
title
.
title
);
floorData
=
floorMap
[
floorTitle
](
data
.
data
.
list
);
}
else
{
floorTitle
=
_getKey
(
data
.
data
.
title
);
floorData
=
floorMap
[
floorTitle
](
data
.
data
.
list
);
}
floorList
.
push
(
floorData
);
});
return
floorList
;
};
const
getContent
=
type
=>
{
return
channelApi
.
getChannelDataAsync
(
type
).
then
(
result
=>
{
const
l
=
camelCase
(
result
.
data
.
list
);
const
floor
=
{
content
:
_processFloorData
(
l
)
};
return
floor
;
});
/* eslint-disable */
const
content
=
{
content
:
[
{
slider
:
[
...
...
@@ -250,7 +485,7 @@ const getContent = () => {
};
/* eslint-enable */
return
content
;
//
return content;
};
module
.
exports
=
{
...
...
apps/channel/views/partial/ad-banner.hbs
View file @
70b102e
<div
class=
"ad-banner"
>
{{#
adBanner
}}
<a
href=
"
{{
link
}}
"
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{
image
img
1150
160
}}
"
alt=
""
>
</a>
{{/
adBanner
}}
...
...
apps/channel/views/partial/ad.hbs
View file @
70b102e
<div
class=
"ad-container clearfix"
>
{{#
brandsAd
}}
<div
class=
"ad
{{#if
@first
}}
first
{{/if}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{
image
img
240
240
}}
"
alt=
""
>
<img
class=
"lazy-img"
data-original=
"
{{
image
src
240
240
}}
"
alt=
""
>
{{>
brand-text-box
}}
</div>
{{/
brandsAd
}}
...
...
apps/channel/views/partial/brand-img-box.hbs
View file @
70b102e
{{#
classicBrands
}}
<div
class=
"brand-img-box
{{#if
right
}}
right
{{/if}}
{{#if
bottomSpace
}}
mb10
{{/if}}
"
>
<a
href=
"
{{
link
}}
"
>
<a
href=
"
{{
url
}}
"
>
{{#
big
}}
<img
class=
"big-img lazy-img"
data-original=
"
{{
image
img
556
333
}}
"
alt=
"big-img"
>
<img
class=
"big-img lazy-img"
data-original=
"
{{
image
src
556
333
}}
"
alt=
"big-img"
>
{{/
big
}}
{{#
small
}}
<img
class=
"small-img lazy-img
{{#if
@first
}}
first
{{/if}}
"
data-original=
"
{{
image
img
283
283
}}
"
alt=
"big-img"
>
<img
class=
"small-img lazy-img
{{#if
@first
}}
first
{{/if}}
"
data-original=
"
{{
image
src
283
283
}}
"
alt=
"big-img"
>
{{/
small
}}
</a>
</div>
...
...
apps/channel/views/partial/brand-text-box.hbs
View file @
70b102e
<div
class=
"brand-text-box"
>
<h4>
{{
name
}}
</h4>
<p>
{{
des
}}
</p>
<button>
{{
btnText
}}
</button>
<h4>
{{
productName
}}
</h4>
<p>
{{
productDesc
}}
</p>
<a
href=
"
{{
url
}}
"
>
<button>
{{
btnText
}}
</button>
</a>
</div>
...
...
apps/channel/views/partial/editorial.hbs
View file @
70b102e
...
...
@@ -4,15 +4,15 @@
{{#
editorial
}}
<div
class=
"news left"
>
{{#
big
}}
<a
href=
"
{{
link
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{
image
img
395
495
}}
"
alt=
""
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{
image
src
395
495
}}
"
alt=
""
>
</a>
{{/
big
}}
</div>
<div
class=
"news right"
>
{{#
small
}}
<a
href=
"
{{
link
}}
"
>
<img
class=
"lazy-img
{{#if
bottomSpace
}}
bottom-space
{{/if}}
{{#if
rightSpace
}}
right-space
{{/if}}
"
data-original=
"
{{
image
img
360
240
}}
"
alt=
""
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"lazy-img
{{#if
bottomSpace
}}
bottom-space
{{/if}}
{{#if
rightSpace
}}
right-space
{{/if}}
"
data-original=
"
{{
image
src
360
240
}}
"
alt=
""
>
</a>
{{/
small
}}
</div>
...
...
apps/channel/views/partial/new-arrival.hbs
View file @
70b102e
...
...
@@ -4,22 +4,22 @@
{{#
newArrivals
}}
<div
class=
"arrival-item
{{#if
smallImg
}}
small-img
{{/if}}
{{#if
@last
}}
last
{{^}}
normal
{{/if}}
"
>
{{#if
even
}}
<a
href=
"
{{
link
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{#if
smallImg
}}{{
image
img
223
490
}}{{^}}{{
image
img
325
490
}}{{/if}}
"
alt=
""
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{#if
smallImg
}}{{
image
src
223
490
}}{{^}}{{
image
src
325
490
}}{{/if}}
"
alt=
""
>
</a>
<div
class=
"brand-name"
>
<a
href=
"
{{
link
}}
"
>
<a
href=
"
{{
url
}}
"
>
<span
class=
"bottom"
>
{{
name
}}
</span>
</a>
</div>
{{^}}
<div
class=
"brand-name"
>
<a
href=
"
{{
link
}}
"
>
<a
href=
"
{{
url
}}
"
>
<span
class=
"top"
>
{{
name
}}
</span>
</a>
</div>
<a
href=
"
{{
link
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{#if
smallImg
}}{{
image
img
223
490
}}{{^}}{{
image
img
325
490
}}{{/if}}
"
alt=
""
>
<a
href=
"
{{
url
}}
"
>
<img
class=
"lazy-img"
data-original=
"
{{#if
smallImg
}}{{
image
src
223
490
}}{{^}}{{
image
src
325
490
}}{{/if}}
"
alt=
""
>
</a>
{{/if}}
</div>
...
...
apps/channel/views/partial/slider.hbs
View file @
70b102e
...
...
@@ -4,7 +4,7 @@
{{#
slider
}}
<li
style=
"
{{#if
bgColor
}}
background:
{{
bgColor
}}{{/if}}
"
>
<a
href=
"
{{
url
}}
"
target=
"_blank"
>
<img
class=
"lazy"
data-original=
"
{{
image
img
1920
645
}}
"
alt=
""
>
<img
class=
"lazy"
data-original=
"
{{
image
src
1920
645
}}
"
alt=
""
>
</a>
{{#
tips
}}
<div
class=
"slide-tips"
>
...
...
@@ -23,7 +23,7 @@
{{#
pagination
}}
<li>
<a
href=
"
{{
url
}}
"
target=
"_blank"
></a>
<img
src=
"
{{
image
img
138
54
}}
"
alt=
""
>
<img
src=
"
{{
image
src
138
54
}}
"
alt=
""
>
</li>
{{/
pagination
}}
</ul>
...
...
apps/channel/views/partial/style-icon.hbs
View file @
70b102e
...
...
@@ -3,7 +3,7 @@
<div
class=
"smooth-card-container"
>
{{#
styleIcon
}}
<div
class=
"card
{{#if
@first
}}
active
{{/if}}
{{#if
@last
}}
last
{{/if}}
"
>
<img
class=
"img lazy-img"
data-original=
"
{{
image
img
221
320
}}
"
/>
<img
class=
"img lazy-img"
data-original=
"
{{
image
src
221
320
}}
"
/>
{{>
brand-text-box
}}
</div>
{{/
styleIcon
}}
...
...
apps/me/models/order.js
View file @
70b102e
...
...
@@ -220,6 +220,7 @@ const _getUserOrder = (uid, type, page) => {
let
total
=
false
;
let
curPage
=
1
;
if
(
result
&&
result
.
data
)
{
orderList
=
camelCase
(
result
.
data
.
order_list
);
total
=
result
.
data
.
total
;
...
...
@@ -229,13 +230,30 @@ const _getUserOrder = (uid, type, page) => {
orderList
.
forEach
(
item
=>
{
const
ot
=
parseInt
(
item
.
orderType
,
10
);
const
st
=
parseInt
(
item
.
status
,
10
);
let
hasRefund
=
false
;
let
canRefund
=
false
;
item
.
orderGoods
.
forEach
(
good
=>
{
let
cnAlphabet
=
good
.
cnAlphabet
?
good
.
cnAlphabet
:
''
;
good
.
goodUrl
=
helpers
.
urlFormat
(
`
/
product
/
pro_$
{
good
.
productId
}
_$
{
good
.
goodsId
}
/${cnAlphabet}.html`
)
;
// 判断该订单是否有换货商品
if
(
good
.
refundNum
)
{
hasRefund
=
true
;
good
.
changed
=
true
;
good
.
returnUrl
=
helpers
.
urlFormat
(
'/me/return'
);
// 判断该订单是否可以退换货
}
else
if
(
good
.
buyNumber
!==
good
.
refund
)
{
canRefund
=
true
;
}
});
item
.
showRefund
=
hasRefund
;
item
.
hideChange
=
!
canRefund
;
// 转换订单创建时间
item
.
createTime
=
_convertUnixTime
(
item
.
createTime
);
...
...
@@ -258,6 +276,7 @@ const _getUserOrder = (uid, type, page) => {
// 在线支付和货到付款有按钮的差异
item
.
isOnlinePaid
=
parseInt
(
item
.
paymentType
,
10
)
===
1
;
item
.
isRefundOrder
=
ot
===
7
;
if
(
item
.
isCancel
===
'Y'
)
{
item
.
showBuyBtn
=
true
;
...
...
@@ -275,9 +294,9 @@ const _getUserOrder = (uid, type, page) => {
});
return
{
orderList
:
orderList
,
total
:
total
,
curPage
:
curPage
orderList
,
total
,
curPage
};
});
};
...
...
apps/me/models/returns.js
View file @
70b102e
...
...
@@ -606,11 +606,13 @@ const getChangeGoodsList = (orderCode, uid) => {
data
.
hidePrice
=
true
;
data
.
orderCode
=
orderCode
;
data
.
goodsList
.
forEach
(
good
=>
{
good
.
showCheckbox
=
true
;
good
.
hidePrice
=
true
;
good
.
buyNumber
=
1
;
});
if
(
data
.
goodsList
)
{
data
.
goodsList
.
forEach
(
good
=>
{
good
.
showCheckbox
=
true
;
good
.
hidePrice
=
true
;
good
.
buyNumber
=
1
;
});
}
}
...
...
apps/me/views/partial/order/goods-box.hbs
View file @
70b102e
...
...
@@ -3,7 +3,14 @@
{{>
order
/
good-info
}}
{{#
unless
hidePrice
}}
<div
class=
"sub-column right-border bold"
>
<p
class=
"
{{#if
@last
}}
last
{{/if}}
"
>
¥
{{
goodsPrice
}}
</p>
<p
class=
"
{{#if
@last
}}
last
{{/if}}
"
>
¥
{{
goodsPrice
}}
{{#if
changed
}}
<a
href=
"
{{
returnUrl
}}
"
>
<span
class=
"btn white change-tag"
>
已退换
</span>
</a>
{{/if}}
</p>
</div>
<div
class=
"sub-column right-border special-column bold"
>
<p
class=
"bold"
>
{{
buyNumber
}}
</p>
...
...
apps/me/views/partial/order/table-body.hbs
View file @
70b102e
...
...
@@ -8,6 +8,9 @@
<div
class=
"common-column special-border"
>
<p
class=
"bold"
>
¥
{{
amount
}}
</p>
<p
class=
"subtext"
>
{{
paymentTypeStr
}}
</p>
{{#if
isRefundOrder
}}
<p
class=
"subtext refund-tag"
>
换货订单
</p>
{{/if}}
</div>
<div
class=
"common-column special-border status"
>
<p
class=
"bold status-str"
>
{{
statusStr
}}
</p>
...
...
@@ -29,12 +32,14 @@
{{/if}}
{{#if
showEditOption
}}
<p
class=
"subtext"
>
评价晒单
</p>
{{#
unless
hideChange
}}
<a
href=
"
{{
refundUrl
}}
"
>
<p
class=
"subtext"
>
申请退货
</p>
</a>
<a
href=
"
{{
exchangeUrl
}}
"
>
<p
class=
"subtext"
>
申请换货
</p>
</a>
{{/
unless
}}
<p
class=
"subtext delete"
>
删除订单
</p>
{{/if}}
{{#if
showGetBtn
}}
...
...
apps/passport/controllers/back.js
View file @
70b102e
...
...
@@ -6,12 +6,12 @@
'use strict'
;
const
helpers
=
global
.
yoho
.
helpers
;
const
service
=
require
(
'../models/back-service'
);
const
passportHelper
=
require
(
'../models/passport-helper'
);
const
BackService
=
require
(
'../models/back-service'
);
const
PassportHelper
=
require
(
'../models/passport-helper'
);
const
_
=
require
(
'lodash'
);
const
index
=
(
req
,
res
,
next
)
=>
{
s
ervice
.
indexPageDataAsync
()
BackS
ervice
.
indexPageDataAsync
()
.
then
(
result
=>
{
res
.
display
(
'back/index'
,
Object
.
assign
({
module
:
'passport'
,
...
...
@@ -27,7 +27,7 @@ const validateInputAPI = (req, res, next) => {
let
userInput
=
req
.
body
.
phoneNum
||
''
;
let
areaCode
=
(
req
.
body
.
area
||
'86'
).
replace
(
'+'
,
''
);
s
ervice
.
validateEmailOrMobileAsync
(
userInput
,
areaCode
)
BackS
ervice
.
validateEmailOrMobileAsync
(
userInput
,
areaCode
)
.
then
(
result
=>
{
req
.
inputInfo
=
result
;
next
();
...
...
@@ -44,7 +44,7 @@ const validateInputPage = (req, res, next) => {
let
userInput
=
req
.
body
.
phoneNum
||
''
;
let
areaCode
=
(
req
.
body
.
area
||
'86'
).
replace
(
'+'
,
''
);
s
ervice
.
validateEmailOrMobileAsync
(
userInput
,
areaCode
)
BackS
ervice
.
validateEmailOrMobileAsync
(
userInput
,
areaCode
)
.
then
(
result
=>
{
req
.
inputInfo
=
result
;
next
();
...
...
@@ -57,7 +57,7 @@ const validateInputPage = (req, res, next) => {
const
getUserInfoAPI
=
(
req
,
res
,
next
)
=>
{
let
inputInfo
=
req
.
inputInfo
;
s
ervice
.
findUserAsync
(
inputInfo
.
type
,
inputInfo
.
phone
,
inputInfo
.
area
)
BackS
ervice
.
findUserAsync
(
inputInfo
.
type
,
inputInfo
.
phone
,
inputInfo
.
area
)
.
then
(
result
=>
{
res
.
json
(
result
);
})
...
...
@@ -67,7 +67,7 @@ const getUserInfoAPI = (req, res, next) => {
const
sendCodePage
=
(
req
,
res
,
next
)
=>
{
let
inputInfo
=
req
.
inputInfo
;
s
ervice
.
sendCodeToUserAsync
(
inputInfo
.
type
,
inputInfo
.
phone
,
inputInfo
.
area
)
BackS
ervice
.
sendCodeToUserAsync
(
inputInfo
.
type
,
inputInfo
.
phone
,
inputInfo
.
area
)
.
then
(
result
=>
{
if
(
!
(
result
.
code
&&
result
.
code
===
200
))
{
return
res
.
redirect
(
helpers
.
urlFormat
(
'/passport/back/index'
));
...
...
@@ -100,7 +100,7 @@ const sendBackMobileAPI = (req, res, next) => {
let
mobile
=
req
.
body
.
mobile
||
''
;
let
area
=
req
.
body
.
area
||
'86'
;
s
ervice
.
sendCodeToMobileAsync
(
area
,
mobile
)
BackS
ervice
.
sendCodeToMobileAsync
(
area
,
mobile
)
.
then
(
result
=>
{
res
.
json
(
result
);
})
...
...
@@ -111,7 +111,7 @@ const validateMobileAPI = (req, res, next) => {
let
mobile
=
req
.
body
.
mobile
||
''
;
const
ERR
=
{
code
:
400
,
message
:
'验证失败'
};
if
(
!
p
assportHelper
.
validator
.
verifyMobile
(
mobile
))
{
if
(
!
P
assportHelper
.
validator
.
verifyMobile
(
mobile
))
{
return
res
.
json
(
ERR
);
}
...
...
@@ -154,7 +154,7 @@ const validateCodeByEmailPage = (req, res, next) => {
return
next
();
}
s
ervice
.
checkEmailCodeAsync
(
code
)
BackS
ervice
.
checkEmailCodeAsync
(
code
)
.
then
(
result
=>
{
if
(
!
result
)
{
return
res
.
redirect
(
helpers
.
urlFormat
(
'/passport/back/index'
));
...
...
@@ -232,7 +232,7 @@ const verifyCodeByMobileAPI = (req, res) => {
return
res
.
json
(
ERR
);
}
s
ervice
.
verifyCodyByMobileAsync
(
area
,
mobile
,
mobileCode
)
BackS
ervice
.
verifyCodyByMobileAsync
(
area
,
mobile
,
mobileCode
)
.
then
(
result
=>
{
res
.
json
(
result
);
})
...
...
@@ -271,7 +271,7 @@ const validateCodeByMobilePage = (req, res, next) => {
};
code
=
new
Buffer
(
code
,
'base64'
).
toString
();
req
.
mobileAuth
=
s
ervice
.
authRequest
(
data
,
code
);
req
.
mobileAuth
=
BackS
ervice
.
authRequest
(
data
,
code
);
next
();
};
...
...
@@ -279,7 +279,7 @@ const validateCodeByMobilePage = (req, res, next) => {
const
validatePwdPage
=
(
req
,
res
,
next
)
=>
{
let
pwd
=
req
.
body
.
pwd
||
''
;
if
(
!
passportHelper
.
validator
.
is
Password
(
pwd
))
{
if
(
!
PassportHelper
.
validator
.
verify
Password
(
pwd
))
{
return
res
.
redirect
(
helpers
.
urlFormat
(
'/passport/back/index'
));
}
...
...
@@ -291,7 +291,7 @@ const updatePwdAPI = (req, res, next) => {
let
mobileAuth
=
req
.
mobileAuth
||
{};
let
newPassword
=
req
.
body
.
pwd
||
''
;
s
ervice
.
updatePwdAsync
(
code
,
mobileAuth
,
newPassword
)
BackS
ervice
.
updatePwdAsync
(
code
,
mobileAuth
,
newPassword
)
.
then
(
result
=>
{
if
(
result
.
status
)
{
req
.
session
.
successType
=
result
.
type
;
...
...
apps/passport/controllers/bind.js
View file @
70b102e
...
...
@@ -9,6 +9,7 @@
const
_
=
require
(
'lodash'
);
const
helpers
=
global
.
yoho
.
helpers
;
const
PassportHelper
=
require
(
'../models/passport-helper'
);
const
UserService
=
require
(
'../models/user-service'
);
const
BindService
=
require
(
'../models/bind-service'
);
const
LoginService
=
require
(
'../models/login-service'
);
...
...
@@ -191,17 +192,17 @@ const bindCheck = (req, res, next) => {
// 绑定流程:code=200 未注册,可绑定
return
{
code
:
200
,
message
:
result
.
message
,
data
:
{
next
:
nextUrl
}};
}
else
if
(
result
.
code
===
200
&&
result
.
data
.
is_register
===
1
)
{
return
PassportHelper
.
getUserInfo
(
area
,
mobile
).
then
(
user
=>
{
return
UserService
.
getUserInfoAsync
(
area
,
mobile
).
then
(
user
=>
{
// 绑定流程:code=201 已注册 绑定过其他第三方
return
{
code
:
201
,
message
:
result
.
message
,
data
:
{
user
:
user
}};
});
}
else
if
(
result
.
code
===
200
&&
result
.
data
.
is_register
===
3
)
{
// 关联流程
return
PassportHelper
.
getUserInfo
(
area
,
mobile
).
then
(
user
=>
{
return
UserService
.
getUserInfoAsync
(
area
,
mobile
).
then
(
user
=>
{
return
{
code
:
203
,
message
:
result
.
message
,
data
:
{
user
:
user
}};
});
}
else
if
(
result
.
code
===
506
||
result
.
code
===
505
)
{
return
PassportHelper
.
getUserInfo
(
area
,
mobile
).
then
(
user
=>
{
return
UserService
.
getUserInfoAsync
(
area
,
mobile
).
then
(
user
=>
{
// 绑定流程:code=201 已注册 绑定过其他第三方
return
{
code
:
205
,
message
:
result
.
message
,
data
:
{
user
:
user
}};
});
...
...
apps/passport/controllers/login.js
View file @
70b102e
...
...
@@ -146,7 +146,7 @@ const local = {
let
refer
=
req
.
cookies
.
refer
;
if
(
isRemember
)
{
yield
LoginService
.
rememberAccount
({
yield
LoginService
.
rememberAccount
Async
({
area
:
req
.
body
.
areaCode
||
'86'
,
account
:
req
.
body
.
account
,
password
:
req
.
body
.
password
...
...
apps/passport/models/back-service.js
View file @
70b102e
...
...
@@ -11,9 +11,9 @@ const moment = require('moment');
const
helpers
=
global
.
yoho
.
helpers
;
const
api
=
require
(
'./back-api'
);
const
userService
=
require
(
'./user-service'
);
const
passportHelper
=
require
(
'./passport-helper'
);
const
backHelper
=
require
(
'./back-helper'
);
const
UserService
=
require
(
'./user-service'
);
const
PassportHelper
=
require
(
'./passport-helper'
);
const
BackHelper
=
require
(
'./back-helper'
);
/**
* 验证手机和邮箱输入正确性
...
...
@@ -22,13 +22,13 @@ const validateEmailOrMobileAsync = (userInput, areaCode) => {
return
new
Promise
(
function
(
resolve
,
rejected
)
{
let
result
=
{
type
:
'email'
,
area
:
''
,
phone
:
''
};
if
(
p
assportHelper
.
validator
.
verifyEmail
(
userInput
))
{
if
(
P
assportHelper
.
validator
.
verifyEmail
(
userInput
))
{
result
.
type
=
'email'
;
result
.
area
=
''
;
result
.
phone
=
userInput
;
resolve
(
result
);
}
else
if
(
p
assportHelper
.
validator
.
verifyMobile
(
userInput
))
{
}
else
if
(
P
assportHelper
.
validator
.
verifyMobile
(
userInput
))
{
result
.
type
=
'mobile'
;
result
.
area
=
areaCode
;
result
.
phone
=
userInput
;
...
...
@@ -54,8 +54,8 @@ const findUserAsync = (type, phone, area) => {
};
const
findBy
=
{
email
:
userService
.
findByEmailAsync
,
mobile
:
(
phone1
,
area1
)
=>
userService
.
findByMobileAsync
(
area1
,
phone1
)
// 交换参数
email
:
UserService
.
findByEmailAsync
,
mobile
:
(
phone1
,
area1
)
=>
UserService
.
findByMobileAsync
(
area1
,
phone1
)
// 交换参数
};
const
OK
=
{
code
:
200
,
message
:
MESSAGE
.
ok
};
...
...
@@ -97,7 +97,7 @@ const sendCodeToMobileAsync = (areaCode, mobile) => {
*/
const
indexPageDataAsync
=
()
=>
{
return
co
(
function
*
()
{
let
countryList
=
p
assportHelper
.
getCountry
();
let
countryList
=
P
assportHelper
.
getCountry
();
return
{
back
:
{
...
...
@@ -133,7 +133,7 @@ const verifyCodyByMobileAsync = (area, mobile, mobileCode) => {
createdAt
:
moment
().
unix
()
};
data
.
code
=
new
Buffer
(
b
ackHelper
.
makeToken
(
data
)).
toString
(
'base64'
);
data
.
code
=
new
Buffer
(
B
ackHelper
.
makeToken
(
data
)).
toString
(
'base64'
);
return
{
code
:
200
,
...
...
@@ -148,7 +148,7 @@ const verifyCodyByMobileAsync = (area, mobile, mobileCode) => {
* 手机 token 合法性验证
*/
const
authRequest
=
(
data
,
token
)
=>
{
if
(
!
b
ackHelper
.
validateToken
(
data
,
token
))
{
if
(
!
B
ackHelper
.
validateToken
(
data
,
token
))
{
return
{};
}
...
...
apps/passport/models/bind-api.js
View file @
70b102e
...
...
@@ -9,6 +9,9 @@
const
api
=
global
.
yoho
.
API
;
/**
* 登录检查用户是否登录注册
*/
const
bindCheckAsync
=
(
mobile
,
openId
,
sourceType
,
area
)
=>
{
let
params
=
{
method
:
'app.passport.signCheck'
,
...
...
@@ -21,6 +24,9 @@ const bindCheckAsync = (mobile, openId, sourceType, area) => {
return
api
.
get
(
''
,
params
);
};
/**
* 发送绑定信息短信
*/
const
sendBindMsgAsync
=
(
area
,
mobile
)
=>
{
let
params
=
{
method
:
'app.passport.smsbind'
,
...
...
@@ -31,6 +37,9 @@ const sendBindMsgAsync = (area, mobile) => {
return
api
.
get
(
''
,
params
);
};
/**
* 验证手机注册码
*/
const
checkBindCodeAsync
=
(
area
,
mobile
,
code
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.register.validRegCode'
,
...
...
@@ -40,6 +49,9 @@ const checkBindCodeAsync = (area, mobile, code) => {
});
};
/**
* 绑定用户信息接口
*/
const
bindMobileAsync
=
(
openId
,
sourceType
,
mobile
,
area
,
password
,
nickname
)
=>
{
let
params
=
{
method
:
'app.passport.bind'
,
...
...
@@ -60,6 +72,9 @@ const bindMobileAsync = (openId, sourceType, mobile, area, password, nickname) =
return
api
.
get
(
''
,
params
);
};
/**
* 关联用户信息
*/
const
relateMobileAsync
=
(
openId
,
sourceType
,
mobile
,
area
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.passport.relatedMobile'
,
...
...
@@ -70,6 +85,9 @@ const relateMobileAsync = (openId, sourceType, mobile, area) => {
});
};
/**
* 改变手机号检查
*/
const
changeCheckAsync
=
(
mobile
,
area
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.passport.changeCheck'
,
...
...
@@ -78,6 +96,9 @@ const changeCheckAsync = (mobile, area) => {
});
};
/**
* 改变手机号绑定
*/
const
changeMobileAsync
=
(
uid
,
mobile
,
area
,
code
)
=>
{
return
api
.
get
(
''
,
{
method
:
'app.passport.changeMobile'
,
...
...
apps/passport/models/login-api.js
View file @
70b102e
...
...
@@ -6,6 +6,9 @@
const
api
=
global
.
yoho
.
API
;
/**
* 手机或邮箱登录
*/
const
signinAsync
=
(
area
,
profile
,
password
,
shoppingKey
)
=>
{
let
param
=
{
method
:
'app.passport.signin'
,
...
...
@@ -21,6 +24,9 @@ const signinAsync = (area, profile, password, shoppingKey) => {
return
api
.
post
(
''
,
param
);
};
/**
* 除微信第三方登录
*/
const
signinByOtherOpenIDAsync
=
(
nickname
,
openId
,
sourceType
,
shoppingKey
)
=>
{
let
param
=
{
nickname
:
nickname
,
...
...
@@ -36,6 +42,9 @@ const signinByOtherOpenIDAsync = (nickname, openId, sourceType, shoppingKey) =>
return
api
.
get
(
''
,
param
);
};
/**
* 微信第三方登录
*/
const
signinByWechatAsync
=
(
nickname
,
openId
,
sourceType
,
shoppingKey
,
unionId
)
=>
{
let
param
=
{
nickname
:
nickname
,
...
...
apps/passport/models/login-service.js
View file @
70b102e
...
...
@@ -11,7 +11,7 @@ const sign = global.yoho.sign;
const
config
=
global
.
yoho
.
config
;
const
api
=
require
(
'./login-api'
);
const
u
serService
=
require
(
'./user-service'
);
const
U
serService
=
require
(
'./user-service'
);
const
signinByOpenIDAsync
=
(
nickname
,
openId
,
sourceType
,
shoppingKey
,
unionId
)
=>
{
let
signinFunc
=
{
...
...
@@ -26,7 +26,7 @@ const signinByOpenIDAsync = (nickname, openId, sourceType, shoppingKey, unionId)
};
const
syncUserSession
=
(
uid
,
req
,
res
)
=>
{
return
userService
.
profile
(
uid
).
then
((
userInfo
)
=>
{
return
UserService
.
profileAsync
(
uid
).
then
((
userInfo
)
=>
{
let
token
=
sign
.
makeToken
(
uid
);
let
user
=
userInfo
.
data
;
...
...
@@ -55,7 +55,7 @@ const syncUserSession = (uid, req, res) => {
});
};
const
rememberAccount
=
(
accountInfo
,
req
,
res
)
=>
{
const
rememberAccount
Async
=
(
accountInfo
,
req
,
res
)
=>
{
let
aWeek
=
(
new
Date
()).
getTime
()
/
1000
+
504000
;
// 504000-一周
let
rememKey
=
md5
(
md5
(
accountInfo
.
account
+
accountInfo
.
password
+
accountInfo
.
area
));
...
...
@@ -76,5 +76,5 @@ module.exports = {
signinAsync
:
api
.
signinAsync
,
signinByOpenIDAsync
,
syncUserSession
,
rememberAccount
rememberAccount
Async
};
...
...
apps/passport/models/passport-helper.js
View file @
70b102e
...
...
@@ -5,11 +5,6 @@
const
_
=
require
(
'lodash'
);
const
helpers
=
global
.
yoho
.
helpers
;
const
UserService
=
require
(
'./user-service'
);
const
DEFAULT_HEAD_IMG_ICO
=
'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'
;
/**
* 国家数据
*/
...
...
@@ -106,7 +101,7 @@ const verifyMobile = phone => {
/**
* 密码是否合法
*/
const
is
Password
=
pwd
=>
{
const
verify
Password
=
pwd
=>
{
if
(
!
pwd
)
{
return
false
;
}
...
...
@@ -116,32 +111,11 @@ const isPassword = pwd => {
return
pwdRegexp
.
test
(
_
.
trim
(
pwd
));
};
/**
* 第三方登录 根据手机号获取用户相关信息
*/
const
getUserInfo
=
(
area
,
mobile
)
=>
{
return
UserService
.
findByMobileAsync
(
area
,
mobile
).
then
(
user
=>
{
let
profile
=
(
user
.
profile_name
||
mobile
).
toString
();
if
((
profile
.
length
===
11
&&
profile
.
indexOf
(
'*'
)
<
0
)
||
(
profile
.
indexOf
(
'-'
)
>=
0
&&
profile
.
indexOf
(
'*'
)
<
0
))
{
profile
=
profile
.
substring
(
0
,
3
)
+
'****'
+
profile
.
substring
(
7
,
11
);
}
return
{
username
:
profile
,
headImg
:
user
.
head_ico
?
helpers
.
image
(
user
.
head_ico
,
100
,
100
,
2
)
:
DEFAULT_HEAD_IMG_ICO
,
bindLogin
:
helpers
.
urlFormat
(
'/signin'
,
{
bindMobile
:
mobile
,
bindArea
:
area
})
};
});
};
module
.
exports
=
{
validator
:
{
verifyMobile
,
verifyEmail
,
is
Password
verify
Password
},
getCountry
,
getUserInfo
getCountry
};
...
...
apps/passport/models/reg-api.js
View file @
70b102e
...
...
@@ -4,6 +4,9 @@
'use strict'
;
const
api
=
global
.
yoho
.
API
;
/**
* 发送注册验证码
*/
let
sendCodeToMobileAsync
=
(
area
,
mobile
)
=>
{
let
params
=
{
method
:
'app.register.sendRegCodeToMobile'
,
...
...
@@ -14,6 +17,9 @@ let sendCodeToMobileAsync = (area, mobile) => {
return
api
.
post
(
''
,
params
);
};
/**
* 检查注册验证码
*/
let
validMobileCodeAsync
=
(
area
,
mobile
,
code
)
=>
{
let
params
=
{
method
:
'app.register.validRegCode'
,
...
...
@@ -25,6 +31,9 @@ let validMobileCodeAsync = (area, mobile, code) => {
return
api
.
post
(
''
,
params
);
};
/**
* 注册帐号
*/
let
regMobileAsync
=
(
area
,
mobile
,
password
,
shoppingKey
)
=>
{
let
params
=
{
method
:
'app.passport.register'
,
...
...
apps/passport/models/user-api.js
View file @
70b102e
...
...
@@ -46,7 +46,10 @@ const findByEmailAsync = (email) => {
});
};
const
profile
=
(
uid
)
=>
{
/**
* 获得个人信息
*/
const
profileAsync
=
(
uid
)
=>
{
let
param
=
{
uid
:
uid
,
method
:
'app.passport.profile'
...
...
@@ -58,5 +61,5 @@ const profile = (uid) => {
module
.
exports
=
{
findByMobileAsync
,
findByEmailAsync
,
profile
profile
Async
};
...
...
apps/passport/models/user-service.js
View file @
70b102e
...
...
@@ -4,5 +4,28 @@
'use strict'
;
const
api
=
require
(
'./user-api'
);
const
helpers
=
global
.
yoho
.
helpers
;
module
.
exports
=
api
;
const
DEFAULT_HEAD_IMG_ICO
=
'http://img10.static.yhbimg.com/headimg/2013/11/28/09/01cae078abe5fe320c88cdf4c220212688.gif?imageView/2/w/100/h/100'
;
/**
* 第三方登录 根据手机号获取用户相关信息
*/
const
getUserInfoAsync
=
(
area
,
mobile
)
=>
{
return
api
.
findByMobileAsync
(
area
,
mobile
).
then
(
user
=>
{
let
profile
=
(
user
.
profile_name
||
mobile
).
toString
();
if
((
profile
.
length
===
11
&&
profile
.
indexOf
(
'*'
)
<
0
)
||
(
profile
.
indexOf
(
'-'
)
>=
0
&&
profile
.
indexOf
(
'*'
)
<
0
))
{
profile
=
profile
.
substring
(
0
,
3
)
+
'****'
+
profile
.
substring
(
7
,
11
);
}
return
{
username
:
profile
,
headImg
:
user
.
head_ico
?
helpers
.
image
(
user
.
head_ico
,
100
,
100
,
2
)
:
DEFAULT_HEAD_IMG_ICO
,
bindLogin
:
helpers
.
urlFormat
(
'/signin'
,
{
bindMobile
:
mobile
,
bindArea
:
area
})
};
});
};
module
.
exports
=
Object
.
assign
(
api
,
{
getUserInfoAsync
});
...
...
apps/shopping/models/order.js
View file @
70b102e
...
...
@@ -122,7 +122,7 @@ const compute = (uid, yohoCoin) => {
* 提交订单api调用
* @param number uid user id
* @param number address_id 地址id
* @param number
yohoCoin 使用的有货币
* @param number
use_yoho_coin 使用的有货币(元)
* @param string invoices_title 发票抬头
* @param int invoices_type_id 发票内容
* @param string remark 备注
...
...
@@ -137,7 +137,7 @@ const _submit = (uid, other) => {
method
:
'app.Shopping.submit'
,
uid
:
uid
,
address_id
:
other
.
address_id
,
yohoCoin
:
other
.
yohoC
oin
,
use_yoho_coin
:
other
.
use_yoho_c
oin
,
remark
:
other
.
remark
,
isPrintPrice
:
other
.
isPrintPrice
,
delivery_time
:
other
.
delivery_time
,
...
...
@@ -163,20 +163,15 @@ const _submit = (uid, other) => {
*/
const
submit
=
(
uid
,
other
)
=>
{
let
theOther
=
{};
let
coin
=
other
.
coin
;
Object
.
assign
(
theOther
,
other
,
{
delivery_time
:
2
,
// 平时和周末都送货
delivery_way
:
1
,
// 普通快递
payment_id
:
1
,
// 支付宝
payment_type
:
1
// 在线支付
payment_type
:
1
,
// 在线支付
use_yoho_coin
:
other
.
use_yoho_coin
/
100
// 有货币稀释
});
// 有货币稀释
if
(
coin
)
{
coin
=
coin
/
100
;
}
return
_submit
(
uid
,
theOther
).
then
(
result
=>
result
);
};
...
...
config/channel-type.js
0 → 100644
View file @
70b102e
/**
* 共用的map数据常量定义
* @author: 赵彪<bill.zhao@yoho.cn>
* @date: 2016/07/26
*/
'use strict'
;
const
channelMap
=
{
men
:
{
code
:
'39c103615558890846e56749af040228'
,
gender
:
'1,3'
},
women
:
{
code
:
'527079e6c46d0f125eb46b835968971b'
,
gender
:
'2,3'
},
lifestyle
:
{
code
:
'94b5ed607b6d565ffc29c2c04be121dc'
,
gender
:
''
}
};
const
meCode
=
'02889429674251b93f2add429008e1f8'
;
module
.
exports
=
{
channelMap
,
meCode
};
...
...
public/js/me/refund-detail.page.js
View file @
70b102e
...
...
@@ -18,6 +18,11 @@ var $expressCompany = $('.express-company'),
var
id
=
$mainWrap
.
data
(
'id'
),
expressList
=
$editExpress
.
data
();
$
(
'.blk-footer .return-top'
).
remove
();
// 移除通用的返回顶部组件
require
(
'../common/header'
);
// header
require
(
'../common/return-top'
);
// return-top
function
cancelRefundApply
()
{
$
.
ajax
({
type
:
'POST'
,
...
...
public/js/me/refund.page.js
View file @
70b102e
...
...
@@ -34,7 +34,11 @@ var tpl = '<div class="img-wrap" data-img="{{data}}">' +
var
checked
;
$
(
'.blk-footer .return-top'
).
remove
();
// 移除通用的返回顶部组件
require
(
'../plugins/check'
);
require
(
'../common/header'
);
// header
require
(
'../common/return-top'
);
// return-top
lazyload
(
$
(
'img.lazy'
));
...
...
public/js/shopping/order.page.js
View file @
70b102e
...
...
@@ -252,7 +252,7 @@ $('.print-price-radio').check({
$
(
'#balance-list'
).
on
(
'click'
,
'#submit-order'
,
function
()
{
var
reqParam
=
{
address_id
:
$
(
'.address.focus'
).
data
(
'id'
),
yohoC
oin
:
getCoinUsed
(),
use_yoho_c
oin
:
getCoinUsed
(),
remark
:
$
(
'#remark-content'
).
val
(),
isPrintPrice
:
$printPrice
.
printPrice
};
...
...
public/scss/channel/_new-arrival.css
View file @
70b102e
...
...
@@ -29,10 +29,12 @@
&.top
{
line-height
:
30px
;
position
:
static
!important
;
}
&
.bottom
{
line-height
:
56px
;
position
:
static
!important
;
}
}
}
...
...
public/scss/me/order/_table.css
View file @
70b102e
...
...
@@ -14,6 +14,25 @@
margin
:
$
space
0
;
}
.refund-tag
{
width
:
55%
;
padding
:
5px
0
;
border-radius
:
10px
;
margin
:
0
auto
;
background-color
:
orange
;
color
:
#fff
;
}
.change-tag
{
margin
:
10px
auto
0
;
color
:
#1b1b1b
;
&:hover
{
background-color
:
#1b1b1b
;
color
:
#fff
;
}
}
.badge
{
min-width
:
16px
;
line-height
:
16px
;
...
...
Please
register
or
login
to post a comment