Authored by 王水玲

sale

... ... @@ -13,6 +13,15 @@ const headerModel = require('../../../doraemon/models/header');
const log = require(`${library}/logger`);
const saleModel = require(`${mRoot}/sale`);
const queryParam = {
brand: '0',
gender: '1,2,3',
sort: '0',
size: '0',
price: '0',
discount: '0.1,0.9'
};
const saleLogger = (err, res) => {
log.error('sale页面渲染错误:' + JSON.stringify(err));
res.send('error');
... ... @@ -32,7 +41,7 @@ exports.index = (req, res) => {
};
saleModel.getSaleData().then((result) => {
res.render('sale', Object.assign(renderData, {
res.render('sale', Object.assign(renderData, queryParam, {
content: result,
floorHeader: {
title: {
... ... @@ -58,7 +67,7 @@ exports.breakCode = (req, res) => {
};
saleModel.getBreakCodeData().then((result) => {
res.render('break-code', Object.assign(renderData, result));
res.render('break-code', Object.assign(renderData, queryParam, result));
}).catch((err) => {
saleLogger(err, res);
});
... ... @@ -99,7 +108,7 @@ exports.specialDetail = (req, res) => {
saleModel.getSpecialDetailData(id).then((result) => {
headerData.navTitle = result.title;
renderData.pageHeader = headerData;
res.render('special-detail', Object.assign(renderData, result));
res.render('special-detail', Object.assign(renderData, queryParam, result));
}).catch((err) => {
saleLogger(err, res);
});
... ... @@ -118,7 +127,7 @@ exports.vip = (req, res) => {
};
saleModel.getVipData().then((result) => {
res.render('vip', Object.assign(renderData, {
res.render('vip', Object.assign(renderData, queryParam, {
content: result
}));
}).catch((err) => {
... ...
... ... @@ -257,49 +257,60 @@ const processFilter = (list, options) => {
name: '所有品牌',
title: '品牌',
dataId: 'id',
subsName: 'brandName'
subsName: 'brandName',
firstSub: 0,
dataType: 'brand'
},
color: {
name: '所有颜色',
title: '颜色',
dataId: 'colorId',
subsName: 'colorName'
subsName: 'colorName',
firstSub: 0,
dataType: 'color'
},
discount: {
name: '所有商品',
title: '折扣',
dataId: 'key',
subsName: 'name'
subsName: 'name',
firstSub: '0.1,0.9',
dataType: 'discount'
},
gender: {
name: '所有性别',
title: '性别',
dataId: 'key',
subsName: 'flag'
subsName: 'flag',
firstSub: '1,2,3',
dataType: 'gender'
},
groupSort: {
name: '所有品类',
title: '品类',
dataId: 'relationParameter',
subsName: 'categoryName'
subsName: 'categoryName',
firstSub: 0,
dataType: 'sort'
},
priceRange: {
name: '所有价格',
title: '价格',
dataId: 'key',
subsName: 'flag'
subsName: 'flag',
firstSub: 0,
dataType: 'price'
},
size: {
name: '所有尺码',
title: '尺码',
dataId: 'sizeId',
subsName: 'sizeName'
subsName: 'sizeName',
firstSub: 0,
dataType: 'size'
}
};
let subs = {};
let classify = {};
options = Object.assign({
gender: '1,2,3', // 默认选择的性别,默认1,2,3表示所有
exclude: null // 需要排除的字段
... ... @@ -307,28 +318,45 @@ const processFilter = (list, options) => {
list = camelCase(list);
_.forEach(list, (item, key) => {
let classify = {
subs: []
};
if (key === 'group_sort') {
return;
}
classify.dataType = key;
classify.dataType = filtersType[key].dataType;
classify.name = filtersType[key].name;
classify.title = filtersType[key].typeCont;
classify.title = filtersType[key].title;
classify.subs.push({
chosed: true,
dataId: filtersType[key].firstSub,
name: filtersType[key].name
});
_.forEach(item, (sub, index) => {
let subs = {};
if (filtersType[key].dataId === 'key') {
subs.dataId = index;
} else if (filtersType[key].dataId === 'relationParameter') {
subs.dataId = item.relationParameter.sort;
subs.dataId = sub.relationParameter['sort']; // eslint-disable-line
} else {
subs.dataId = item[filtersType[key].dataId];
subs.dataId = sub[filtersType[key].dataId];
}
if (filtersType[key].subsName === 'flag') {
subs.name = index;
subs.name = sub;
} else {
subs.name = sub[filtersType[key].subsName];
if (key === 'discount') {
subs.name = subs.name + '折商品';
}
}
classify.subs.push(subs)
classify.subs.push(subs);
});
filters.classify.push(classify);
... ...
... ... @@ -13,7 +13,7 @@ module.exports = {
port: 6001,
siteUrl: 'http://m.yohobuy.com',
domains: {
api: 'http://testapi.yoho.cn:28078/', // http://devapi.yoho.cn:58078/ http://testapi.yoho.cn:28078/
api: 'http://192.168.102.205:8080/gateway/', // http://devapi.yoho.cn:58078/ http://testapi.yoho.cn:28078/ http://192.168.102.205:8080/gateway/
service: 'http://testservice.yoho.cn:28077/',
search: 'http://192.168.10.64:8080/yohosearch/'
},
... ...
... ... @@ -13,7 +13,9 @@ let camelCase,
camelCaseObject = (obj) => {
_.forEach(Object.keys(obj), (k) => {
obj[k] = camelCase(obj[k]);
obj[_.camelCase(k)] = obj[k];
if (/[_-]/.test(k)) {
obj[_.camelCase(k)] = obj[k];
}
});
return obj;
};
... ...
.filter-mask, .filter-body {
.filter-mask,
.filter-body {
position: absolute;
left: 0;
right: 0;
... ... @@ -7,7 +8,7 @@
.filter-mask {
height: 100%;
background: rgba(0,0,0,0.1);
background: rgba(0, 0, 0, 0.1);
}
.filter-body {
... ... @@ -70,7 +71,7 @@
-webkit-overflow-scrolling: touch;
> li {
height: 160px;
height: 120px;
line-height: 120px;
padding-left: 30px;
border-bottom: 1px solid #e6e6e6;
... ...