From e6c7099b1f642c63822f8288471bfd9fbfeb5625 Mon Sep 17 00:00:00 2001 From: tanghaolin <1723298894@qq.com> Date: 星期二, 30 八月 2022 13:20:38 +0800 Subject: [PATCH] 添加品牌选择和品牌筛选 --- src/views/Select/PumpCategory.vue | 85 +++++++++++++++++++++++++++++------------- 1 files changed, 58 insertions(+), 27 deletions(-) diff --git a/src/views/Select/PumpCategory.vue b/src/views/Select/PumpCategory.vue index 07c8bad..8fe8f7a 100644 --- a/src/views/Select/PumpCategory.vue +++ b/src/views/Select/PumpCategory.vue @@ -74,16 +74,22 @@ </van-cell-group> --> <van-collapse v-model="currentExplanCategory"> <van-collapse-item - :title="group_item.label" - v-for="group_item in m_VisiblepumpCateGoryOption" - :key="group_item.label" - :name="group_item.label"> + v-for="(group_item,group_index) in m_VisiblepumpCateGoryOption" + :key="group_index" + :name="group_item.label" + > + <template #title> + <van-badge v-if="group_item.isHaveSelect" dot color="#528abe"> + <div style="color:#578ebe">{{group_item.label}}</div> + </van-badge> + <div v-else>{{group_item.label}}</div> + </template> <van-cell - v-for="(item, index) in group_item.child" + v-for="item in group_item.child" clickable title-style="color:#808080" :key="item.value" - @click="toggle(item, index)" + @click="toggle(item, group_index)" > <template #title> <span style="font-size: 14px;font-weight: 700;">{{item.label}}</span> @@ -180,6 +186,7 @@ m_prevPageData: {}, //涓婁釜椤甸潰浼犲叆鐨勬暟鎹� m_selectIndex: 1, //鍒楄〃鐨勯�夋嫨鐘舵�� 1琛ㄧず鎸夌被鍨� 2琛ㄧず鎸夎涓� 3琛ㄧず鎸変粙璐� currentCheckedCategory: "", //褰撳墠閫夋嫨鐨勭被鍨� + currentCheckedLabel:"", currentExplanCategory:[],//褰撳墠灞曞紑鐨勮彍鍗� m_SelectAllList: false, @@ -211,22 +218,6 @@ this.m_pageTitle = this.getSoftName(); document.title = this.m_pageTitle; - let prvePathDataObj = this.$store.state.instante.select.ByParas.filterData; - if (prvePathDataObj) { - this.m_prevPageData = prvePathDataObj; - if (prvePathDataObj.FilterInfo.CatalogID) { - //console.log(prvePathDataObj.FilterInfo.SeriesID,104) - this.currentCheckedCategory = prvePathDataObj.FilterInfo.CatalogID; - } - } - if (this.currentCheckedCategory == "") { - _this.showPopover = true; - setTimeout(function() { - _this.showPopover = false; - }, 3000); - } else { - _this.showPopover = false; - } this.$nextTick(function() { //绉婚櫎婊氬姩浜嬩欢 document.removeEventListener("scroll", this.setBackShow, true); @@ -314,10 +305,10 @@ label: group.label, parentID: group.parentID, isExpland: false, + isHaveSelect:false, child: [] }; catalogChilds.forEach(child => { - // console.log(group,child) if (child.parentID == group.value) { let node = { value: child.value, @@ -330,15 +321,47 @@ }); currentCatalogOptions.push(catalogOption); }); - // console.log(currentCatalogOptions, 362); + // console.log(currentCatalogOptions, 362); _this.m_pumpCateGoryOption = currentCatalogOptions; _this.m_VisiblepumpCateGoryOption = currentCatalogOptions; + + _this.getPrivePageData() } }) .catch(err => { console.log(err); }); }, + //鑾峰彇涓婁竴椤电殑鍘嗗彶鏁版嵁 + getPrivePageData(){ + let prvePathDataObj = this.$store.state.instante.select.ByParas.filterData; + if (prvePathDataObj) { + this.m_prevPageData = prvePathDataObj; + if (prvePathDataObj.FilterInfo.CatalogID) { + //console.log(prvePathDataObj.FilterInfo.SeriesID,104) + this.currentCheckedCategory = prvePathDataObj.FilterInfo.CatalogID; + } + } + if (this.currentCheckedCategory == "") { + this.showPopover = true; + setTimeout(function() { + _this.showPopover = false; + }, 3000); + } else { + this.showPopover = false; + } + for(let i=0,length= this.m_pumpCateGoryOption.length;i<length;i++){ + let groupItem = this.m_pumpCateGoryOption[i] + for(let j=0,childlength= groupItem.child.length;j<childlength;j++){ + let childItem = groupItem.child[j] + if(childItem.value == this.currentCheckedCategory){ + groupItem.isHaveSelect = true + this.currentCheckedLabel = childItem.label + break; + } + } + } + }, //鏋勫缓琛屼笟鍒楄〃 // buildHYList() { // if ( @@ -409,12 +432,17 @@ }, //鎸夌被鍨嬪閫� checkbox 閫夋嫨鐘舵�佸垏鎹� toggle(item, index) { - // console.log(item) + console.log(item.label) if(item.seriesNumber == 0){ return } + this.m_VisiblepumpCateGoryOption.forEach(item=>{ + item.isHaveSelect = false + }) + this.m_VisiblepumpCateGoryOption[index].isHaveSelect = true this.currentCheckedCategory = item.value; - }, + this.currentCheckedLabel = item.label + }, //鎸夎涓氶�夋嫨 clickHYItem(item) { this.m_currentSelectHY = item.ID; @@ -556,7 +584,10 @@ //select 琛ㄧずvuex鐨勬枃浠跺悕 filterData: groupPageData }); - this.gotoPage("/Select/SelSeries", "", null); + let query = { + catalogName:this.currentCheckedLabel + } + this.gotoPage("/Select/SelSeries", query, null); //console.log(groupPageData); //console.log(this.m_SelectSeriesID); }, -- Gitblit v1.9.3