Authored by 郝肖肖

秒杀结算 切换地址

... ... @@ -12,7 +12,14 @@ exports.ensure = (req, res, next) => {
const sku = Number.parseInt(req.query.sku, 10);
const skn = Number.parseInt(req.query.skn, 10);
const uid = req.user.uid;
const orderInfo = req.cookies['order-info'];
let orderInfo = req.cookies['order-info'];
try {
orderInfo = JSON.parse(req.cookies['order-info'])
} catch (e) {
orderInfo = {}
}
// require skn, sku;
if (!(sku && skn)) {
... ...
... ... @@ -38,7 +38,7 @@
"request-promise": "^3.0.0",
"serve-favicon": "^2.3.0",
"uuid": "^2.0.3",
"yoho-node-lib": "0.1.23",
"yoho-node-lib": "^0.1.24",
"yoho-zookeeper": "^1.0.3"
},
"devDependencies": {
... ...
... ... @@ -27,7 +27,7 @@ function init() {
msg: null,
cartType: 'ordinary'
};
window.setCookie('order-info', JSON.stringify(info));
window.setCookie('order-info', JSON.stringify(info), {path: '/cart'});
}
// info 必须是 JSON 字符串
... ... @@ -47,5 +47,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), {path: '/cart'});
};
... ...
... ... @@ -284,7 +284,7 @@ function submitOrder() {
} else {
url = '/home/orders/pay?order_code=' + res.data.order_code;
}
window.setCookie('order-info', '');
window.setCookie('order-info', '', {path: '/cart'});
window.location.href = url;
} else if (res.message) {
tip.show(res.message);
... ...
... ... @@ -21,10 +21,10 @@ function tranformPayment(data, orderInfo) {
result.name = cookieAddress ? cookieAddress.consignee : addressData.consignee;
result.phoneNum = cookieAddress ? cookieAddress.mobile : addressData.mobile;
result.addressId = cookieAddress ? crypto.decrypt(null, cookieAddress.address_id) : addressData.address_id;
result.addressId = cookieAddress ? parseInt(crypto.decrypt(null, cookieAddress.address_id), 10) : addressData.address_id;
result.addressInfo = cookieAddress ? cookieAddress.address_info : [addressData.area, addressData.address].join(' ');
result.addressId = crypto.encryption(null, result.addressId);
result.addressId = crypto.encryption(null, result.addressId + '');
}
// delivery_way 配送信息
... ...