diff --git a/apps/home/models/favorite.js b/apps/home/models/favorite.js index 4448bbe..7cf2765 100644 --- a/apps/home/models/favorite.js +++ b/apps/home/models/favorite.js @@ -1,8 +1,8 @@ /** -* 个人中心我的收藏 -* @author: zxr<xiaoru.zhang@yoho.cn> -* @date: 2016/08/16 -*/ + * 个人中心我的收藏 + * @author: zxr<xiaoru.zhang@yoho.cn> + * @date: 2016/08/16 + */ 'use strict'; @@ -41,8 +41,10 @@ const favProduct = (uid, page, limit) => { } if (page <= list.data.pageTotal) { - - _.forEach(list.data.productList, function(val) { + list.data.productList = _.filter(list.data.productList, function (n) { + return n.productSkn > 0; + }); + _.forEach(list.data.productList, function (val) { let obj = {}; // if (empty(val.productSkn)) { @@ -143,7 +145,7 @@ const favfavBrand = (uid, page, limit) => { if (page <= list.data.pageTotal) { - _.forEach(list.data.brandList, function(val) { + _.forEach(list.data.brandList, function (val) { let obj = { productList: [] }; @@ -173,10 +175,10 @@ const favfavBrand = (uid, page, limit) => { update: val.newProductNum }); - _.forEach(val.newProduct, function(data, key) { + _.forEach(val.newProduct, function (data, key) { obj.productList.push({ link: '/product/pro_' + data.productId + '_' + - data.goods[0].id + '/' + data.cnAlphabet + '.html', + data.goods[0].id + '/' + data.cnAlphabet + '.html', imgUrl: data.defaultImages, price: '¥' + Number(data.marketPrice).toFixed(2), discount: data.marketPrice > data.salesPrice ? '¥' + Number(data.salesPrice).toFixed(2) : false, @@ -212,14 +214,14 @@ const favoriteDelete = (uid, type, favId) => { }; const index = (uid, page, limit, isbrand) => { if (isbrand) { - return favfavBrand(uid, page, limit).then(result=>{ + return favfavBrand(uid, page, limit).then(result=> { if (result.total === 0) { - result = {nobrandData: 1 }; + result = {nobrandData: 1}; } return result; }); } else { - return favProduct(uid, page, limit).then(result=>{ + return favProduct(uid, page, limit).then(result=> { if (result.total === 0) { result = {noproductData: 1}; }