Browse Source

Merge branch 'dev/v1.0.53_tsz' of jianyu/web into feature/v1.0.53

汤世哲 1 year ago
parent
commit
d3c50e50c5

+ 1 - 0
apps/mobile/src/components/selector/area-three-sidebar/index.vue

@@ -520,6 +520,7 @@ export default {
       // 重新计算parent数据统计
       firstSidebar.refreshAllChildrenState()
       this.$emit('modelChange', state || {})
+      console.log(state, 'state')
     },
     setSidebarState(state) {
       for (const proName in state) {

+ 23 - 8
apps/mobile/src/views/collection/components/filters.vue

@@ -331,7 +331,7 @@ import InfoTypeOneClassify from '@/components/selector/info-type-one-classify/in
 import BuyerClassSidebar from '@/components/selector/buyer-class-sidebar/index'
 import MoneyInputGroup from '@/components/selector/money-input-group'
 import KeywordsInputGroup from '@/components/selector/keyword-input-group/index'
-import { deepCompare } from '@/utils'
+import { deepCompare, FilterHistoryViewModel2AjaxModel } from '@/utils'
 import {
   biddingSearchConcat,
   collectionSearchTime,
@@ -593,17 +593,27 @@ export default {
       }
     },
     valueTextWithArea() {
-      const { area } = this.cacheMoreFilters
-      if (Array.isArray(area) && area.length) {
-        return `已选:${area.length}个`
+      const { area, city, district } = FilterHistoryViewModel2AjaxModel.formatAreaCity(this.cacheMoreFilters.area) || {}
+      // 提取公共逻辑到函数
+      function countSelections(str) {
+        if (!str) return 0
+        return str.split(',').length
+      }
+      let areaCount = countSelections(area) + countSelections(city) + countSelections(district)
+      if (areaCount !== 0) {
+        return `已选:${areaCount}个`
       } else {
         return '已选:全部'
       }
     },
     valueTextWithIndustry() {
       const { industry } = this.cacheMoreFilters
-      if (Array.isArray(industry) && industry.length) {
-        return `已选:${industry.length}个`
+      let industryCount = 0
+      if (Object.keys(industry).length) {
+        Object.keys(industry).forEach((key) => {
+          industryCount += industry[key].length
+        })
+        return `已选:${industryCount}个`
       } else {
         return '已选:全部'
       }
@@ -741,13 +751,14 @@ export default {
             moreKeywordsMode,
             price,
             area,
+            industry,
             priceCheckbox,
             infoType,
             buyerClass,
             winnerConcat,
             buyerConcat,
           } = this.filters
-
+          console.log(this.filters, 'filtersfilters')
           // 更多关键词
           this.cacheMoreFilters.moreKeywordsMode = moreKeywordsMode
           try {
@@ -759,13 +770,17 @@ export default {
           if (priceCheckbox.includes('custom')) {
             priceSelector?.setState(price)
           }
-
           // 地区
           if (area) {
             // 恢复数据
+            this.cacheMoreFilters.area = area
             const arr = Object.keys(area)
             areaSelector?.setState(arr)
           }
+          // 行业
+          if (industry) {
+            this.cacheMoreFilters.industry = industry
+          }
 
           // 信息类型
           this.cacheMoreFilters.infoType = infoType