Authored by 郭成尧

断码区尺码筛选数据

... ... @@ -2,7 +2,7 @@
* @Author: Targaryen
* @Date: 2016-05-25 18:16:59
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-26 11:11:07
* @Last Modified time: 2016-05-26 13:33:33
*/
'use strict';
... ... @@ -195,21 +195,20 @@ exports.handleSaleSortData = (origin, params) => {
* 处理断码区分类筛选数据 待处理
* @return {[type]} [description]
*/
exports.handleSalebreakingYardsSortData = (origin) => {
var leftContent = {};
exports.handleSalebreakingYardsSortData = (origin, params) => {
var dest = [];
leftContent.allDiscount = {};
leftContent.allDiscount.list = [];
_.forEach(origin[0], function(value) {
let size = {};
_.forEach(origin, function(value) {
let category = {};
size.checked = false;
size.href = handleFilterUrl(params, { size: value.size_id });
size.name = value.size_name;
category.name = value.sort_name;
leftContent.allDiscount.list.push(category);
dest.push(size);
});
return leftContent;
return dest;
};
/**
... ...
... ... @@ -2,14 +2,13 @@
* @Author: Targaryen
* @Date: 2016-05-19 10:20:08
* @Last Modified by: Targaryen
* @Last Modified time: 2016-05-26 11:11:37
* @Last Modified time: 2016-05-26 13:32:58
*/
'use strict';
const library = '../../../library';
const API = require(`${library}/api`).API;
const api = new API();
const _ = require('lodash');
const saleApi = require('./sale-api');
const saleHandler = require('./sale-handler');
... ... @@ -61,21 +60,13 @@ exports.getSaleOthersData = (params) => {
let finalResult = {};
if (result[0].code === 200) {
if (!_.isEmpty(result[0].data.product_list)) { // 处理商品列表数据
finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
}
if (!_.isEmpty(result[0].data.filter)) {
finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
}
if (!_.isEmpty(result[0].data.filter.group_sort)) {
finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
}
}
finalResult.opts = saleHandler.handleSaleOptsData();
return finalResult;
});
};
... ... @@ -104,23 +95,19 @@ exports.getSaleDiscountData = (params) => {
* @return {[type]} [description]
*/
exports.getSalebreakingYardsData = (params) => {
return api.all([saleApi.getSalebreakingYardsSortList(), saleApi.getSaleGoodsList(params)]).then(result => {
return api.all([saleApi.getSaleGoodsList(params), saleApi.getSalebreakingYardsSortList()]).then(result => {
let finalResult = {};
if (result[0].code === 200) {
finalResult.size = saleHandler.handleSalebreakingYardsSortData(result[0].data); // 待处理
finalResult.goods = saleHandler.handleSaleGoodsListData(result[0].data.product_list);
finalResult.filters = saleHandler.handleSaleFilterData(result[0].data.filter, params);
finalResult.leftContent = saleHandler.handleSaleSortData(result[0].data.filter.group_sort, params);
}
if (result[1].code === 200) {
if (!_.isEmpty(result[1].data.product_list)) { // 处理商品列表数据
finalResult.goods = saleHandler.handleSaleGoodsListData(result[1].data.product_list);
if (result[1].code === 200) {
finalResult.filters.size = saleHandler.handleSalebreakingYardsSortData(result[1].data, params);
}
if (!_.isEmpty(result[1].data.filter)) {
finalResult.filters = saleHandler.handleSaleFilterData(result[1].data.filter);
finalResult.leftContent = saleHandler.handleSaleSortData(result[1].data.filter.group_sort, params);
}
}
finalResult.opts = saleHandler.handleSaleOptsData(params);
return finalResult;
});
... ...
{{!-- <pre>{{resultShow}}</pre> --}}
<pre>{{resultShow}}</pre>
<div class="new-sale-page product-page yoho-page">
{{# saleList}}
... ...