|
@@ -7,6 +7,7 @@ |
|
@@ -7,6 +7,7 @@ |
7
|
'use strict';
|
7
|
'use strict';
|
8
|
|
8
|
|
9
|
let $ = require('yoho-jquery'),
|
9
|
let $ = require('yoho-jquery'),
|
|
|
10
|
+ cookie = require('yoho-cookie'),
|
10
|
tip = require('../../plugin/tip'),
|
11
|
tip = require('../../plugin/tip'),
|
11
|
dialog = require('../../plugin/dialog');
|
12
|
dialog = require('../../plugin/dialog');
|
12
|
|
13
|
|
|
@@ -14,7 +15,7 @@ let $ = require('yoho-jquery'), |
|
@@ -14,7 +15,7 @@ let $ = require('yoho-jquery'), |
14
|
let actCkOpthn = {
|
15
|
let actCkOpthn = {
|
15
|
expires: 'Session',
|
16
|
expires: 'Session',
|
16
|
path: '/cart/index',
|
17
|
path: '/cart/index',
|
17
|
- domain: '.m.yohobuy.com'
|
18
|
+ domain: 'm.yohobuy.com'
|
18
|
};
|
19
|
};
|
19
|
|
20
|
|
20
|
let cartObj = {
|
21
|
let cartObj = {
|
|
@@ -47,17 +48,17 @@ let cartObj = { |
|
@@ -47,17 +48,17 @@ let cartObj = { |
47
|
let self = this;
|
48
|
let self = this;
|
48
|
let type = $(e.currentTarget).data('type');
|
49
|
let type = $(e.currentTarget).data('type');
|
49
|
|
50
|
|
50
|
- window.setCookie('cartType', type);
|
51
|
+ cookie.set('_cartType', type);
|
51
|
self.handle.refreshPage('');
|
52
|
self.handle.refreshPage('');
|
52
|
},
|
53
|
},
|
53
|
initPresellTip() {
|
54
|
initPresellTip() {
|
54
|
- if (typeof window.cookie === 'function' && window.cookie('_hasShowCartPresellTip') === 'y') {
|
55
|
+ if (cookie.enabled() && cookie.get('_hasShowCartPresellTip') === 'y') {
|
55
|
$('#presell-tip').removeClass('show').addClass('hide');
|
56
|
$('#presell-tip').removeClass('show').addClass('hide');
|
56
|
} else {
|
57
|
} else {
|
57
|
$('#presell-tip').removeClass('hide').addClass('show');
|
58
|
$('#presell-tip').removeClass('hide').addClass('show');
|
58
|
setTimeout(function() {
|
59
|
setTimeout(function() {
|
59
|
$('#presell-tip').removeClass('show').addClass('hide');
|
60
|
$('#presell-tip').removeClass('show').addClass('hide');
|
60
|
- window.setCookie('_hasShowCartPresellTip', 'y');
|
61
|
+ cookie.set('_hasShowCartPresellTip', 'y');
|
61
|
}, 3000);
|
62
|
}, 3000);
|
62
|
}
|
63
|
}
|
63
|
},
|
64
|
},
|
|
@@ -75,7 +76,7 @@ let cartObj = { |
|
@@ -75,7 +76,7 @@ let cartObj = { |
75
|
});
|
76
|
});
|
76
|
},
|
77
|
},
|
77
|
toPromotionPage(opts) {
|
78
|
toPromotionPage(opts) {
|
78
|
- let cartType = window.cookie('cartType') || 'ordinary';
|
79
|
+ let cartType = cookie.get('_cartType') || 'ordinary';
|
79
|
let title = '促销商品';
|
80
|
let title = '促销商品';
|
80
|
|
81
|
|
81
|
if (opts.promotionType === 'Gift') {
|
82
|
if (opts.promotionType === 'Gift') {
|
|
@@ -97,7 +98,7 @@ let cartObj = { |
|
@@ -97,7 +98,7 @@ let cartObj = { |
97
|
}
|
98
|
}
|
98
|
},
|
99
|
},
|
99
|
allGiftBoxClick(e) {
|
100
|
allGiftBoxClick(e) {
|
100
|
- let cartType = window.cookie('cartType') || 'ordinary';
|
101
|
+ let cartType = cookie.get('_cartType') || 'ordinary';
|
101
|
|
102
|
|
102
|
if ($(e.currentTarget).find('.no-storage').length) {
|
103
|
if ($(e.currentTarget).find('.no-storage').length) {
|
103
|
return;
|
104
|
return;
|
|
@@ -110,7 +111,7 @@ let cartObj = { |
|
@@ -110,7 +111,7 @@ let cartObj = { |
110
|
},
|
111
|
},
|
111
|
balanceClick() {
|
112
|
balanceClick() {
|
112
|
let self = this;
|
113
|
let self = this;
|
113
|
- let cartType = window.cookie('cartType') || 'ordinary';
|
114
|
+ let cartType = cookie.get('_cartType') || 'ordinary';
|
114
|
|
115
|
|
115
|
if (window._yas && window._yas.sendCustomInfo) {
|
116
|
if (window._yas && window._yas.sendCustomInfo) {
|
116
|
let productId = Array.from($('.good-item.is-checked').map((i, e) => $(e).data('id')));
|
117
|
let productId = Array.from($('.good-item.is-checked').map((i, e) => $(e).data('id')));
|
|
@@ -154,7 +155,7 @@ let cartObj = { |
|
@@ -154,7 +155,7 @@ let cartObj = { |
154
|
self.toOrderEnsure(cartType);
|
155
|
self.toOrderEnsure(cartType);
|
155
|
},
|
156
|
},
|
156
|
toOrderEnsure(cartType) {
|
157
|
toOrderEnsure(cartType) {
|
157
|
- window.cookie('order-info') && window.setCookie('order-info', '', actCkOpthn);
|
158
|
+ cookie.get('order-info') && cookie.remove('order-info');
|
158
|
window.location.href = '/cart/index/new/orderEnsure?cartType=' + cartType;
|
159
|
window.location.href = '/cart/index/new/orderEnsure?cartType=' + cartType;
|
159
|
},
|
160
|
},
|
160
|
toGiftPromotion(cartType) {
|
161
|
toGiftPromotion(cartType) {
|