Authored by 姜敏

逛-品牌搜索修改

... ... @@ -36,18 +36,24 @@ var Bll = {
getBrands: function () {
var Brand = {};
$.get("/ajax/yohosearch", function (res) {
res.data.forEach(function (item, index) {
var brandAlif = (item.brand_alif || "").toUpperCase();
if (/^[0-9]$/.test(item.brand_alif)) {
brandAlif = "0-9";
}
if (/^\W$/.test(item.brand_alif)) {
brandAlif = "#";
}
Brand[brandAlif] = Brand[brandAlif] || [];
Brand[brandAlif].push(item);
Bll.Brands1[item.id] = item;
});
if(!res.data||!res.data.brands){
return;
}
for(var key in res.data.brands){
var name=key;
if (/^[0-9]$/.test(name)) {
name = "0-9";
}
if (name==="") {
name = "#";
}
for(var key2 in res.data.brands[key]){
var item=res.data.brands[key][key2];
Brand[name] = Brand[name] || [];
Brand[name].push(item);
Bll.Brands1[item.id] = item;
}
}
for (var i in Brand) {
Brand[i].sort(function (a, b) {
var aName = a.brand_name.toLowerCase(),
... ...