浏览代码

feat: 商机推荐筛选项带入

zhangyuhan 1 年之前
父节点
当前提交
dff11f29ce

+ 1 - 1
apps/bigmember_pc/src/components/push-list/PotentialList.vue

@@ -400,7 +400,7 @@ export default {
     // 获取监控数量
     async getListStatus(list) {
       const nameList = []
-      if (!list) return
+      if (!list || list.length === 0) return
       list.forEach((v, i) => {
         if (i === 0) {
           nameList.push(v.Buyer)

+ 79 - 9
apps/bigmember_pc/src/views/PotentialList.vue

@@ -55,7 +55,7 @@
             class="ex-line-2"
             @onChange="changeBusiness"
             ref="businessScopeSelector"
-            :initList="getScopeKeyList"
+            :initList="getScopeKeyListFull"
             selectorType="line"
           >
             <div slot="header">业务范围:</div>
@@ -185,10 +185,22 @@ export default {
         showD3: false,
         alreadyNum: 0,
         remainNum: 0
+      },
+      cacheFilter: {
+        business_scope: []
       }
     }
   },
   methods: {
+    formatScopeKey(list) {
+      return list.map((v) => {
+        let str = v.key.join(' ')
+        if (v?.appendkey) {
+          str = str + ' ' + v?.appendkey.join(' ')
+        }
+        return str
+      })
+    },
     showMonitorDialog(data) {
       const { remainNum, alreadyNum } = data
       this.monitorInfo.remainNum = remainNum
@@ -363,7 +375,6 @@ export default {
     },
     changeBusiness(item) {
       item = item.map((v) => v.split(' ')[0])
-      console.log(item, 'xx')
       let tempArr = []
       this.scope.forEach((v) => {
         if (item.includes(v.key.join(' '))) {
@@ -397,9 +408,52 @@ export default {
           sessionStorage.getItem('potential_cor_list_search') || '{}'
         )
         console.log(cacheFilter)
+
+        if (cacheFilter?.area) {
+          this.filters.area = { [cacheFilter.area]: [] } || {}
+        }
+        if (cacheFilter?.industry) {
+          if (cacheFilter?.industry?.indexOf('_') > -1) {
+            try {
+              const splitResult = cacheFilter.industry.split('_')
+              const result = {
+                [splitResult[0]]: [splitResult[1]]
+              }
+              this.filters.industry = result
+            } catch (e) {
+              console.warn(e)
+            }
+          } else {
+            this.filters.industry = [cacheFilter?.industry] || []
+          }
+        }
+        if (cacheFilter?.buyerClass) {
+          this.filters.buyerclass = [cacheFilter?.buyerClass] || []
+        }
+        if (cacheFilter?.keywords) {
+          const tempKey = [
+            {
+              key: [cacheFilter?.keywords],
+              notkey: [],
+              appendkey: null,
+              matchway: 1,
+              updatetime: Date.now()
+            }
+          ]
+          this.filters.business_scope = [].concat(tempKey)
+          this.cacheFilter.business_scope = [].concat(tempKey)
+        }
       } catch (e) {
         console.warn(e)
       }
+    },
+    doResetSelectorForCahce() {
+      this.$refs.areaSelector.setCitySelected(this.filters.area)
+      this.$refs.industrySelector.setIndustryState(this.filters.industry)
+      this.$refs.buyerclassSelector.setCateState(this.filters.buyerclass)
+      this.$refs.businessScopeSelector.setState(
+        this.formatScopeKey(this.filters.business_scope)
+      )
     }
   },
   computed: {
@@ -412,21 +466,34 @@ export default {
       return this.topInfo[this.$route.params.type || 'c']
     },
     getScopeKeyList() {
-      return this.scope.map((v) => {
-        let str = v.key.join(' ')
-        if (v?.appendkey) {
-          str = str + ' ' + v?.appendkey.join(' ')
-        }
-        return str
-      })
+      return this.formatScopeKey(this.scope)
+    },
+    getCacheScopeKeyList() {
+      return this.formatScopeKey(this.cacheFilter.business_scope)
+    },
+    getScopeKeyListFull() {
+      if (this.isUseCache) {
+        return [].concat(this.getCacheScopeKeyList, this.getScopeKeyList)
+      } else {
+        return this.getScopeKeyList
+      }
+    },
+    isUseCache() {
+      return this.$route.query.mark === '1'
     }
   },
   mounted() {
     this.changeBusiness([])
     this.recoverCreate()
+    if (this.isUseCache) {
+      this.doResetSelectorForCahce()
+    }
   },
   activated() {
     this.changeBusiness([])
+    if (this.isUseCache) {
+      this.doResetSelectorForCahce()
+    }
   },
   async created() {
     if (!this.isDeleteAllScope) {
@@ -434,6 +501,9 @@ export default {
     }
     this.filters.business_scope = this.scope
     // 从缓存中获取详情页筛选项
+    if (this.isUseCache) {
+      this.doResetArticleCacheFilter()
+    }
   }
 }
 </script>

+ 3 - 2
apps/bigmember_pc/src/views/article-content/composables/useArticleUtil.js

@@ -44,9 +44,10 @@ export function doOpenWinnerListPage() {
 }
 
 // 打开更多客户监控列表
-export function doOpenCorListPage() {
+export function doOpenCorListPage(query = {}) {
   const link = router.resolve({
-    path: '/potential_cor_list/c'
+    path: '/potential_cor_list/c',
+    query
   })
   window.open(link.href, '_blank')
 }

+ 3 - 1
apps/bigmember_pc/src/views/article-content/pages/Article.vue

@@ -237,7 +237,9 @@ function doOpenMore(key) {
           ContentExpandsModel.value.recommendCustomers?.search || {}
         )
       )
-      doOpenCorListPage()
+      doOpenCorListPage({
+        mark: 1
+      })
       break
     }
   }