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
xuqi
9 years ago
Commit
5c852073d2488a873d2e0ae1a71c0b2d98457fa9
2 parents
a523e48a
e454b065
Merge branch 'release/1.0' of
http://git.yoho.cn/fe/yoho-blk
into release/1.0
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
93 additions
and
19 deletions
apps/product/router.js
apps/shopping/models/pay.js
apps/shopping/views/action/cart.hbs
apps/shopping/views/partial/cart/cart-list-body.hbs
config/common.js
doraemon/middleware/auth.js
public/js/product/list/favorite.js
public/js/shopping/cart/stepper.js
public/js/shopping/pay.page.js
public/scss/shopping/_cart-products.css
public/scss/shopping/_pay.css
apps/product/router.js
View file @
5c85207
...
...
@@ -6,6 +6,7 @@
'use strict'
;
const
auth
=
require
(
`
$
{
global
.
middleware
}
/auth`
)
;
const
router
=
require
(
'express'
).
Router
();
// eslint-disable-line
const
cRoot
=
'./controllers'
;
const
list
=
require
(
cRoot
+
'/list'
);
...
...
@@ -19,14 +20,14 @@ router.get('/list', list.index); // 列表页面
router
.
get
(
'/list/new'
,
list
.
newPage
);
// 新品列表页
router
.
get
(
/
\/
pro_
([\d]
+
)
_
([\d]
+
)\/(
.*
)
/
,
item
.
index
);
// 商品详情routers
router
.
post
(
'/item/togglecollect'
,
fav
.
product
);
// 商品详情页
router
.
post
(
'/item/togglecollect'
,
auth
,
fav
.
product
);
// 商品详情页
router
.
get
(
'/item/getProductInfo'
,
item
.
getProductInfo
);
// 商品详情信息
router
.
get
(
'/shop/query/all'
,
shop
.
indexQuery
);
router
.
get
(
'/shop/:domain/list'
,
shop
.
list
);
router
.
get
(
'/shop/:domain'
,
shop
.
index
);
router
.
post
(
'/shop/togglecollect'
,
fav
.
shop
);
router
.
post
(
'/brand/togglecollect'
,
fav
.
brand
);
router
.
post
(
'/shop/togglecollect'
,
auth
,
fav
.
shop
);
router
.
post
(
'/brand/togglecollect'
,
auth
,
fav
.
brand
);
router
.
get
(
'/query'
,
query
.
index
);
...
...
apps/shopping/models/pay.js
View file @
5c85207
...
...
@@ -23,10 +23,8 @@ const getOnlinePayProvider = () => {
return
[];
}
console
.
log
(
result
.
data
);
let
online
=
_
(
result
.
data
)
.
filter
(
i
=>
_
.
includes
([
'Alipay'
,
'Wechatqrcode'
],
i
.
payCode
))
.
filter
(
i
=>
_
.
includes
([
'Alipay'
],
i
.
payCode
))
.
map
(
i
=>
{
return
{
id
:
i
.
id
,
...
...
apps/shopping/views/action/cart.hbs
View file @
5c85207
...
...
@@ -231,16 +231,16 @@
<div class="pro-list">
\{{#each invalidPros}}
<ul>
<li class="chk">
<li class="chk"
data-product_info='{"goods_type": "invalid", "buy_number": \{{buy_number}}, "selected": "\{{selected}}", "product_sku": "\{{product_sku}}", "promotion_id": 0}'
>
<span class="iconfont warning"></span>
</li>
<li>
<a href="
/product/pro_\{{product_id}}_\{{goods_id}}/\{{cn_alphabet}}.html" target="_blank
">
<a href="
javascript:void(0)
">
<img src="\{{image goods_images 100 134}}" alt="\{{product_name}}">
</a>
</li>
<li class="pro-info">
<div class="pro-name"><a href="
/product/pro_\{{product_id}}_\{{goods_id}}/\{{cn_alphabet}}.html" target="_blank
">\{{product_name}}</a></div>
<div class="pro-name"><a href="
javascript:void(0)
">\{{product_name}}</a></div>
<div>
\{{#if color_name}}
<span class="mr20">颜色: \{{color_name}}</span>
...
...
apps/shopping/views/partial/cart/cart-list-body.hbs
View file @
5c85207
...
...
@@ -111,16 +111,16 @@
<div
class=
"pro-list"
>
{{#
each
invalidPros
}}
<ul>
<li
class=
"chk"
>
<li
class=
"chk"
data-product_info=
'{"goods_type": "invalid", "buy_number":
{{
buy_number
}}
, "selected": "
{{
selected
}}
", "product_sku": "
{{
product_sku
}}
", "promotion_id": 0}'
>
<span
class=
"iconfont warning"
>

</span>
</li>
<li>
<a
href=
"
/product/pro_
{{
product_id
}}
_
{{
goods_id
}}
/
{{
cn_alphabet
}}
.html"
target=
"_blank
"
>
<a
href=
"
javascript:void(0)
"
>
<img
src=
"
{{
image
goods_images
100
134
}}
"
alt=
"
{{
product_name
}}
"
>
</a>
</li>
<li
class=
"pro-info"
>
<div
class=
"pro-name"
><a
href=
"
/product/pro_
{{
product_id
}}
_
{{
goods_id
}}
/
{{
cn_alphabet
}}
.html"
target=
"_blank
"
>
{{
product_name
}}
</a></div>
<div
class=
"pro-name"
><a
href=
"
javascript:void(0)
"
>
{{
product_name
}}
</a></div>
<div>
{{#if
color_name
}}
<span
class=
"mr20"
>
颜色:
{{
color_name
}}
</span>
...
...
@@ -131,7 +131,7 @@
</div>
</li>
<li
class=
"price-num"
>
<span
class=
"price sale-price"
>
¥
{{
round
sales
P
rice
2
}}
</span>
<span
class=
"price sale-price"
>
¥
{{
round
sales
_p
rice
2
}}
</span>
{{>
cart
/
stepper
}}
</li>
<li
class=
"total-price-action"
>
...
...
config/common.js
View file @
5c85207
...
...
@@ -19,8 +19,8 @@ module.exports = {
},
cookieDomain
:
'yohobuy.com'
,
domains
:
{
api
:
'http://testapi.yoho.cn:28078/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service
:
'http://testservice.yoho.cn:28077/'
,
// testservice.yoho.cn:28077 devservice.yoho.cn:58077
api
:
'http://api.yoho.cn/'
,
// devapi.yoho.cn:58078 testapi.yoho.cn:28078 devapi.yoho.cn:58078
service
:
'http://service.yoho.cn/'
,
// testservice.yoho.cn:28077 devservice.yoho.cn:58077
search
:
'http://192.168.102.216:8080/yohosearch/'
},
useOneapm
:
false
,
...
...
doraemon/middleware/auth.js
View file @
5c85207
...
...
@@ -14,7 +14,15 @@ module.exports = (req, res, next) => {
return
req
.
protocol
+
'://'
+
req
.
get
(
'host'
)
+
req
.
originalUrl
;
};
let
loginUrl
=
helpers
.
urlFormat
(
'/passport/login'
,
{
refer
:
req
.
getUrl
()});
let
refer
=
''
;
if
(
req
.
method
===
'GET'
)
{
refer
=
req
.
getUrl
();
}
else
{
refer
=
req
.
get
(
'Referer'
);
}
let
loginUrl
=
helpers
.
urlFormat
(
'/passport/login'
,
{
refer
:
refer
});
if
(
_
.
isEmpty
(
req
.
user
)
||
!
req
.
user
.
uid
)
{
if
(
req
.
xhr
)
{
...
...
public/js/product/list/favorite.js
View file @
5c85207
...
...
@@ -7,6 +7,8 @@
function
_favBack
(
data
)
{
if
(
data
&&
data
.
code
===
200
)
{
$
(
'#brand-fav'
).
toggleClass
(
'coled'
);
}
else
if
(
data
&&
data
.
data
&&
data
.
data
.
refer
)
{
location
.
href
=
data
.
data
.
refer
;
}
}
...
...
public/js/shopping/cart/stepper.js
View file @
5c85207
...
...
@@ -77,7 +77,7 @@ var Stepper = {
currNum
=
$input
.
val
();
plus
=
$input
.
parent
().
next
();
if
(
!
$target
.
hasClass
(
'disable'
))
{
if
(
!
$target
.
hasClass
(
'disable'
)
&&
!
$target
.
parents
(
'.cart-pro-list'
).
hasClass
(
'invalid-pros'
)
)
{
sku
=
$
.
parseJSON
(
$target
.
parents
(
'ul'
).
children
().
first
().
attr
(
'data-product_info'
)).
product_sku
;
goodType
=
$target
.
parent
().
attr
(
'data-producttype'
);
_this
.
decrease
(
goodType
,
sku
,
currNum
,
function
(
num
,
changed
)
{
...
...
@@ -103,7 +103,7 @@ var Stepper = {
currNum
=
$input
.
val
();
minus
=
$input
.
parent
().
prev
();
if
(
!
$target
.
hasClass
(
'disable'
))
{
if
(
!
$target
.
hasClass
(
'disable'
)
&&
!
$target
.
parents
(
'.cart-pro-list'
).
hasClass
(
'invalid-pros'
)
)
{
sku
=
$
.
parseJSON
(
$target
.
parents
(
'ul'
).
children
().
first
().
attr
(
'data-product_info'
)).
product_sku
;
goodType
=
$target
.
parent
().
attr
(
'data-producttype'
);
_this
.
increase
(
goodType
,
sku
,
currNum
,
function
(
num
,
changed
,
overflow
)
{
...
...
public/js/shopping/pay.page.js
View file @
5c85207
...
...
@@ -6,6 +6,24 @@ var $ = require('yoho-jquery');
var
$orderDetail
=
$
(
'.order-detail'
);
var
Dialog
=
require
(
'../plugins/dialog'
).
Dialog
;
var
tpl
=
'<div class="pay-page-tips">'
+
'<h3>请您在新打开的页面完成付款</h3>'
+
'<p>付款完成前请不要关闭此窗口</p>'
+
'<p>完成付款后请根据您的情况点击下面的按钮</p>'
+
'<div><a href="/me/order"><span class="btn">已完成付款</span></a>'
+
'<span class="btn white close-btn">更换支付方式</span>'
+
'</div>'
+
'</div>'
;
var
infoDaialog
=
new
Dialog
({
className
:
'pay-info-dialog'
,
content
:
tpl
,
keep
:
true
});
// 展开详情/收起详情
$
(
'#order-detail-ctrl'
).
click
(
function
()
{
var
$this
=
$
(
this
);
...
...
@@ -40,6 +58,14 @@ $('.pay-type-icon').click(function() {
$
(
'#pay-type-name'
).
text
(
$this
.
data
(
'name'
));
});
function
showDialog
()
{
infoDaialog
.
show
();
$
(
'.pay-page-tips .btn.close-btn'
).
off
().
on
(
'click'
,
function
()
{
infoDaialog
.
close
();
});
}
// 去支付
$
(
'#go-pay-btn'
).
click
(
function
()
{
var
payType
=
$
(
'.pay-type-icon.active'
).
data
(
'id'
);
...
...
@@ -48,13 +74,16 @@ $('#go-pay-btn').click(function() {
$
.
ajax
({
type
:
'POST'
,
url
:
'/shopping/pay/online/go'
,
async
:
false
,
data
:
{
code
:
order
,
method
:
payType
}
}).
then
(
function
(
data
)
{
if
(
data
.
code
===
200
)
{
location
.
href
=
data
.
data
.
href
;
window
.
open
(
data
.
data
.
href
);
showDialog
();
}
});
});
...
...
public/scss/shopping/_cart-products.css
View file @
5c85207
...
...
@@ -223,6 +223,20 @@ $hoverColor: #379ed6;
border-top
:
1px
solid
#eee
;
color
:
#999
;
input
{
color
:
#999
!important
;
}
a
{
color
:
#999
!important
;
}
.stepper
{
.warning
{
display
:
none
;
}
}
.warning
{
font-size
:
18px
!important
;
color
:
#666
;
...
...
public/scss/shopping/_pay.css
View file @
5c85207
...
...
@@ -156,3 +156,25 @@ $fontColor: #616161;
}
}
.pay-info-dialog
{
.pay-page-tips
{
text-align
:
center
;
h3
{
font-size
:
18px
;
font-weight
:
700
;
margin
:
30px
0
;
}
p
{
font-size
:
14px
;
color
:
#999
;
margin
:
10px
0
;
}
.btn
{
margin-top
:
20px
;
}
}
}
...
...
Please
register
or
login
to post a comment