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
Email Patches
Plain Diff
Browse Files
Authored by
姜枫
9 years ago
Commit
1da084640d072ab3a298b3d994be2efcbf446f8c
1 parent
290e80b7
add pay tips dialog
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
10 deletions
apps/product/router.js
apps/shopping/models/pay.js
config/common.js
doraemon/middleware/auth.js
public/js/product/list/favorite.js
public/js/shopping/pay.page.js
public/scss/shopping/_pay.css
apps/product/router.js
View file @
1da0846
...
...
@@ -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 @
1da0846
...
...
@@ -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
,
...
...
config/common.js
View file @
1da0846
...
...
@@ -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 @
1da0846
...
...
@@ -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 @
1da0846
...
...
@@ -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/pay.page.js
View file @
1da0846
...
...
@@ -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/_pay.css
View file @
1da0846
...
...
@@ -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