detail.js
25.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
/**
* 商品详情models
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2016/5/6
*/
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const sign = require(`${library}/sign`);
const _ = require('lodash');
const helpers = require(`${library}/helpers`);
var api = new API();
/**
* 处理品牌关联店铺信息
* @param {array}
* @return {array}
*/
const getShopsInfo = (data) => {
var enterStore = {};
_.forEach(data, function(value, key) {
enterStore[key] = {};
enterStore[key].img = value.brand_ico;
enterStore[key].storeName = value.brand_name;
if (value.shop_id !== null && typeof value.shop_id !== 'undefined') {
let params = {};
params.shop_id = value.shop_id;
enterStore[key].url =
helpers.url('/product/index/brand', params);
} else {
enterStore[key].url =
helpers.url('', null, value.brand_domain);
}
});
return enterStore;
};
/**
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
* @param {array} 需要处理的数据
* @param {int} 限购商品的关联状态
* @param {Boolean} 限购商品是否已开售
* @return {array}
*/
const procShowStatus = (data, showStatus, isBeginSale) => {
switch (showStatus) {
case 1:// 开售前/后,立即分享获得限购码(用户未领取限购码)
// 显示获取限购码按钮
data.canGetLimitCode = true;
if (isBeginSale) { // 开售后
data.cartInfo.noLimitCode = true;
} else {
data.cartInfo.limitNotForSale = true;
}
break;
case 2: // 开售后,限购码已抢光(用户未领取限购码)
data.codeEmpty = true;
data.cartInfo.noLimitCode = true;
break;
case 3: // 开售后,商品已经售罄
data.noLimitGoodsBtn = true;
data.cartInfo.soldOut = true;
break;
case 4: // 开售后,立即购买(用户已领取限购码)
data.gotCode = true;
data.cartInfo.canBuyLimit = true;
break;
case 5: // 开售前,限购码已被抢光(用户未领取限购码)
data.codeEmpty = true;
data.cartInfo.limitNotForSale = true;
break;
case 6: // 开售前,即将开售(用户已领取限购码)
data.gotCode = true;
data.cartInfo.limitNotForSale = true;
break;
case 7: // 开售后,用户已经用获得的限购码购买过商品
data.gotCode = true;
data.cartInfo.noLimitCode = true;
break;
default:
break;
}
return data;
};
/**
* 根据设备类型获得限购商品跳转app的url 待处理
* @param {[string]} productCode 限购商品码
* @param {[string]} skn 限购商品skn
* @return {[string]} 限购商品跳转url
*/
const getLimitCodeUrl = (productCode, skn, ua) => {
var url = 'yohoapp://yoho.app/openwith?limit_product_code=' + productCode +
'&product_skn=' + skn;
let isIphone = String(ua).indexOf('iPhone') >= 0;
let isIpad = ua.indexOf('iPad') >= 0;
if (isIphone || isIpad) {
let params = {};
params.lp = productCode;
url = 'yohobuy://' + helpers.url('/limitpurchase', params);
}
return url;
};
/**
* 详情页数据格式化
* @param origin Object 原始数据
* @return dest Object 格式化数据
*/
const detailDataPkg = (origin, uid, vipLevel, ua) => {
var dest = {}, // 结果输出
colorGroup = {},
thumbImageList = {},
sizeGroup = {},
totalStorageNum = 0;
// 商品名称
if (origin.productName === null || typeof origin.productName === 'undefined') {
return dest;
}
dest.goodsName = origin.productName;
// 用户未登录时 待处理
if (uid === null || typeof uid === 'undefined') {
let params = {};
params.refer = helpers.url('/product/show_' + origin.erpProductId + '.html');
dest.loginUrl = helpers.url('/signin.html', params);
}
// 商品促销短语
if (origin.salesPhrase !== null && typeof origin.salesPhrase !== 'undefined') {
dest.goodsSubtitle = origin.salesPhrase;
}
// 商品标签
if (origin.productTagBoList !== null && typeof origin.productTagBoList !== 'undefined') {
_.forEach(origin.productTagBoList, function(value) {
switch (value.tagLabel) {
case 'is_soon_sold_out':
dest.tags.is_soon_sold_out = true;
break;
case 'is_new':
dest.tags.is_new = true;
break;
case 'is_discount':
dest.tags.is_discount = true;
break;
case 'is_limited':
dest.tags.is_limited = true;
break;
case 'is_yohood':
dest.tags.is_yohood = true;
break;
case 'is_advance':
dest.tags.is_advance = true;
break;
default:
break;
}
});
}
// 商品价格
dest.goodsPrice = {};
if (origin.productPriceBo !== null && typeof origin.productPriceBo !== 'undefined') {
dest.goodsPrice.currentPrice = origin.productPriceBo.formatSalesPrice;
if (origin.productPriceBo.formatMarketPrice !== origin.productPriceBo.formatSalesPrice) {
dest.goodsPrice.previousPrice = origin.productPriceBo.formatMarketPrice;
}
// 商品返回 YOHO 币
if (origin.productPriceBo.yohoCoinNum !== null && origin.productPriceBo.yohoCoinNum !== 0) {
dest.commodityReturn = dest.productPriceBo.yohoCoinNum;
}
}
// VIP 商品价格
dest.vipLevel = {};
dest.vipLevel.list = {};
if (origin.productPriceBo.vipPrices !== null && typeof origin.productPriceBo.vipPrices !== 'undefined') {
_.forEach(origin.productPriceBo.vipPrices, function(value, key) {
dest.vipLevel.list[key] = {};
dest.vipLevel.list[key].level = value.vipLevel;
dest.vipLevel.list[key].text = value.vipPrice;
dest.vipLevel.list[key].currentLevel = (value.vipLevel === vipLevel) ? true : false;
});
}
// 上市期
if (origin.expectArrivalTime !== null && typeof origin.expectArrivalTime !== 'undefined') {
dest.periodOfMarket = origin.expectArrivalTime + '月';
}
// 促销信息
dest.goodsDiscount = {};
dest.goodsDiscount.list = [];
if (origin.promotionBoList !== null && typeof origin.promotionBoList !== 'undefined') {
_.forEach(origin.promotionBoList, function(value) {
let temp = {};
temp.text = '【' + value.promotionType + '】' +
value.promotionTitle;
dest.goodsDiscount.list.push(temp);
});
}
// 商品咨询
dest.feedbacks = {};
dest.feedbacks.consults = {};
dest.feedbacks.consultsNum = 0;
if (origin.consultBoWrapper !== null && typeof origin.consultBoWrapper !== 'undefined') {
dest.feedbacks.consultsNum = origin.consultBoWrapper.consultTotal;
_.forEach(origin.consultBoWrapper.consultBoList, function(value, key) {
dest.feedbacks.consults[key] = {};
dest.feedbacks.consults[key].question = value.ask;
dest.feedbacks.consults[key].time = value.askTime;
dest.feedbacks.consults[key].answer = value.answer;
});
let params = {};
params.product_id = origin.id;
params.total = dest.feedbacks.consultsNum;
dest.feedbacks.consultsUrl = helpers.url('/product/detail/consults', params);
} else { // 暂无咨询
let params = {};
params.product_id = origin.id;
dest.feedbacks.consultsUrl = helpers.url('/product/detail/consultform', params);
}
// 商品评价
dest.feedbacks.commentsNum = 0;
if (origin.commentBoWrapper !== null && typeof origin.commentBoWrapper !== 'undefined') {
dest.feedbacks.commentsNum = origin.commentBoWrapper.commentTotal;
dest.feedbacks.comments = {};
_.forEach(origin.commentBoWrapper.commentBoList, function(value, key) {
dest.feedbacks.comments[key] = {};
dest.feedbacks.comments[key].userName = value.nickName;
dest.feedbacks.comments[key].desc = value.colorName +
'/' + value.sizeName;
dest.feedbacks.comments[key].content = (value.content !== null &&
typeof value.content !== 'undefined') ? value.content : '';
dest.feedbacks.comments[key].time = value.createTime;
});
let params = {};
params.product_id = origin.id;
params.total = dest.feedbacks.commentsNum;
dest.feedbacks.commentsUrl = helpers.url('/product/detail/comments', params);
}
// 品牌信息
if (origin.brand !== null && typeof origin.brand !== 'undefined') {
// 为你优选的链接
let params = {};
params.productSkn = origin.erpProductId;
params.brandId = origin.brand.id;
dest.preferenceUrl = helpers.url('/product/detail/preference', params, '');
}
dest.productSkn = origin.erpProductId;
// 商品信息
if (origin.goodsList !== null && typeof origin.goodsList !== 'undefined') {
let goodsGroup = {},
sizeName = '',
colorList = {},
sizeList = {},
allSizeList = {},
colorStorageGroup = {},
colorStorageNum = 0;
_.forEach(origin.goodsList, function(value, key) {
if (value.status === 0) {
return true;
}
colorStorageNum = 0;
// 商品分组
if (value.goodsImagesList !== null && typeof value.goodsImagesList !== 'undefined') {
_.forEach(value.goodsImagesList, function(good, keyForGood) {
goodsGroup[keyForGood] = {};
goodsGroup[keyForGood].goodsId = good.goodsId;
goodsGroup[keyForGood].img = good.imageUrl;
});
}
// 商品的尺码列表
colorStorageGroup[value.productSkc] = {};
if (value.goodsSizeBoList !== null && typeof value.goodsSizeBoList !== 'undefined') {
_.forEach(value.goodsSizeBoList, function(size, keyForSize) {
sizeList[value.productSkc] = {};
sizeList[value.productSkc][keyForSize] = {};
sizeList[value.productSkc][keyForSize].id = size.id;
sizeList[value.productSkc][keyForSize].skuId = size.goodsSizeSkuId;
sizeList[value.productSkc][keyForSize].goodsId = size.goodsId;
sizeList[value.productSkc][keyForSize].colorId = size.colorId;
sizeList[value.productSkc][keyForSize].name = size.sizeName;
sizeList[value.productSkc][keyForSize].sizeNum = size.goodsSizeStorageNum;
sizeName = size.sizeName;
// 所有尺码列表,赋值用于前端展示默认尺码的时候
// 判断出没有库存则显示灰色
let build = {};
build.storage = size.goodsSizeStorageNum;
build.id = size.id;
allSizeList[sizeName] = (allSizeList[sizeName] === null ||
typeof allSizeList[sizeName] === 'undefined') ? build :
allSizeList[sizeName];
colorStorageNum += parseInt(size.goodsSizeStorageNum, 10);
colorStorageGroup[value.productSkc][sizeName] = parseInt(size.goodsSizeStorageNum, 10);
});
// 颜色分组
colorList[key] = {};
colorList[key].id = value.colorId;
colorList[key].skcId = value.productSkc;
colorList[key].name = value.colorName;
colorList[key].goodsName = value.goodsName;
colorList[key].colorNum = colorStorageNum;
}
// 缩略图
let params = {};
params.img = value.colorImage;
thumbImageList[key] = params;
// 商品库存总数
totalStorageNum += colorStorageNum;
});
// 遍历所有尺码,构建颜色显示数据
let i = 1;
_.forEach(allSizeList, function(value, key) {
// 默认尺码
sizeGroup[0] = {};
sizeGroup[0].size = {};
sizeGroup[0].size[key] = {};
sizeGroup[0].size[key].name = sizeName;
sizeGroup[0].size[key].sizeNum = (typeof value.storage === 'undefined' ||
value.storage === null) ? false : true;
sizeGroup[0].size[key].id = value.id;
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
_.forEach(colorList, function(colorArr, keyForColorArr) {
colorGroup[i] = {};
colorGroup[i].color = {};
colorGroup[i].color[keyForColorArr] = {};
colorGroup[i].color[keyForColorArr].colorNum =
(colorStorageGroup[colorArr.skcId][sizeName] !== null &&
typeof colorStorageGroup[colorArr.skcId][sizeName] !== 'undefined') ?
colorStorageGroup[colorArr.skcId][sizeName] : 0;
});
colorGroup[i].id = value.id;
++i;
});
// 遍历所有颜色, 构建尺码显示数据
i = 1;
_.forEach(colorList, function(value, key) {
// 各个尺码的颜色, 每行显示一个颜色的对应尺码
sizeGroup[i] = {};
sizeGroup[i].size = sizeList[value.skcId];
sizeGroup[i].colorId = value.skcId;
// 默认颜色
colorGroup[0] = {};
colorGroup[0].color = {};
colorGroup[0].color[key] = value;
++i;
});
// 商品图:多个
if (goodsGroup[1] !== null && typeof goodsGroup[1] !== 'undefined') {
_.forEach(goodsGroup, function(value, key) {
dest.bannerTop = {};
dest.bannerTop.list = {};
let params = {};
params.img = value.img;
dest.bannerTop.list[key] = params;
});
} else if (goodsGroup[0] !== null && typeof goodsGroup[0] !== 'undefined') {
dest.bannerTop = {};
dest.bannerTop.img = goodsGroup[0].img;
}
}
// 悬浮的购物车信息
dest.cartInfo = {};
dest.cartInfo.cartUrl = helpers.url('/cart/index/index', null);
dest.cartInfo.numInCart = 0;
dest.cartInfo.goodsInstore = origin.storage;
let soldOut = (origin.storage === 0) || (origin.status === 0 || totalStorageNum === 0);
let notForSale = origin.attribute === 2;
// 显示加入购物车链接
if (!soldOut && !notForSale) {
_.orderBy(colorGroup);
dest.cartInfo = {};
dest.cartInfo.productId = origin.id;
dest.cartInfo.thumbs = thumbImageList;
dest.cartInfo.name = (dest.goodsName !== null && typeof dest.goodsName !== 'undefined') ? dest.goodsName : '';
dest.cartInfo.price = (dest.goodsPrice.previousPrice !== null &&
typeof dest.goodsPrice.previousPrice !== 'undefined') ? dest.goodsPrice.previousPrice : '';
dest.cartInfo.salePrice = (dest.goodsPrice.currentPrice !== null &&
typeof dest.goodsPrice.currentPrice !== 'undefined') ? dest.goodsPrice.currentPrice : '';
dest.cartInfo.totalNum = totalStorageNum;
dest.cartInfo.colors = colorGroup;
dest.cartInfo.sizes = sizeGroup;
// 限购商品
if (origin.isLimitBuy === 'Y') {
// 是否开售
let isBeginSale = (origin.saleStatus !== null && typeof origin.saleStatus !== 'undefined' &&
origin.saleStatus === 1);
// 限购商品有关的展示状态
let showStatus = 1;
if (origin.showStatus !== null && typeof origin.showStatus !== 'undefined') {
showStatus = parseInt(origin.showStatus, 10);
}
// 处理限购商品有关的按钮状态
dest = procShowStatus(dest, showStatus, isBeginSale);
dest.cartInfo.limitProductCode = origin.limitProductCode;
dest.cartInfo.limitCodeUrl = getLimitCodeUrl(origin.limitProductCode, origin.erpProductId, ua);
dest.cartInfo.limitProductPay = helpers.url('/cart/index/orderEnsure');
} else {
dest.cartInfo.addToCartUrl = helpers.url('/product/buy_' + origin.id + '_' +
origin.goodsList.id + '.html'); // 待处理 确认 goodsId 的含义
}
} else if (notForSale) {
dest.cartInfo.notForSale = true;
} else if (soldOut) {
dest.cartInfo.soldOut = true;
}
// 是否收藏
dest.isCollect = false;
if (origin.isCollect !== null && typeof origin.isCollect !== 'undefined' && origin.isCollect === 'Y') {
dest.isCollect = true;
}
// 底部简介的URL链接
dest.introUrl = helpers.url('/product/intro_' + origin.erpProductId + '/' + origin.cnAlphabet + '.html', null, '');
dest.id = origin.id;
return dest;
};
/**
* 商品尺码信息处理
* @param {[type]} productSkn [description]
* @param {[type]} uid [description]
* @param {[type]} udid [description]
* @return {[type]} [description]
*/
/* const getSizeInfo = (sizeInfo) => {
var dest = {},
temp = {};
if (_.isEmpty(sizeInfo.productDescBo.erpProductId)) {
let sex = '通用';
switch (sizeInfo.productDescBo.gender) {
case 1:
sex = '男款';
break;
case 2:
sex = '女款';
break;
default:
break;
}
dest.goodsDescription = {};
dest.goodsDescription.title = '商品信息';
dest.goodsDescription.enTitle = 'DESCRIPTION';
dest.goodsDescription.detail = {};
dest.goodsDescription.detail.list = {};
dest.goodsDescription.detail.list[0].param =
'编号:' + sizeInfo.productDescBo.erpProductId;
dest.goodsDescription.detail.list[1].param =
'颜色:' + sizeInfo.productDescBo.colorName;
dest.goodsDescription.detail.list[2].param =
'性别:' + sex;
}
if (_.isEmpty(sizeInfo.productDescBo.standardBos)) {
_.forEach(sizeInfo.productDescBo.standardBos, function(value, key) {
dest.goodsDescription.detail.list[3].param = value.standardName + ':' +
value.standardVal;
});
}
if (_.isEmpty(sizeInfo.phrase)) {
dest.goodsDescription.desc = sizeInfo.phrase;
}
// 尺码信息
if (!_.isEmpty(sizeInfo.sizeInfoBo)) {
dest.sizeInfo = {};
dest.sizeInfo.title = '尺码信息';
dest.sizeInfo.enTitle = 'SIZE INFO';
dest.sizeInfo.detail = {};
dest.sizeInfo.detail.list = {};
// 参考尺码
let boyReference = !_.isEmpty(sizeInfo.productExtra.boyReference);
let girlReference = !_.isEmpty(sizeInfo.productExtra.girlReference);
let gender = !_.isEmpty(sizeInfo.productDescBo.gender) ? sizeInfo.productDescBo.gender : 3;
let referenceName = '参考尺码';
if ((gender === 1 && boyReference) || (gender === 2 && girlReference)) {
referenceName = '参考尺码';
} else if (gender === 3 && boyReference) {
referenceName = '参考尺码(男)';
} else if (gender === 3 && girlReference) {
referenceName = '参考尺码(女)';
}
let referenceList = {};
// 判断是否显示参考尺码
let showReference = (boyReference &&
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].boyReferSize)) || (girlReference &&
!_.isEmpty(sizeInfo.sizeInfoBo.sizeBoList[0].girlReferSize));
if (showReference) {
referenceList[0] = {};
referenceList[0].param = referenceName;
}
if (!_.isEmpty(sizeInfo.sizeInfoBo.sizeAttributeBos)) {
let sizeNameList = {};
sizeNameList[0] = {};
sizeNameList[0].param = '吊牌尺码';
let sizeBoGroup = {};
_.forEach(sizeInfo.sizeInfoBo.sizeAttributeBos, function(attr) {
sizeBoGroup[attr.id[0]].param = _.isEmpty(value.attributeName) ?
' ' : attr.attributeName;
});
let item = {};
_.forEach(sizeInfo.sizeInfoBo.sizeBoList, function(value) {
item = {};
let sizeNameList = {};
sizeNameList[0].param = value.sizeName;
if (boyReference && (gender === 1 || gender === 3)) {
temp = {};
temp.param = _.isEmpty(value.boyReferSize.referenceName) ?
' ' : value.boyReferSize.referenceName;
sizeNameList.push(temp);
} else if (girlReference && (gender === 2 || gender === 3)) {
temp = {};
temp.param = _.isEmpty(value.girlReferSize.referenceName) ?
' ' : value.girlReferSize.referenceName;
sizeNameList.push(temp);
} else {
showReference = false;
}
_.forEach(value.sortAttributes, function(attr) {
temp = {};
temp.param = _.isEmpty(attr.sizeValue) ? ' ' : attr.sizeValue;
sizeBoGroup[attr.id].push(temp);
});
});
// 根据模板页面的显示,按表格一列一列来显示
dest.sizeInfo.detail.list[0].params = sizeNameList;
if (showReference) {
dest.sizeInfo.detail.list[1].params = referenceList;
}
_.forEach(sizeBoGroup, function(value) {
temp = {};
temp.params = value;
dest.sizeInfo.detail.list.push(temp);
});
} else {
temp = {};
temp[0].param = '';
dest.sizeInfo.detail.list[0].params.push(temp);
}
}
// 测量方式
if (!_.isEmpty(sizeInfo.sizeImage)) {
dest.measurementMethod = {};
dest.measurementMethod.title = '测量方式';
dest.measurementMethod.enTitle = 'MEASUREMENT METHOD';
dest.measurementMethod.img = sizeInfo.sizeImage;
}
// 模特试穿, 竖着输出排列显示
if (!_.isEmpty(sizeInfo.modelBos)) {
dest.reference = {};
dest.reference.title = '模特试穿';
dest.reference.enTitle = 'REFERENCE';
dest.reference.detail = {};
dest.reference.detail.list = {};
// 控制是否显示备注
let showRemark = false;
let remarkList = {};
remarkList[0] = {};
remarkList[0].param = '备注';
for (var i = 0; i < 7; i++) {
dest.reference.detail.list[i] = {};
dest.reference.detail.list[i].params = {};
dest.reference.detail.list[0].params[0] = {};
}
dest.reference.detail.list[0].params[0].param = '';
dest.reference.detail.list[1].params[0].param = '模特';
dest.reference.detail.list[2].params[0].param = '身高';
dest.reference.detail.list[3].params[0].param = '体重';
dest.reference.detail.list[4].params[0].param = '三围';
dest.reference.detail.list[5].params[0].param = '吊牌尺码';
dest.reference.detail.list[6].params[0].param = '试穿描述';
_.forEach(sizeInfo.modelBos, function(value) {
// 待处理
});
// 显示模特备注
if (showRemark) {
}
}
// 商品材质
if (!_.isEmpty(sizeInfo.productMaterialList)) {
dest.materials = {};
dest.materials.title = '商品材质';
dest.materials.enTitle = 'MATERIALS';
dest.materials.list = {};
_.forEach(sizeInfo.productMaterialList, function(value) {
temp = {};
temp.img = value.imageUrl;
temp.desc = value.remark;
dest.materials.list.push();
});
}
// 洗涤提示
if (!_.isEmpty(sizeInfo.washTipsBoList)) {
dest.washTips = {};
dest.washTips.list = {};
_.forEach(sizeInfo.washTipsBoList, function(value) {
dest.washTips.list.push(value);
});
}
// 详情配图
if (!_.isEmpty(sizeInfo.productIntroBo.productIntro)) {
let productIntro = '';
if (!_.isEmpty(sizeInfo.productDescBo.phrase)) {
productIntro = productIntro + sizeInfo.productDescBo.phrase +
'<br />';
}
productIntro = productIntro + sizeInfo.productIntroBo.productIntro;
if (!_.isEmpty(productIntro) && productIntro !== '') {
dest.productDetail = {};
dest.productDetail.title = '商品详情';
dest.productDetail.enTitle = 'DETAILS';
// 待开发
}
// 清空变量,释放内存
sizeInfo = {};
}
return dest;
};*/
module.exports = (data) => {
var finalResult;
return api.get('', sign.apiSign({
productId: data.id,
uid: data.uid,
vipLevel: data.vipLevel,
method: 'h5.product.data'
})).then(result => {
finalResult = detailDataPkg(result, data.uid, data.vipLevel, data.ua);
return api.get('', sign.apiSign({
method: 'app.shop.queryShopsByBrandId',
brand_id: result.brand.id
})).then(shops => {
if (shops.code === 200) {
finalResult.enterStore = getShopsInfo(shops.data);
}
return finalResult;
});
});
};