Showing
1 changed file
with
22 additions
and
20 deletions
@@ -124,27 +124,29 @@ const _convertActicityData = (data) => { | @@ -124,27 +124,29 @@ const _convertActicityData = (data) => { | ||
124 | 124 | ||
125 | data = data || []; | 125 | data = data || []; |
126 | _.forEach(data, (item) => { | 126 | _.forEach(data, (item) => { |
127 | - discountArr = item.promotionName.split('~'); | ||
128 | - if (discountArr.length === 1) { | ||
129 | - discountNum = _transDiscountToArr(discountArr[0])[0]; | ||
130 | - discountText = _transDiscountToArr(discountArr[0])[1]; | ||
131 | - } else { | ||
132 | - discountNum = discountArr[0] + '~' + _transDiscountToArr(discountArr[1])[0]; | ||
133 | - discountText = _transDiscountToArr(discountArr[1])[1]; | 127 | + if (item.promotionName) { |
128 | + discountArr = item.promotionName.split('~'); | ||
129 | + if (discountArr.length === 1) { | ||
130 | + discountNum = _transDiscountToArr(discountArr[0])[0]; | ||
131 | + discountText = _transDiscountToArr(discountArr[0])[1]; | ||
132 | + } else { | ||
133 | + discountNum = discountArr[0] + '~' + _transDiscountToArr(discountArr[1])[0]; | ||
134 | + discountText = _transDiscountToArr(discountArr[1])[1]; | ||
135 | + } | ||
136 | + | ||
137 | + | ||
138 | + formatData.push({ | ||
139 | + activityUrl: '/product/outlet/activity?id=' + item.id, | ||
140 | + coverUrl: item.coverUrl, | ||
141 | + logoUrl: item.logoUrl, | ||
142 | + title: item.title, | ||
143 | + discountNum: discountNum, | ||
144 | + discountText: discountText, | ||
145 | + productPoolId: item.productPoolId || '', | ||
146 | + leftTime: item.startLeftTime > 0 ? dateFormate(item.startTime) : item.endLeftTime, | ||
147 | + hide: false | ||
148 | + }); | ||
134 | } | 149 | } |
135 | - | ||
136 | - | ||
137 | - formatData.push({ | ||
138 | - activityUrl: '/product/outlet/activity?id=' + item.id, | ||
139 | - coverUrl: item.coverUrl, | ||
140 | - logoUrl: item.logoUrl, | ||
141 | - title: item.title, | ||
142 | - discountNum: discountNum, | ||
143 | - discountText: discountText, | ||
144 | - productPoolId: item.productPoolId || '', | ||
145 | - leftTime: item.startLeftTime > 0 ? dateFormate(item.startTime) : item.endLeftTime, | ||
146 | - hide: false | ||
147 | - }); | ||
148 | }); | 150 | }); |
149 | 151 | ||
150 | return formatData; | 152 | return formatData; |
-
Please register or login to post a comment