Browse Source

fix: 修复调用作用域问题

zhangyuhan 3 years ago
parent
commit
b932ab1f19
1 changed files with 133 additions and 134 deletions
  1. 133 134
      src/jfw/modules/app/src/web/templates/big-member/page_client_list.html

+ 133 - 134
src/jfw/modules/app/src/web/templates/big-member/page_client_list.html

@@ -60,7 +60,7 @@
                         :finished="finished"
                         finished-text="没有更多了"
                         @load="getProjectList"
-                      >   
+                      >
                       <div class="followList" v-for="(item, index) in list" style="padding-left: 16px;" @click="followView(item.fid,item.sid,item)">
                         <p class="pro_title">
                           <span class="j-icon icon-company"></span>
@@ -104,7 +104,7 @@
                         :finished="finished"
                         finished-text="没有更多了"
                         @load="getProjectList"
-                      >   
+                      >
                       <div class="followList" v-for="(item, index) in havaClaimList" style="padding-left: 16px;" @click="followView(item.fid,item.sid,item)">
                         <p class="pro_title">
                           <span class="j-icon icon-company"></span>
@@ -148,7 +148,7 @@
                         :finished="finished"
                         finished-text="没有更多了"
                         @load="getProjectList"
-                      >   
+                      >
                       <div class="followList" v-for="(item, index) in noClaimList" style="padding-left: 16px;" @click="followView(item.fid,item.sid,item)">
                         <p class="pro_title">
                           <span class="j-icon icon-company"></span>
@@ -231,7 +231,7 @@
               let getclient = sessionStorage.getItem('setClientInfo')
               if(getclient) {
                 getclient = JSON.parse(getclient)
-                vNode.methods.changeFollowState(getclient.data,getclient.str,data,'tag')
+                  vueComponent.changeFollowState(getclient.data,getclient.str,data,'tag')
               }
             }
             // changeKeepStatus (type, that) {
@@ -240,11 +240,11 @@
             // }
         }
     })
-    var vNode = {
+    var vueComponent = new Vue({
         delimiters: ['${', '}'],
         el: '#v-node',
         components: {
-          areaCityMobile: areaCityMobileComponent
+            areaCityMobile: areaCityMobileComponent
         },
         data: {
             sessStorageKey:'$data-pro_follow_list',
@@ -300,143 +300,143 @@
                 return !!$data
             },
             toggle(index) {
-              this.$refs.checkboxes[index].toggle();
+                this.$refs.checkboxes[index].toggle();
             },
             getEntFollow: function(arr) {
-              let _this = this
-              const params = {
-                names: arr.join(',')
-              }
-              // 关注
-              $.ajax({
-                type: 'POST',
-                url: '/entnicheNew/customer/check',
-                contentType: 'application/json',
-                data: JSON.stringify(params),
-                success: function(res) {
-                  console.log(res)
-                  if(res.error_code == 0) {
-                    if(res.data.iscoll) {
-                      _this.list.forEach(item => {
-                        res.data.names.forEach(sum => {
-                          if(sum === item.name) {
-                            item.follow = true
-                          }
-                        })
-                      });
-                    }
-                  }
+                let _this = this
+                const params = {
+                    names: arr.join(',')
                 }
-              })
-              // 认领
-              $.ajax({
-                type: 'POST',
-                url: '/entnicheNew/customer/claimcheck',
-                contentType: 'application/json',
-                data: JSON.stringify(params),
-                success: function(res) {
-                  console.log(res)
-                  if(res.error_code == 0) {
-                    _this.havaClaimList = []
-                    _this.noClaimList = []
-                    let newarr = []
-                    if(res.data.iscoll) {
-                      let listcopy = _this.list
-                      listcopy.forEach((item, index) => {
-                        res.data.names.forEach(sum => {
-                          if(sum === item.name) {
-                            _this.havaClaimList.push(item)
-                            newarr = _this.remove(listcopy, item)
-                            item.claim = true
-                          }
-                        })
-                      });
-                      if(res.data.names.length !== listcopy.length) {
-                        _this.noClaimList = newarr
-                      } else {
-                        _this.noClaimList = _this.list
-                      }
-                    } else {
-                      _this.noClaimList = _this.list
+                // 关注
+                $.ajax({
+                    type: 'POST',
+                    url: '/entnicheNew/customer/check',
+                    contentType: 'application/json',
+                    data: JSON.stringify(params),
+                    success: function(res) {
+                        console.log(res)
+                        if(res.error_code == 0) {
+                            if(res.data.iscoll) {
+                                _this.list.forEach(item => {
+                                    res.data.names.forEach(sum => {
+                                        if(sum === item.name) {
+                                            item.follow = true
+                                        }
+                                    })
+                                });
+                            }
+                        }
                     }
-                  }
-                }
-              })
+                })
+                // 认领
+                $.ajax({
+                    type: 'POST',
+                    url: '/entnicheNew/customer/claimcheck',
+                    contentType: 'application/json',
+                    data: JSON.stringify(params),
+                    success: function(res) {
+                        console.log(res)
+                        if(res.error_code == 0) {
+                            _this.havaClaimList = []
+                            _this.noClaimList = []
+                            let newarr = []
+                            if(res.data.iscoll) {
+                                let listcopy = _this.list
+                                listcopy.forEach((item, index) => {
+                                    res.data.names.forEach(sum => {
+                                        if(sum === item.name) {
+                                            _this.havaClaimList.push(item)
+                                            newarr = _this.remove(listcopy, item)
+                                            item.claim = true
+                                        }
+                                    })
+                                });
+                                if(res.data.names.length !== listcopy.length) {
+                                    _this.noClaimList = newarr
+                                } else {
+                                    _this.noClaimList = _this.list
+                                }
+                            } else {
+                                _this.noClaimList = _this.list
+                            }
+                        }
+                    }
+                })
             },
             remove(arr, item) {
-              var result=[];  
-                  arr.forEach(function(element){  
-                      if(element.name != item.name){  
-                          result.push(element);  
-                      }  
-                  });  
-              return result;  
+                var result=[];
+                arr.forEach(function(element){
+                    if(element.name != item.name){
+                        result.push(element);
+                    }
+                });
+                return result;
             },
             // 关注、认领
             changeFollowState (data, str, taglid, tag) {
-              this.loading = true
-              let params = {
-                "name": data.name, //采购单位名称
-                "province": data.province || data.wProvince, //省份
-                "city": data.wCity, //区域
-              }
-              if(str == 'g') {
-                params.mold = 0
-                params.B = data.follow
-                this.ajaxClaim(params)
-              } else if(str == 'r') {
-                const sessParams = {
-                  data: data,
-                  str: str
+                this.loading = true
+                let params = {
+                    "name": data.name, //采购单位名称
+                    "province": data.province || data.wProvince, //省份
+                    "city": data.wCity, //区域
                 }
-                sessionStorage.setItem('setClientInfo', JSON.stringify(sessParams))
-                params.mold = 1
-                params.D = data.claim
-                // 获取标签
-                if(tag) {
-                  params.label = taglid
-                  this.ajaxClaim(params)
-                } else {
-                  if(data.claim) {
+                if(str == 'g') {
+                    params.mold = 0
+                    params.B = data.follow
                     this.ajaxClaim(params)
-                  } else {
-                    // this.ajaxClaim(params)
-                    if (vKeepComponent) {
-                      vKeepComponent.changeBid(data.name, !data.claim)
-                      // vKeepComponent.changeKeepStatus(!data.claim, this)
+                } else if(str == 'r') {
+                    const sessParams = {
+                        data: data,
+                        str: str
+                    }
+                    sessionStorage.setItem('setClientInfo', JSON.stringify(sessParams))
+                    params.mold = 1
+                    params.D = data.claim
+                    // 获取标签
+                    if(tag) {
+                        params.label = taglid
+                        this.ajaxClaim(params)
+                    } else {
+                        if(data.claim) {
+                            this.ajaxClaim(params)
+                        } else {
+                            // this.ajaxClaim(params)
+                            if (vKeepComponent) {
+                                vKeepComponent.changeBid(data.name, !data.claim)
+                                // vKeepComponent.changeKeepStatus(!data.claim, this)
+                            }
+                        }
                     }
-                  }
                 }
-              }
             },
             ajaxClaim: function (params) {
-              const _this = this
-              $.ajax({
-                type:'POST',
-                url: '/entnicheNew/customer/attention',
-                contentType: 'application/json',
-                data: JSON.stringify(params),
-                success: (res) => {
-                  _this.loading = false
-                  console.log(res)
-                  if(res.error_code == 0) {
-                    if(res.data) {
-                      _this.$toast('取消认领成功')
-                      _this.getProjectList()
-                    } else {
-                      _this.$toast(res.error_msg)
+                const _this = this
+                $.ajax({
+                    type:'POST',
+                    url: '/entnicheNew/customer/attention',
+                    contentType: 'application/json',
+                    data: JSON.stringify(params),
+                    success: (res) => {
+                        _this.loading = false
+                        console.log(res)
+                        if(res.error_code == 0) {
+                            if(res.data) {
+                                _this.$toast('取消认领成功')
+                                _this.getProjectList()
+                            } else {
+                                _this.$toast(res.error_msg)
+                            }
+                        } else {
+                            _this.$toast(res.error_msg)
+                        }
+                    },
+                    error: function(err) {
+                        _this.loading = false
                     }
-                  } else {
-                    _this.$toast(res.error_msg)
-                  }
-                },
-                error: function(err) {
-                  _this.loading = false
-                }
-              })
+                })
             },
             searchFn: function() {
-              this.getProjectList()
+                this.getProjectList()
             },
             // 判断是否开通大会员
             isOpening:function() {
@@ -454,11 +454,11 @@
                 })
             },
             checkAll() {
-              if (this.clientchecked) {
-                this.$refs.checkboxGroup.toggleAll(true);
-              } else {
-                this.$refs.checkboxGroup.toggleAll();
-              }
+                if (this.clientchecked) {
+                    this.$refs.checkboxGroup.toggleAll(true);
+                } else {
+                    this.$refs.checkboxGroup.toggleAll();
+                }
             },
             getProjectList () {
                 // 异步更新数据
@@ -468,7 +468,7 @@
                     type:'get',
                     url:'/entnicheNew/customer/list',
                     data:{
-                      searchCode: _this.inputVal,
+                        searchCode: _this.inputVal,
                     },
                     success:function(res) {
                         if (res.error_code == 0){
@@ -485,7 +485,7 @@
                                 }
                                 _this.list = res.data.list
                                 if(nameArr.length !== 0) {
-                                  _this.getEntFollow(nameArr)
+                                    _this.getEntFollow(nameArr)
                                 }
                                 if(!res.data.hasNext){
                                     _this.loading = true
@@ -569,8 +569,7 @@
                 return td;
             }
         }
-    }
-    var vueComponent = new Vue(vNode)
+    })
 </script>
 
 </body>