Merge remote-tracking branch 'remotes/origin/master' into feature/guang
Showing
14 changed files
with
105 additions
and
54 deletions
@@ -33,7 +33,7 @@ exports.getNewArrival = (req, res, next) => { | @@ -33,7 +33,7 @@ exports.getNewArrival = (req, res, next) => { | ||
33 | let reqBody = req.body, | 33 | let reqBody = req.body, |
34 | pageIndex = reqBody.pageIndex, | 34 | pageIndex = reqBody.pageIndex, |
35 | pageCount = reqBody.pageCount, | 35 | pageCount = reqBody.pageCount, |
36 | - channel = reqBody.type, | 36 | + channel = reqBody.type || req.yoho.channel, |
37 | goods = [], | 37 | goods = [], |
38 | result = {}; | 38 | result = {}; |
39 | 39 |
@@ -15,7 +15,7 @@ const searchApi = require(`${mRoot}/search-api`); | @@ -15,7 +15,7 @@ const searchApi = require(`${mRoot}/search-api`); | ||
15 | const shop = (shopId, req, res, next, brandInfo) => { | 15 | const shop = (shopId, req, res, next, brandInfo) => { |
16 | shopId = parseInt(shopId, 10); | 16 | shopId = parseInt(shopId, 10); |
17 | 17 | ||
18 | - list.getShopInfo(shopId, req.user.id).then(shopInfo => { | 18 | + list.getShopInfo(shopId, req.user.uid).then(shopInfo => { |
19 | if (+shopInfo.shopTemplateType === 2) { // 经典模板 | 19 | if (+shopInfo.shopTemplateType === 2) { // 经典模板 |
20 | let pjax = req.query._pjax; | 20 | let pjax = req.query._pjax; |
21 | 21 | ||
@@ -158,7 +158,7 @@ exports.shopList = (req, res, next) => { | @@ -158,7 +158,7 @@ exports.shopList = (req, res, next) => { | ||
158 | return next(); | 158 | return next(); |
159 | } | 159 | } |
160 | 160 | ||
161 | - list.getShopListData(req.yoho.channel, req.query).then(result => { | 161 | + list.getShopListData(req.yoho.channel, req.query, req.user.uid).then(result => { |
162 | Object.assign(result, { | 162 | Object.assign(result, { |
163 | page: 'shop', | 163 | page: 'shop', |
164 | shopId: shopId | 164 | shopId: shopId |
@@ -16,7 +16,7 @@ const sale = require(`${mRoot}/sale`); // sale 页 model | @@ -16,7 +16,7 @@ const sale = require(`${mRoot}/sale`); // sale 页 model | ||
16 | * @return {[type]} [description] | 16 | * @return {[type]} [description] |
17 | */ | 17 | */ |
18 | exports.index = (req, res, next) => { | 18 | exports.index = (req, res, next) => { |
19 | - let channel = req.query.channel || req.cookies._Channel || 'boys'; | 19 | + let channel = req.query.channel || req.yoho.channel; |
20 | 20 | ||
21 | // 真实数据输出 | 21 | // 真实数据输出 |
22 | sale.getSaleIndexData(channel).then(result => { | 22 | sale.getSaleIndexData(channel).then(result => { |
@@ -41,7 +41,7 @@ exports.discount = (req, res, next) => { | @@ -41,7 +41,7 @@ exports.discount = (req, res, next) => { | ||
41 | saleType: '3' | 41 | saleType: '3' |
42 | }, req.query); | 42 | }, req.query); |
43 | 43 | ||
44 | - let channel = req.query.channel || req.cookies._Channel || 'boys'; | 44 | + let channel = req.query.channel || req.yoho.channel; |
45 | 45 | ||
46 | let responseData = { | 46 | let responseData = { |
47 | module: 'product', | 47 | module: 'product', |
@@ -68,7 +68,7 @@ exports.vip = (req, res, next) => { | @@ -68,7 +68,7 @@ exports.vip = (req, res, next) => { | ||
68 | saleType: '2' | 68 | saleType: '2' |
69 | }, req.query); | 69 | }, req.query); |
70 | 70 | ||
71 | - let channel = req.query.channel || req.cookies._Channel || 'boys'; | 71 | + let channel = req.query.channel || req.yoho.channel; |
72 | 72 | ||
73 | params.uid = req.user.uid || 0; | 73 | params.uid = req.user.uid || 0; |
74 | 74 | ||
@@ -95,7 +95,7 @@ exports.newSale = (req, res, next) => { | @@ -95,7 +95,7 @@ exports.newSale = (req, res, next) => { | ||
95 | order: 's_t_desc' | 95 | order: 's_t_desc' |
96 | }, req.query); | 96 | }, req.query); |
97 | 97 | ||
98 | - let channel = req.query.channel || req.cookies._Channel || 'boys'; | 98 | + let channel = req.query.channel || req.yoho.channel; |
99 | 99 | ||
100 | sale.getSaleOthersData(params, channel).then((result) => { | 100 | sale.getSaleOthersData(params, channel).then((result) => { |
101 | res.render('sale/other', Object.assign({ | 101 | res.render('sale/other', Object.assign({ |
@@ -119,7 +119,7 @@ exports.breakingYards = (req, res, next) => { | @@ -119,7 +119,7 @@ exports.breakingYards = (req, res, next) => { | ||
119 | saleType: '5' | 119 | saleType: '5' |
120 | }, req.query); | 120 | }, req.query); |
121 | 121 | ||
122 | - let channel = req.query.channel || req.cookies._Channel || 'boys'; | 122 | + let channel = req.query.channel || req.yoho.channel; |
123 | 123 | ||
124 | let responseData = { | 124 | let responseData = { |
125 | module: 'product', | 125 | module: 'product', |
@@ -373,7 +373,7 @@ const _getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { | @@ -373,7 +373,7 @@ const _getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { | ||
373 | // dis //失效 | 373 | // dis //失效 |
374 | // buyNow //是否立即购买 | 374 | // buyNow //是否立即购买 |
375 | let result = { | 375 | let result = { |
376 | - getLimitedCode: true, | 376 | + getLimitedCode: false, |
377 | hadLimitedCode: false, | 377 | hadLimitedCode: false, |
378 | limitedCodeSoldOut: false, | 378 | limitedCodeSoldOut: false, |
379 | openSoon: false, | 379 | openSoon: false, |
@@ -393,17 +393,16 @@ const _getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { | @@ -393,17 +393,16 @@ const _getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { | ||
393 | result.openSoon = true; | 393 | result.openSoon = true; |
394 | result.hadLimitedCode = false; | 394 | result.hadLimitedCode = false; |
395 | } | 395 | } |
396 | + result.getLimitedCode = true; | ||
396 | break; | 397 | break; |
397 | case 2: // 开售后,限购码已抢光(用户未领取限购码) | 398 | case 2: // 开售后,限购码已抢光(用户未领取限购码) |
398 | result.buyNow = true; | 399 | result.buyNow = true; |
399 | result.dis = true; | 400 | result.dis = true; |
400 | result.limitedCodeSoldOut = true; | 401 | result.limitedCodeSoldOut = true; |
401 | - result.getLimitedCode = false; | ||
402 | result.hadLimitedCode = false; | 402 | result.hadLimitedCode = false; |
403 | break; | 403 | break; |
404 | case 3: // 开售后,商品已经售罄 | 404 | case 3: // 开售后,商品已经售罄 |
405 | result.soldOut = true; | 405 | result.soldOut = true; |
406 | - result.getLimitedCode = false; | ||
407 | break; | 406 | break; |
408 | case 4:// 开售后,立即购买(用户已领取限购码) | 407 | case 4:// 开售后,立即购买(用户已领取限购码) |
409 | result.buyNow = true; | 408 | result.buyNow = true; |
@@ -417,7 +416,6 @@ const _getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { | @@ -417,7 +416,6 @@ const _getFashionTopGoodsStatus = (uid, showStatus, isBeginSale) => { | ||
417 | result.openSoon = true; | 416 | result.openSoon = true; |
418 | result.hadLimitedCode = true; | 417 | result.hadLimitedCode = true; |
419 | result.limitedCodeSoldOut = true; | 418 | result.limitedCodeSoldOut = true; |
420 | - result.getLimitedCode = false; | ||
421 | break; | 419 | break; |
422 | case 6: // 开售前,即将开售(用户已领取限购码) | 420 | case 6: // 开售前,即将开售(用户已领取限购码) |
423 | result.openSoon = true; | 421 | result.openSoon = true; |
@@ -1102,21 +1100,22 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | @@ -1102,21 +1100,22 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | ||
1102 | result.vipPrice = _getVipDataByProductBaseInfo(origin, vipLevel, uid); | 1100 | result.vipPrice = _getVipDataByProductBaseInfo(origin, vipLevel, uid); |
1103 | } | 1101 | } |
1104 | 1102 | ||
1105 | - // 促销活动banner,虚拟商品无促销 | 1103 | + // 促销活动banner,虚拟商品无促销 |
1106 | if (propOrigin('attribute') !== 3) { | 1104 | if (propOrigin('attribute') !== 3) { |
1107 | result.activity = _getActivityDataByProductBaseInfo(promotionData, additionalData); | 1105 | result.activity = _getActivityDataByProductBaseInfo(promotionData, additionalData); |
1108 | } | 1106 | } |
1109 | 1107 | ||
1110 | - const C_VALUE = { | ||
1111 | - type: '返有货币', | ||
1112 | - des: '每件返 ', | ||
1113 | - rest: '个 有货币' | ||
1114 | - }; | 1108 | + // 有货币 |
1109 | + if (!_.includes(['', '0'], propOrigin('yohoCoinNum'))) { | ||
1110 | + const C_VALUE = { | ||
1111 | + type: '返有货币', | ||
1112 | + des: '每件返 ', | ||
1113 | + rest: '个 有货币' | ||
1114 | + }; | ||
1115 | 1115 | ||
1116 | - if (propOrigin('yoho_coin_num', '0') !== '0') { | ||
1117 | result.activity.push({ | 1116 | result.activity.push({ |
1118 | type: C_VALUE.type, | 1117 | type: C_VALUE.type, |
1119 | - des: `${C_VALUE.des}${propOrigin('yoho_coin_num')}${C_VALUE.rest}` | 1118 | + des: `${C_VALUE.des}${propOrigin('yohoCoinNum')}${C_VALUE.rest}` |
1120 | }); | 1119 | }); |
1121 | } | 1120 | } |
1122 | 1121 | ||
@@ -1152,12 +1151,12 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | @@ -1152,12 +1151,12 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | ||
1152 | // 是否收藏 | 1151 | // 是否收藏 |
1153 | result.isCollect = favoriteData.product; | 1152 | result.isCollect = favoriteData.product; |
1154 | 1153 | ||
1155 | - if (propOrigin('is_limit_buy', false)) { | 1154 | + if (propOrigin('isLimitBuy', false)) { |
1156 | // 是否开售 | 1155 | // 是否开售 |
1157 | - let isBeginSale = propOrigin('sale_status', 0) === 1; | 1156 | + let isBeginSale = propOrigin('saleStatus', 0) === 1; |
1158 | 1157 | ||
1159 | // 限购商品有关的展示状态 | 1158 | // 限购商品有关的展示状态 |
1160 | - let showStatus = propOrigin('show_status', 1); | 1159 | + let showStatus = propOrigin('showStatus', 1); |
1161 | 1160 | ||
1162 | let fashTopGoods = _getFashionTopGoodsStatus(uid, showStatus, isBeginSale); | 1161 | let fashTopGoods = _getFashionTopGoodsStatus(uid, showStatus, isBeginSale); |
1163 | 1162 | ||
@@ -1237,8 +1236,13 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | @@ -1237,8 +1236,13 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | ||
1237 | statGoodsInfo.productId = propOrigin('product_id'); | 1236 | statGoodsInfo.productId = propOrigin('product_id'); |
1238 | statGoodsInfo.productName = result.name.replace('\'', '’'); | 1237 | statGoodsInfo.productName = result.name.replace('\'', '’'); |
1239 | statGoodsInfo.brandName = (result.brandName || '').replace('\'', '’'); | 1238 | statGoodsInfo.brandName = (result.brandName || '').replace('\'', '’'); |
1240 | - statGoodsInfo.marketPrice = result.marketPrice; | ||
1241 | - statGoodsInfo.salePrice = result.salePrice ? result.salePrice : result.marketPrice; | 1239 | + statGoodsInfo.marketPrice = result.marketPrice.replace('¥', ''); // 数字 |
1240 | + statGoodsInfo.salePrice = (result.salePrice ? result.salePrice : result.marketPrice).replace('¥', ''); // 数字 | ||
1241 | + statGoodsInfo.imageUrl = 'http:' + result.img.split('?')[0]; | ||
1242 | + statGoodsInfo.productUrl = 'http:' + | ||
1243 | + helpers.urlFormat(url.parse(propOrigin('product_url')).pathname, null, 'item'); | ||
1244 | + statGoodsInfo.smallSortId = result.smallSortId; | ||
1245 | + statGoodsInfo.soldOut = soldOut ? 1 : 0; | ||
1242 | 1246 | ||
1243 | if (banner.brandId) { | 1247 | if (banner.brandId) { |
1244 | let domainBrand = yield brandService.getBrandByDomainAsync(banner.brandDomain); | 1248 | let domainBrand = yield brandService.getBrandByDomainAsync(banner.brandDomain); |
@@ -1258,11 +1262,6 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | @@ -1258,11 +1262,6 @@ const _detailDataPkg = (origin, uid, vipLevel) => { | ||
1258 | } | 1262 | } |
1259 | } | 1263 | } |
1260 | 1264 | ||
1261 | - statGoodsInfo.imageUrl = 'http:' + result.img.split('?')[0]; | ||
1262 | - statGoodsInfo.productUrl = 'http:' + | ||
1263 | - helpers.urlFormat(url.parse(propOrigin('product_url')).pathname, null, 'item'); | ||
1264 | - statGoodsInfo.smallSortId = result.smallSortId; | ||
1265 | - statGoodsInfo.soldOut = soldOut ? 1 : 0; | ||
1266 | 1265 | ||
1267 | // 获取商品尺寸相关 | 1266 | // 获取商品尺寸相关 |
1268 | let sizeInfo = _getSizeInfo(result, result.maxSortId, additionalData); | 1267 | let sizeInfo = _getSizeInfo(result, result.maxSortId, additionalData); |
@@ -118,7 +118,9 @@ const getListData = (params, channel) => { | @@ -118,7 +118,9 @@ const getListData = (params, channel) => { | ||
118 | totalCount: result[2].data.total, | 118 | totalCount: result[2].data.total, |
119 | footPager: searchHandler.handlePagerData(result[2].data.total, params), | 119 | footPager: searchHandler.handlePagerData(result[2].data.total, params), |
120 | goods: productProcess.processProductList(result[2].data.product_list, | 120 | goods: productProcess.processProductList(result[2].data.product_list, |
121 | - Object.assign({showDiscount: false}, params)), | 121 | + Object.assign({showDiscount: false}, params, { |
122 | + from: {type: 'list', params: params} | ||
123 | + })), | ||
122 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), | 124 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), |
123 | 125 | ||
124 | // 最近浏览记录 | 126 | // 最近浏览记录 |
@@ -194,7 +196,8 @@ const getListNewData = (params, channel) => { | @@ -194,7 +196,8 @@ const getListNewData = (params, channel) => { | ||
194 | totalCount: result[2].data.total, | 196 | totalCount: result[2].data.total, |
195 | footPager: searchHandler.handlePagerData(result[2].data.total, params), | 197 | footPager: searchHandler.handlePagerData(result[2].data.total, params), |
196 | goods: productProcess.processProductList(result[2].data.product_list, | 198 | goods: productProcess.processProductList(result[2].data.product_list, |
197 | - Object.assign({showDiscount: false, showNew: false}, params)), | 199 | + Object.assign({showDiscount: false, showNew: false, |
200 | + from: {type: 'listNew', params: params}}, params)), | ||
198 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), | 201 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), |
199 | 202 | ||
200 | // 最近浏览记录 | 203 | // 最近浏览记录 |
@@ -265,7 +268,7 @@ const getBrandData = (params, extra, channel) => { | @@ -265,7 +268,7 @@ const getBrandData = (params, extra, channel) => { | ||
265 | let apiMethod = [ | 268 | let apiMethod = [ |
266 | headerModel.requestHeaderData(channel), | 269 | headerModel.requestHeaderData(channel), |
267 | searchApi.getSortList(queryBase), | 270 | searchApi.getSortList(queryBase), |
268 | - searchApi.getProductList(Object.assign({order: order}, searchParams, queryBase)) | 271 | + searchApi.getProductList(Object.assign(searchParams, {order: order}, queryBase)) |
269 | 272 | ||
270 | ]; | 273 | ]; |
271 | 274 | ||
@@ -304,16 +307,16 @@ const getBrandData = (params, extra, channel) => { | @@ -304,16 +307,16 @@ const getBrandData = (params, extra, channel) => { | ||
304 | totalCount: result[2].data.total, | 307 | totalCount: result[2].data.total, |
305 | footPager: searchHandler.handlePagerData(result[2].data.total, params), | 308 | footPager: searchHandler.handlePagerData(result[2].data.total, params), |
306 | goods: productProcess.processProductList(result[2].data.product_list, | 309 | goods: productProcess.processProductList(result[2].data.product_list, |
307 | - Object.assign({showDiscount: false}, params)), | 310 | + Object.assign({showDiscount: false, from: {type: 'brand', params: params}}, params)), |
308 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), | 311 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), |
309 | 312 | ||
310 | // 最近浏览记录 | 313 | // 最近浏览记录 |
311 | latestWalk: 7 | 314 | latestWalk: 7 |
312 | }); | 315 | }); |
313 | - } | ||
314 | 316 | ||
315 | - // 品牌页不显示品牌筛选项 | ||
316 | - delete finalResult.brand.filters.brand; | 317 | + // 品牌页不显示品牌筛选项 |
318 | + _.unset(finalResult, 'brand.filters.brand'); | ||
319 | + } | ||
317 | 320 | ||
318 | finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.brand, 'goods'))}; | 321 | finalResult.criteo = {skn: searchHandler.getCriteo(_.get(finalResult.brand, 'goods'))}; |
319 | 322 | ||
@@ -417,7 +420,7 @@ const getShopAbout = (shopId, uid, channel) => { | @@ -417,7 +420,7 @@ const getShopAbout = (shopId, uid, channel) => { | ||
417 | 420 | ||
418 | if (result[1].code === 200) { | 421 | if (result[1].code === 200) { |
419 | let data = result[1].data || {}, | 422 | let data = result[1].data || {}, |
420 | - decorator = shopHandler.getShopDecorator(data, {}, shopId); | 423 | + decorator = shopHandler.getShopDecorator(data, {}, shopId, true); |
421 | 424 | ||
422 | Object.assign(decorator.shopTopBannerBase, { | 425 | Object.assign(decorator.shopTopBannerBase, { |
423 | shopId: shopId, | 426 | shopId: shopId, |
@@ -637,7 +640,8 @@ const getShopData = (shopId, channel, params, shopInfo) => { | @@ -637,7 +640,8 @@ const getShopData = (shopId, channel, params, shopInfo) => { | ||
637 | finalResult.leftContent = searchHandler.handleSortData(groupSort, params); | 640 | finalResult.leftContent = searchHandler.handleSortData(groupSort, params); |
638 | 641 | ||
639 | if (finalResult.allGoods) { | 642 | if (finalResult.allGoods) { |
640 | - Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, params)); | 643 | + Object.assign(finalResult.allGoods, searchHandler.setShopSort(groupSort, Object.assign({}, |
644 | + params, {page: 1}))); | ||
641 | } | 645 | } |
642 | } | 646 | } |
643 | 647 | ||
@@ -652,7 +656,7 @@ const getShopData = (shopId, channel, params, shopInfo) => { | @@ -652,7 +656,7 @@ const getShopData = (shopId, channel, params, shopInfo) => { | ||
652 | 656 | ||
653 | for (let i = 0; i < 3; i++) { | 657 | for (let i = 0; i < 3; i++) { |
654 | trendList.push({ | 658 | trendList.push({ |
655 | - href: articleList[i].url, | 659 | + href: helpers.urlFormat(`/${articleList[i].id}.html`, '', 'guang'), |
656 | src: helpers.getForceSourceUrl(articleList[i].src) + | 660 | src: helpers.getForceSourceUrl(articleList[i].src) + |
657 | '?imageView/1/w/{width}/h/{height}', | 661 | '?imageView/1/w/{width}/h/{height}', |
658 | mainTitle: articleList[i].title, | 662 | mainTitle: articleList[i].title, |
@@ -712,7 +716,8 @@ const getShopGoodsData = (shopId, channel, params) => { | @@ -712,7 +716,8 @@ const getShopGoodsData = (shopId, channel, params) => { | ||
712 | if (subRes.code === 200) { | 716 | if (subRes.code === 200) { |
713 | let groupSort = _.get(subRes, 'data.sort', []); | 717 | let groupSort = _.get(subRes, 'data.sort', []); |
714 | 718 | ||
715 | - Object.assign(resData, searchHandler.setShopSort(groupSort, params)); | 719 | + Object.assign(resData, searchHandler.setShopSort(groupSort, Object.assign(params, |
720 | + {page: 1}))); | ||
716 | } | 721 | } |
717 | 722 | ||
718 | return resData; | 723 | return resData; |
@@ -794,6 +799,9 @@ const getShopListData = (channel, params, uid) => { | @@ -794,6 +799,9 @@ const getShopListData = (channel, params, uid) => { | ||
794 | }), | 799 | }), |
795 | footPager: {tip: tip} | 800 | footPager: {tip: tip} |
796 | }); | 801 | }); |
802 | + | ||
803 | + _.set(finalResult, 'filters.checkedConditions.clearUrl', | ||
804 | + `?navBar=${params.navBar}&shopId=${params.shopId}`); | ||
797 | } else { | 805 | } else { |
798 | finalResult.searchEmpty = true; | 806 | finalResult.searchEmpty = true; |
799 | 807 | ||
@@ -886,6 +894,11 @@ const getBaseShopData = (params, extra, channel, shopId) => { | @@ -886,6 +894,11 @@ const getBaseShopData = (params, extra, channel, shopId) => { | ||
886 | }); | 894 | }); |
887 | } | 895 | } |
888 | 896 | ||
897 | + // 临时删除seo信息 | ||
898 | + _.unset(resData, 'title'); | ||
899 | + _.unset(resData, 'keywords'); | ||
900 | + _.unset(resData, 'description'); | ||
901 | + | ||
889 | return resData; | 902 | return resData; |
890 | }); | 903 | }); |
891 | }; | 904 | }; |
@@ -63,14 +63,14 @@ exports.getSalebreakingYardsSortList = (params) => { | @@ -63,14 +63,14 @@ exports.getSalebreakingYardsSortList = (params) => { | ||
63 | * @return {[type]} [description] | 63 | * @return {[type]} [description] |
64 | */ | 64 | */ |
65 | exports.getSaleActivityList = (params, channel) => { | 65 | exports.getSaleActivityList = (params, channel) => { |
66 | - let tempChannel = _.isEmpty(channel) ? 'boys' : channel; | 66 | + let tempChannel = yhChannel[channel] || yhChannel.boys; |
67 | 67 | ||
68 | return api.get('', { | 68 | return api.get('', { |
69 | id: params.id || null, | 69 | id: params.id || null, |
70 | method: 'app.activity.get', | 70 | method: 'app.activity.get', |
71 | sort: '2', | 71 | sort: '2', |
72 | plateform: '1', | 72 | plateform: '1', |
73 | - yh_channel: yhChannel[tempChannel].channel | 73 | + yh_channel: tempChannel.channel |
74 | }); | 74 | }); |
75 | }; | 75 | }; |
76 | 76 |
@@ -529,7 +529,7 @@ exports.getSaleSpecialData = (id, params, channel) => { | @@ -529,7 +529,7 @@ exports.getSaleSpecialData = (id, params, channel) => { | ||
529 | limit: limit, | 529 | limit: limit, |
530 | attribute_not: 2 | 530 | attribute_not: 2 |
531 | }); | 531 | }); |
532 | - let banner = JSON.parse(data.banner_img) || []; | 532 | + let banner = data.banner_img ? JSON.parse(data.banner_img) : []; |
533 | 533 | ||
534 | Object.assign(resData, { | 534 | Object.assign(resData, { |
535 | mainBanner: { | 535 | mainBanner: { |
@@ -581,7 +581,8 @@ exports.getSaleSpecialData = (id, params, channel) => { | @@ -581,7 +581,8 @@ exports.getSaleSpecialData = (id, params, channel) => { | ||
581 | Object.assign(resData, { | 581 | Object.assign(resData, { |
582 | filters: searchHandler.handleFilterDataAll(_.get(result[2], 'data', {}), params), | 582 | filters: searchHandler.handleFilterDataAll(_.get(result[2], 'data', {}), params), |
583 | opts: searchHandler.handleOptsData(params, tip.total), | 583 | opts: searchHandler.handleOptsData(params, tip.total), |
584 | - goods: productProcess.processProductList(_.get(result[2], 'data.product_list', [])), | 584 | + goods: productProcess.processProductList(_.get(result[2], 'data.product_list', []), |
585 | + {from: {type: 'saleSpecial', params: params}}), | ||
585 | footPager: {tip: tip} | 586 | footPager: {tip: tip} |
586 | }); | 587 | }); |
587 | 588 |
@@ -311,7 +311,7 @@ exports.handleOptsData = (params, total, extra) => { | @@ -311,7 +311,7 @@ exports.handleOptsData = (params, total, extra) => { | ||
311 | 311 | ||
312 | switch (i) { | 312 | switch (i) { |
313 | case 0: | 313 | case 0: |
314 | - opt.href = handleFilterUrl(params, {order: ''}, {page: true}); | 314 | + opt.href = handleFilterUrl(params, {}, {page: true, order: true}); |
315 | if (extra === 'discont') { // 如果是折扣专场 | 315 | if (extra === 'discont') { // 如果是折扣专场 |
316 | opt.name = '全部'; | 316 | opt.name = '全部'; |
317 | if (_.isEmpty(params.order) || params.order === 's_t_desc') { | 317 | if (_.isEmpty(params.order) || params.order === 's_t_desc') { |
@@ -582,6 +582,9 @@ exports.handleFilterData = (origin, params, total) => { | @@ -582,6 +582,9 @@ exports.handleFilterData = (origin, params, total) => { | ||
582 | if (params.price === key) { | 582 | if (params.price === key) { |
583 | priceRangechecked = true; | 583 | priceRangechecked = true; |
584 | } | 584 | } |
585 | + if (_.isString(value)) { | ||
586 | + value = _.replace(value, '¥', '¥'); | ||
587 | + } | ||
585 | let price = { | 588 | let price = { |
586 | checked: params.price === key, | 589 | checked: params.price === key, |
587 | href: handleFilterUrl(params, {price: key}), | 590 | href: handleFilterUrl(params, {price: key}), |
@@ -68,7 +68,7 @@ exports.getSearchData = (params, channel) => { | @@ -68,7 +68,7 @@ exports.getSearchData = (params, channel) => { | ||
68 | totalCount: result[2].data.total, | 68 | totalCount: result[2].data.total, |
69 | footPager: searchHandler.handlePagerData(result[2].data.total, params), | 69 | footPager: searchHandler.handlePagerData(result[2].data.total, params), |
70 | goods: productProcess.processProductList(result[2].data.product_list, | 70 | goods: productProcess.processProductList(result[2].data.product_list, |
71 | - Object.assign({showDiscount: false}, params)), | 71 | + Object.assign({showDiscount: false, from: {type: 'search', params: params}}, params)), |
72 | latestWalk: 6, | 72 | latestWalk: 6, |
73 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), | 73 | hasNextPage: searchHandler.handleNextPage(params, result[2].data.total), |
74 | shopEntry: result[3] | 74 | shopEntry: result[3] |
@@ -78,7 +78,7 @@ | @@ -78,7 +78,7 @@ | ||
78 | </p> | 78 | </p> |
79 | <div class="hideList hide"> | 79 | <div class="hideList hide"> |
80 | {{#goods_list}} | 80 | {{#goods_list}} |
81 | - <li data-src="{{image images_url 280 374}}" data-url="{{../url}}" data-status="{{status}}"></li> | 81 | + <li data-src="{{image images_url 280 382}}" data-url="{{../url}}" data-status="{{status}}"></li> |
82 | {{/goods_list}} | 82 | {{/goods_list}} |
83 | </div> | 83 | </div> |
84 | </div> | 84 | </div> |
@@ -64,7 +64,7 @@ exports.setPager = (total, params)=>{ | @@ -64,7 +64,7 @@ exports.setPager = (total, params)=>{ | ||
64 | for (i = 1; i <= len; i++) { | 64 | for (i = 1; i <= len; i++) { |
65 | let p = currentPage + i + 2; | 65 | let p = currentPage + i + 2; |
66 | 66 | ||
67 | - if (i > total) { | 67 | + if (p > total) { |
68 | break; | 68 | break; |
69 | } | 69 | } |
70 | 70 | ||
@@ -78,7 +78,7 @@ exports.setPager = (total, params)=>{ | @@ -78,7 +78,7 @@ exports.setPager = (total, params)=>{ | ||
78 | for (i = 1; i <= len; i++) { | 78 | for (i = 1; i <= len; i++) { |
79 | let p = currentPage - i - 2; | 79 | let p = currentPage - i - 2; |
80 | 80 | ||
81 | - if (i < 1) { | 81 | + if (p < 1) { |
82 | break; | 82 | break; |
83 | } | 83 | } |
84 | 84 |
@@ -7,6 +7,15 @@ const helpers = global.yoho.helpers; | @@ -7,6 +7,15 @@ const helpers = global.yoho.helpers; | ||
7 | 7 | ||
8 | // const images = require(`${global.utils}/images`); | 8 | // const images = require(`${global.utils}/images`); |
9 | 9 | ||
10 | +const itemFromBase = { | ||
11 | + search: {domain: 'search', module: 's'}, // 搜索页search.yohobuy.com | ||
12 | + list: {domain: 'list', module: 'c'}, // list.yohobuy.com | ||
13 | + listSale: {domain: 'list', module: 's'}, // list.yohobuy.com/sale | ||
14 | + listNew: {domain: 'list', module: 'n'}, // list.yohobuy.com/new | ||
15 | + brand: {domain: 'brand', module: 'b'}, // xxx.yohobuy.com[品牌域名] | ||
16 | + saleSpecial: {domain: 'sale', module: 's'}// sale.yohobuy.com | ||
17 | +}; | ||
18 | + | ||
10 | // NOTE: 这里修改了图片质量的参数 | 19 | // NOTE: 这里修改了图片质量的参数 |
11 | helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90')); | 20 | helpers.image = _.flow(helpers.image, fp.replace(/\/quality\/\d*$/, '/quality/90')); |
12 | 21 | ||
@@ -105,6 +114,8 @@ const procProductImgs = (item, gender) => { | @@ -105,6 +114,8 @@ const procProductImgs = (item, gender) => { | ||
105 | */ | 114 | */ |
106 | exports.processProductList = (list, options) => { | 115 | exports.processProductList = (list, options) => { |
107 | const pruductList = []; | 116 | const pruductList = []; |
117 | + let itemNum = 0, | ||
118 | + itemFrom; | ||
108 | 119 | ||
109 | options = Object.assign({ | 120 | options = Object.assign({ |
110 | showTags: true, | 121 | showTags: true, |
@@ -118,11 +129,30 @@ exports.processProductList = (list, options) => { | @@ -118,11 +129,30 @@ exports.processProductList = (list, options) => { | ||
118 | height: 388, | 129 | height: 388, |
119 | isApp: false, | 130 | isApp: false, |
120 | showPoint: true, | 131 | showPoint: true, |
121 | - gender: '2,3' | 132 | + gender: '2,3', |
133 | + from: {} // 来源 | ||
122 | }, options); | 134 | }, options); |
123 | 135 | ||
124 | - _.forEach(list, (product) => { | 136 | + // 处理item from |
137 | + if (!_.isEmpty(options.from) && itemFromBase[options.from.type]) { | ||
138 | + let f = {domain: '', module: '', key: ''}; | ||
139 | + let params = options.from.params || {}; | ||
140 | + | ||
141 | + f.page = params.page || 1; | ||
142 | + | ||
143 | + Object.assign(f, itemFromBase[options.from.type], { | ||
144 | + page: params.page || 1, | ||
145 | + key: params.misort || params.msort || '' | ||
146 | + }); | ||
125 | 147 | ||
148 | + if (options.from.type === 'search') { | ||
149 | + f.key = params.query || ''; | ||
150 | + } | ||
151 | + | ||
152 | + itemFrom = `from=${f.domain}-${f.module}-${f.key}_${f.page}_`; | ||
153 | + } | ||
154 | + | ||
155 | + _.forEach(list, (product) => { | ||
126 | 156 | ||
127 | // 商品信息有问题,则不显示 | 157 | // 商品信息有问题,则不显示 |
128 | if (!product || !product.product_skn || !product.goods_list.length) { | 158 | if (!product || !product.product_skn || !product.goods_list.length) { |
@@ -166,7 +196,7 @@ exports.processProductList = (list, options) => { | @@ -166,7 +196,7 @@ exports.processProductList = (list, options) => { | ||
166 | }); | 196 | }); |
167 | 197 | ||
168 | product.is_few = product.is_soon_sold_out === 'Y'; | 198 | product.is_few = product.is_soon_sold_out === 'Y'; |
169 | - product.url = helpers.urlFormat(`/product/pro_${product.product_id}_${product.goods_list[0].goods_id}/${product.cn_alphabet}.html`); // eslint-disable-line | 199 | + product.url = helpers.urlFormat(`/product/pro_${product.product_id}_${product.goods_list[0].goods_id}/${product.cn_alphabet}.html`, '', 'item'); // eslint-disable-line |
170 | 200 | ||
171 | // tar add 1606071146 品牌链接处理 | 201 | // tar add 1606071146 品牌链接处理 |
172 | product.brandUrl = helpers.urlFormat('', '', product.brand_domain); | 202 | product.brandUrl = helpers.urlFormat('', '', product.brand_domain); |
@@ -175,6 +205,10 @@ exports.processProductList = (list, options) => { | @@ -175,6 +205,10 @@ exports.processProductList = (list, options) => { | ||
175 | // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 | 205 | // 备注:如果以后APP的接口太多,可以把这边参数提取出来,变成一个公共的方法来生成,便于以后管理维护 |
176 | if (options.isApp) { | 206 | if (options.isApp) { |
177 | product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'${product.product_id}'}}`; // eslint-disable-line | 207 | product.url += `?openby:yohobuy={"action":"go.productDetail","params":{"product_skn":'${product.product_id}'}}`; // eslint-disable-line |
208 | + } else if (itemFrom) { | ||
209 | + // 累加商品数量 | ||
210 | + itemNum++; | ||
211 | + product.url += `?${itemFrom}${itemNum}`; | ||
178 | } | 212 | } |
179 | 213 | ||
180 | if (options.showTags) { | 214 | if (options.showTags) { |
-
Please register or login to post a comment