|
@@ -30,8 +30,9 @@ const HeaderModel = require('../../../doraemon/models/header'); |
|
@@ -30,8 +30,9 @@ const HeaderModel = require('../../../doraemon/models/header'); |
30
|
|
30
|
|
31
|
const BLANK_STR = ' ';
|
31
|
const BLANK_STR = ' ';
|
32
|
|
32
|
|
33
|
-const multiResourcesUrl = {};
|
|
|
34
|
-const setMultiResourceByProductBaseInfo = (data) => {
|
33
|
+const cachedRequestData = {};
|
|
|
34
|
+
|
|
|
35
|
+const getProductAdditionInfoByProductBaseInfoAsync = (data) => {
|
35
|
return co(function * () {
|
36
|
return co(function * () {
|
36
|
let productId = data.id;
|
37
|
let productId = data.id;
|
37
|
let uid = data.uid ? data.uid : 0;
|
38
|
let uid = data.uid ? data.uid : 0;
|
|
@@ -42,37 +43,38 @@ const setMultiResourceByProductBaseInfo = (data) => { |
|
@@ -42,37 +43,38 @@ const setMultiResourceByProductBaseInfo = (data) => { |
42
|
// 获取相关url
|
43
|
// 获取相关url
|
43
|
|
44
|
|
44
|
let result = yield Promise.all([
|
45
|
let result = yield Promise.all([
|
45
|
- productAPI.getProductBannerAsync(productId, 'web', isOnlyUrl),
|
|
|
46
|
- productAPI.sizeInfoAsync(skn, isOnlyUrl),
|
|
|
47
|
- productAPI.getProductComfortAsync(productId, isOnlyUrl),
|
|
|
48
|
- productAPI.getProductModelCardAsync(productId, isOnlyUrl),
|
|
|
49
|
- productAPI.getProductModelTryAsync(skn, isOnlyUrl),
|
|
|
50
|
- brandService.getBannerInfoAsync(brandId, isOnlyUrl)
|
46
|
+ productAPI.getProductBannerAsync(productId, 'web'),
|
|
|
47
|
+ productAPI.sizeInfoAsync(skn),
|
|
|
48
|
+ productAPI.getProductComfortAsync(productId),
|
|
|
49
|
+ productAPI.getProductModelCardAsync(productId),
|
|
|
50
|
+ productAPI.getProductModelTryAsync(skn),
|
|
|
51
|
+ brandService.getBannerInfoAsync(brandId)
|
51
|
]);
|
52
|
]);
|
52
|
|
53
|
|
53
|
- multiResourcesUrl['ItemData::getProductBanner'] = result[0];
|
|
|
54
|
- multiResourcesUrl['ItemData::sizeInfo'] = result[1];
|
|
|
55
|
- multiResourcesUrl['ItemData::getProductComfort'] = result[2];
|
|
|
56
|
- multiResourcesUrl['ItemData::getProductModelCard'] = result[3];
|
|
|
57
|
- multiResourcesUrl['ItemData::getProductModelTry'] = result[4];
|
|
|
58
|
- multiResourcesUrl['BrandData::getBannerInfo'] = result[5];
|
54
|
+ cachedRequestData['ItemData::getProductBanner'] = result[0];
|
|
|
55
|
+ cachedRequestData['ItemData::sizeInfo'] = result[1];
|
|
|
56
|
+ cachedRequestData['ItemData::getProductComfort'] = result[2];
|
|
|
57
|
+ cachedRequestData['ItemData::getProductModelCard'] = result[3];
|
|
|
58
|
+ cachedRequestData['ItemData::getProductModelTry'] = result[4];
|
|
|
59
|
+ cachedRequestData['BrandData::getBannerInfo'] = result[5];
|
59
|
|
60
|
|
60
|
if (uid) {
|
61
|
if (uid) {
|
61
|
- multiResourcesUrl['FavoriteData::getUidProductFav'] =
|
62
|
+ cachedRequestData['FavoriteData::getUidProductFav'] =
|
62
|
yield favoriteProductService.isFavoriteAsync(uid, productId, isOnlyUrl);
|
63
|
yield favoriteProductService.isFavoriteAsync(uid, productId, isOnlyUrl);
|
63
|
}
|
64
|
}
|
|
|
65
|
+
|
|
|
66
|
+ return null;
|
64
|
})();
|
67
|
})();
|
65
|
};
|
68
|
};
|
66
|
|
69
|
|
67
|
-function getMultiDataByResourceName(resourceName) {
|
|
|
68
|
- return multiResourcesUrl[resourceName] || false;
|
70
|
+function getCacheDataByName(resourceName) {
|
|
|
71
|
+ return cachedRequestData[resourceName] || false;
|
69
|
}
|
72
|
}
|
70
|
|
73
|
|
71
|
-
|
|
|
72
|
/**
|
74
|
/**
|
73
|
* 获取商品的喜欢
|
75
|
* 获取商品的喜欢
|
74
|
*/
|
76
|
*/
|
75
|
-const getProductFavoriteData = (uid, pid, bid) => {
|
77
|
+const getProductFavoriteDataAsync = (uid, pid, bid) => {
|
76
|
return co(function*() {
|
78
|
return co(function*() {
|
77
|
|
79
|
|
78
|
let result = {
|
80
|
let result = {
|
|
@@ -82,7 +84,7 @@ const getProductFavoriteData = (uid, pid, bid) => { |
|
@@ -82,7 +84,7 @@ const getProductFavoriteData = (uid, pid, bid) => { |
82
|
|
84
|
|
83
|
if (uid) {
|
85
|
if (uid) {
|
84
|
if (pid) {
|
86
|
if (pid) {
|
85
|
- let productData = getMultiDataByResourceName('FavoriteData::getUidProductFav');
|
87
|
+ let productData = getCacheDataByName('FavoriteData::getUidProductFav');
|
86
|
|
88
|
|
87
|
if (!productData) {
|
89
|
if (!productData) {
|
88
|
productData = yield favoriteProductService.isFavoriteAsync(uid, pid);
|
90
|
productData = yield favoriteProductService.isFavoriteAsync(uid, pid);
|
|
@@ -177,49 +179,43 @@ const getVipDataByProductBaseInfo = (data, vipLevel, uid) => { |
|
@@ -177,49 +179,43 @@ const getVipDataByProductBaseInfo = (data, vipLevel, uid) => { |
177
|
return vipData;
|
179
|
return vipData;
|
178
|
};
|
180
|
};
|
179
|
|
181
|
|
180
|
-function getProductActivityBannerAsync(pid) {
|
182
|
+function getProductActivityBanner() {
|
181
|
|
183
|
|
182
|
- return co(function*() {
|
184
|
+ let result = {};
|
183
|
|
185
|
|
184
|
- let result = {};
|
|
|
185
|
-
|
|
|
186
|
- let data = getMultiDataByResourceName('ItemData::getProductBanner');
|
186
|
+ let data = getCacheDataByName('ItemData::getProductBanner');
|
187
|
|
187
|
|
188
|
- if (!data) {
|
|
|
189
|
- data = yield productAPI.getProductBannerAsync(pid);
|
|
|
190
|
- }
|
188
|
+ if (!data) {
|
|
|
189
|
+ return result;
|
|
|
190
|
+ }
|
191
|
|
191
|
|
192
|
- if (data.code && data.code === 200 && data.data) {
|
|
|
193
|
- result.activityImg = helpers.image(data.data.bannerImg, 260, 64);
|
|
|
194
|
- result.url = data.data.promotionUrl;
|
|
|
195
|
- }
|
192
|
+ if (data.code && data.code === 200 && data.data) {
|
|
|
193
|
+ result.activityImg = helpers.image(data.data.bannerImg, 260, 64);
|
|
|
194
|
+ result.url = data.data.promotionUrl;
|
|
|
195
|
+ }
|
196
|
|
196
|
|
197
|
- return result;
|
|
|
198
|
- })();
|
197
|
+ return result;
|
199
|
}
|
198
|
}
|
200
|
|
199
|
|
201
|
const getActivityDataByProductBaseInfo = (data) => {
|
200
|
const getActivityDataByProductBaseInfo = (data) => {
|
202
|
- return co(function *() {
|
201
|
+ let result = [];
|
203
|
|
202
|
|
204
|
- let result = [];
|
203
|
+ let activityBanner = getProductActivityBanner();
|
205
|
|
204
|
|
206
|
- let activityBanner = yield getProductActivityBannerAsync(data.id);
|
|
|
207
|
-
|
|
|
208
|
- if (activityBanner) {
|
|
|
209
|
- result.push(activityBanner);
|
|
|
210
|
- }
|
205
|
+ if (activityBanner) {
|
|
|
206
|
+ result.push(activityBanner);
|
|
|
207
|
+ }
|
211
|
|
208
|
|
212
|
- if (data.promotionBoList) {
|
|
|
213
|
- data.promotionBoList.forEach(value => {
|
|
|
214
|
- result.push({
|
|
|
215
|
- type: value.promotionType,
|
|
|
216
|
- des: value.promotionTitle
|
|
|
217
|
- });
|
209
|
+ if (data.promotionBoList) {
|
|
|
210
|
+ data.promotionBoList.forEach(value => {
|
|
|
211
|
+ result.push({
|
|
|
212
|
+ type: value.promotionType,
|
|
|
213
|
+ des: value.promotionTitle
|
218
|
});
|
214
|
});
|
219
|
- }
|
215
|
+ });
|
|
|
216
|
+ }
|
220
|
|
217
|
|
221
|
- return result;
|
|
|
222
|
- })();
|
218
|
+ return result;
|
223
|
};
|
219
|
};
|
224
|
|
220
|
|
225
|
/**
|
221
|
/**
|
|
@@ -232,7 +228,7 @@ const getConsultCommentDataByProductInfo = (data) => { |
|
@@ -232,7 +228,7 @@ const getConsultCommentDataByProductInfo = (data) => { |
232
|
let consultComment = {};
|
228
|
let consultComment = {};
|
233
|
|
229
|
|
234
|
consultComment.consultNum = 0;
|
230
|
consultComment.consultNum = 0;
|
235
|
- consultComment.captchaUrl = helpers.urlFormat('/passport/images', {
|
231
|
+ consultComment.captchaUrl = helpers.urlFormat('passport/images', {
|
236
|
t: moment().valueOf()
|
232
|
t: moment().valueOf()
|
237
|
});
|
233
|
});
|
238
|
|
234
|
|
|
@@ -244,7 +240,7 @@ const getConsultCommentDataByProductInfo = (data) => { |
|
@@ -244,7 +240,7 @@ const getConsultCommentDataByProductInfo = (data) => { |
244
|
consultComment.commentNum = 0;
|
240
|
consultComment.commentNum = 0;
|
245
|
if (data.commentBoWrapper) {
|
241
|
if (data.commentBoWrapper) {
|
246
|
consultComment.comments = [];
|
242
|
consultComment.comments = [];
|
247
|
- consultComment.commentUrl = helpers.urlFormat('/home/commnet');
|
243
|
+ consultComment.commentUrl = helpers.urlFormat('home/commnet');
|
248
|
}
|
244
|
}
|
249
|
|
245
|
|
250
|
return consultComment;
|
246
|
return consultComment;
|
|
@@ -255,62 +251,58 @@ const getConsultCommentDataByProductInfo = (data) => { |
|
@@ -255,62 +251,58 @@ const getConsultCommentDataByProductInfo = (data) => { |
255
|
* 获取品牌数据
|
251
|
* 获取品牌数据
|
256
|
*/
|
252
|
*/
|
257
|
const getBrandDataByProductBaseInfo = (data) => {
|
253
|
const getBrandDataByProductBaseInfo = (data) => {
|
|
|
254
|
+ if (!data.brand) {
|
|
|
255
|
+ return {};
|
|
|
256
|
+ }
|
258
|
|
257
|
|
259
|
- return co(function *() {
|
|
|
260
|
-
|
|
|
261
|
- if (!data.brand) {
|
|
|
262
|
- return {};
|
|
|
263
|
- }
|
|
|
264
|
-
|
|
|
265
|
- let brandId = data.brand.id;
|
258
|
+ let brandId = data.brand.id;
|
266
|
|
259
|
|
267
|
- let bgImg = '';
|
260
|
+ let bgImg = '';
|
268
|
|
261
|
|
269
|
- let logo = '';
|
262
|
+ let logo = '';
|
270
|
|
263
|
|
271
|
- let bannerInfo = null;
|
264
|
+ let bannerInfo = null;
|
272
|
|
265
|
|
273
|
- let result = getMultiDataByResourceName('BrandData::getBannerInfo');
|
266
|
+ let result = getCacheDataByName('BrandData::getBannerInfo');
|
274
|
|
267
|
|
275
|
- if (!result) {
|
|
|
276
|
- result = yield brandService.getBannerInfoAsync(brandId);
|
|
|
277
|
- }
|
268
|
+ if (!result) {
|
|
|
269
|
+ return {};
|
|
|
270
|
+ }
|
278
|
|
271
|
|
279
|
- if (data.brand.brandIco) {
|
|
|
280
|
- logo = helpers.getForceSourceUrl(data.brand.brandIco);
|
|
|
281
|
- }
|
272
|
+ if (data.brand.brandIco) {
|
|
|
273
|
+ logo = helpers.getForceSourceUrl(data.brand.brandIco);
|
|
|
274
|
+ }
|
282
|
|
275
|
|
283
|
- if (result.code && result.code === 200 && result.data) {
|
|
|
284
|
- bannerInfo = result.data;
|
|
|
285
|
- if (bannerInfo.bannerUrl) {
|
|
|
286
|
- bgImg = helpers.getForceSourceUrl(bannerInfo.bannerUrl);
|
|
|
287
|
- }
|
276
|
+ if (result.code && result.code === 200 && result.data) {
|
|
|
277
|
+ bannerInfo = result.data;
|
|
|
278
|
+ if (bannerInfo.bannerUrl) {
|
|
|
279
|
+ bgImg = helpers.getForceSourceUrl(bannerInfo.bannerUrl);
|
288
|
}
|
280
|
}
|
|
|
281
|
+ }
|
289
|
|
282
|
|
290
|
- // banner的logo
|
|
|
291
|
- if (bannerInfo.logo) {
|
|
|
292
|
- logo = helpers.image(bannerInfo.logo);
|
|
|
293
|
- }
|
283
|
+ // banner的logo
|
|
|
284
|
+ if (bannerInfo.logo) {
|
|
|
285
|
+ logo = helpers.image(bannerInfo.logo);
|
|
|
286
|
+ }
|
294
|
|
287
|
|
295
|
- let homeUrl = 'javascript:void(0)';
|
288
|
+ let homeUrl = 'javascript:void(0)';
|
296
|
|
289
|
|
297
|
- if (data.brand.brandDomain) {
|
|
|
298
|
- homeUrl = helpers.urlFormat('', {}, data.brand.brandDomain);
|
|
|
299
|
- }
|
290
|
+ if (data.brand.brandDomain) {
|
|
|
291
|
+ homeUrl = helpers.urlFormat('', {}, data.brand.brandDomain);
|
|
|
292
|
+ }
|
300
|
|
293
|
|
301
|
- // 导航的品牌banner
|
|
|
302
|
- return {
|
|
|
303
|
- brandId: brandId,
|
|
|
304
|
- bgColor: bannerInfo.colorValue ? bannerInfo.colorValue : '#000000',
|
|
|
305
|
- bgImg: bgImg,
|
|
|
306
|
- logo: logo,
|
|
|
307
|
- alt: data.brand.brandName,
|
|
|
308
|
- brandName: data.brand.brandName,
|
|
|
309
|
- brandDomain: data.brand.brandDomain,
|
|
|
310
|
- homeUrl: homeUrl,
|
|
|
311
|
- isCollect: false
|
|
|
312
|
- };
|
|
|
313
|
- })();
|
294
|
+ // 导航的品牌banner
|
|
|
295
|
+ return {
|
|
|
296
|
+ brandId: brandId,
|
|
|
297
|
+ bgColor: bannerInfo.colorValue ? bannerInfo.colorValue : '#000000',
|
|
|
298
|
+ bgImg: bgImg,
|
|
|
299
|
+ logo: logo,
|
|
|
300
|
+ alt: data.brand.brandName,
|
|
|
301
|
+ brandName: data.brand.brandName,
|
|
|
302
|
+ brandDomain: data.brand.brandDomain,
|
|
|
303
|
+ homeUrl: homeUrl,
|
|
|
304
|
+ isCollect: false
|
|
|
305
|
+ };
|
314
|
};
|
306
|
};
|
315
|
|
307
|
|
316
|
/**
|
308
|
/**
|
|
@@ -442,41 +434,41 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
|
@@ -442,41 +434,41 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
442
|
// 显示获取限购码按钮
|
434
|
// 显示获取限购码按钮
|
443
|
switch (showStatus) {
|
435
|
switch (showStatus) {
|
444
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
436
|
case 1: // 开售前/后,立即分享获得限购码(用户未领取限购码)
|
445
|
- {
|
|
|
446
|
- if (isBeginSale) {
|
|
|
447
|
- result.buyNow = true;
|
|
|
448
|
- result.dis = true;
|
|
|
449
|
- } else {
|
|
|
450
|
- result.openSoon = true;
|
|
|
451
|
- result.hasLimitedCode = false;
|
|
|
452
|
- }
|
|
|
453
|
- break;
|
|
|
454
|
- }
|
|
|
455
|
- case 2: // 开售后,限购码已抢光(用户未领取限购码)
|
|
|
456
|
- {
|
437
|
+ {
|
|
|
438
|
+ if (isBeginSale) {
|
457
|
result.buyNow = true;
|
439
|
result.buyNow = true;
|
458
|
result.dis = true;
|
440
|
result.dis = true;
|
459
|
- result.limitedCodeSoldOut = true;
|
|
|
460
|
- result.getLimitedCode = false;
|
441
|
+ } else {
|
|
|
442
|
+ result.openSoon = true;
|
461
|
result.hasLimitedCode = false;
|
443
|
result.hasLimitedCode = false;
|
462
|
- break;
|
|
|
463
|
}
|
444
|
}
|
|
|
445
|
+ break;
|
|
|
446
|
+ }
|
|
|
447
|
+ case 2: // 开售后,限购码已抢光(用户未领取限购码)
|
|
|
448
|
+ {
|
|
|
449
|
+ result.buyNow = true;
|
|
|
450
|
+ result.dis = true;
|
|
|
451
|
+ result.limitedCodeSoldOut = true;
|
|
|
452
|
+ result.getLimitedCode = false;
|
|
|
453
|
+ result.hasLimitedCode = false;
|
|
|
454
|
+ break;
|
|
|
455
|
+ }
|
464
|
case 3: // 开售后,商品已经售罄
|
456
|
case 3: // 开售后,商品已经售罄
|
465
|
- {
|
|
|
466
|
- result.soldOut = true;
|
|
|
467
|
- result.getLimitedCode = false;
|
|
|
468
|
- break;
|
|
|
469
|
- }
|
457
|
+ {
|
|
|
458
|
+ result.soldOut = true;
|
|
|
459
|
+ result.getLimitedCode = false;
|
|
|
460
|
+ break;
|
|
|
461
|
+ }
|
470
|
case 4:// 开售后,立即购买(用户已领取限购码)
|
462
|
case 4:// 开售后,立即购买(用户已领取限购码)
|
471
|
- {
|
|
|
472
|
- result.buyNow = true;
|
|
|
473
|
- result.dis = false;
|
|
|
474
|
- result.hasLimitedCode = true;
|
|
|
475
|
- if (uid) { // 限购码失效
|
|
|
476
|
- result.getLimitedCodeDis = true;
|
|
|
477
|
- }
|
|
|
478
|
- break;
|
463
|
+ {
|
|
|
464
|
+ result.buyNow = true;
|
|
|
465
|
+ result.dis = false;
|
|
|
466
|
+ result.hasLimitedCode = true;
|
|
|
467
|
+ if (uid) { // 限购码失效
|
|
|
468
|
+ result.getLimitedCodeDis = true;
|
479
|
}
|
469
|
}
|
|
|
470
|
+ break;
|
|
|
471
|
+ }
|
480
|
case 5: // 开售前,限购码已被抢光(用户未领取限购码)
|
472
|
case 5: // 开售前,限购码已被抢光(用户未领取限购码)
|
481
|
result.openSoon = true;
|
473
|
result.openSoon = true;
|
482
|
result.hasLimitedCode = true;
|
474
|
result.hasLimitedCode = true;
|
|
@@ -506,7 +498,6 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
|
@@ -506,7 +498,6 @@ const getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { |
506
|
/**
|
498
|
/**
|
507
|
* 获取分类导航列表
|
499
|
* 获取分类导航列表
|
508
|
*/
|
500
|
*/
|
509
|
-// controller item.php 32;
|
|
|
510
|
function getSortNavAsync(smallSortId, gender) {
|
501
|
function getSortNavAsync(smallSortId, gender) {
|
511
|
return co(function*() {
|
502
|
return co(function*() {
|
512
|
|
503
|
|
|
@@ -562,10 +553,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -562,10 +553,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
562
|
result.maxSortId = origin.maxSortId;
|
553
|
result.maxSortId = origin.maxSortId;
|
563
|
result.smallSortId = origin.smallSortId;
|
554
|
result.smallSortId = origin.smallSortId;
|
564
|
result.promotionId = origin.isPromotion;
|
555
|
result.promotionId = origin.isPromotion;
|
565
|
- result.goCartUrl = helpers.urlFormat('/shopping/cart');
|
|
|
566
|
-
|
|
|
567
|
- // 接口处理数据,设置并发请求数据
|
|
|
568
|
- yield setMultiResourceByProductBaseInfo(origin);
|
556
|
+ result.goCartUrl = helpers.urlFormat('shopping/cart');
|
569
|
|
557
|
|
570
|
let brandId = 0;
|
558
|
let brandId = 0;
|
571
|
|
559
|
|
|
@@ -573,8 +561,12 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -573,8 +561,12 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
573
|
brandId = origin.brand.id;
|
561
|
brandId = origin.brand.id;
|
574
|
}
|
562
|
}
|
575
|
|
563
|
|
576
|
- // 处理收藏喜欢数据
|
|
|
577
|
- let favoriteData = yield getProductFavoriteData(uid, result.productId, brandId);
|
564
|
+ let requestData = yield Promise.all([
|
|
|
565
|
+ getProductAdditionInfoByProductBaseInfoAsync(origin), // 接口处理数据,设置并发请求数据
|
|
|
566
|
+ getProductFavoriteDataAsync(uid, result.productId, brandId) //处理收藏喜欢数据
|
|
|
567
|
+ ]);
|
|
|
568
|
+
|
|
|
569
|
+ let favoriteData = requestData[1];
|
578
|
|
570
|
|
579
|
// 商品标签
|
571
|
// 商品标签
|
580
|
result.tags = getTagsDataByProductInfo(origin);
|
572
|
result.tags = getTagsDataByProductInfo(origin);
|
|
@@ -599,7 +591,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -599,7 +591,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
599
|
result.vipPrice = getVipDataByProductBaseInfo(origin, vipLevel, uid);
|
591
|
result.vipPrice = getVipDataByProductBaseInfo(origin, vipLevel, uid);
|
600
|
|
592
|
|
601
|
// 促销活动banner
|
593
|
// 促销活动banner
|
602
|
- result.activity = yield getActivityDataByProductBaseInfo(origin);
|
594
|
+ result.activity = getActivityDataByProductBaseInfo(origin);
|
603
|
|
595
|
|
604
|
const C_VALUE = {
|
596
|
const C_VALUE = {
|
605
|
type: '返YOHO币',
|
597
|
type: '返YOHO币',
|
|
@@ -632,7 +624,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -632,7 +624,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
632
|
result.brandImg = helpers.image(origin.brand.brandIco, 47, 47);
|
624
|
result.brandImg = helpers.image(origin.brand.brandIco, 47, 47);
|
633
|
result.brandName = origin.brand.brandName;
|
625
|
result.brandName = origin.brand.brandName;
|
634
|
result.brandUrl = helpers.urlFormat('', {}, origin.brand.brandDomain);
|
626
|
result.brandUrl = helpers.urlFormat('', {}, origin.brand.brandDomain);
|
635
|
- banner = yield getBrandDataByProductBaseInfo(origin);
|
627
|
+ banner = getBrandDataByProductBaseInfo(origin);
|
636
|
if (banner.isCollect && favoriteData.brand) {
|
628
|
if (banner.isCollect && favoriteData.brand) {
|
637
|
banner.isCollect = favoriteData.brand;
|
629
|
banner.isCollect = favoriteData.brand;
|
638
|
}
|
630
|
}
|
|
@@ -661,7 +653,6 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -661,7 +653,6 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
661
|
|
653
|
|
662
|
let fashTopGoods = getFashionTopGoodsStatus(uid, showStatus, isBeginSale);
|
654
|
let fashTopGoods = getFashionTopGoodsStatus(uid, showStatus, isBeginSale);
|
663
|
|
655
|
|
664
|
-
|
|
|
665
|
result.fashTopGoods = {
|
656
|
result.fashTopGoods = {
|
666
|
getLimitedCode: fashTopGoods.getLimitedCode, // 限购码状态
|
657
|
getLimitedCode: fashTopGoods.getLimitedCode, // 限购码状态
|
667
|
hasLimitedCode: fashTopGoods.hasLimitedCode, // 是否已经获取限购码
|
658
|
hasLimitedCode: fashTopGoods.hasLimitedCode, // 是否已经获取限购码
|
|
@@ -702,7 +693,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -702,7 +693,7 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
702
|
} else if (virtualGoods) {
|
693
|
} else if (virtualGoods) {
|
703
|
// 虚拟商品
|
694
|
// 虚拟商品
|
704
|
result.buyNow = true; // 是否立即购买
|
695
|
result.buyNow = true; // 是否立即购买
|
705
|
- result.buyNowBase = helpers.urlFormat('/ticket', {}, 'shopping');
|
696
|
+ result.buyNowBase = helpers.urlFormat('ticket', {}, 'shopping');
|
706
|
result.virtualGoods = virtualGoods;
|
697
|
result.virtualGoods = virtualGoods;
|
707
|
if (result.salePrice) {
|
698
|
if (result.salePrice) {
|
708
|
result.advancePrice = result.salePrice; // 先行价格
|
699
|
result.advancePrice = result.salePrice; // 先行价格
|
|
@@ -723,7 +714,6 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -723,7 +714,6 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
723
|
result.shareImg = result.img;
|
714
|
result.shareImg = result.img;
|
724
|
result.shareDesc = result.phrase;
|
715
|
result.shareDesc = result.phrase;
|
725
|
|
716
|
|
726
|
-
|
|
|
727
|
// 统计需要的商品信息
|
717
|
// 统计需要的商品信息
|
728
|
let statGoodsInfo = {};
|
718
|
let statGoodsInfo = {};
|
729
|
|
719
|
|
|
@@ -745,19 +735,19 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -745,19 +735,19 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
745
|
if (domainBrand.type && domainBrand.shopId) {
|
735
|
if (domainBrand.type && domainBrand.shopId) {
|
746
|
switch (parseInt(domainBrand.type)) {
|
736
|
switch (parseInt(domainBrand.type)) {
|
747
|
case 1:
|
737
|
case 1:
|
748
|
- {
|
738
|
+ {
|
749
|
// 多品店不显示
|
739
|
// 多品店不显示
|
750
|
- banner = [];
|
|
|
751
|
- break;
|
|
|
752
|
- }
|
740
|
+ banner = [];
|
|
|
741
|
+ break;
|
|
|
742
|
+ }
|
753
|
case 2:
|
743
|
case 2:
|
754
|
- {
|
744
|
+ {
|
755
|
// TODO:单品店显示新版的店铺banner,item.php 210
|
745
|
// TODO:单品店显示新版的店铺banner,item.php 210
|
756
|
- let basisData = shopAPI.basisTemplateAsync(domainBrand.shopId);
|
746
|
+ let basisData = shopAPI.basisTemplateAsync(domainBrand.shopId);
|
757
|
|
747
|
|
758
|
- banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
759
|
- break;
|
|
|
760
|
- }
|
748
|
+ banner.bgImg = basisData.shopTopBanner.banner || banner.bgImg;
|
|
|
749
|
+ break;
|
|
|
750
|
+ }
|
761
|
|
751
|
|
762
|
}
|
752
|
}
|
763
|
}
|
753
|
}
|
|
@@ -780,102 +770,97 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
|
@@ -780,102 +770,97 @@ const detailDataPkg = (origin, uid, vipLevel) => { |
780
|
/**
|
770
|
/**
|
781
|
* 获取商品的舒适度
|
771
|
* 获取商品的舒适度
|
782
|
*/
|
772
|
*/
|
783
|
-function getProductComfortAsync(productId) {
|
|
|
784
|
- return co(function*() {
|
|
|
785
|
-
|
|
|
786
|
- let result = [];
|
773
|
+function getProductComfort() {
|
787
|
|
774
|
|
788
|
- let comfort = getMultiDataByResourceName('ItemData::getProductComfort');
|
775
|
+ let result = [];
|
789
|
|
776
|
|
790
|
- if (!comfort) {
|
|
|
791
|
- comfort = yield favoriteBrandService.getProductComfortAsync(productId);
|
|
|
792
|
- }
|
777
|
+ let comfort = getCacheDataByName('ItemData::getProductComfort');
|
793
|
|
778
|
|
794
|
- if (comfort.data) {
|
|
|
795
|
- comfort.data.forEach(value => {
|
|
|
796
|
- let blocks = [];
|
779
|
+ if (!comfort) {
|
|
|
780
|
+ return result;
|
|
|
781
|
+ }
|
797
|
|
782
|
|
798
|
- let flag = false;
|
783
|
+ if (comfort.data) {
|
|
|
784
|
+ comfort.data.forEach(value => {
|
|
|
785
|
+ let blocks = [];
|
799
|
|
786
|
|
800
|
- _.range(1, 6).forEach(i => {
|
|
|
801
|
- if (i === value.wearSense.value) {
|
|
|
802
|
- flag = true;
|
|
|
803
|
- blocks.push({
|
|
|
804
|
- cur: true
|
|
|
805
|
- });
|
|
|
806
|
- } else {
|
|
|
807
|
- blocks.push({});
|
|
|
808
|
- }
|
|
|
809
|
- });
|
787
|
+ let flag = false;
|
810
|
|
788
|
|
811
|
- // 存在,添加
|
|
|
812
|
- if (flag) {
|
|
|
813
|
- result.push({
|
|
|
814
|
- name: value.caption.caption,
|
|
|
815
|
- minDes: value.caption.low,
|
|
|
816
|
- blocks: blocks,
|
|
|
817
|
- maxDes: value.caption.high
|
789
|
+ _.range(1, 6).forEach(i => {
|
|
|
790
|
+ if (i === value.wearSense.value) {
|
|
|
791
|
+ flag = true;
|
|
|
792
|
+ blocks.push({
|
|
|
793
|
+ cur: true
|
818
|
});
|
794
|
});
|
|
|
795
|
+ } else {
|
|
|
796
|
+ blocks.push({});
|
819
|
}
|
797
|
}
|
820
|
-
|
|
|
821
|
});
|
798
|
});
|
822
|
- }
|
|
|
823
|
|
799
|
|
824
|
- return result;
|
|
|
825
|
- })();
|
|
|
826
|
-}
|
800
|
+ // 存在,添加
|
|
|
801
|
+ if (flag) {
|
|
|
802
|
+ result.push({
|
|
|
803
|
+ name: value.caption.caption,
|
|
|
804
|
+ minDes: value.caption.low,
|
|
|
805
|
+ blocks: blocks,
|
|
|
806
|
+ maxDes: value.caption.high
|
|
|
807
|
+ });
|
|
|
808
|
+ }
|
827
|
|
809
|
|
|
|
810
|
+ });
|
|
|
811
|
+ }
|
828
|
|
812
|
|
829
|
-function getDescriptionDataBySizeInfoAsync(sizeInfo) {
|
|
|
830
|
- return co(function *() {
|
813
|
+ return result;
|
|
|
814
|
+}
|
831
|
|
815
|
|
832
|
- let description = {};
|
|
|
833
|
|
816
|
|
834
|
- if (sizeInfo.productDescBo.erpProductId) {
|
|
|
835
|
- let sex = '通用';
|
817
|
+function getDescriptionDataBySizeInfo(sizeInfo) {
|
|
|
818
|
+ let description = {};
|
836
|
|
819
|
|
837
|
- switch (sizeInfo.productDescBo.gender) {
|
|
|
838
|
- case 1:
|
|
|
839
|
- {
|
|
|
840
|
- sex = '男款';
|
|
|
841
|
- break;
|
|
|
842
|
- }
|
|
|
843
|
- case 2:
|
|
|
844
|
- {
|
|
|
845
|
- sex = '女款';
|
|
|
846
|
- break;
|
|
|
847
|
- }
|
820
|
+ if (sizeInfo.productDescBo.erpProductId) {
|
|
|
821
|
+ let sex = '通用';
|
|
|
822
|
+
|
|
|
823
|
+ switch (sizeInfo.productDescBo.gender) {
|
|
|
824
|
+ case 1:
|
|
|
825
|
+ {
|
|
|
826
|
+ sex = '男款';
|
|
|
827
|
+ break;
|
848
|
}
|
828
|
}
|
|
|
829
|
+ case 2:
|
|
|
830
|
+ {
|
|
|
831
|
+ sex = '女款';
|
|
|
832
|
+ break;
|
|
|
833
|
+ }
|
|
|
834
|
+ }
|
849
|
|
835
|
|
850
|
- description.basic = [];
|
|
|
851
|
- description.basic.push({
|
|
|
852
|
- key: '编号',
|
|
|
853
|
- value: sizeInfo.productDescBo.erpProductId
|
|
|
854
|
- });
|
|
|
855
|
- description.basic.push({
|
|
|
856
|
- key: '颜色',
|
|
|
857
|
- value: sizeInfo.productDescBo.colorName,
|
|
|
858
|
- dColor: true
|
|
|
859
|
- });
|
|
|
860
|
- description.basic.push({
|
|
|
861
|
- key: '性别',
|
|
|
862
|
- value: sex
|
|
|
863
|
- });
|
836
|
+ description.basic = [];
|
|
|
837
|
+ description.basic.push({
|
|
|
838
|
+ key: '编号',
|
|
|
839
|
+ value: sizeInfo.productDescBo.erpProductId
|
|
|
840
|
+ });
|
|
|
841
|
+ description.basic.push({
|
|
|
842
|
+ key: '颜色',
|
|
|
843
|
+ value: sizeInfo.productDescBo.colorName,
|
|
|
844
|
+ dColor: true
|
|
|
845
|
+ });
|
|
|
846
|
+ description.basic.push({
|
|
|
847
|
+ key: '性别',
|
|
|
848
|
+ value: sex
|
|
|
849
|
+ });
|
864
|
|
850
|
|
865
|
- if (sizeInfo.productDescBo.standardBos) {
|
|
|
866
|
- sizeInfo.productDescBo.standardBos.forEach(value => {
|
|
|
867
|
- description.basic.push({
|
|
|
868
|
- key: value.standardName,
|
|
|
869
|
- value: value.standardVal
|
|
|
870
|
- });
|
851
|
+ if (sizeInfo.productDescBo.standardBos) {
|
|
|
852
|
+ sizeInfo.productDescBo.standardBos.forEach(value => {
|
|
|
853
|
+ description.basic.push({
|
|
|
854
|
+ key: value.standardName,
|
|
|
855
|
+ value: value.standardVal
|
871
|
});
|
856
|
});
|
872
|
- }
|
|
|
873
|
-
|
|
|
874
|
- description.confort = yield getProductComfortAsync(sizeInfo.productBo.id);
|
857
|
+ });
|
875
|
}
|
858
|
}
|
876
|
|
859
|
|
877
|
- return description;
|
|
|
878
|
- })();
|
860
|
+ description.confort = getProductComfort();
|
|
|
861
|
+ }
|
|
|
862
|
+
|
|
|
863
|
+ return description;
|
879
|
}
|
864
|
}
|
880
|
|
865
|
|
881
|
/**
|
866
|
/**
|
|
@@ -1012,29 +997,27 @@ function getSizeDataBySizeInfo(sizeInfo) { |
|
@@ -1012,29 +997,27 @@ function getSizeDataBySizeInfo(sizeInfo) { |
1012
|
* 获取商品模特卡
|
997
|
* 获取商品模特卡
|
1013
|
* @param productId
|
998
|
* @param productId
|
1014
|
*/
|
999
|
*/
|
1015
|
-function getProductModelCardAsync(productId) {
|
|
|
1016
|
- return co(function*() {
|
1000
|
+function getProductModelCard() {
|
1017
|
|
1001
|
|
1018
|
- let result = [];
|
1002
|
+ let result = [];
|
1019
|
|
1003
|
|
1020
|
- let data = getMultiDataByResourceName('ItemData::getProductModelCard');
|
1004
|
+ let data = getCacheDataByName('ItemData::getProductModelCard');
|
1021
|
|
1005
|
|
1022
|
- if (!data) {
|
|
|
1023
|
- data = yield productAPI.getProductModelCardAsync(productId);
|
|
|
1024
|
- }
|
1006
|
+ if (!data) {
|
|
|
1007
|
+ return result;
|
|
|
1008
|
+ }
|
1025
|
|
1009
|
|
1026
|
- if (data.code && data.code === 200) {
|
|
|
1027
|
- _(data.data).forEach(val => {
|
|
|
1028
|
- result.push({
|
|
|
1029
|
- url: helpers.getForceSourceUrl(val.modelImg),
|
|
|
1030
|
- size: val.size,
|
|
|
1031
|
- name: val.modelName
|
|
|
1032
|
- });
|
1010
|
+ if (data.code && data.code === 200) {
|
|
|
1011
|
+ _(data.data).forEach(val => {
|
|
|
1012
|
+ result.push({
|
|
|
1013
|
+ url: helpers.getForceSourceUrl(val.modelImg),
|
|
|
1014
|
+ size: val.size,
|
|
|
1015
|
+ name: val.modelName
|
1033
|
});
|
1016
|
});
|
1034
|
- }
|
1017
|
+ });
|
|
|
1018
|
+ }
|
1035
|
|
1019
|
|
1036
|
- return result;
|
|
|
1037
|
- })();
|
1020
|
+ return result;
|
1038
|
}
|
1021
|
}
|
1039
|
|
1022
|
|
1040
|
/**
|
1023
|
/**
|
|
@@ -1155,47 +1138,45 @@ function getDetailDataBySizeInfo(sizeInfo) { |
|
@@ -1155,47 +1138,45 @@ function getDetailDataBySizeInfo(sizeInfo) { |
1155
|
* 获取模特试穿
|
1138
|
* 获取模特试穿
|
1156
|
* @param productSkn
|
1139
|
* @param productSkn
|
1157
|
*/
|
1140
|
*/
|
1158
|
-function getProductModelTryAsync(productSkn) {
|
|
|
1159
|
- return co(function*() {
|
|
|
1160
|
- let modelTry = {};
|
1141
|
+function getProductModelTry() {
|
|
|
1142
|
+ let modelTry = {};
|
1161
|
|
1143
|
|
1162
|
- let result = getMultiDataByResourceName('ItemData::getProductModelTry');
|
1144
|
+ let result = getCacheDataByName('ItemData::getProductModelTry');
|
1163
|
|
1145
|
|
1164
|
- if (!result) {
|
|
|
1165
|
- result = yield productAPI.getProductModelTryAsync(productSkn);
|
|
|
1166
|
- }
|
|
|
1167
|
-
|
|
|
1168
|
- if (result.code && result.code === 200 && result.data) {
|
|
|
1169
|
- // 先显示模特信息
|
|
|
1170
|
- if (result.data.modelTryBoList) {
|
|
|
1171
|
- modelTry.thead = ['模特', '身高', '体重', '三围', '试穿尺码', '试穿描述'];
|
|
|
1172
|
- modelTry.tbody = [];
|
|
|
1173
|
-
|
|
|
1174
|
- result.data.modelTryBoList.forEach(val => {
|
|
|
1175
|
- if (val.modelBo &&
|
|
|
1176
|
- val.sizeBo &&
|
|
|
1177
|
- val.modelBo.modelName &&
|
|
|
1178
|
- val.sizeBo.sizeName) {
|
|
|
1179
|
-
|
|
|
1180
|
- modelTry.tbody.push([
|
|
|
1181
|
- val.modelBo.modelName,
|
|
|
1182
|
- val.modelBo.height,
|
|
|
1183
|
- val.modelBo.weight,
|
|
|
1184
|
- val.modelBo.vitalStatistics,
|
|
|
1185
|
- val.sizeBo.sizeName,
|
|
|
1186
|
- val.tryDesc
|
|
|
1187
|
- ]);
|
|
|
1188
|
- }
|
|
|
1189
|
- });
|
|
|
1190
|
- } else if (result.data.modelTryImgBoList) {
|
|
|
1191
|
- let tryImg = _.head(result.data.modelTryImgBoList);
|
1146
|
+ if (!result) {
|
|
|
1147
|
+ return modelTry;
|
|
|
1148
|
+ }
|
1192
|
|
1149
|
|
1193
|
- modelTry.frImg = helpers.getForceSourceUrl(tryImg.tryImg);
|
|
|
1194
|
- }
|
1150
|
+ if (result.code && result.code === 200 && result.data) {
|
|
|
1151
|
+ // 先显示模特信息
|
|
|
1152
|
+ if (result.data.modelTryBoList) {
|
|
|
1153
|
+ modelTry.thead = ['模特', '身高', '体重', '三围', '试穿尺码', '试穿描述'];
|
|
|
1154
|
+ modelTry.tbody = [];
|
|
|
1155
|
+
|
|
|
1156
|
+ result.data.modelTryBoList.forEach(val => {
|
|
|
1157
|
+ if (val.modelBo &&
|
|
|
1158
|
+ val.sizeBo &&
|
|
|
1159
|
+ val.modelBo.modelName &&
|
|
|
1160
|
+ val.sizeBo.sizeName) {
|
|
|
1161
|
+
|
|
|
1162
|
+ modelTry.tbody.push([
|
|
|
1163
|
+ val.modelBo.modelName,
|
|
|
1164
|
+ val.modelBo.height,
|
|
|
1165
|
+ val.modelBo.weight,
|
|
|
1166
|
+ val.modelBo.vitalStatistics,
|
|
|
1167
|
+ val.sizeBo.sizeName,
|
|
|
1168
|
+ val.tryDesc
|
|
|
1169
|
+ ]);
|
|
|
1170
|
+ }
|
|
|
1171
|
+ });
|
|
|
1172
|
+ } else if (result.data.modelTryImgBoList) {
|
|
|
1173
|
+ let tryImg = _.head(result.data.modelTryImgBoList);
|
1195
|
|
1174
|
|
|
|
1175
|
+ modelTry.frImg = helpers.getForceSourceUrl(tryImg.tryImg);
|
1196
|
}
|
1176
|
}
|
1197
|
- return modelTry;
|
|
|
1198
|
- })();
|
1177
|
+
|
|
|
1178
|
+ }
|
|
|
1179
|
+ return modelTry;
|
1199
|
}
|
1180
|
}
|
1200
|
|
1181
|
|
1201
|
/**
|
1182
|
/**
|
|
@@ -1210,25 +1191,25 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) { |
|
@@ -1210,25 +1191,25 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) { |
1210
|
switch (maxSortId) {
|
1191
|
switch (maxSortId) {
|
1211
|
case 1:
|
1192
|
case 1:
|
1212
|
case 2:
|
1193
|
case 2:
|
1213
|
- {
|
|
|
1214
|
- attributeIds = [3, 4];
|
|
|
1215
|
- break;
|
|
|
1216
|
- }
|
1194
|
+ {
|
|
|
1195
|
+ attributeIds = [3, 4];
|
|
|
1196
|
+ break;
|
|
|
1197
|
+ }
|
1217
|
|
1198
|
|
1218
|
case 3:
|
1199
|
case 3:
|
1219
|
- {
|
|
|
1220
|
- attributeIds = [6, 10];
|
|
|
1221
|
- break;
|
|
|
1222
|
- }
|
1200
|
+ {
|
|
|
1201
|
+ attributeIds = [6, 10];
|
|
|
1202
|
+ break;
|
|
|
1203
|
+ }
|
1223
|
case 6:
|
1204
|
case 6:
|
1224
|
- {
|
|
|
1225
|
- attributeIds = [13];
|
|
|
1226
|
- break;
|
|
|
1227
|
- }
|
1205
|
+ {
|
|
|
1206
|
+ attributeIds = [13];
|
|
|
1207
|
+ break;
|
|
|
1208
|
+ }
|
1228
|
default:
|
1209
|
default:
|
1229
|
- {
|
|
|
1230
|
- attributeIds = [];
|
|
|
1231
|
- }
|
1210
|
+ {
|
|
|
1211
|
+ attributeIds = [];
|
|
|
1212
|
+ }
|
1232
|
}
|
1213
|
}
|
1233
|
|
1214
|
|
1234
|
let sizeInfos = [];
|
1215
|
let sizeInfos = [];
|
|
@@ -1270,58 +1251,49 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) { |
|
@@ -1270,58 +1251,49 @@ function getSizeAttrByMaxSortId(maxSortId, sizeList) { |
1270
|
* @param int $maxSortId
|
1251
|
* @param int $maxSortId
|
1271
|
* @return array
|
1252
|
* @return array
|
1272
|
*/
|
1253
|
*/
|
1273
|
-const getSizeInfoAsync = (productSkn, maxSortId)=> {
|
|
|
1274
|
- return co(function*() {
|
1254
|
+const getSizeInfo = (productSkn, maxSortId)=> {
|
1275
|
|
1255
|
|
1276
|
- let result = {};
|
|
|
1277
|
-
|
|
|
1278
|
- if (productSkn) {
|
|
|
1279
|
- // 并发资源中是否存在数据
|
|
|
1280
|
- let sizeInfo = getMultiDataByResourceName('ItemData::sizeInfo');
|
1256
|
+ let result = {};
|
1281
|
|
1257
|
|
1282
|
- if (!sizeInfo) {
|
|
|
1283
|
- // 获取尺码
|
|
|
1284
|
- sizeInfo = yield productAPI.sizeInfoAsync(productSkn);
|
|
|
1285
|
- }
|
1258
|
+ if (productSkn) {
|
|
|
1259
|
+ // 并发资源中是否存在数据
|
|
|
1260
|
+ let sizeInfo = getCacheDataByName('ItemData::sizeInfo');
|
1286
|
|
1261
|
|
1287
|
- if (!sizeInfo) {
|
|
|
1288
|
- return result;
|
|
|
1289
|
- }
|
|
|
1290
|
-
|
|
|
1291
|
- let productId = sizeInfo.productBo.id;
|
1262
|
+ if (!sizeInfo) {
|
|
|
1263
|
+ return result;
|
|
|
1264
|
+ }
|
1292
|
|
1265
|
|
1293
|
- // 描述数据
|
|
|
1294
|
- result.description = yield getDescriptionDataBySizeInfoAsync(sizeInfo);
|
1266
|
+ // 描述数据
|
|
|
1267
|
+ result.description = getDescriptionDataBySizeInfo(sizeInfo);
|
1295
|
|
1268
|
|
1296
|
- // 尺寸数据
|
|
|
1297
|
- result.size = getSizeDataBySizeInfo(sizeInfo);
|
1269
|
+ // 模特卡
|
|
|
1270
|
+ result.modelCards = getProductModelCard();
|
1298
|
|
1271
|
|
1299
|
- // 模特卡
|
|
|
1300
|
- result.modelCards = yield getProductModelCardAsync(productId);
|
1272
|
+ // 试穿模特
|
|
|
1273
|
+ let fittingReport = getProductModelTry();
|
1301
|
|
1274
|
|
1302
|
- // 模特数据
|
|
|
1303
|
- result.reference = getReferenceDataBySizeInfo(sizeInfo);
|
1275
|
+ if (!_.isEmpty(fittingReport)) {
|
|
|
1276
|
+ result.fittingReport = fittingReport;
|
|
|
1277
|
+ }
|
1304
|
|
1278
|
|
1305
|
- // 洗涤材质
|
|
|
1306
|
- result.material = getMaterialDataBySizeInfo(sizeInfo);
|
1279
|
+ // 尺寸数据
|
|
|
1280
|
+ result.size = getSizeDataBySizeInfo(sizeInfo);
|
1307
|
|
1281
|
|
1308
|
- // 商品详情页介绍
|
|
|
1309
|
- result.details = getDetailDataBySizeInfo(sizeInfo);
|
1282
|
+ // 模特数据
|
|
|
1283
|
+ result.reference = getReferenceDataBySizeInfo(sizeInfo);
|
1310
|
|
1284
|
|
1311
|
- // 试穿模特
|
|
|
1312
|
- let fittingReport = yield getProductModelTryAsync(productSkn);
|
1285
|
+ // 洗涤材质
|
|
|
1286
|
+ result.material = getMaterialDataBySizeInfo(sizeInfo);
|
1313
|
|
1287
|
|
1314
|
- if (!_.isEmpty(fittingReport)) {
|
|
|
1315
|
- result.fittingReport = fittingReport;
|
|
|
1316
|
- }
|
1288
|
+ // 商品详情页介绍
|
|
|
1289
|
+ result.details = getDetailDataBySizeInfo(sizeInfo);
|
1317
|
|
1290
|
|
1318
|
- // 获取尺寸说明
|
|
|
1319
|
- result.sizeTitleJson =
|
|
|
1320
|
- sizeInfo.sizeInfoBo ? JSON.stringify(getSizeAttrByMaxSortId(maxSortId, sizeInfo.sizeInfoBo)) : '';
|
|
|
1321
|
- }
|
1291
|
+ // 获取尺寸说明
|
|
|
1292
|
+ result.sizeTitleJson =
|
|
|
1293
|
+ sizeInfo.sizeInfoBo ? JSON.stringify(getSizeAttrByMaxSortId(maxSortId, sizeInfo.sizeInfoBo)) : '';
|
|
|
1294
|
+ }
|
1322
|
|
1295
|
|
1323
|
- return result;
|
|
|
1324
|
- })();
|
1296
|
+ return result;
|
1325
|
};
|
1297
|
};
|
1326
|
|
1298
|
|
1327
|
/**
|
1299
|
/**
|
|
@@ -1346,21 +1318,32 @@ module.exports.showMainAsync = (data) => { |
|
@@ -1346,21 +1318,32 @@ module.exports.showMainAsync = (data) => { |
1346
|
|
1318
|
|
1347
|
return co(function * () {
|
1319
|
return co(function * () {
|
1348
|
|
1320
|
|
1349
|
- // 获取商品信息
|
|
|
1350
|
- let productInfo = yield productAPI.getProductInfo(data.id);
|
1321
|
+ let result = {};
|
1351
|
|
1322
|
|
1352
|
- productInfo = yield detailDataPkg(productInfo, data.uid, data.vipLevel);
|
1323
|
+ let currentUserProductInfo = _.curry(detailDataPkg)(_, data.uid, data.vipLevel);
|
|
|
1324
|
+
|
|
|
1325
|
+ // 获取商品信息
|
|
|
1326
|
+ let productInfo = yield productAPI.getProductInfo(data.id).then(currentUserProductInfo);
|
1353
|
|
1327
|
|
1354
|
// 获取商品尺寸相关
|
1328
|
// 获取商品尺寸相关
|
1355
|
- let sizeInfo = yield getSizeInfoAsync(productInfo.goodsInfo, productInfo.goodsInfo.maxSortId);
|
1329
|
+ let requestData = yield Promise.all([
|
|
|
1330
|
+ getSortNavAsync(productInfo.goodsInfo.smallSortId, data.gender),
|
|
|
1331
|
+ HeaderModel.requestHeaderData()
|
|
|
1332
|
+ ]);
|
1356
|
|
1333
|
|
1357
|
- let navs = yield getSortNavAsync(productInfo.goodsInfo.smallSortId, data.gender);
|
1334
|
+ let sizeInfo = getSizeInfo(productInfo.goodsInfo, productInfo.goodsInfo.maxSortId);
|
1358
|
|
1335
|
|
1359
|
- let result = {
|
|
|
1360
|
- productDetailPage: true,
|
|
|
1361
|
- detail: Object.assign(productInfo, sizeInfo),
|
|
|
1362
|
- statGoodsInfo: Object.assign({fullSortName: navs.map(x => x.name).join('-')}, productInfo.statGoodsInfo)
|
|
|
1363
|
- };
|
1336
|
+ let navs = requestData[0];
|
|
|
1337
|
+
|
|
|
1338
|
+ result.headerData = requestData[1];
|
|
|
1339
|
+
|
|
|
1340
|
+ result.productDetailPage = true;
|
|
|
1341
|
+ result.detail = Object.assign(productInfo, sizeInfo);
|
|
|
1342
|
+ result.statGoodsInfo = Object.assign({
|
|
|
1343
|
+ fullSortName: navs.map(x => x.name).join('-')
|
|
|
1344
|
+ },
|
|
|
1345
|
+ productInfo.statGoodsInfo
|
|
|
1346
|
+ );
|
1364
|
|
1347
|
|
1365
|
// 导航
|
1348
|
// 导航
|
1366
|
result.detail.pathNav = _.concat(
|
1349
|
result.detail.pathNav = _.concat(
|
|
@@ -1370,8 +1353,6 @@ module.exports.showMainAsync = (data) => { |
|
@@ -1370,8 +1353,6 @@ module.exports.showMainAsync = (data) => { |
1370
|
);
|
1353
|
);
|
1371
|
|
1354
|
|
1372
|
result.detail.lastWalk = 5;
|
1355
|
result.detail.lastWalk = 5;
|
1373
|
- result.headerData = yield HeaderModel.requestHeaderData();
|
|
|
1374
|
-
|
|
|
1375
|
return result;
|
1356
|
return result;
|
1376
|
})();
|
1357
|
})();
|
1377
|
};
|
1358
|
};
|