Authored by 陈峰

Merge branch 'feature/cart' into 'release/5.4.1'

Feature/cart



See merge request !221
... ... @@ -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));
... ...
... ... @@ -6,13 +6,13 @@
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
<div class="action iconfont">
<span class="edit" data-href="/home/addressAct?id={{address_id}}&refer=shopping">&#xe61e;</span>
<span class="edit" href="/home/addressAct?id={{address_id}}&refer=shopping">&#xe61e;</span>
<span class="del" data-id="{{address_id}}">&#xe621;</span>
</div>
</div>
{{/ address}}
<a class="add-address" data-href="/home/addressAct?refer=shopping">
<a class="add-address" href="/home/addressAct?refer=shopping">
添加新地址
</a>
... ...
... ... @@ -8,7 +8,7 @@
</div>
{{/ address}}
<a class="add-address" data-href="/home/addressAct?refer=modify">
<a class="add-address" href="/home/addressAct?refer=modify">
添加新地址
</a>
... ...
... ... @@ -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 {
... ...
... ... @@ -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) {
... ...
... ... @@ -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: '/',
... ...
... ... @@ -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);
};
... ...
... ... @@ -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);
... ...
... ... @@ -399,7 +399,10 @@ function givePoint(parameter) {
break;
}
} else {
header.removeClass('girls', 'life-style', 'kids').addClass('boys');
header.removeClass('kids');
header.removeClass('girls');
header.removeClass('life-style');
header.addClass('boys');
}
switch (channel) {
... ...
... ... @@ -96,7 +96,7 @@ $addressForm.on('submit', function() {
loading.hideLoadingMask();
} else if (window.queryString) {
if (window.queryString.refer === 'shopping') {
window.location.href = '/cart/index/selectAddress';
window.location.href = '/cart/index/new/selectAddress';
} else if (window.queryString.refer === 'modify') {
window.location.href = '/home/addressModify';
} else {
... ...
... ... @@ -87,7 +87,7 @@ exports.showDialog = function(data, callback, callbackForLeft, fullWithBtn) {
event.preventDefault();
event.stopPropagation();
});
}, 100);
}, 500);
};
exports.hideDialog = function() {
... ...
... ... @@ -52,7 +52,7 @@
i {
position: absolute;
left: 16px;
top: 0;
top: 40px;
font-size: 44px;
}
... ... @@ -638,7 +638,7 @@
border-radius: 28px;
width: 28px;
height: 28px;
line-height: 28px;
line-height: 36px;
text-align: center;
color: #fff;
font-size: 22px;
... ...