Authored by 郭成尧

会员商品列表页会员数据添加

... ... @@ -100,7 +100,8 @@ exports.discount = (req, res) => {
*/
exports.vip = (req, res) => {
let params = Object.assign({
saleType: 2
saleType: 2,
order: 's_t_asc,s_s_asc'
}, req.query);
params.uid = req.user.uid || 0;
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-25 18:16:59
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-01 17:01:39
* @Last Modified time: 2016-06-01 18:08:49
*/
'use strict';
... ...
... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-19 10:20:08
* @Last Modified by: Targaryen
* @Last Modified time: 2016-06-01 17:29:11
* @Last Modified time: 2016-06-01 18:09:23
*/
'use strict';
... ... @@ -45,6 +45,7 @@ exports.getSaleGoodsData = (params) => {
}
}
// 处理 VIP 商品数据
if (result[1].code === 200 && parseInt(params.saleType, 10) === 2) {
_.forEach(finalResult.goods, (value, key) => {
... ... @@ -117,9 +118,8 @@ exports.getSaleOthersData = (params) => {
promiseObject = [
saleApi.getSaleGoodsList(params),
saleApi.getSaleBannerList(cCode),
saleApi.getLeftContentList()
// saleApi.getUserProfile(params.uid) // 不处理 VIP
saleApi.getLeftContentList(),
saleApi.getUserProfile(params.uid)
];
} else {
cCode = '7c2b77093421efa8ae9302c91460db73';
... ... @@ -145,6 +145,13 @@ exports.getSaleOthersData = (params) => {
finalResult.opts = saleHandler.handleSaleOptsData(params, result[0].data.total);
finalResult.totalCount = result[0].data.total;
finalResult.pager = saleHandler.handleSalePagerData(result[0].data.total, params);
if (!_.isEmpty(params) && params.saleType === 2) {
finalResult.saleTitle = {};
finalResult.saleTitle.name = '所有商品';
finalResult.saleTitle.count = finalResult.totalCount;
}
}
// 获取焦点图数据
... ... @@ -161,14 +168,31 @@ exports.getSaleOthersData = (params) => {
}
}
// 不处理 VIP
// if (!_.isEmpty(params) && params.saleType === 2) {
// 处理 VIP 商品数据
if (result[3].code === 200 && parseInt(params.saleType, 10) === 2) {
_.forEach(finalResult.goods, (value, key) => {
switch (result[3].curLevel) {
case '1':
finalResult.goods[key].vipPrice = value.vip1_price;
finalResult.goods[key].vip1 = true;
break;
case '2':
finalResult.goods[key].vipPrice = value.vip2_price;
finalResult.goods[key].vip2 = true;
break;
case '3':
finalResult.goods[key].vipPrice = value.vip3_price;
finalResult.goods[key].vip3 = true;
break;
default:
finalResult.goods[key].vipPrice = value.vip_price;
finalResult.goods[key].vip = true;
break;
}
// // 获取用户数据
// if (result[3].code === 200) {
// finalResult.vip = result[3].curLevel > 0 ? result[3].curLevel : false;
// }
// }
});
}
return finalResult;
});
... ...