Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuy-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
1
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
yyq
8 years ago
Commit
88d4ad123a75d4e9ea465a6938e8e3b2c372df01
1 parent
52ffc80e
订单参数校验
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
5 deletions
apps/cart/controllers/order-ensure.js
public/img/sprite.cart.png
public/js/cart/ensure.page.js
apps/cart/controllers/order-ensure.js
View file @
88d4ad1
...
...
@@ -66,10 +66,10 @@ const submit = (req, res, next) => {
let
uid
=
req
.
user
.
uid
;
let
remoteIp
=
req
.
ip
;
if
(
!
req
.
body
.
addressId
)
{
if
(
!
req
.
body
.
addressId
||
!
req
.
body
.
paymentType
||
!
req
.
body
.
deliveryWay
)
{
res
.
send
({
code
:
500
,
message
:
'
配送地址不能为空
'
message
:
'
订单参数不完整
'
});
return
;
}
...
...
public/img/sprite.cart.png
View file @
88d4ad1
608 Bytes
|
W:
|
H:
42.6 KB
|
W:
|
H:
2-up
Swipe
Onion skin
public/js/cart/ensure.page.js
View file @
88d4ad1
...
...
@@ -127,6 +127,29 @@ function compute(coin, cb) {
});
}
function
validateOrderInfo
(
info
)
{
var
errTip
=
''
;
if
(
!
errTip
&&
!
info
.
addressId
)
{
errTip
=
'请填写配送地址'
;
}
if
(
!
errTip
&&
!
info
.
paymentType
)
{
errTip
=
'请选择支付方式'
;
}
if
(
!
errTip
&&
!
info
.
deliveryWay
)
{
errTip
=
'请选择配送方式'
;
}
if
(
errTip
)
{
new
dialog
.
Alert
(
errTip
).
show
();
return
false
;
}
return
true
;
}
// 支付方式
payWay
=
{
$allType
:
$
(
'.pay-wrap > p'
),
...
...
@@ -167,7 +190,7 @@ payWay = {
$this
.
addClass
(
'checked'
);
// 更新订单支付数据
that
.
updateOrder
(
$this
.
data
()
);
that
.
updateOrder
(
pt
);
// 重新计算订单价格
compute
();
...
...
@@ -230,11 +253,11 @@ payWay = {
return
;
}
if
(
info
.
id
)
{
if
(
info
.
hasOwnProperty
(
'id'
)
)
{
order
.
paymentId
=
info
.
id
;
}
if
(
info
.
type
)
{
if
(
info
.
hasOwnProperty
(
'type'
)
)
{
order
.
paymentType
=
info
.
type
;
}
}
...
...
@@ -692,6 +715,11 @@ $('#order-submit').click(function() {
$
.
extend
(
order
,
invoiceInfo
);
}
// 订单参数校验
if
(
!
validateOrderInfo
(
order
))
{
return
;
}
$
.
ajax
({
type
:
'POST'
,
url
:
'/cart/ensure/submit'
,
...
...
Please
register
or
login
to post a comment