Authored by chenchao

品牌支持搜索

@@ -105,6 +105,7 @@ var conditionEdit={ @@ -105,6 +105,7 @@ var conditionEdit={
105 promotionFlagList:null, 105 promotionFlagList:null,
106 106
107 sortTree:{}, 107 sortTree:{},
  108 + brands:{},
108 toJsonArray:function(_params){ 109 toJsonArray:function(_params){
109 var result={}; 110 var result={};
110 var one_form_data= _params.one_form_data; 111 var one_form_data= _params.one_form_data;
@@ -516,14 +517,30 @@ var conditionEdit={ @@ -516,14 +517,30 @@ var conditionEdit={
516 caption :'品牌' 517 caption :'品牌'
517 },*/ 518 },*/
518 519
519 - 520 + if("condition_product_brand"===_type_l3){
  521 + _g.setFormElementVal({pObj: _parent, type: "select", name: "operator", data: _data_level_3});
  522 + _g.setFormElementVal({pObj: _parent, type: "select", name: "value", data: _data_level_3});
  523 + var brand_id=_data_level_3["value"];
  524 + if(brand_id){
  525 + var suffixIndex = _key_level_2 + _g.base_conf.splitor + _level_3_index;
  526 + var brand = {};
  527 + $.each(_g.brandList,function(_index,_brand){
  528 + if(_brand.id == brand_id){
  529 + brand=_brand;
  530 + return false;
  531 + }
  532 + });
  533 + _g.brands[suffixIndex].setValue(brand);
  534 + }
  535 +
  536 + }
520 /* 537 /*
521 { 538 {
522 name:'condition_promotion_flag', 539 name:'condition_promotion_flag',
523 caption :'促销标记' 540 caption :'促销标记'
524 541
525 },*/ 542 },*/
526 - if("condition_product_brand"===_type_l3 || "condition_promotion_flag" === _type_l3){ 543 + if("condition_promotion_flag" === _type_l3){
527 _g.setFormElementVal({pObj: _parent, type: "select", name: "operator", data: _data_level_3}); 544 _g.setFormElementVal({pObj: _parent, type: "select", name: "operator", data: _data_level_3});
528 _g.setFormElementVal({pObj: _parent, type: "select", name: "value", data: _data_level_3}); 545 _g.setFormElementVal({pObj: _parent, type: "select", name: "value", data: _data_level_3});
529 } 546 }
@@ -669,7 +686,17 @@ var conditionEdit={ @@ -669,7 +686,17 @@ var conditionEdit={
669 type:"condition_product", 686 type:"condition_product",
670 html_id:"fm_condition_product_brand" 687 html_id:"fm_condition_product_brand"
671 }); 688 });
672 - 689 +
  690 + var suffixIndex=pNodeIndex+"_"+curNodeIndex;
  691 + var brand = new common.dropDown({
  692 + el: '#brands_' + suffixIndex,
  693 + ajax: 'queryBrand',
  694 + hash: true,
  695 + params:function(){
  696 + return {userLimitFlag:false};
  697 + }
  698 + });
  699 + _g.brands[suffixIndex]=brand;
673 break; 700 break;
674 701
675 case condition_type_list[0].child[_g.base_conf.productIndex].child[_g.base_conf.promotion_flag_index].name||'condition_promotion_flag': 702 case condition_type_list[0].child[_g.base_conf.productIndex].child[_g.base_conf.promotion_flag_index].name||'condition_promotion_flag':
@@ -735,9 +762,10 @@ var conditionEdit={ @@ -735,9 +762,10 @@ var conditionEdit={
735 nodeIndex:_params.pNodeIndex, 762 nodeIndex:_params.pNodeIndex,
736 curnodeIndex:_params.curNodeIndex 763 curnodeIndex:_params.curNodeIndex
737 }; 764 };
  765 + /*
738 if(_g.brandList && _g.brandList.length>0){ 766 if(_g.brandList && _g.brandList.length>0){
739 _data.brandList=_g.brandList; 767 _data.brandList=_g.brandList;
740 - } 768 + }*/
741 if(_g.promotionFlagList && _g.promotionFlagList.length>0){ 769 if(_g.promotionFlagList && _g.promotionFlagList.length>0){
742 _data.promotionFlagList=_g.promotionFlagList; 770 _data.promotionFlagList=_g.promotionFlagList;
743 } 771 }
@@ -757,10 +785,25 @@ var conditionEdit={ @@ -757,10 +785,25 @@ var conditionEdit={
757 * @param liDomId 785 * @param liDomId
758 */ 786 */
759 delCondition : function(pnodeIndex,nodeIndex) { 787 delCondition : function(pnodeIndex,nodeIndex) {
  788 + var _g=this;
760 if(pnodeIndex===0){ 789 if(pnodeIndex===0){
761 $('div[pnodeIndex="' + nodeIndex+'"]').remove(); 790 $('div[pnodeIndex="' + nodeIndex+'"]').remove();
762 } 791 }
763 - $('div[pnodeIndex="' + pnodeIndex+'"][nodeIndex="'+ nodeIndex +'"]').remove(); 792 + $('div[pnodeIndex="' + pnodeIndex+'"][nodeIndex="'+ nodeIndex +'"]').remove();
  793 + var suffixIndex=pnodeIndex+"_"+nodeIndex;
  794 + for(var _name in _g.sortTree){
  795 + if(_name == suffixIndex){
  796 + delete _g.sortTree[_name];
  797 + break;
  798 + }
  799 + }
  800 +
  801 + for(var _name in _g.brands){
  802 + if(_name == suffixIndex){
  803 + delete _g.brands[_name];
  804 + break;
  805 + }
  806 + }
764 }, 807 },
765 findSortById:function(_sortId,_productSortList){ 808 findSortById:function(_sortId,_productSortList){
766 var _g=this; 809 var _g=this;