|
@@ -138,6 +138,426 @@ const _getLimitCodeUrl = (productCode, skn, ua) => { |
|
@@ -138,6 +138,426 @@ const _getLimitCodeUrl = (productCode, skn, ua) => { |
138
|
* @param origin Object 原始数据
|
138
|
* @param origin Object 原始数据
|
139
|
* @return dest Object 格式化数据
|
139
|
* @return dest Object 格式化数据
|
140
|
*/
|
140
|
*/
|
|
|
141
|
+// 老接口h5的代码
|
|
|
142
|
+// const _detailDataPkg = (origin, uid, vipLevel, ua) => {
|
|
|
143
|
+// let dest = {}, // 结果输出
|
|
|
144
|
+// thumbImageList = [],
|
|
|
145
|
+// colorGroup = {},
|
|
|
146
|
+// sizeGroup = [],
|
|
|
147
|
+// totalStorageNum = 0;
|
|
|
148
|
+
|
|
|
149
|
+// // 商品名称
|
|
|
150
|
+// if (origin.productName === null || typeof origin.productName === 'undefined') {
|
|
|
151
|
+// return dest;
|
|
|
152
|
+// }
|
|
|
153
|
+
|
|
|
154
|
+// dest.goodsName = origin.productName;
|
|
|
155
|
+
|
|
|
156
|
+// // 是否是虚拟商品
|
|
|
157
|
+// dest.virtualGoods = origin.attribute * 1 === 3 ? true : false;
|
|
|
158
|
+
|
|
|
159
|
+// // 用户未登录时
|
|
|
160
|
+// if (!uid) {
|
|
|
161
|
+// let params = {};
|
|
|
162
|
+
|
|
|
163
|
+// params.refer = helpers.urlFormat('/product/show_' + origin.erpProductId + '.html');
|
|
|
164
|
+// dest.loginUrl = helpers.urlFormat('/signin.html', params);
|
|
|
165
|
+// }
|
|
|
166
|
+
|
|
|
167
|
+// // 商品促销短语
|
|
|
168
|
+// if (origin.salesPhrase) {
|
|
|
169
|
+// dest.goodsSubtitle = origin.salesPhrase;
|
|
|
170
|
+// }
|
|
|
171
|
+
|
|
|
172
|
+// // 促销信息 TODO: 换新接口
|
|
|
173
|
+// if (origin.promotionBoList) {
|
|
|
174
|
+// let discountList = [];
|
|
|
175
|
+
|
|
|
176
|
+// _.forEach(origin.promotionBoList, function(value) {
|
|
|
177
|
+// discountList.push({
|
|
|
178
|
+// text: `【${value.promotionType}】${value.promotionTitle}`
|
|
|
179
|
+// });
|
|
|
180
|
+// });
|
|
|
181
|
+
|
|
|
182
|
+// if (discountList.length) {
|
|
|
183
|
+// dest.goodsDiscount = {
|
|
|
184
|
+// list: discountList
|
|
|
185
|
+// };
|
|
|
186
|
+// }
|
|
|
187
|
+// }
|
|
|
188
|
+
|
|
|
189
|
+// // 商品标签
|
|
|
190
|
+// if (origin.productTagBoList) {
|
|
|
191
|
+// let productTags = {};
|
|
|
192
|
+
|
|
|
193
|
+// _.forEach(origin.productTagBoList, function(value) {
|
|
|
194
|
+// switch (value.tagLabel) {
|
|
|
195
|
+// case 'is_soon_sold_out':
|
|
|
196
|
+// productTags.is_soon_sold_out = true;
|
|
|
197
|
+// break;
|
|
|
198
|
+// case 'is_new':
|
|
|
199
|
+// productTags.is_new = true;
|
|
|
200
|
+// break;
|
|
|
201
|
+// case 'is_discount':
|
|
|
202
|
+// productTags.is_discount = true;
|
|
|
203
|
+// break;
|
|
|
204
|
+// case 'is_limited':
|
|
|
205
|
+// productTags.is_limited = true;
|
|
|
206
|
+// break;
|
|
|
207
|
+// case 'is_yohood':
|
|
|
208
|
+// productTags.is_yohood = true;
|
|
|
209
|
+// break;
|
|
|
210
|
+// case 'is_advance':
|
|
|
211
|
+// productTags.is_advance = true;
|
|
|
212
|
+// break;
|
|
|
213
|
+// default:
|
|
|
214
|
+// break;
|
|
|
215
|
+// }
|
|
|
216
|
+// });
|
|
|
217
|
+
|
|
|
218
|
+// dest.tags = productTags;
|
|
|
219
|
+// }
|
|
|
220
|
+
|
|
|
221
|
+// // 商品价格
|
|
|
222
|
+// if (origin.productPriceBo) {
|
|
|
223
|
+// let originPrice = origin.productPriceBo;
|
|
|
224
|
+// let goodsPrice = {
|
|
|
225
|
+// currentPrice: originPrice.formatSalesPrice
|
|
|
226
|
+// };
|
|
|
227
|
+
|
|
|
228
|
+// if (originPrice.formatMarketPrice !== originPrice.formatSalesPrice) {
|
|
|
229
|
+// goodsPrice.previousPrice = originPrice.formatMarketPrice;
|
|
|
230
|
+// }
|
|
|
231
|
+
|
|
|
232
|
+// dest.goodsPrice = goodsPrice;
|
|
|
233
|
+
|
|
|
234
|
+// // 商品返回 有货币
|
|
|
235
|
+// if (originPrice.yohoCoinNum) {
|
|
|
236
|
+// dest.commodityReturn = originPrice.yohoCoinNum;
|
|
|
237
|
+// }
|
|
|
238
|
+// }
|
|
|
239
|
+
|
|
|
240
|
+// // VIP 商品价格
|
|
|
241
|
+// if (origin.productPriceBo.vipPrices) {
|
|
|
242
|
+// let vipList = [];
|
|
|
243
|
+
|
|
|
244
|
+// _.forEach(origin.productPriceBo.vipPrices, function(value) {
|
|
|
245
|
+// vipList.push({
|
|
|
246
|
+// level: value.vipLevel,
|
|
|
247
|
+// text: value.vipPrice,
|
|
|
248
|
+// currentLevel: (value.vipLevel === vipLevel)
|
|
|
249
|
+// });
|
|
|
250
|
+// });
|
|
|
251
|
+
|
|
|
252
|
+// if (vipList.length) {
|
|
|
253
|
+// dest.vipLevel = {
|
|
|
254
|
+// list: vipList
|
|
|
255
|
+// };
|
|
|
256
|
+// }
|
|
|
257
|
+
|
|
|
258
|
+// }
|
|
|
259
|
+
|
|
|
260
|
+// // 上市期
|
|
|
261
|
+// if (origin.expectArrivalTime) {
|
|
|
262
|
+// dest.periodOfMarket = `${origin.expectArrivalTime}月`;
|
|
|
263
|
+// }
|
|
|
264
|
+
|
|
|
265
|
+// // 商品咨询
|
|
|
266
|
+// dest.feedbacks = {
|
|
|
267
|
+// consults: [],
|
|
|
268
|
+// consultsNum: 0
|
|
|
269
|
+// };
|
|
|
270
|
+
|
|
|
271
|
+// let consultParams = {
|
|
|
272
|
+// product_id: origin.id
|
|
|
273
|
+// };
|
|
|
274
|
+
|
|
|
275
|
+// if (_.has(dest, 'feedbacks.consultsNum')) {
|
|
|
276
|
+// consultParams.total = dest.feedbacks.consultsNum;
|
|
|
277
|
+// dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consults', consultParams);
|
|
|
278
|
+// } else {
|
|
|
279
|
+// dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams);
|
|
|
280
|
+// }
|
|
|
281
|
+
|
|
|
282
|
+
|
|
|
283
|
+// // 商品评价
|
|
|
284
|
+// dest.feedbacks.commentsNum = 0;
|
|
|
285
|
+// if (origin.commentBoWrapper) {
|
|
|
286
|
+// dest.feedbacks.commentsNum = origin.commentBoWrapper.commentTotal;
|
|
|
287
|
+
|
|
|
288
|
+// let commentList = [];
|
|
|
289
|
+
|
|
|
290
|
+// _.forEach(origin.commentBoWrapper.commentBoList, function(value) {
|
|
|
291
|
+// commentList.push({
|
|
|
292
|
+// userName: value.nickName,
|
|
|
293
|
+// desc: `${value.colorName}/${value.sizeName}`,
|
|
|
294
|
+// content: value.content ? value.content : '',
|
|
|
295
|
+// time: value.createTime
|
|
|
296
|
+// });
|
|
|
297
|
+// });
|
|
|
298
|
+
|
|
|
299
|
+// dest.feedbacks.comments = commentList;
|
|
|
300
|
+
|
|
|
301
|
+// dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
|
|
|
302
|
+// product_id: origin.id,
|
|
|
303
|
+// total: dest.feedbacks.commentsNum
|
|
|
304
|
+// });
|
|
|
305
|
+// }
|
|
|
306
|
+
|
|
|
307
|
+// // 品牌信息
|
|
|
308
|
+// if (origin.brand) {
|
|
|
309
|
+// let extra = `?productSkn=${origin.erpProductId}&brandId=${origin.brand.id}`;
|
|
|
310
|
+
|
|
|
311
|
+// dest.preferenceUrl = `/product/detail/preference${extra}`;
|
|
|
312
|
+// }
|
|
|
313
|
+
|
|
|
314
|
+// dest.productSkn = origin.erpProductId;
|
|
|
315
|
+
|
|
|
316
|
+// // 商品信息
|
|
|
317
|
+// if (origin.goodsList) {
|
|
|
318
|
+// let goodsGroup = [],
|
|
|
319
|
+// sizeName = '',
|
|
|
320
|
+// colorList = [],
|
|
|
321
|
+// sizeList = {},
|
|
|
322
|
+// allSizeList = {},
|
|
|
323
|
+// colorStorageGroup = {},
|
|
|
324
|
+// colorStorageNum = 0;
|
|
|
325
|
+
|
|
|
326
|
+// _.forEach(origin.goodsList, function(value) {
|
|
|
327
|
+// if (value.status === 0) {
|
|
|
328
|
+// return;
|
|
|
329
|
+// }
|
|
|
330
|
+
|
|
|
331
|
+// colorStorageNum = 0;
|
|
|
332
|
+
|
|
|
333
|
+// // 商品分组
|
|
|
334
|
+// if (value.goodsImagesList) {
|
|
|
335
|
+// _.forEach(value.goodsImagesList, function(good) {
|
|
|
336
|
+// goodsGroup.push({
|
|
|
337
|
+// goodsId: good.goodsId,
|
|
|
338
|
+// img: good.imageUrl
|
|
|
339
|
+// });
|
|
|
340
|
+// });
|
|
|
341
|
+// }
|
|
|
342
|
+
|
|
|
343
|
+// // 商品的尺码列表
|
|
|
344
|
+// colorStorageGroup[value.productSkc] = {};
|
|
|
345
|
+// if (value.goodsSizeBoList) {
|
|
|
346
|
+// sizeList[value.productSkc] = [];
|
|
|
347
|
+// _.forEach(value.goodsSizeBoList, function(size) {
|
|
|
348
|
+// sizeList[value.productSkc].push({
|
|
|
349
|
+// id: size.id,
|
|
|
350
|
+// skuId: size.goodsSizeSkuId,
|
|
|
351
|
+// goodsId: size.goodsId,
|
|
|
352
|
+// colorId: size.colorId,
|
|
|
353
|
+// name: size.sizeName,
|
|
|
354
|
+// sizeNum: size.goodsSizeStorageNum
|
|
|
355
|
+// });
|
|
|
356
|
+
|
|
|
357
|
+// sizeName = size.sizeName;
|
|
|
358
|
+
|
|
|
359
|
+// // 所有尺码列表,赋值用于前端展示默认尺码的时候
|
|
|
360
|
+// // 判断出没有库存则显示灰色
|
|
|
361
|
+// let build = {
|
|
|
362
|
+// id: size.id,
|
|
|
363
|
+// storage: size.goodsSizeStorageNum
|
|
|
364
|
+// };
|
|
|
365
|
+
|
|
|
366
|
+// allSizeList[sizeName] = (allSizeList[sizeName] === null ||
|
|
|
367
|
+// typeof allSizeList[sizeName] === 'undefined') ? build :
|
|
|
368
|
+// allSizeList[sizeName];
|
|
|
369
|
+
|
|
|
370
|
+// colorStorageNum += parseInt(size.goodsSizeStorageNum, 10);
|
|
|
371
|
+// colorStorageGroup[value.productSkc][sizeName] = parseInt(size.goodsSizeStorageNum, 10);
|
|
|
372
|
+// });
|
|
|
373
|
+
|
|
|
374
|
+// // 颜色分组
|
|
|
375
|
+// colorList.push({
|
|
|
376
|
+// id: value.colorId,
|
|
|
377
|
+// skcId: value.productSkc,
|
|
|
378
|
+// name: value.colorName,
|
|
|
379
|
+// goodsName: value.goodsName,
|
|
|
380
|
+// colorNum: colorStorageNum
|
|
|
381
|
+// });
|
|
|
382
|
+// }
|
|
|
383
|
+
|
|
|
384
|
+// // 缩略图
|
|
|
385
|
+// thumbImageList.push({
|
|
|
386
|
+// img: value.colorImage
|
|
|
387
|
+// });
|
|
|
388
|
+
|
|
|
389
|
+// // 商品库存总数
|
|
|
390
|
+// totalStorageNum += _.toNumber(colorStorageNum);
|
|
|
391
|
+// });
|
|
|
392
|
+
|
|
|
393
|
+// // 遍历所有尺码,构建颜色显示数据
|
|
|
394
|
+// let i = 1;
|
|
|
395
|
+
|
|
|
396
|
+// sizeGroup[0] = {
|
|
|
397
|
+// size: []
|
|
|
398
|
+// };
|
|
|
399
|
+
|
|
|
400
|
+// _.forEach(allSizeList, (value, key) => {
|
|
|
401
|
+
|
|
|
402
|
+// // 默认尺码
|
|
|
403
|
+// sizeGroup[0].size.push({
|
|
|
404
|
+// name: key,
|
|
|
405
|
+// sizeNum: _.toNumber(value.storage) > 0 ? true : false,
|
|
|
406
|
+// id: value.id
|
|
|
407
|
+// });
|
|
|
408
|
+
|
|
|
409
|
+// colorGroup[i] = {
|
|
|
410
|
+// color: []
|
|
|
411
|
+// };
|
|
|
412
|
+
|
|
|
413
|
+// // 各个颜色的尺码, 每行显示一个尺码对应的颜色
|
|
|
414
|
+// _.forEach(colorList, (colorArr) => {
|
|
|
415
|
+// let tempColorArr = _.cloneDeep(colorArr);
|
|
|
416
|
+
|
|
|
417
|
+// if (colorStorageGroup[tempColorArr.skcId] &&
|
|
|
418
|
+// colorStorageGroup[tempColorArr.skcId][key]) {
|
|
|
419
|
+// tempColorArr.colorNum = colorStorageGroup[tempColorArr.skcId][key];
|
|
|
420
|
+// } else {
|
|
|
421
|
+// tempColorArr.colorNum = 0;
|
|
|
422
|
+// }
|
|
|
423
|
+// colorGroup[i].color.push(Object.assign({}, tempColorArr));
|
|
|
424
|
+// });
|
|
|
425
|
+// colorGroup[i].id = value.id;
|
|
|
426
|
+
|
|
|
427
|
+// ++i;
|
|
|
428
|
+// });
|
|
|
429
|
+
|
|
|
430
|
+// colorGroup[0] = {
|
|
|
431
|
+// color: []
|
|
|
432
|
+// };
|
|
|
433
|
+
|
|
|
434
|
+// // 遍历所有颜色, 构建尺码显示数据
|
|
|
435
|
+// i = 1;
|
|
|
436
|
+// _.forEach(colorList, function(value) {
|
|
|
437
|
+// // 各个尺码的颜色, 每行显示一个颜色的对应尺码
|
|
|
438
|
+// sizeGroup[i] = {
|
|
|
439
|
+// size: sizeList[value.skcId],
|
|
|
440
|
+// colorId: value.skcId
|
|
|
441
|
+// };
|
|
|
442
|
+
|
|
|
443
|
+// // 默认颜色
|
|
|
444
|
+// colorGroup[0].color.push(value);
|
|
|
445
|
+// ++i;
|
|
|
446
|
+// });
|
|
|
447
|
+
|
|
|
448
|
+
|
|
|
449
|
+// // 商品图:多个
|
|
|
450
|
+// if (goodsGroup.length > 1) {
|
|
|
451
|
+// let bannerList = [];
|
|
|
452
|
+
|
|
|
453
|
+// _.forEach(goodsGroup, function(value) {
|
|
|
454
|
+// bannerList.push({
|
|
|
455
|
+// img: value.img
|
|
|
456
|
+// });
|
|
|
457
|
+// });
|
|
|
458
|
+
|
|
|
459
|
+// dest.bannerTop = {
|
|
|
460
|
+// list: bannerList
|
|
|
461
|
+// };
|
|
|
462
|
+// } else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') {
|
|
|
463
|
+// dest.bannerTop = {
|
|
|
464
|
+// img: goodsGroup[0].img
|
|
|
465
|
+// };
|
|
|
466
|
+// }
|
|
|
467
|
+// }
|
|
|
468
|
+
|
|
|
469
|
+// // 悬浮的购物车信息
|
|
|
470
|
+// dest.cartInfo = {
|
|
|
471
|
+// cartUrl: helpers.urlFormat('/cart/index/index'),
|
|
|
472
|
+// numInCart: 0,
|
|
|
473
|
+// goodsInstore: origin.storage
|
|
|
474
|
+// };
|
|
|
475
|
+
|
|
|
476
|
+// let soldOut = (origin.storage === 0) || (origin.status === 0 || totalStorageNum === 0);
|
|
|
477
|
+// let notForSale = origin.attribute === 2;
|
|
|
478
|
+
|
|
|
479
|
+// // 显示加入购物车链接
|
|
|
480
|
+// if (!soldOut && !notForSale) {
|
|
|
481
|
+// _.orderBy(colorGroup);
|
|
|
482
|
+
|
|
|
483
|
+// Object.assign(dest.cartInfo, {
|
|
|
484
|
+// productId: origin.id,
|
|
|
485
|
+// thumbs: thumbImageList,
|
|
|
486
|
+// name: dest.goodsName ? dest.goodsName : '',
|
|
|
487
|
+// price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
|
|
|
488
|
+// salePrice: dest.goodsPrice.currentPrice ? dest.goodsPrice.currentPrice : '',
|
|
|
489
|
+// totalNum: totalStorageNum,
|
|
|
490
|
+// colors: _.toArray(colorGroup),
|
|
|
491
|
+// sizes: sizeGroup
|
|
|
492
|
+// });
|
|
|
493
|
+
|
|
|
494
|
+// // 限购商品
|
|
|
495
|
+// if (origin.isLimitBuy === 'Y') {
|
|
|
496
|
+// // 是否开售
|
|
|
497
|
+// let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
|
|
|
498
|
+// origin.saleStatus === 1);
|
|
|
499
|
+
|
|
|
500
|
+// // 限购商品有关的展示状态
|
|
|
501
|
+// let showStatus = 1;
|
|
|
502
|
+
|
|
|
503
|
+// if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') {
|
|
|
504
|
+// showStatus = parseInt(origin.showStatus, 10);
|
|
|
505
|
+// }
|
|
|
506
|
+
|
|
|
507
|
+// // 处理限购商品有关的按钮状态
|
|
|
508
|
+// dest = _procShowStatus(dest, showStatus, isBeginSale);
|
|
|
509
|
+
|
|
|
510
|
+// dest.cartInfo.limitProductCode = origin.limitProductCode;
|
|
|
511
|
+// dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.erpProductId, ua);
|
|
|
512
|
+// dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
|
|
|
513
|
+// } else {
|
|
|
514
|
+// dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.id + '_' +
|
|
|
515
|
+// origin.goodsList.id + '.html');
|
|
|
516
|
+// }
|
|
|
517
|
+// } else if (notForSale) {
|
|
|
518
|
+// dest.cartInfo.notForSale = true;
|
|
|
519
|
+// } else if (soldOut) {
|
|
|
520
|
+// dest.cartInfo.soldOut = true;
|
|
|
521
|
+// }
|
|
|
522
|
+
|
|
|
523
|
+// // 是否收藏
|
|
|
524
|
+// dest.isCollect = false;
|
|
|
525
|
+// if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') {
|
|
|
526
|
+// dest.isCollect = true;
|
|
|
527
|
+// dest.cartInfo.isCollect = true;
|
|
|
528
|
+// }
|
|
|
529
|
+
|
|
|
530
|
+// // 底部简介URL链接
|
|
|
531
|
+// dest.introUrl = '/product/detail/intro/' + origin.erpProductId;
|
|
|
532
|
+// dest.id = origin.id;
|
|
|
533
|
+
|
|
|
534
|
+// // 虚拟商品(门票)
|
|
|
535
|
+// if (origin.attribute * 1 === 3) {
|
|
|
536
|
+// dest.tickets = true;
|
|
|
537
|
+// dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
|
|
|
538
|
+
|
|
|
539
|
+// // 展览票
|
|
|
540
|
+// if (origin.erpProductId * 1 === SINGLE_TICKETS_SKN) {
|
|
|
541
|
+// dest.single = true;
|
|
|
542
|
+// } else {
|
|
|
543
|
+// // 套票
|
|
|
544
|
+// dest.package = true;
|
|
|
545
|
+// }
|
|
|
546
|
+
|
|
|
547
|
+// // 购票限制
|
|
|
548
|
+// dest.cartInfo.limit = 4;
|
|
|
549
|
+
|
|
|
550
|
+// // 清空活动
|
|
|
551
|
+// dest.goodsDiscount = [];
|
|
|
552
|
+
|
|
|
553
|
+// // 来自登录页,自动弹出选择框
|
|
|
554
|
+// // if (isset($_GET['product_type']) && $_GET['product_type'] == 'ticket') {
|
|
|
555
|
+// // $result['showPannel'] = true;
|
|
|
556
|
+// // }
|
|
|
557
|
+// }
|
|
|
558
|
+
|
|
|
559
|
+// return dest;
|
|
|
560
|
+// };
|
141
|
const _detailDataPkg = (origin, uid, vipLevel, ua) => {
|
561
|
const _detailDataPkg = (origin, uid, vipLevel, ua) => {
|
142
|
let dest = {}, // 结果输出
|
562
|
let dest = {}, // 结果输出
|
143
|
thumbImageList = [],
|
563
|
thumbImageList = [],
|
|
@@ -145,28 +565,26 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -145,28 +565,26 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
145
|
sizeGroup = [],
|
565
|
sizeGroup = [],
|
146
|
totalStorageNum = 0;
|
566
|
totalStorageNum = 0;
|
147
|
|
567
|
|
148
|
- // 商品名称
|
|
|
149
|
- if (origin.productName === null || typeof origin.productName === 'undefined') {
|
568
|
+ // 商品名称
|
|
|
569
|
+ if (!origin.productName) {
|
|
|
570
|
+ dest.feedbacks = {};
|
150
|
return dest;
|
571
|
return dest;
|
151
|
}
|
572
|
}
|
152
|
|
573
|
|
153
|
dest.goodsName = origin.productName;
|
574
|
dest.goodsName = origin.productName;
|
154
|
|
575
|
|
155
|
- // 是否是虚拟商品
|
|
|
156
|
- dest.virtualGoods = origin.attribute * 1 === 3 ? true : false;
|
576
|
+ // 是否是虚拟商品
|
|
|
577
|
+ dest.virtualGoods = (origin.attribute * 1 === 3);
|
157
|
|
578
|
|
158
|
// 用户未登录时
|
579
|
// 用户未登录时
|
159
|
if (!uid) {
|
580
|
if (!uid) {
|
160
|
- let params = {};
|
|
|
161
|
-
|
|
|
162
|
- params.refer = helpers.urlFormat('/product/show_' + origin.erpProductId + '.html');
|
|
|
163
|
- dest.loginUrl = helpers.urlFormat('/signin.html', params);
|
581
|
+ dest.loginUrl = helpers.urlFormat('/signin.html', {
|
|
|
582
|
+ refer: helpers.urlFormat('/product/show_' + origin.productSkn + '.html')
|
|
|
583
|
+ });
|
164
|
}
|
584
|
}
|
165
|
|
585
|
|
166
|
- // 商品促销短语
|
|
|
167
|
- if (origin.salesPhrase) {
|
|
|
168
|
- dest.goodsSubtitle = origin.salesPhrase;
|
|
|
169
|
- }
|
586
|
+ // 商品促销短语
|
|
|
587
|
+ origin.salesPhrase && (dest.goodsSubtitle = origin.salesPhrase);
|
170
|
|
588
|
|
171
|
// 促销信息 TODO: 换新接口
|
589
|
// 促销信息 TODO: 换新接口
|
172
|
if (origin.promotionBoList) {
|
590
|
if (origin.promotionBoList) {
|
|
@@ -178,94 +596,61 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -178,94 +596,61 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
178
|
});
|
596
|
});
|
179
|
});
|
597
|
});
|
180
|
|
598
|
|
181
|
- if (discountList.length) {
|
|
|
182
|
- dest.goodsDiscount = {
|
|
|
183
|
- list: discountList
|
|
|
184
|
- };
|
|
|
185
|
- }
|
599
|
+ discountList.length && (dest.goodsDiscount = {
|
|
|
600
|
+ list: discountList
|
|
|
601
|
+ });
|
186
|
}
|
602
|
}
|
187
|
|
603
|
|
188
|
- // 商品标签
|
|
|
189
|
- if (origin.productTagBoList) {
|
604
|
+ // 商品标签
|
|
|
605
|
+ if (origin.tags) {
|
190
|
let productTags = {};
|
606
|
let productTags = {};
|
191
|
|
607
|
|
192
|
- _.forEach(origin.productTagBoList, function(value) {
|
|
|
193
|
- switch (value.tagLabel) {
|
|
|
194
|
- case 'is_soon_sold_out':
|
|
|
195
|
- productTags.is_soon_sold_out = true;
|
|
|
196
|
- break;
|
|
|
197
|
- case 'is_new':
|
|
|
198
|
- productTags.is_new = true;
|
|
|
199
|
- break;
|
|
|
200
|
- case 'is_discount':
|
|
|
201
|
- productTags.is_discount = true;
|
|
|
202
|
- break;
|
|
|
203
|
- case 'is_limited':
|
|
|
204
|
- productTags.is_limited = true;
|
|
|
205
|
- break;
|
|
|
206
|
- case 'is_yohood':
|
|
|
207
|
- productTags.is_yohood = true;
|
|
|
208
|
- break;
|
|
|
209
|
- case 'is_advance':
|
|
|
210
|
- productTags.is_advance = true;
|
|
|
211
|
- break;
|
|
|
212
|
- default:
|
|
|
213
|
- break;
|
|
|
214
|
- }
|
608
|
+ _.forEach(origin.tags, function(value) {
|
|
|
609
|
+ productTags[value] = true;
|
215
|
});
|
610
|
});
|
216
|
|
611
|
|
217
|
dest.tags = productTags;
|
612
|
dest.tags = productTags;
|
218
|
}
|
613
|
}
|
219
|
|
614
|
|
220
|
- // 商品价格
|
|
|
221
|
- if (origin.productPriceBo) {
|
|
|
222
|
- let originPrice = origin.productPriceBo;
|
|
|
223
|
- let goodsPrice = {
|
|
|
224
|
- currentPrice: originPrice.formatSalesPrice,
|
|
|
225
|
- studentPrice: originPrice.studentPrice
|
|
|
226
|
- };
|
|
|
227
|
-
|
|
|
228
|
- if (originPrice.formatMarketPrice !== originPrice.formatSalesPrice) {
|
|
|
229
|
- goodsPrice.previousPrice = originPrice.formatMarketPrice;
|
|
|
230
|
- }
|
|
|
231
|
- dest.goodsPrice = goodsPrice;
|
615
|
+ // 商品价格
|
|
|
616
|
+ let goodsPrice = {
|
|
|
617
|
+ currentPrice: origin.formatSalesPrice === '0' ? origin.formatMarketPrice : origin.formatSalesPrice
|
|
|
618
|
+ };
|
232
|
|
619
|
|
233
|
- // 商品返回 有货币
|
620
|
+ if (origin.formatSalesPrice !== '0' && origin.formatMarketPrice !== origin.formatSalesPrice) {
|
|
|
621
|
+ goodsPrice.previousPrice = origin.formatMarketPrice;
|
|
|
622
|
+ }
|
234
|
|
623
|
|
235
|
- if (originPrice.yohoCoinNum) {
|
|
|
236
|
- dest.commodityReturn = originPrice.yohoCoinNum;
|
|
|
237
|
- }
|
624
|
+ dest.goodsPrice = goodsPrice;
|
238
|
|
625
|
|
239
|
- // 学生有货币
|
|
|
240
|
- if (originPrice.studentCoinNum) {
|
|
|
241
|
- dest.studentCoinNum = originPrice.studentCoinNum;
|
|
|
242
|
- }
|
|
|
243
|
- }
|
626
|
+ // 商品返回 YOHO 币
|
|
|
627
|
+ origin.yohoCoinNum && (dest.commodityReturn = origin.yohoCoinNum);
|
244
|
|
628
|
|
245
|
- // VIP 商品价格
|
|
|
246
|
- if (origin.productPriceBo.vipPrices) {
|
629
|
+ // VIP 商品价格
|
|
|
630
|
+ if (origin.vip) {
|
247
|
let vipList = [];
|
631
|
let vipList = [];
|
|
|
632
|
+ let levelList = {
|
|
|
633
|
+ 银卡: 1,
|
|
|
634
|
+ 金卡: 2,
|
|
|
635
|
+ 白金: 3
|
|
|
636
|
+ };
|
248
|
|
637
|
|
249
|
- _.forEach(origin.productPriceBo.vipPrices, function(value) {
|
638
|
+ _.forEach(origin.vip, function(value) {
|
250
|
vipList.push({
|
639
|
vipList.push({
|
251
|
- level: value.vipLevel,
|
|
|
252
|
- text: value.vipPrice,
|
640
|
+ level: levelList[value.caption],
|
|
|
641
|
+ text: value.price,
|
253
|
currentLevel: (value.vipLevel === vipLevel)
|
642
|
currentLevel: (value.vipLevel === vipLevel)
|
254
|
});
|
643
|
});
|
255
|
});
|
644
|
});
|
256
|
|
645
|
|
257
|
- if (vipList.length) {
|
|
|
258
|
- dest.vipLevel = {
|
|
|
259
|
- list: vipList
|
|
|
260
|
- };
|
|
|
261
|
- }
|
646
|
+ vipList.length && (dest.vipLevel = {
|
|
|
647
|
+ list: vipList
|
|
|
648
|
+ });
|
262
|
|
649
|
|
263
|
}
|
650
|
}
|
264
|
|
651
|
|
265
|
- // 上市期
|
|
|
266
|
- if (origin.expectArrivalTime) {
|
|
|
267
|
- dest.periodOfMarket = `${origin.expectArrivalTime}月`;
|
|
|
268
|
- }
|
652
|
+ // 上市期
|
|
|
653
|
+ origin.expectArrivalTime && (dest.periodOfMarket = `${origin.expectArrivalTime}月`);
|
269
|
|
654
|
|
270
|
// 商品咨询
|
655
|
// 商品咨询
|
271
|
dest.feedbacks = {
|
656
|
dest.feedbacks = {
|
|
@@ -274,7 +659,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -274,7 +659,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
274
|
};
|
659
|
};
|
275
|
|
660
|
|
276
|
let consultParams = {
|
661
|
let consultParams = {
|
277
|
- product_id: origin.id
|
662
|
+ product_id: origin.productId
|
278
|
};
|
663
|
};
|
279
|
|
664
|
|
280
|
if (_.has(dest, 'feedbacks.consultsNum')) {
|
665
|
if (_.has(dest, 'feedbacks.consultsNum')) {
|
|
@@ -284,39 +669,19 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -284,39 +669,19 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
284
|
dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams);
|
669
|
dest.feedbacks.consultsUrl = helpers.urlFormat('/product/detail/consultform', consultParams);
|
285
|
}
|
670
|
}
|
286
|
|
671
|
|
287
|
-
|
|
|
288
|
- // 商品评价
|
|
|
289
|
- dest.feedbacks.commentsNum = 0;
|
|
|
290
|
- if (origin.commentBoWrapper) {
|
|
|
291
|
- dest.feedbacks.commentsNum = origin.commentBoWrapper.commentTotal;
|
|
|
292
|
-
|
|
|
293
|
- let commentList = [];
|
|
|
294
|
-
|
|
|
295
|
- _.forEach(origin.commentBoWrapper.commentBoList, function(value) {
|
|
|
296
|
- commentList.push({
|
|
|
297
|
- userName: value.nickName,
|
|
|
298
|
- desc: `${value.colorName}/${value.sizeName}`,
|
|
|
299
|
- content: value.content ? value.content : '',
|
|
|
300
|
- time: value.createTime
|
|
|
301
|
- });
|
|
|
302
|
- });
|
|
|
303
|
-
|
|
|
304
|
- dest.feedbacks.comments = commentList;
|
|
|
305
|
-
|
|
|
306
|
- dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
|
|
|
307
|
- product_id: origin.id,
|
|
|
308
|
- total: dest.feedbacks.commentsNum
|
|
|
309
|
- });
|
|
|
310
|
- }
|
672
|
+ // 商品评价
|
|
|
673
|
+ dest.feedbacks.commentsUrl = helpers.urlFormat('/product/detail/comments', {
|
|
|
674
|
+ product_id: origin.productId,
|
|
|
675
|
+ });
|
311
|
|
676
|
|
312
|
// 品牌信息
|
677
|
// 品牌信息
|
313
|
if (origin.brand) {
|
678
|
if (origin.brand) {
|
314
|
- let extra = `?productSkn=${origin.erpProductId}&brandId=${origin.brand.id}`;
|
679
|
+ let extra = `?productSkn=${origin.productSkn}&brandId=${origin.brandInfo.brandId}`;
|
315
|
|
680
|
|
316
|
dest.preferenceUrl = `/product/detail/preference${extra}`;
|
681
|
dest.preferenceUrl = `/product/detail/preference${extra}`;
|
317
|
}
|
682
|
}
|
318
|
|
683
|
|
319
|
- dest.productSkn = origin.erpProductId;
|
684
|
+ dest.productSkn = origin.productSkn;
|
320
|
|
685
|
|
321
|
// 商品信息
|
686
|
// 商品信息
|
322
|
if (origin.goodsList) {
|
687
|
if (origin.goodsList) {
|
|
@@ -335,11 +700,11 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -335,11 +700,11 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
335
|
|
700
|
|
336
|
colorStorageNum = 0;
|
701
|
colorStorageNum = 0;
|
337
|
|
702
|
|
338
|
- // 商品分组
|
|
|
339
|
- if (value.goodsImagesList) {
|
|
|
340
|
- _.forEach(value.goodsImagesList, function(good) {
|
703
|
+ // 商品分组
|
|
|
704
|
+ if (value.imagesList) {
|
|
|
705
|
+ _.forEach(value.imagesList, function(good) {
|
341
|
goodsGroup.push({
|
706
|
goodsGroup.push({
|
342
|
- goodsId: good.goodsId,
|
707
|
+ goodsId: value.goodsId,
|
343
|
img: good.imageUrl
|
708
|
img: good.imageUrl
|
344
|
});
|
709
|
});
|
345
|
});
|
710
|
});
|
|
@@ -347,16 +712,16 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -347,16 +712,16 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
347
|
|
712
|
|
348
|
// 商品的尺码列表
|
713
|
// 商品的尺码列表
|
349
|
colorStorageGroup[value.productSkc] = {};
|
714
|
colorStorageGroup[value.productSkc] = {};
|
350
|
- if (value.goodsSizeBoList) {
|
715
|
+ if (value.sizeList) {
|
351
|
sizeList[value.productSkc] = [];
|
716
|
sizeList[value.productSkc] = [];
|
352
|
- _.forEach(value.goodsSizeBoList, function(size) {
|
717
|
+ _.forEach(value.sizeList, function(size) {
|
353
|
sizeList[value.productSkc].push({
|
718
|
sizeList[value.productSkc].push({
|
354
|
- id: size.id,
|
|
|
355
|
- skuId: size.goodsSizeSkuId,
|
|
|
356
|
- goodsId: size.goodsId,
|
|
|
357
|
- colorId: size.colorId,
|
719
|
+ id: size.sizeId,
|
|
|
720
|
+ skuId: size.productSku,
|
|
|
721
|
+ goodsId: value.goodsId,
|
|
|
722
|
+ colorId: value.colorId,
|
358
|
name: size.sizeName,
|
723
|
name: size.sizeName,
|
359
|
- sizeNum: size.goodsSizeStorageNum
|
724
|
+ sizeNum: size.storageNumber
|
360
|
});
|
725
|
});
|
361
|
|
726
|
|
362
|
sizeName = size.sizeName;
|
727
|
sizeName = size.sizeName;
|
|
@@ -364,16 +729,14 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -364,16 +729,14 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
364
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候
|
729
|
// 所有尺码列表,赋值用于前端展示默认尺码的时候
|
365
|
// 判断出没有库存则显示灰色
|
730
|
// 判断出没有库存则显示灰色
|
366
|
let build = {
|
731
|
let build = {
|
367
|
- id: size.id,
|
|
|
368
|
- storage: size.goodsSizeStorageNum
|
732
|
+ id: size.sizeId,
|
|
|
733
|
+ storage: size.storageNumber
|
369
|
};
|
734
|
};
|
370
|
|
735
|
|
371
|
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
|
736
|
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
|
372
|
- typeof allSizeList[sizeName] === 'undefined') ? build :
|
|
|
373
|
- allSizeList[sizeName];
|
|
|
374
|
-
|
|
|
375
|
- colorStorageNum += parseInt(size.goodsSizeStorageNum, 10);
|
|
|
376
|
- colorStorageGroup[value.productSkc][sizeName] = parseInt(size.goodsSizeStorageNum, 10);
|
737
|
+ typeof allSizeList[sizeName] === 'undefined') ? build : allSizeList[sizeName];
|
|
|
738
|
+ colorStorageNum += parseInt(size.storageNumber, 10);
|
|
|
739
|
+ colorStorageGroup[value.productSkc][sizeName] = parseInt(size.storageNumber, 10);
|
377
|
});
|
740
|
});
|
378
|
|
741
|
|
379
|
// 颜色分组
|
742
|
// 颜色分组
|
|
@@ -381,7 +744,6 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -381,7 +744,6 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
381
|
id: value.colorId,
|
744
|
id: value.colorId,
|
382
|
skcId: value.productSkc,
|
745
|
skcId: value.productSkc,
|
383
|
name: value.colorName,
|
746
|
name: value.colorName,
|
384
|
- goodsName: value.goodsName,
|
|
|
385
|
colorNum: colorStorageNum
|
747
|
colorNum: colorStorageNum
|
386
|
});
|
748
|
});
|
387
|
}
|
749
|
}
|
|
@@ -401,10 +763,8 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -401,10 +763,8 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
401
|
sizeGroup[0] = {
|
763
|
sizeGroup[0] = {
|
402
|
size: []
|
764
|
size: []
|
403
|
};
|
765
|
};
|
404
|
-
|
|
|
405
|
_.forEach(allSizeList, (value, key) => {
|
766
|
_.forEach(allSizeList, (value, key) => {
|
406
|
-
|
|
|
407
|
- // 默认尺码
|
767
|
+ // 默认尺码
|
408
|
sizeGroup[0].size.push({
|
768
|
sizeGroup[0].size.push({
|
409
|
name: key,
|
769
|
name: key,
|
410
|
sizeNum: _.toNumber(value.storage) > 0 ? true : false,
|
770
|
sizeNum: _.toNumber(value.storage) > 0 ? true : false,
|
|
@@ -464,7 +824,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -464,7 +824,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
464
|
dest.bannerTop = {
|
824
|
dest.bannerTop = {
|
465
|
list: bannerList
|
825
|
list: bannerList
|
466
|
};
|
826
|
};
|
467
|
- } else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') {
|
827
|
+ } else if (goodsGroup[0]) {
|
468
|
dest.bannerTop = {
|
828
|
dest.bannerTop = {
|
469
|
img: goodsGroup[0].img
|
829
|
img: goodsGroup[0].img
|
470
|
};
|
830
|
};
|
|
@@ -475,10 +835,9 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -475,10 +835,9 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
475
|
dest.cartInfo = {
|
835
|
dest.cartInfo = {
|
476
|
cartUrl: helpers.urlFormat('/cart/index/index'),
|
836
|
cartUrl: helpers.urlFormat('/cart/index/index'),
|
477
|
numInCart: 0,
|
837
|
numInCart: 0,
|
478
|
- goodsInstore: origin.storage
|
838
|
+ goodsInstore: origin.storageSum
|
479
|
};
|
839
|
};
|
480
|
-
|
|
|
481
|
- let soldOut = (origin.storage === 0) || (origin.status === 0 || totalStorageNum === 0);
|
840
|
+ let soldOut = (origin.storageSum === 0) || (totalStorageNum === 0); // status
|
482
|
let notForSale = origin.attribute === 2;
|
841
|
let notForSale = origin.attribute === 2;
|
483
|
|
842
|
|
484
|
// 显示加入购物车链接
|
843
|
// 显示加入购物车链接
|
|
@@ -486,7 +845,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -486,7 +845,7 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
486
|
_.orderBy(colorGroup);
|
845
|
_.orderBy(colorGroup);
|
487
|
|
846
|
|
488
|
Object.assign(dest.cartInfo, {
|
847
|
Object.assign(dest.cartInfo, {
|
489
|
- productId: origin.id,
|
848
|
+ productId: origin.productId,
|
490
|
thumbs: thumbImageList,
|
849
|
thumbs: thumbImageList,
|
491
|
name: dest.goodsName ? dest.goodsName : '',
|
850
|
name: dest.goodsName ? dest.goodsName : '',
|
492
|
price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
|
851
|
price: dest.goodsPrice.previousPrice ? dest.goodsPrice.previousPrice : '',
|
|
@@ -496,28 +855,25 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -496,28 +855,25 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
496
|
sizes: sizeGroup
|
855
|
sizes: sizeGroup
|
497
|
});
|
856
|
});
|
498
|
|
857
|
|
499
|
- // 限购商品
|
|
|
500
|
- if (origin.isLimitBuy === 'Y') {
|
|
|
501
|
- // 是否开售
|
|
|
502
|
- let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
|
|
|
503
|
- origin.saleStatus === 1);
|
858
|
+ // 限购商品
|
|
|
859
|
+ if (origin.isLimitBuy) {
|
|
|
860
|
+ // 是否开售
|
|
|
861
|
+ let isBeginSale = (origin.saleStatus === 1);
|
504
|
|
862
|
|
505
|
// 限购商品有关的展示状态
|
863
|
// 限购商品有关的展示状态
|
506
|
let showStatus = 1;
|
864
|
let showStatus = 1;
|
507
|
|
865
|
|
508
|
- if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') {
|
|
|
509
|
- showStatus = parseInt(origin.showStatus, 10);
|
|
|
510
|
- }
|
866
|
+ origin.showStatus && (showStatus = parseInt(origin.showStatus, 10));
|
511
|
|
867
|
|
512
|
// 处理限购商品有关的按钮状态
|
868
|
// 处理限购商品有关的按钮状态
|
513
|
dest = _procShowStatus(dest, showStatus, isBeginSale);
|
869
|
dest = _procShowStatus(dest, showStatus, isBeginSale);
|
514
|
|
870
|
|
515
|
dest.cartInfo.limitProductCode = origin.limitProductCode;
|
871
|
dest.cartInfo.limitProductCode = origin.limitProductCode;
|
516
|
- dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.erpProductId, ua);
|
872
|
+ dest.cartInfo.limitCodeUrl = _getLimitCodeUrl(origin.limitProductCode, origin.productSkn, ua);
|
517
|
dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
|
873
|
dest.cartInfo.limitProductPay = helpers.urlFormat('/cart/index/orderEnsure');
|
518
|
} else {
|
874
|
} else {
|
519
|
- dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.id + '_' +
|
|
|
520
|
- origin.goodsList.id + '.html');
|
875
|
+ dest.cartInfo.addToCartUrl = helpers.urlFormat('/product/buy_' + origin.productId + '_' +
|
|
|
876
|
+ origin.goodsList.goodsId + '.html');
|
521
|
}
|
877
|
}
|
522
|
} else if (notForSale) {
|
878
|
} else if (notForSale) {
|
523
|
dest.cartInfo.notForSale = true;
|
879
|
dest.cartInfo.notForSale = true;
|
|
@@ -527,22 +883,22 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
|
@@ -527,22 +883,22 @@ const _detailDataPkg = (origin, uid, vipLevel, ua) => { |
527
|
|
883
|
|
528
|
// 是否收藏
|
884
|
// 是否收藏
|
529
|
dest.isCollect = false;
|
885
|
dest.isCollect = false;
|
530
|
- if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') {
|
886
|
+ if (origin.isCollect === 'Y') {
|
531
|
dest.isCollect = true;
|
887
|
dest.isCollect = true;
|
532
|
dest.cartInfo.isCollect = true;
|
888
|
dest.cartInfo.isCollect = true;
|
533
|
}
|
889
|
}
|
534
|
|
890
|
|
535
|
- // 底部简介URL链接
|
|
|
536
|
- dest.introUrl = '/product/detail/intro/' + origin.erpProductId;
|
|
|
537
|
- dest.id = origin.id;
|
891
|
+ // 底部简介URL链接
|
|
|
892
|
+ dest.introUrl = '/product/detail/intro/' + origin.productSkn;
|
|
|
893
|
+ dest.id = origin.productId;
|
538
|
|
894
|
|
539
|
// 虚拟商品(门票)
|
895
|
// 虚拟商品(门票)
|
540
|
if (origin.attribute * 1 === 3) {
|
896
|
if (origin.attribute * 1 === 3) {
|
541
|
dest.tickets = true;
|
897
|
dest.tickets = true;
|
542
|
dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
|
898
|
dest.ticketsConfirm = helpers.urlFormat('/cart/index/ticketsConfirm');
|
543
|
|
899
|
|
544
|
- // 展览票
|
|
|
545
|
- if (origin.erpProductId * 1 === SINGLE_TICKETS_SKN) {
|
900
|
+ // 展览票
|
|
|
901
|
+ if (origin.productSkn * 1 === SINGLE_TICKETS_SKN) {
|
546
|
dest.single = true;
|
902
|
dest.single = true;
|
547
|
} else {
|
903
|
} else {
|
548
|
// 套票
|
904
|
// 套票
|
|
@@ -619,12 +975,12 @@ const _getCommonConsult = () => { |
|
@@ -619,12 +975,12 @@ const _getCommonConsult = () => { |
619
|
let getProductData = (data) => {
|
975
|
let getProductData = (data) => {
|
620
|
let finalResult;
|
976
|
let finalResult;
|
621
|
let params = {
|
977
|
let params = {
|
622
|
- method: 'h5.product.data'
|
978
|
+ method: 'app.product.data'
|
623
|
};
|
979
|
};
|
624
|
|
980
|
|
625
|
if (data.id) { // 通过 productId 获取商品详情
|
981
|
if (data.id) { // 通过 productId 获取商品详情
|
626
|
Object.assign(params, {
|
982
|
Object.assign(params, {
|
627
|
- productId: _.toString(data.id)
|
983
|
+ product_id: _.toString(data.id)
|
628
|
});
|
984
|
});
|
629
|
} else if (data.productSkn) { // 通过 productSkn 获取商品详情
|
985
|
} else if (data.productSkn) { // 通过 productSkn 获取商品详情
|
630
|
Object.assign(params, {
|
986
|
Object.assign(params, {
|
|
@@ -643,22 +999,22 @@ let getProductData = (data) => { |
|
@@ -643,22 +999,22 @@ let getProductData = (data) => { |
643
|
params.current_vip_level = data.vipLevel;
|
999
|
params.current_vip_level = data.vipLevel;
|
644
|
|
1000
|
|
645
|
return api.get('', params, {
|
1001
|
return api.get('', params, {
|
646
|
- cache: false
|
|
|
647
|
- }).then(result => {
|
|
|
648
|
- if (result.code === 500) {
|
1002
|
+ code: 200
|
|
|
1003
|
+ }).then(global.yoho.camelCase).then(result => {
|
|
|
1004
|
+ if (result.code === 500 || !result.data) {
|
649
|
return {};
|
1005
|
return {};
|
650
|
}
|
1006
|
}
|
|
|
1007
|
+ result = result.data;
|
651
|
return Promise.all([
|
1008
|
return Promise.all([
|
652
|
- _getShopsInfo(result.brandId),
|
|
|
653
|
- _getPromotionInfo(result.erpProductId),
|
1009
|
+ _getShopsInfo(result.brandInfo.brandId),
|
|
|
1010
|
+ _getPromotionInfo(result.productSkn),
|
654
|
comment.getCommentInfo({
|
1011
|
comment.getCommentInfo({
|
655
|
- productId: result.id
|
1012
|
+ productId: result.productId
|
656
|
}),
|
1013
|
}),
|
657
|
_getCommonConsult(),
|
1014
|
_getCommonConsult(),
|
658
|
- comment.getConsults(result.id, 1, 2)
|
1015
|
+ comment.getConsults(result.productId, 1, 2)
|
659
|
]).then((info) => {
|
1016
|
]).then((info) => {
|
660
|
result.promotionBoList = info[1];
|
1017
|
result.promotionBoList = info[1];
|
661
|
-
|
|
|
662
|
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
|
1018
|
finalResult = _detailDataPkg(result, data.uid, data.vipLevel, data.ua);
|
663
|
finalResult.enterStore = info[0];
|
1019
|
finalResult.enterStore = info[0];
|
664
|
finalResult.isStudent = data.isStudent;
|
1020
|
finalResult.isStudent = data.isStudent;
|
|
@@ -681,7 +1037,6 @@ let getProductData = (data) => { |
|
@@ -681,7 +1037,6 @@ let getProductData = (data) => { |
681
|
consults: _.take(info[3], 2)
|
1037
|
consults: _.take(info[3], 2)
|
682
|
});
|
1038
|
});
|
683
|
}
|
1039
|
}
|
684
|
-
|
|
|
685
|
return finalResult;
|
1040
|
return finalResult;
|
686
|
});
|
1041
|
});
|
687
|
|
1042
|
|