处理营销系统C端白名单根据token查询商品组装商品集合,按照商品权重进行处理显示排序

This commit is contained in:
Apple 2022-06-16 14:22:32 +08:00
parent b215b091ff
commit 9203acc5eb
1 changed files with 11 additions and 0 deletions

View File

@ -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);