Authored by 陈峰

解决购物车bug

... ... @@ -11,13 +11,6 @@ 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;
... ... @@ -64,38 +57,37 @@ let cartObj = {
},
promoItemClick(e) {
let self = this;
let promotionId = $(e.currentTarget).data('id');
let promotionType = $(e.currentTarget).data('type');
let promotionTitle = encodeURIComponent(`以下商品参加【${$(e.currentTarget).data('title')}】促销活动`);
let promotionId = $(e.currentTarget).data('id'),
promotionType = $(e.currentTarget).data('type'),
status = $(e.currentTarget).data('status'),
promotionTitle = encodeURIComponent(`以下商品参加【${$(e.currentTarget).data('title')}】促销活动`);
self.toPromotionPage({
promotionType,
promotionId,
promotionTitle,
status: $(e.currentTarget).data('status')
status
});
},
toPromotionPage(opts) {
let cartType = cookie.get('_cartType') || 'ordinary';
let title = encodeURIComponent('优惠活动商品');
let href;
if (opts.promotionType === 'Gift') {
if (opts.status === 20 || (opts.promotionType !== 'Gift' && opts.promotionType !== 'Needpaygift')) {
href = `/product/index/index?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
} else if (opts.promotionType === 'Gift') {
href = `/cart/index/new/gift?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
if (opts.status === 30) {
window.location.href = `/cart/index/new/gift?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}&edit=1`;
} else {
window.location.href = `/cart/index/new/gift?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
href += '&edit=1';
}
} else if (opts.promotionType === 'Needpaygift') {
href = `/cart/index/new/advanceBuy?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
if (opts.status === 30) {
window.location.href = `/cart/index/new/advanceBuy?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}&edit=1`;
} else {
window.location.href = `/cart/index/new/advanceBuy?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
href += '&edit=1';
}
} else {
window.location.href = `/product/index/index?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
}
window.location.href = href;
},
allGiftBoxClick(e) {
let cartType = cookie.get('_cartType') || 'ordinary';
... ...
... ... @@ -219,11 +219,13 @@
.to-gift {
text-align: right;
width: 139px;
&.no-storage {
a {
color: #c6c6c6;
}
}
a {
color: #ff575c;
font-size: 23px;
... ...
... ... @@ -11,7 +11,7 @@ const productProcess = require('./product-process');
const regPromoTitle = /^【[^]+】(.*)/;
const transPrice = (price, isSepcialZero) => {
return (price >= 0 || isSepcialZero) ? parseFloat(price).toFixed(2) : 0;
return (price > 0 || isSepcialZero) ? parseFloat(price).toFixed(2) : 0;
};
const formatPromotionTitle = (promo) => {
let title;
... ...