Authored by 郭成尧

Merge branch 'feature/cart' of git.yoho.cn:fe/yohobuywap-node into feature/cart

@@ -11,13 +11,6 @@ let $ = require('yoho-jquery'), @@ -11,13 +11,6 @@ let $ = require('yoho-jquery'),
11 tip = require('../../plugin/tip'), 11 tip = require('../../plugin/tip'),
12 dialog = require('../../plugin/dialog'); 12 dialog = require('../../plugin/dialog');
13 13
14 -// cookie 参数  
15 -let actCkOpthn = {  
16 - expires: 'Session',  
17 - path: '/cart/index',  
18 - domain: 'm.yohobuy.com'  
19 -};  
20 -  
21 let cartObj = { 14 let cartObj = {
22 init(handle) { 15 init(handle) {
23 let self = this; 16 let self = this;
@@ -64,38 +57,37 @@ let cartObj = { @@ -64,38 +57,37 @@ let cartObj = {
64 }, 57 },
65 promoItemClick(e) { 58 promoItemClick(e) {
66 let self = this; 59 let self = this;
67 - let promotionId = $(e.currentTarget).data('id');  
68 - let promotionType = $(e.currentTarget).data('type');  
69 - let promotionTitle = encodeURIComponent(`以下商品参加【${$(e.currentTarget).data('title')}】促销活动`); 60 + let promotionId = $(e.currentTarget).data('id'),
  61 + promotionType = $(e.currentTarget).data('type'),
  62 + status = $(e.currentTarget).data('status'),
  63 + promotionTitle = encodeURIComponent(`以下商品参加【${$(e.currentTarget).data('title')}】促销活动`);
70 64
71 self.toPromotionPage({ 65 self.toPromotionPage({
72 promotionType, 66 promotionType,
73 promotionId, 67 promotionId,
74 promotionTitle, 68 promotionTitle,
75 - status: $(e.currentTarget).data('status') 69 + status
76 }); 70 });
77 }, 71 },
78 toPromotionPage(opts) { 72 toPromotionPage(opts) {
79 let cartType = cookie.get('_cartType') || 'ordinary'; 73 let cartType = cookie.get('_cartType') || 'ordinary';
80 let title = encodeURIComponent('优惠活动商品'); 74 let title = encodeURIComponent('优惠活动商品');
  75 + let href;
81 76
82 - if (opts.promotionType === 'Gift') { 77 + if (opts.status === 20 || (opts.promotionType !== 'Gift' && opts.promotionType !== 'Needpaygift')) {
  78 + href = `/product/index/index?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
  79 + } else if (opts.promotionType === 'Gift') {
  80 + href = `/cart/index/new/gift?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
83 if (opts.status === 30) { 81 if (opts.status === 30) {
84 - window.location.href = `/cart/index/new/gift?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}&edit=1`;  
85 - } else {  
86 - window.location.href = `/cart/index/new/gift?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`; 82 + href += '&edit=1';
87 } 83 }
88 -  
89 } else if (opts.promotionType === 'Needpaygift') { 84 } else if (opts.promotionType === 'Needpaygift') {
  85 + href = `/cart/index/new/advanceBuy?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;
90 if (opts.status === 30) { 86 if (opts.status === 30) {
91 - window.location.href = `/cart/index/new/advanceBuy?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}&edit=1`;  
92 - } else {  
93 - window.location.href = `/cart/index/new/advanceBuy?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`; 87 + href += '&edit=1';
94 } 88 }
95 -  
96 - } else {  
97 - window.location.href = `/product/index/index?promotion_id=${opts.promotionId}&title=${title}&intro_text=${opts.promotionTitle}&cartType=${cartType}`;  
98 } 89 }
  90 + window.location.href = href;
99 }, 91 },
100 allGiftBoxClick(e) { 92 allGiftBoxClick(e) {
101 let cartType = cookie.get('_cartType') || 'ordinary'; 93 let cartType = cookie.get('_cartType') || 'ordinary';
@@ -219,11 +219,13 @@ @@ -219,11 +219,13 @@
219 .to-gift { 219 .to-gift {
220 text-align: right; 220 text-align: right;
221 width: 139px; 221 width: 139px;
  222 +
222 &.no-storage { 223 &.no-storage {
223 a { 224 a {
224 color: #c6c6c6; 225 color: #c6c6c6;
225 } 226 }
226 } 227 }
  228 +
227 a { 229 a {
228 color: #ff575c; 230 color: #ff575c;
229 font-size: 23px; 231 font-size: 23px;
@@ -11,7 +11,7 @@ const productProcess = require('./product-process'); @@ -11,7 +11,7 @@ const productProcess = require('./product-process');
11 const regPromoTitle = /^【[^]+】(.*)/; 11 const regPromoTitle = /^【[^]+】(.*)/;
12 12
13 const transPrice = (price, isSepcialZero) => { 13 const transPrice = (price, isSepcialZero) => {
14 - return (price >= 0 || isSepcialZero) ? parseFloat(price).toFixed(2) : 0; 14 + return (price > 0 || isSepcialZero) ? parseFloat(price).toFixed(2) : 0;
15 }; 15 };
16 const formatPromotionTitle = (promo) => { 16 const formatPromotionTitle = (promo) => {
17 let title; 17 let title;