蛋疼,销售中有重复商品上报

var arry = [
{
itemType: "1",
item_id: "86753",
organizationId: "3117",
price: "1000",
qty: "1",
},
{
itemType: "1",
item_id: "86753",
organizationId: "3118",
price: "1000",
qty: "1",
},
{
itemType: "1",
item_id: "86753",
organizationId: "3117",
price: "1000",
qty: "1",
}
]

function isRepeat(arr){

var hash = {};

for(var i in arr) {
if(
hash[arr[i].price] &&
hash[arr[i].itemType] &&
hash[arr[i].item_id] &&
hash[arr[i].qty] &&
hash[arr[i].organizationId]
) {
console.log('---', hash[arr[i].price]);
return true;

// hash[arr[i].itemType] = true;
} else {
hash[arr[i].price] = true;
hash[arr[i].itemType] = true;
hash[arr[i].item_id] = true;
hash[arr[i].qty] = true;
hash[arr[i].organizationId] = true;
}
}

return false;

};
console.log(isRepeat(arry));

相关文章:

  • 2021-09-17
  • 2021-08-11
  • 2022-12-23
  • 2022-12-23
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-05
相关资源
相似解决方案