Showing
1 changed file
with
31 additions
and
30 deletions
@@ -27,7 +27,7 @@ const getShopsInfo = (data) => { | @@ -27,7 +27,7 @@ const getShopsInfo = (data) => { | ||
27 | enterStore[key].img = value.brand_ico; | 27 | enterStore[key].img = value.brand_ico; |
28 | enterStore[key].storeName = value.brand_name; | 28 | enterStore[key].storeName = value.brand_name; |
29 | 29 | ||
30 | - if (value.shop_id !== null && value.shop_id !== undefined) { | 30 | + if (value.shop_id !== null && typeof value.shop_id !== 'undefined') { |
31 | let params = {}; | 31 | let params = {}; |
32 | 32 | ||
33 | params.shop_id = value.shop_id; | 33 | params.shop_id = value.shop_id; |
@@ -126,14 +126,14 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -126,14 +126,14 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
126 | totalStorageNum = 0; | 126 | totalStorageNum = 0; |
127 | 127 | ||
128 | // 商品名称 | 128 | // 商品名称 |
129 | - if (origin.productName === null || origin.productName === undefined) { | 129 | + if (origin.productName === null || typeof origin.productName === 'undefined') { |
130 | return dest; | 130 | return dest; |
131 | } | 131 | } |
132 | 132 | ||
133 | dest.goodsName = origin.productName; | 133 | dest.goodsName = origin.productName; |
134 | 134 | ||
135 | // 用户未登录时 待处理 | 135 | // 用户未登录时 待处理 |
136 | - if (uid === null || uid === undefined) { | 136 | + if (uid === null || typeof uid === 'undefined') { |
137 | let params = {}; | 137 | let params = {}; |
138 | 138 | ||
139 | params.refer = helpers.url('/product/show_' + origin.erpProductId + '.html'); | 139 | params.refer = helpers.url('/product/show_' + origin.erpProductId + '.html'); |
@@ -141,12 +141,12 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -141,12 +141,12 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
141 | } | 141 | } |
142 | 142 | ||
143 | // 商品促销短语 | 143 | // 商品促销短语 |
144 | - if (origin.salesPhrase !== null && origin.salesPhrase !== undefined) { | 144 | + if (origin.salesPhrase !== null && typeof origin.salesPhrase !== 'undefined') { |
145 | dest.goodsSubtitle = origin.salesPhrase; | 145 | dest.goodsSubtitle = origin.salesPhrase; |
146 | } | 146 | } |
147 | 147 | ||
148 | // 商品标签 | 148 | // 商品标签 |
149 | - if (origin.productTagBoList !== null && origin.productTagBoList !== undefined) { | 149 | + if (origin.productTagBoList !== null && typeof origin.productTagBoList !== 'undefined') { |
150 | _.forEach(origin.productTagBoList, function(value) { | 150 | _.forEach(origin.productTagBoList, function(value) { |
151 | switch (value.tagLabel) { | 151 | switch (value.tagLabel) { |
152 | case 'is_soon_sold_out': | 152 | case 'is_soon_sold_out': |
@@ -176,7 +176,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -176,7 +176,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
176 | // 商品价格 | 176 | // 商品价格 |
177 | dest.goodsPrice = {}; | 177 | dest.goodsPrice = {}; |
178 | 178 | ||
179 | - if (origin.productPriceBo !== null && origin.productPriceBo !== undefined) { | 179 | + if (origin.productPriceBo !== null && typeof origin.productPriceBo !== 'undefined') { |
180 | dest.goodsPrice.currentPrice = origin.productPriceBo.formatSalesPrice; | 180 | dest.goodsPrice.currentPrice = origin.productPriceBo.formatSalesPrice; |
181 | if (origin.productPriceBo.formatMarketPrice !== origin.productPriceBo.formatSalesPrice) { | 181 | if (origin.productPriceBo.formatMarketPrice !== origin.productPriceBo.formatSalesPrice) { |
182 | dest.goodsPrice.previousPrice = origin.productPriceBo.formatMarketPrice; | 182 | dest.goodsPrice.previousPrice = origin.productPriceBo.formatMarketPrice; |
@@ -192,7 +192,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -192,7 +192,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
192 | dest.vipLevel = {}; | 192 | dest.vipLevel = {}; |
193 | dest.vipLevel.list = {}; | 193 | dest.vipLevel.list = {}; |
194 | 194 | ||
195 | - if (origin.productPriceBo.vipPrices !== null && origin.productPriceBo.vipPrices !== undefined) { | 195 | + if (origin.productPriceBo.vipPrices !== null && typeof origin.productPriceBo.vipPrices !== 'undefined') { |
196 | _.forEach(origin.productPriceBo.vipPrices, function(value, key) { | 196 | _.forEach(origin.productPriceBo.vipPrices, function(value, key) { |
197 | dest.vipLevel.list[key] = {}; | 197 | dest.vipLevel.list[key] = {}; |
198 | dest.vipLevel.list[key].level = value.vipLevel; | 198 | dest.vipLevel.list[key].level = value.vipLevel; |
@@ -202,7 +202,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -202,7 +202,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
202 | } | 202 | } |
203 | 203 | ||
204 | // 上市期 | 204 | // 上市期 |
205 | - if (origin.expectArrivalTime !== null && origin.expectArrivalTime !== undefined) { | 205 | + if (origin.expectArrivalTime !== null && typeof origin.expectArrivalTime !== 'undefined') { |
206 | dest.periodOfMarket = origin.expectArrivalTime + '月'; | 206 | dest.periodOfMarket = origin.expectArrivalTime + '月'; |
207 | } | 207 | } |
208 | 208 | ||
@@ -210,7 +210,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -210,7 +210,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
210 | dest.goodsDiscount = {}; | 210 | dest.goodsDiscount = {}; |
211 | dest.goodsDiscount.list = {}; | 211 | dest.goodsDiscount.list = {}; |
212 | 212 | ||
213 | - if (origin.promotionBoList !== null && origin.promotionBoList !== undefined) { | 213 | + if (origin.promotionBoList !== null && typeof origin.promotionBoList !== 'undefined') { |
214 | _.forEach(origin.promotionBoList, function(value, key) { | 214 | _.forEach(origin.promotionBoList, function(value, key) { |
215 | dest.goodsDiscount.list[key] = {}; | 215 | dest.goodsDiscount.list[key] = {}; |
216 | dest.goodsDiscount.list[key].text = '【' + value.promotionType + '】' + | 216 | dest.goodsDiscount.list[key].text = '【' + value.promotionType + '】' + |
@@ -223,7 +223,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -223,7 +223,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
223 | dest.feedbacks.consults = {}; | 223 | dest.feedbacks.consults = {}; |
224 | dest.feedbacks.consultsNum = 0; | 224 | dest.feedbacks.consultsNum = 0; |
225 | 225 | ||
226 | - if (origin.consultBoWrapper !== null && origin.consultBoWrapper !== undefined) { | 226 | + if (origin.consultBoWrapper !== null && typeof origin.consultBoWrapper !== 'undefined') { |
227 | dest.feedbacks.consultsNum = origin.consultBoWrapper.consultTotal; | 227 | dest.feedbacks.consultsNum = origin.consultBoWrapper.consultTotal; |
228 | _.forEach(origin.consultBoWrapper.consultBoList, function(value, key) { | 228 | _.forEach(origin.consultBoWrapper.consultBoList, function(value, key) { |
229 | dest.feedbacks.consults[key] = {}; | 229 | dest.feedbacks.consults[key] = {}; |
@@ -250,7 +250,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -250,7 +250,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
250 | 250 | ||
251 | // 商品评价 | 251 | // 商品评价 |
252 | dest.feedbacks.commentsNum = 0; | 252 | dest.feedbacks.commentsNum = 0; |
253 | - if (origin.commentBoWrapper !== null && origin.commentBoWrapper !== undefined) { | 253 | + if (origin.commentBoWrapper !== null && typeof origin.commentBoWrapper !== 'undefined') { |
254 | dest.feedbacks.commentsNum = origin.commentBoWrapper.commentTotal; | 254 | dest.feedbacks.commentsNum = origin.commentBoWrapper.commentTotal; |
255 | dest.feedbacks.comments = {}; | 255 | dest.feedbacks.comments = {}; |
256 | 256 | ||
@@ -260,7 +260,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -260,7 +260,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
260 | dest.feedbacks.comments[key].desc = value.colorName + | 260 | dest.feedbacks.comments[key].desc = value.colorName + |
261 | '/' + value.sizeName; | 261 | '/' + value.sizeName; |
262 | dest.feedbacks.comments[key].content = (value.content !== null && | 262 | dest.feedbacks.comments[key].content = (value.content !== null && |
263 | - value.content !== undefined) ? value.content : ''; | 263 | + typeof value.content !== 'undefined') ? value.content : ''; |
264 | dest.feedbacks.comments[key].time = value.createTime; | 264 | dest.feedbacks.comments[key].time = value.createTime; |
265 | }); | 265 | }); |
266 | 266 | ||
@@ -273,7 +273,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -273,7 +273,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
273 | } | 273 | } |
274 | 274 | ||
275 | // 品牌信息 | 275 | // 品牌信息 |
276 | - if (origin.brand !== null && origin.brand !== undefined) { | 276 | + if (origin.brand !== null && typeof origin.brand !== 'undefined') { |
277 | 277 | ||
278 | // 为你优选的链接 | 278 | // 为你优选的链接 |
279 | let params = {}; | 279 | let params = {}; |
@@ -286,7 +286,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -286,7 +286,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
286 | dest.productSkn = origin.erpProductId; | 286 | dest.productSkn = origin.erpProductId; |
287 | 287 | ||
288 | // 商品信息 | 288 | // 商品信息 |
289 | - if (origin.goodsList !== null && origin.goodsList !== undefined) { | 289 | + if (origin.goodsList !== null && typeof origin.goodsList !== 'undefined') { |
290 | let goodsGroup = {}, | 290 | let goodsGroup = {}, |
291 | sizeName = '', | 291 | sizeName = '', |
292 | colorList = {}, | 292 | colorList = {}, |
@@ -303,7 +303,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -303,7 +303,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
303 | colorStorageNum = 0; | 303 | colorStorageNum = 0; |
304 | 304 | ||
305 | // 商品分组 | 305 | // 商品分组 |
306 | - if (value.goodsImagesList !== null && value.goodsImagesList !== undefined) { | 306 | + if (value.goodsImagesList !== null && typeof value.goodsImagesList !== 'undefined') { |
307 | _.forEach(value.goodsImagesList, function(good, keyForGood) { | 307 | _.forEach(value.goodsImagesList, function(good, keyForGood) { |
308 | goodsGroup[keyForGood] = {}; | 308 | goodsGroup[keyForGood] = {}; |
309 | goodsGroup[keyForGood].goodsId = good.goodsId; | 309 | goodsGroup[keyForGood].goodsId = good.goodsId; |
@@ -313,7 +313,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -313,7 +313,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
313 | 313 | ||
314 | // 商品的尺码列表 | 314 | // 商品的尺码列表 |
315 | colorStorageGroup[value.productSkc] = {}; | 315 | colorStorageGroup[value.productSkc] = {}; |
316 | - if (value.goodsSizeBoList !== null && value.goodsSizeBoList !== undefined) { | 316 | + if (value.goodsSizeBoList !== null && typeof value.goodsSizeBoList !== 'undefined') { |
317 | 317 | ||
318 | _.forEach(value.goodsSizeBoList, function(size, keyForSize) { | 318 | _.forEach(value.goodsSizeBoList, function(size, keyForSize) { |
319 | sizeList[value.productSkc] = {}; | 319 | sizeList[value.productSkc] = {}; |
@@ -334,11 +334,11 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -334,11 +334,11 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
334 | build.storage = size.goodsSizeStorageNum; | 334 | build.storage = size.goodsSizeStorageNum; |
335 | build.id = size.id; | 335 | build.id = size.id; |
336 | allSizeList[sizeName] = (allSizeList[sizeName] === null || | 336 | allSizeList[sizeName] = (allSizeList[sizeName] === null || |
337 | - allSizeList[sizeName] === undefined) ? build : | 337 | + typeof allSizeList[sizeName] === 'undefined') ? build : |
338 | allSizeList[sizeName]; | 338 | allSizeList[sizeName]; |
339 | 339 | ||
340 | - colorStorageNum += parseInt(size.goodsSizeStorageNum); | ||
341 | - colorStorageGroup[value.productSkc][sizeName] = parseInt(size.goodsSizeStorageNum); | 340 | + colorStorageNum += parseInt(size.goodsSizeStorageNum, 10); |
341 | + colorStorageGroup[value.productSkc][sizeName] = parseInt(size.goodsSizeStorageNum, 10); | ||
342 | }); | 342 | }); |
343 | 343 | ||
344 | // 颜色分组 | 344 | // 颜色分组 |
@@ -371,7 +371,8 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -371,7 +371,8 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
371 | sizeGroup[0].size = {}; | 371 | sizeGroup[0].size = {}; |
372 | sizeGroup[0].size[key] = {}; | 372 | sizeGroup[0].size[key] = {}; |
373 | sizeGroup[0].size[key].name = sizeName; | 373 | sizeGroup[0].size[key].name = sizeName; |
374 | - sizeGroup[0].size[key].sizeNum = (value.storage === undefined || value.storage === null) ? false : true; | 374 | + sizeGroup[0].size[key].sizeNum = (typeof value.storage === 'undefined' || |
375 | + value.storage === null) ? false : true; | ||
375 | sizeGroup[0].size[key].id = value.id; | 376 | sizeGroup[0].size[key].id = value.id; |
376 | 377 | ||
377 | // 各个颜色的尺码, 每行显示一个尺码对应的颜色 | 378 | // 各个颜色的尺码, 每行显示一个尺码对应的颜色 |
@@ -381,7 +382,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -381,7 +382,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
381 | colorGroup[i].color[keyForColorArr] = {}; | 382 | colorGroup[i].color[keyForColorArr] = {}; |
382 | colorGroup[i].color[keyForColorArr].colorNum = | 383 | colorGroup[i].color[keyForColorArr].colorNum = |
383 | (colorStorageGroup[colorArr.skcId][sizeName] !== null && | 384 | (colorStorageGroup[colorArr.skcId][sizeName] !== null && |
384 | - colorStorageGroup[colorArr.skcId][sizeName] !== undefined) ? | 385 | + typeof colorStorageGroup[colorArr.skcId][sizeName] !== 'undefined') ? |
385 | colorStorageGroup[colorArr.skcId][sizeName] : 0; | 386 | colorStorageGroup[colorArr.skcId][sizeName] : 0; |
386 | }); | 387 | }); |
387 | colorGroup[i].id = value.id; | 388 | colorGroup[i].id = value.id; |
@@ -407,7 +408,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -407,7 +408,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
407 | }); | 408 | }); |
408 | 409 | ||
409 | // 商品图:多个 | 410 | // 商品图:多个 |
410 | - if (goodsGroup[1] !== null && goodsGroup[1] !== undefined) { | 411 | + if (goodsGroup[1] !== null && typeof goodsGroup[1] !== 'undefined') { |
411 | _.forEach(goodsGroup, function(value, key) { | 412 | _.forEach(goodsGroup, function(value, key) { |
412 | dest.bannerTop = {}; | 413 | dest.bannerTop = {}; |
413 | 414 | ||
@@ -417,7 +418,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -417,7 +418,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
417 | params.img = value.img; | 418 | params.img = value.img; |
418 | dest.bannerTop.list[key] = params; | 419 | dest.bannerTop.list[key] = params; |
419 | }); | 420 | }); |
420 | - } else if (goodsGroup[0] !== null && goodsGroup[0] !== undefined) { | 421 | + } else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') { |
421 | dest.bannerTop = {}; | 422 | dest.bannerTop = {}; |
422 | dest.bannerTop.img = goodsGroup[0].img; | 423 | dest.bannerTop.img = goodsGroup[0].img; |
423 | } | 424 | } |
@@ -439,11 +440,11 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -439,11 +440,11 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
439 | dest.cartInfo = {}; | 440 | dest.cartInfo = {}; |
440 | dest.cartInfo.productId = origin.id; | 441 | dest.cartInfo.productId = origin.id; |
441 | dest.cartInfo.thumbs = thumbImageList; | 442 | dest.cartInfo.thumbs = thumbImageList; |
442 | - dest.cartInfo.name = (dest.goodsName !== null && dest.goodsName !== undefined) ? dest.goodsName : ''; | 443 | + dest.cartInfo.name = (dest.goodsName !== null && typeof dest.goodsName !== 'undefined') ? dest.goodsName : ''; |
443 | dest.cartInfo.price = (dest.goodsPrice.previousPrice !== null && | 444 | dest.cartInfo.price = (dest.goodsPrice.previousPrice !== null && |
444 | - dest.goodsPrice.previousPrice !== undefined) ? dest.goodsPrice.previousPrice : ''; | 445 | + typeof dest.goodsPrice.previousPrice !== 'undefined') ? dest.goodsPrice.previousPrice : ''; |
445 | dest.cartInfo.salePrice = (dest.goodsPrice.currentPrice !== null && | 446 | dest.cartInfo.salePrice = (dest.goodsPrice.currentPrice !== null && |
446 | - dest.goodsPrice.currentPrice !== undefined) ? dest.goodsPrice.currentPrice : ''; | 447 | + typeof dest.goodsPrice.currentPrice !== 'undefined') ? dest.goodsPrice.currentPrice : ''; |
447 | dest.cartInfo.totalNum = totalStorageNum; | 448 | dest.cartInfo.totalNum = totalStorageNum; |
448 | dest.cartInfo.colors = colorGroup; | 449 | dest.cartInfo.colors = colorGroup; |
449 | dest.cartInfo.sizes = sizeGroup; | 450 | dest.cartInfo.sizes = sizeGroup; |
@@ -451,14 +452,14 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -451,14 +452,14 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
451 | // 限购商品 | 452 | // 限购商品 |
452 | if (origin.isLimitBuy === 'Y') { | 453 | if (origin.isLimitBuy === 'Y') { |
453 | // 是否开售 | 454 | // 是否开售 |
454 | - let isBeginSale = (origin.saleStatus !== null && origin.saleStatus !== undefined && | 455 | + let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' && |
455 | origin.saleStatus === 1); | 456 | origin.saleStatus === 1); |
456 | 457 | ||
457 | // 限购商品有关的展示状态 | 458 | // 限购商品有关的展示状态 |
458 | let showStatus = 1; | 459 | let showStatus = 1; |
459 | 460 | ||
460 | - if (origin.showStatus !== null && origin.showStatus !== undefined) { | ||
461 | - showStatus = parseInt(origin.showStatus); | 461 | + if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') { |
462 | + showStatus = parseInt(origin.showStatus, 10); | ||
462 | } | 463 | } |
463 | 464 | ||
464 | // 处理限购商品有关的按钮状态 | 465 | // 处理限购商品有关的按钮状态 |
@@ -479,7 +480,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | @@ -479,7 +480,7 @@ const detailDataPkg = (origin, uid, vipLevel, ua) => { | ||
479 | // 是否收藏 | 480 | // 是否收藏 |
480 | 481 | ||
481 | dest.isCollect = false; | 482 | dest.isCollect = false; |
482 | - if (origin.isCollect !== null && origin.isCollect !== undefined && origin.isCollect === 'Y') { | 483 | + if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') { |
483 | dest.isCollect = true; | 484 | dest.isCollect = true; |
484 | } | 485 | } |
485 | 486 |
-
Please register or login to post a comment