Authored by 毕凯

不同用户 确认订单cookie信息隔离

... ... @@ -10,7 +10,7 @@ var $ = require('jquery'),
Handlebars = require('yoho.handlebars'),
tip = require('../plugin/tip'),
loading = require('../plugin/loading'),
orderInfo = require('./order-info').orderInfo;
order = require('./order-info');
var dispatchModeHammer,
dispatchTimeHammer,
... ... @@ -18,10 +18,15 @@ var dispatchModeHammer,
$price = $('.price-cal'),
payType,
priceTmpl = Handlebars.compile($('#tmpl-price').html()),
queryString = $.queryString();
queryString = $.queryString(),
orderInfo = order.orderInfo;
lazyLoad();
if (window.getUid() !== orderInfo('uid')) {
order.init();
}
function dispacthTapEvt(e) {
var $cur = $(e.target).closest('li');
... ...
... ... @@ -6,11 +6,9 @@
var $ = require('jquery');
var info = window.cookie('order-info');
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
function init() {
info = {
uid: window.getUid(),
deliveryId: 1,
deliveryTimeId: 1,
paymentTypeId: 1,
... ... @@ -26,6 +24,15 @@ try {
window.setCookie('order-info', JSON.stringify(info));
}
// info 必须是 JSON 字符串
try {
info = JSON.parse(info);
} catch (e) {
init();
}
exports.init = init;
exports.orderInfo = function(key, value) {
if (value === undefined) {
return info[key];
... ...