Authored by weiqingting

自动获取品牌

@@ -412,7 +412,11 @@ var goodsgird = new common.grid({ @@ -412,7 +412,11 @@ var goodsgird = new common.grid({
412 if (common.util.__input('endPrice')) { 412 if (common.util.__input('endPrice')) {
413 endPrice = common.util.__input('endPrice') 413 endPrice = common.util.__input('endPrice')
414 } 414 }
415 - return { 415 + return {//status=1&sales=Y&stocknumber=1&attribute_not=2
  416 + status:1,
  417 + sales:"Y",
  418 + stocknumber:"1",
  419 + attribute_not:"2",
416 query: common.util.__input('skns'), 420 query: common.util.__input('skns'),
417 price: beginPrice + "," + endPrice 421 price: beginPrice + "," + endPrice
418 }; 422 };
@@ -656,6 +660,19 @@ $(document).on("change", "#maxSortId", function () { @@ -656,6 +660,19 @@ $(document).on("change", "#maxSortId", function () {
656 }); 660 });
657 }); 661 });
658 662
  663 +
  664 +var Unique = function(Array) {
  665 + var res = [], hash = {};
  666 + for(var i=0, elem; (elem = Array[i]) != null; i++) {
  667 + if (!hash[elem.id])
  668 + {
  669 + res.push(elem);
  670 + hash[elem.id] = true;
  671 + }
  672 + }
  673 + return res;
  674 +}
  675 +
659 $(document).on("click", "#brandAutoBtn", function () { 676 $(document).on("click", "#brandAutoBtn", function () {
660 var product_skc = []; 677 var product_skc = [];
661 Bll.contentDatas.forEach(function (item, index) { 678 Bll.contentDatas.forEach(function (item, index) {
@@ -700,7 +717,9 @@ $(document).on("click", "#brandAutoBtn", function () { @@ -700,7 +717,9 @@ $(document).on("click", "#brandAutoBtn", function () {
700 b.push(map[item]); 717 b.push(map[item]);
701 } 718 }
702 }); 719 });
703 - Bll.Brdata = (ViewModel.brandList || []).concat(b); 720 + Bll.Brdata = (Bll.Brdata||ViewModel.brandList || []).concat(b);
  721 + Bll.Brdata=Unique(Bll.Brdata);
  722 + // Bll.Brdata=Bll.Brdata.unique5()
704 // var map2={}; 723 // var map2={};
705 // Bll.Brdata.forEach(function(item){ 724 // Bll.Brdata.forEach(function(item){
706 // map2[item.id]=item; 725 // map2[item.id]=item;