处理营销系统C端白名单根据token查询商品组装商品集合,按照商品权重进行处理显示排序
This commit is contained in:
parent
b215b091ff
commit
9203acc5eb
|
@ -310,6 +310,17 @@
|
||||||
})
|
})
|
||||||
goodsArr.push(obj);
|
goodsArr.push(obj);
|
||||||
});
|
});
|
||||||
|
/*商品自定义排序:0-100,降序排列,100第一个展示,0最后一个展示*/
|
||||||
|
var objectArraySort =(keyName)=>{
|
||||||
|
return (objectN, objectM)=>{
|
||||||
|
var valueN = objectN[keyName]
|
||||||
|
var valueM = objectM[keyName]
|
||||||
|
if (valueN < valueM) return 1
|
||||||
|
else if (valueN > valueM) return -1
|
||||||
|
else return 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
goodsArr.sort(objectArraySort('weight'))
|
||||||
self.swiperDataList = goodsArr;
|
self.swiperDataList = goodsArr;
|
||||||
self.goodsShow = goodsArr.length > 1;
|
self.goodsShow = goodsArr.length > 1;
|
||||||
sessionStorage.setItem('goodsCount', goodsArr.length);
|
sessionStorage.setItem('goodsCount', goodsArr.length);
|
||||||
|
|
Loading…
Reference in New Issue