order-info.js
456 Bytes
/**
* 订单信息读取
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/12/14
*/
var info = window.cookie('order-info'),
orderInfo;
// info 必须是 JSON 字符串
try {
info = JSON.parse(orderInfo);
} catch (e) {
info = {};
}
orderInfo = function(key, value) {
if (value === undefined) {
return info[key];
}
info[key] = value;
window.setCookie('order-info', JSON.stringify(info));
};
module.export = orderInfo;