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
421ece542313a385f304a132200a822027fe22f6
1 parent
ee0807cf
cookie-handle
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
51 additions
and
10 deletions
apps/cart/controllers/order.js
public/js/cart/cart.js
public/js/cart/index/cart.js
public/js/cart/order-ensure.page.js
public/js/cart/order-info.js
public/js/cart/seckill/order-ensure.js
apps/cart/controllers/order.js
View file @
421ece5
...
...
@@ -10,6 +10,13 @@ const orderModel = require('../models/order');
const
crypto
=
global
.
yoho
.
crypto
;
const
authcode
=
require
(
global
.
utils
+
'/authcode'
);
// cookie 参数
const
actCkOpthn
=
{
expires
:
0
,
path
:
'/cart/index'
,
domain
:
'.m.yohobuy.com'
};
exports
.
orderEnsure
=
(
req
,
res
,
next
)
=>
{
let
headerData
=
headerModel
.
setNav
({
navTitle
:
'确认订单'
,
...
...
@@ -25,6 +32,7 @@ exports.orderEnsure = (req, res, next) => {
orderInfo
=
JSON
.
parse
(
req
.
cookies
[
'order-info'
]);
}
catch
(
e
)
{
orderInfo
=
{};
res
.
cookie
(
'order-info'
,
null
,
actCkOpthn
);
}
let
cookieCartType
=
_
.
get
(
orderInfo
,
'cartType'
);
...
...
@@ -149,6 +157,7 @@ exports.orderSub = (req, res) => {
orderInfo
=
JSON
.
parse
(
req
.
cookies
[
'order-info'
]);
}
catch
(
e
)
{
orderInfo
=
{};
res
.
cookie
(
'order-info'
,
null
,
actCkOpthn
);
}
let
times
=
req
.
body
.
times
||
1
;
...
...
@@ -216,9 +225,8 @@ exports.orderSub = (req, res) => {
}
// 提交成功清除Cookie
res
.
cookie
(
'order-info'
,
null
,
{
domain
:
'yohobuy.com'
});
orderInfo
=
{};
res
.
cookie
(
'order-info'
,
null
,
actCkOpthn
);
if
(
result
.
code
===
409
)
{
return
res
.
json
(
decodeURI
(
result
));
...
...
public/js/cart/cart.js
View file @
421ece5
...
...
@@ -27,6 +27,13 @@ var isRefreshByDelete = window.cookie('_yoho-cart-refreshByDelete') === 'true' ?
var
lowStockCount
=
0
;
// cookie 参数
var
actCkOpthn
=
{
expires
:
'Session'
,
path
:
'/cart/index'
,
domain
:
'.m.yohobuy.com'
};
loading
.
showLoadingMask
();
...
...
@@ -115,7 +122,7 @@ function showChooseGifDialog() {
var
info
=
window
.
cookie
(
'order-info'
);
if
(
info
)
{
window
.
setCookie
(
'order-info'
,
''
);
window
.
setCookie
(
'order-info'
,
''
,
actCkOpthn
);
}
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
cartType
;
});
...
...
@@ -207,7 +214,7 @@ $('.btn-balance').on('touchend', function() {
if
(
hasChecked
())
{
if
(
info
)
{
window
.
setCookie
(
'order-info'
,
''
);
window
.
setCookie
(
'order-info'
,
''
,
actCkOpthn
);
}
window
.
location
.
href
=
'/cart/index/orderEnsure?cartType='
+
cartType
;
}
else
{
...
...
public/js/cart/index/cart.js
View file @
421ece5
...
...
@@ -10,6 +10,13 @@ let $ = require('yoho-jquery'),
tip
=
require
(
'../../plugin/tip'
),
dialog
=
require
(
'../../plugin/dialog'
);
// cookie 参数
let
actCkOpthn
=
{
expires
:
'Session'
,
path
:
'/cart/index'
,
domain
:
'.m.yohobuy.com'
};
let
cartObj
=
{
init
(
handle
)
{
let
self
=
this
;
...
...
@@ -144,7 +151,7 @@ let cartObj = {
self
.
toOrderEnsure
(
cartType
);
},
toOrderEnsure
(
cartType
)
{
window
.
cookie
(
'order-info'
)
&&
window
.
setCookie
(
'order-info'
,
''
);
window
.
cookie
(
'order-info'
)
&&
window
.
setCookie
(
'order-info'
,
''
,
actCkOpthn
);
window
.
location
.
href
=
'/cart/index/new/orderEnsure?cartType='
+
cartType
;
},
toGiftPromotion
(
cartType
)
{
...
...
public/js/cart/order-ensure.page.js
View file @
421ece5
...
...
@@ -46,6 +46,13 @@ var invoiceCont = {
2
:
'电子'
};
// cookie 参数
var
actCkOpthn
=
{
expires
:
'Session'
,
path
:
'/cart/index'
,
domain
:
'.m.yohobuy.com'
};
require
(
'../common'
);
lazyLoad
();
...
...
@@ -325,7 +332,7 @@ function submitOrder() {
},
true
);
}
window
.
setCookie
(
'order-info'
,
''
);
window
.
setCookie
(
'order-info'
,
''
,
actCkOpthn
);
window
.
setCookie
(
'activity-info'
,
''
,
{
expires
:
'Session'
,
path
:
'/'
,
...
...
public/js/cart/order-info.js
View file @
421ece5
...
...
@@ -6,6 +6,12 @@
require
(
'../common'
);
var
info
=
window
.
cookie
(
'order-info'
);
// cookie 参数
var
actCkOpthn
=
{
expires
:
'Session'
,
path
:
'/cart/index'
,
domain
:
'.m.yohobuy.com'
};
function
init
()
{
info
=
{
...
...
@@ -27,7 +33,7 @@ function init() {
msg
:
null
,
cartType
:
'ordinary'
};
window
.
setCookie
(
'order-info'
,
JSON
.
stringify
(
info
));
window
.
setCookie
(
'order-info'
,
JSON
.
stringify
(
info
)
,
actCkOpthn
);
}
// info 必须是 JSON 字符串
...
...
@@ -47,5 +53,5 @@ exports.orderInfo = function(key, value) {
return
info
[
key
];
}
info
[
key
]
=
value
;
window
.
setCookie
(
'order-info'
,
JSON
.
stringify
(
info
));
window
.
setCookie
(
'order-info'
,
JSON
.
stringify
(
info
)
,
actCkOpthn
);
};
...
...
public/js/cart/seckill/order-ensure.js
View file @
421ece5
...
...
@@ -44,6 +44,12 @@ var invoiceCont = {
2
:
'电子'
};
// cookie 参数
var
actCkOpthn
=
{
expires
:
'Session'
,
path
:
'/cart/index'
,
domain
:
'.m.yohobuy.com'
};
lazyLoad
();
...
...
@@ -293,7 +299,7 @@ function submitOrder() {
}
else
{
url
=
'/home/orders/pay?order_code='
+
res
.
data
.
order_code
;
}
window
.
setCookie
(
'order-info'
,
''
);
window
.
setCookie
(
'order-info'
,
''
,
actCkOpthn
);
window
.
location
.
href
=
url
;
}
else
if
(
res
.
message
)
{
tip
.
show
(
res
.
message
);
...
...
Please
register
or
login
to post a comment