瀏覽代碼

feat: 客户关注优化

cuiyalong 3 年之前
父節點
當前提交
c374c1e3aa
共有 3 個文件被更改,包括 76 次插入56 次删除
  1. 24 18
      src/components/push-list/PushList.vue
  2. 44 37
      src/views/ent-intel/MyClient.vue
  3. 8 1
      src/views/workspace/components/EntFollow.vue

+ 24 - 18
src/components/push-list/PushList.vue

@@ -110,7 +110,7 @@
         <el-button size="mini" class="get-more" type="plain" icon="el-icon-arrow-right" @click="getMore">更多</el-button>
       </div>
     </div>
-    <div class="tags-box">
+    <div class="sub-collection tags-box">
       <div class="tags-inputs">
         <div class="tag-input">
           <div class="tag-labels"></div>
@@ -269,6 +269,11 @@ export default {
             }
           })
         }
+
+        if (query.vt === 'f') {
+          query.vt = ''
+        }
+
         const res = await getExportPushList(query)
         if (res.error_code === 0) {
           if (res.data._id) {
@@ -585,7 +590,7 @@ export default {
             }
             const { top, left } = _this.calcCardTopLeft(event, !!list)
             $('.tags-box').show(function () {
-              window.activeTags = []
+              window.pushListActiveTags = []
               $('.tag-labels').empty()
               $('.clear-input').val('')
               $('.tags-list').find('.tags-item').removeClass('tags-active')
@@ -707,7 +712,7 @@ export default {
       $('.tags-footer .button-cancel').on('click', function () {
         $('.tags-box').hide(function () {
           // 标签弹框消失时 清除上次选择的标签分类
-          activeTags = []
+          pushListActiveTags = []
           $('.tag-labels').empty()
           $('.clear-input').val('')
           $('.tags-list').find('.tags-item').removeClass('tags-active')
@@ -715,28 +720,29 @@ export default {
         })
       })
 
-      window.activeTags = [] // 选中的自定义标签 作为全局变量使用
+      window.pushListActiveTags = [] // 选中的自定义标签 作为全局变量使用
       // 解绑自定义标签
       function deleteInputTag (item) {
         var index = $(item).parent().attr('data-index')
         var id = $(item).parent().attr('data-id')
-        activeTags.splice(index, 1)
+        pushListActiveTags.splice(index, 1)
         inputTagList()
         $('.tags-item[data-id="' + id + '"]').removeClass('tags-active')
       }
 
-      window.deleteInputTag = deleteInputTag
-
       function inputTagList () {
         var ht = ''
         $('.tag-labels').html(ht)
-        activeTags.forEach(function (v, i) {
+        pushListActiveTags.forEach(function (v, i) {
           ht += '<span class="tag-label" data-index=' + i + ' data-id="' + v.lid + '">'
           ht += '<em>' + v.lname + '</em>'
-          ht += '<i class="tag-close" onclick="deleteInputTag(this)"></i>'
+          ht += '<i class="tag-close"></i>'
           ht += '</span>'
         })
-        $('.tag-labels').html(ht)
+        $('.tag-labels').html(ht).off('click').on('click', '.tag-close' ,function (e) {
+          const target = getEventTarget(e)
+          deleteInputTag(target)
+        })
         if ($('.tag-labels').children('.tag-label').length > 0) {
           $('.tag-placeholder').hide()
         }
@@ -751,7 +757,7 @@ export default {
             ht += '<span class="tags-item" data-count=' + v.count + ' data-id=' + v.lid + '>' + v.lanme + '</span>'
           })
           $('.tags-list').html(ht)
-          activeTags.forEach(function (s, j) {
+          pushListActiveTags.forEach(function (s, j) {
             $('.tags-list .tags-item[data-id="' + s.lid + '"]').addClass('tags-active')
           })
           $('.tags-item').click(function (e) {
@@ -761,17 +767,17 @@ export default {
             var name = $(this).text()
             $(this).toggleClass('tags-active')
             if ($(this).hasClass('tags-active')) {
-              activeTags.push({
+              pushListActiveTags.push({
                 lid: id,
                 lname: name
               })
               inputTagList()
             } else {
-              var newArr = activeTags.filter(function (item) {
+              var newArr = pushListActiveTags.filter(function (item) {
                 return item.lid != id
               })
-              activeTags = newArr
-              console.log(activeTags, newArr, 'quxiao')
+              pushListActiveTags = newArr
+              console.log(pushListActiveTags, newArr, 'quxiao')
               inputTagList()
             }
           })
@@ -818,8 +824,8 @@ export default {
           if (r.data) {
             $('.tag-input .clear-input').val('')
             // 添加标签成功后 绑定标签
-            if (activeTags.length < 3) {
-              activeTags.push({
+            if (pushListActiveTags.length < 3) {
+              pushListActiveTags.push({
                 lid: r.data,
                 lname: name
               })
@@ -833,7 +839,7 @@ export default {
       }
 
       function checkTagDisabled () {
-        if (activeTags.length >= 3) {
+        if (pushListActiveTags.length >= 3) {
           // 禁用标签
           $('.tags-list').find('.tags-item:not(.tags-active)').addClass('disabled')
         } else {

+ 44 - 37
src/views/ent-intel/MyClient.vue

@@ -6,7 +6,7 @@
       <template v-slot:main>
         <div class="filter-container">
           <div class="filter-title">筛选条件</div>
-          <div class="select-group" v-if="isNewEnt.isNew">
+          <div class="select-group" v-if="isNewEnt">
             <span>认领分类:</span>
             <button v-for="(item, i) in renData" :key="999-i"
               class="j-button-item bgc"
@@ -51,7 +51,7 @@
                     </div>
                   </div>
                   <div class="item-time w-100">{{item.followdate}}</div>
-                  <div class="item-handle w-100" v-if="isNewEnt.isNew">
+                  <div class="item-handle w-100" v-if="isNewEnt">
                     <p @click="cancelFollow(item)">取消关注</p>
                     <div class="action-follow" @click="clickRenButton(item, index)" v-if="item.name">
                       <span class="spa1" :class="{
@@ -73,7 +73,7 @@
                   :hide-on-single-page="true"
                   :current-page="client.pageNum"
                   :page-size="client.pageSize"
-                  :total="client.total"
+                  :total="client.count"
                   @current-change="onPageChange"
                 >
                 </el-pagination>
@@ -123,9 +123,10 @@ export default {
     return {
       value: '',
       loading: true,
+      maxCount: 10,
       client: {
         followTotal: 0,
-        total: 0,
+        count: 0, // 筛选后有多少条数据
         list: [],
         pageSize: 10,
         pageNum: 1
@@ -140,11 +141,11 @@ export default {
   },
   computed: {
     ...mapState({
-      isNewEnt: state => state.user.isNewEnt,
+      newEnt: state => state.user.isNewEnt,
       power: state => state.user.power
     }),
-    maxCount () {
-      return this.power.indexOf(7) > -1 ? 500 : 10
+    isNewEnt () {
+      return this.newEnt.isNew
     },
     showTips () {
       if (this.client.followTotal === 0) {
@@ -157,28 +158,31 @@ export default {
       return this.client.list.length === 0 && !this.loading
     }
   },
-  created () {},
-  mounted () {
-    this.getClientList()
+  created () {
+    this.doSearch()
   },
   methods: {
-    getClientList (p = 0) {
-      let obj = {}
-      if (this.isNewEnt.isNew) {
-        obj = {
-          pagesize: 10,
-          pageno: p,
-          keyword: this.value,
-          isCliam: this.isRen
-        }
-      } else {
-        obj = {
-          pagesize: 10,
-          pageno: p,
-          keyword: this.value
-        }
+    doSearch () {
+      this.resetState()
+      this.getClientList()
+    },
+    resetState () {
+      const r = this.$options.data().client
+      delete r.list
+      Object.assign(this.client, r)
+    },
+    getClientList () {
+      const { pageSize, pageNum } = this.client
+      const params = {
+        pagesize: pageSize,
+        pageno: pageNum - 1,
+        keyword: this.value
       }
-      followClientList(obj).then(res => {
+      if (this.isNewEnt) {
+        params.isCliam = this.isRen
+      }
+
+      followClientList(params).then(res => {
         if (res.error_code === 0 && res.data) {
           const arrs = []
           res.data.list.forEach(v => {
@@ -197,9 +201,13 @@ export default {
           if (res.data.list.length === 0) {
             this.client.list = []
           } else {
-            this.client.followTotal = res.data.count
-            this.claimcheck(arrs.join(','), res.data.list)
+            if (this.isNewEnt) {
+              this.claimcheck(arrs.join(','), res.data.list)
+            } else {
+              this.client.list = res.data.list
+            }
           }
+          this.client.count = res.data.count
           this.client.followTotal = res.data.total
         }
         this.loading = false
@@ -220,29 +228,28 @@ export default {
             }
           })
           this.client.list = arrs
-          this.client.total = arrs.length
         }
       })
     },
     enterKeydown () {
-      this.getClientList()
+      this.doSearch()
     },
     onInput (val) {
       if (!val) {
-        this.getClientList()
+        this.doSearch()
       }
     },
     // 认领筛选
     changeState (item) {
       this.isRen = item.v
-      this.getClientList()
+      this.doSearch()
     },
     // 搜索
     searchHandle () {
-      this.getClientList()
+      this.doSearch()
     },
     clearHandle () {
-      this.getClientList()
+      this.doSearch()
     },
     goUnit (item) {
       var name = item.name
@@ -260,7 +267,7 @@ export default {
     },
     onPageChange (p) {
       this.client.pageNum = p
-      this.getClientList(p)
+      this.getClientList()
     },
     // 取消关注
     cancelFollow (item) {
@@ -270,7 +277,7 @@ export default {
       }).then(res => {
         if (res.error_code === 0 && res.data) {
           this.$toast('取消关注成功', 1000)
-          this.getClientList(this.client.pageNum)
+          this.doSearch()
         } else {
           this.$toast(res.error_msg, 1500)
         }
@@ -286,7 +293,7 @@ export default {
           label: ''
         }).then(res => {
           if (res.error_code === 0 && res.data) {
-            this.getClientList()
+            this.doSearch()
             this.$toast('取消认领成功!')
           } else {
             if (res.error_msg) {

+ 8 - 1
src/views/workspace/components/EntFollow.vue

@@ -57,9 +57,16 @@ export default {
       //   )
       // )
       if (this.entniche) {
+        // 跳转商机管理画像?跳转商机管理企业画像
         window.open(this.resolveLink(`/ent_portrait/${item._id}`))
       } else {
-        window.open(this.resolveLink(`/ent_portrait/${item._id}`))
+        if (this.bigmember) {
+          // this.$router.push(`/ent_portrait/${item._id}`)
+          window.open(this.resolveLink(`/ent_portrait/${item._id}`))
+        } else {
+          // this.$router.push(`/svip/ent_ser_portrait/${item._id}`)
+          window.open(this.resolveLink(`/svip/ent_ser_portrait/${item._id}`))
+        }
       }
     },
     linkMore () {