...
|
...
|
@@ -44,6 +44,45 @@ const helpers = { |
|
|
return letters;
|
|
|
},
|
|
|
|
|
|
getLettersFromBrand(brands, numberIndex) {
|
|
|
numberIndex = numberIndex || 0;
|
|
|
|
|
|
let letters = new Set();
|
|
|
let other = false;
|
|
|
|
|
|
_.forEach(brands, (b) => {
|
|
|
let name = b.brandNameEn || b.brandName;
|
|
|
let char = name.toLowerCase().charAt(0);
|
|
|
|
|
|
if ((char >= 'a' && char <= 'z') || (char >= 'A' && char <= 'Z')) {
|
|
|
letters.add(char);
|
|
|
} else {
|
|
|
other = true;
|
|
|
}
|
|
|
});
|
|
|
|
|
|
letters = Array.from(letters).sort().map(s => {
|
|
|
return {
|
|
|
letter: s.toUpperCase(),
|
|
|
selected: false
|
|
|
};
|
|
|
});
|
|
|
|
|
|
if (other && numberIndex === -1) {
|
|
|
letters.push({
|
|
|
letter: '0-9',
|
|
|
selected: false
|
|
|
});
|
|
|
} else if (other && numberIndex === 0) {
|
|
|
letters.unshift({
|
|
|
letter: '0-9',
|
|
|
selected: false
|
|
|
});
|
|
|
}
|
|
|
|
|
|
return letters;
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 男女条件
|
|
|
* @returns {*[]}
|
...
|
...
|
@@ -280,7 +319,7 @@ const helpers = { |
|
|
priceRange: priceRange,
|
|
|
filters: filters,
|
|
|
showFilters: filters.length > 0,
|
|
|
letters: this.brandLetters(),
|
|
|
letters: this.getLettersFromBrand(brands),
|
|
|
customPriceLow: customPriceLow,
|
|
|
customPriceHigh: customPriceHigh,
|
|
|
showSize: showSize,
|
...
|
...
|
@@ -294,20 +333,27 @@ const helpers = { |
|
|
* @param list
|
|
|
* @returns {*}
|
|
|
*/
|
|
|
handleProductList(list) {
|
|
|
handleProductList(list, q) {
|
|
|
if (_.isArray(list)) {
|
|
|
list.forEach(g => {
|
|
|
let goodsList = g.goodsList;
|
|
|
let defaultImages = g.defaultImages;
|
|
|
let goodsId;
|
|
|
|
|
|
console.log(g);
|
|
|
|
|
|
if (goodsList && goodsList.length > 0) {
|
|
|
goodsId = goodsList[0].goodsId;
|
|
|
|
|
|
goodsList.forEach(o => {
|
|
|
o.url = `${config.siteUrl}/product/pro_${g.productId}_${o.goodsId}/${o.cnAlphabet}.html`;
|
|
|
if (q.color && q.color === o.colorId) {
|
|
|
defaultImages = o.imagesUrl;
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
g.salesPrice = g.salesPrice || g.marketPrice;
|
|
|
g.defaultImages = defaultImages;
|
|
|
if (g.salesPrice === g.marketPrice) {
|
|
|
delete g.marketPrice;
|
|
|
}
|
...
|
...
|
|