Forráskód Böngészése

Merge branch 'dev4.6.3' of http://192.168.3.207:8080/qmx/jy into dev4.6.3

tsz 3 éve
szülő
commit
e41cc5f4a3

+ 1 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/client_buyer-example.js

@@ -11,7 +11,7 @@ var vipDialog = `
       <span class="vip_extend"><span>{{getTextMap.headText.top}}</span><br/>{{getTextMap.headText.bot}}</span>
   </div>
   <div class="openBtn">
-      <button style="width:auto;color:#2cb7ca;font-size:0.26rem;" class="" @click="goOpen(getTextMap.headText.top,getTextMap.headText.bot, getTextMap.source)">{{getTextMap.btnText}}</button>
+      <button style="width:auto;color:#2cb7ca;font-size:0.26rem;background:#fff;" class="" @click="goOpen(getTextMap.headText.top,getTextMap.headText.bot, getTextMap.source)">{{getTextMap.btnText}}</button>
   </div>
 </div>
 `

+ 83 - 43
src/jfw/modules/app/src/web/templates/big-member/page_client_follow_detail.html

@@ -26,6 +26,9 @@
 <div class="j-container">
     {{include "/big-member/header.html"}}
     <!--S-Vue-->
+    <div id="jyKeepEntComponent">
+        <keep-ent-component ref="vKeepComponent" @on-save-tag="onSaveTag" :bid="nowOpenBid" :first="false"></keep-ent-component>
+    </div>
     <div class="j-main prodetail" id="v-pro" v-cloak>
         <div class="prodetailTop">
             <div class="prodetail_title">
@@ -147,7 +150,7 @@
                         </div>
                         <span class="columnLine"></span>
                         <div class="claim" @click="claimBtn($event, this)">
-                          <span class="j-icon icon-add-claim"></span>
+                          <span class="j-icon icon-claim"></span>
                           <span class="icon-claim-text" style="color:#2ABED1;font-size: .26rem;">认领客户</span>
                         </div>
                       </div>
@@ -218,6 +221,7 @@
 <script src=//cdn-common.jianyu360.com/cdn/lib/vue/2.6.11/vue.min.js></script>
 <script src=//cdn-common.jianyu360.com/cdn/lib/vant/2.12.24/lib/vant.min.js></script>
 <script src=//cdn-common.jianyu360.com/cdn/lib/zepto/1.2.0/zepto.min.js></script>
+<script src='/common-module/keep-tags/keep-ent-tags-template.js?v={{Msg "seo" "version"}}'></script>
 {{include "/big-member/commonjs.html"}}
 <script src='{{Cdns .Host "seo" "cdn"|SafeUrl}}/jyapp/js/common.js?v={{Msg "seo" "version"}}'></script>
 
@@ -275,6 +279,28 @@
         }
     }
     var localEmail =  {{.T.email}} || sessionStorage.getItem('reportEmail') || ''
+    // 商机管理-认领客户
+    var vKeepEntComponent = new Vue({
+        delimiters: ['${', '}'],
+        el: '#jyKeepEntComponent',
+        data: {
+            nowOpenBid: ''
+        },
+        methods: {
+            changeBid (id, type) {
+                this.nowOpenBid = id
+                this.$refs.vKeepComponent.ajaxAddKeep(id, type)
+            },
+            onSaveTag (data) {
+                var getclient = sessionStorage.getItem('setClientInfo')
+                if(getclient) {
+                    getclient = JSON.parse(getclient)
+                    getclient.label = data
+                    vm.setClaimState(getclient)
+                }
+            }
+        }
+    })
     var vNode = {
         delimiters: ['${', '}'],
         el: '#v-pro',
@@ -367,54 +393,68 @@
                 success: function(res) {
                   console.log(res)
                   if(res.data.iscoll) {
-                    if(res.data.names.length > 0) {
-                      $('.icon-claim-text').text('已认领')
-                    } else {
-                      $('.icon-claim-text').text('认领')
-                    }
+                    _this.changeClaimState(res.data.names.length > 0)
                   }
                 }
               })
             },
             // 认领
             claimBtn: function(e, that) {
-              e.stopPropagation()
-              let claim = $('.icon-claim-text').text()
-              if(claim == '已认领') {
-                this.$toast('不支持在该页面进行退回')
-                return
-              }
-              let _this = this
-              let params = {
-                "name": this.$data.prolist.buyer, //采购单位名称
-                "province": this.$data.prolist.area, //省份
-                "city": this.$data.prolist.city, //区域
-                "mold": 1, //1 认领;默认 0关注
-                "D": false, //true 取关;默认 false 关注
-              }
-              $.ajax({
-                type: 'POST',
-                url: '/entnicheNew/customer/attention',
-                contentType: 'application/json',
-                data: JSON.stringify(params),
-                success: function(res) {
-                  console.log(res)
-                  if(res.error_code == 0) {
-                    if(res.data) {
-                      if(params.mold == 0) {
-                        _this.follow = !_this.follow
-                      } else {
-                        _this.$toast('认领成功')
-                        $('.icon-claim-text').text('已认领')
-                      }
-                    } else {
-                      _this.$toast(res.error_msg)
-                    }
-                    // this.getActionState(utils.getParam('entName'), 'g')
-                    // this.getActionState(utils.getParam('entName'), 'r')
-                  }
+                e.stopPropagation()
+                let claim = $('.icon-claim-text').text()
+                var claimState = claim === '已认领'
+                // if(claim == '已认领') {
+                //   return this.$toast('不支持在该页面进行退回')
+                // }
+
+                let _this = this
+                let params = {
+                    "name": this.$data.prolist.buyer, //采购单位名称
+                    "province": this.$data.prolist.area, //省份
+                    "city": this.$data.prolist.city, //区域
+                    "mold": 1, //1 认领;默认 0关注
+                    "D": claimState, //true 取关;默认 false 关注
                 }
-              })
+                sessionStorage.setItem('setClientInfo', JSON.stringify(params))
+
+                if (!claimState) {
+                    vKeepEntComponent.changeBid(params.name, !claimState)
+                } else {
+                    // 取消认领
+                    this.setClaimState(params)
+                }
+            },
+            setClaimState: function (params) {
+                var _this = this
+                $.ajax({
+                    type: 'POST',
+                    url: '/entnicheNew/customer/attention',
+                    contentType: 'application/json',
+                    data: JSON.stringify(params),
+                    success: function(res) {
+                        if(res.error_code == 0) {
+                            if(res.data) {
+                                if (params.D) {
+                                    _this.$toast('取消认领成功')
+                                } else {
+                                    _this.$toast('认领成功')
+                                }
+                                _this.changeClaimState(!params.D)
+                            }
+                        } else {
+                            _this.$toast(res.error_msg)
+                        }
+                    }
+                })
+            },
+            changeClaimState: function (f) {
+              if (f) {
+                $('.icon-claim-text').text('已认领')
+                $('.claim .j-icon').removeClass('icon-claim').addClass('icon-add-claim')
+              } else {
+                $('.icon-claim-text').text('认领客户')
+                $('.claim .j-icon').removeClass('icon-add-claim').addClass('icon-claim')
+              }
             },
             // 获取项目详情
             getProDetail: function () {
@@ -844,7 +884,7 @@
             }
         }
     }
-    var tt = new Vue(vNode)
+    var vm = new Vue(vNode)
 </script>
 
 </body>

+ 74 - 29
src/jfw/modules/app/src/web/templates/weixin/wxinfocontent.html

@@ -163,6 +163,9 @@
 <div id="jyKeepComponent">
     <keep-component ref="vKeepComponent" @on-save-tag="getKeepList" @on-change-keep="changeKeepStatus" :bid="nowOpenBid" :first="false"></keep-component>
 </div>
+<div id="jyKeepEntComponent">
+  <keep-ent-component ref="vKeepComponent" @on-save-tag="onSaveTag" :bid="nowOpenBid" :first="false"></keep-ent-component>
+</div>
 <div class="share1">
 
     <!-- 复制提示 star -->
@@ -844,6 +847,9 @@
 <script src=//cdn-common.jianyu360.com/cdn/lib/vue/2.6.11/vue.min.js></script>
 <script src=//cdn-common.jianyu360.com/cdn/lib/vant/2.12.24/lib/vant.min.js></script>
 <script src='/common-module/keep-tags/keep-tags-template.js?v={{Msg "seo" "version"}}'></script>
+<script src='/common-module/keep-tags/keep-ent-tags-template.js?v={{Msg "seo" "version"}}'></script>
+<!-- <script src="https://cdn.bootcss.com/vConsole/3.3.4/vconsole.min.js"></script>
+<script> new VConsole(); </script> -->
 <script>
     var	shareimgflag = true;
     var area = {{.T.obj.area}}
@@ -1302,16 +1308,12 @@
           contentType: 'application/json',
           data: JSON.stringify(params),
           success: function(res) {
-            console.log(res)
-            if(res.data.iscoll) {
+            if(res.data && res.data.iscoll) {
               claimData = true
-              // $('.icon_state').removeClass('icon-claim').addClass('icon-add-claim')
-              $('.icon-claim-text').text('已认领')
             } else {
               claimData = false
-              // $('.icon_state').removeClass('icon-add-claim').addClass('icon-claim')
-              $('.icon-claim-text').text('认领客户')
             }
+            changeClaimState(claimData)
           }
         })
       } else if (str == 'g') {
@@ -1343,41 +1345,84 @@
     // 商机管理---认领
     function setClientClaim (e) {
       e.preventDefault()
-      if(claimData) {
-        EasyAlert.show("不支持在该页面进行退回");
-        return
-      }
+      // if(claimData) {
+      //   EasyAlert.show("不支持在该页面进行退回");
+      //   return
+      // }
+      // claimData:true则当前为已认领
       if(window.entniche) {
         params = {
-          "userId": 123,
           "name": {{.T.obj.buyer}}, //采购单位名称
           "province": {{.T.obj.area}}, //省份
           "city": {{.T.obj.city}}, //区域
           "mold": 1, //1 认领;默认 0关注
           "D": claimData, //true 取关;默认 false 关注
         }
-        $.ajax({
-          type: 'POST',
-          url: '/entnicheNew/customer/attention',
-          contentType: 'application/json',
-          data: JSON.stringify(params),
-          success: function(res) {
-            console.log(res)
-            if(res.error_code == 0) {
-              if(res.data) {
-                if(claimData) {
-                  // $('.icon_state').removeClass('icon-add-claim').addClass('icon-claim')
-                } else {
-                  $('.icon-claim-text').text('已认领')
-                  // $('.icon_state').removeClass('icon-claim').addClass('icon-add-claim')
-                }
+
+        sessionStorage.setItem('setClientInfo', JSON.stringify(params))
+        if (!claimData) {
+          vKeepEntComponent.changeBid(params.name, !claimData)
+        } else {
+          // 取消认领
+          setClaimState(params)
+        }
+      }
+    }
+
+    function setClaimState (params) {
+      $.ajax({
+        type: 'POST',
+        url: '/entnicheNew/customer/attention',
+        contentType: 'application/json',
+        data: JSON.stringify(params),
+        success: function(res) {
+          if(res.error_code == 0) {
+            if(res.data) {
+              claimData = !claimData
+              changeClaimState(claimData)
+              if (claimData) {
+                EasyAlert.show('认领成功')
+              } else {
+                EasyAlert.show('取消认领成功')
               }
             }
           }
-        })
+        }
+      })
+    }
+    function changeClaimState (f) {
+      if (f) {
+        $('.icon-claim-text').text('已认领')
+        $('.icon_state').removeClass('icon-claim').addClass('icon-add-claim')
+      } else {
+        $('.icon-claim-text').text('认领客户')
+        $('.icon_state').removeClass('icon-add-claim').addClass('icon-claim')
       }
     }
 
+    // 商机管理-认领客户
+    var vKeepEntComponent = new Vue({
+      delimiters: ['${', '}'],
+      el: '#jyKeepEntComponent',
+      data: {
+        nowOpenBid: ''
+      },
+      methods: {
+        changeBid (id, type) {
+          this.nowOpenBid = id
+          this.$refs.vKeepComponent.ajaxAddKeep(id, type)
+        },
+        onSaveTag (data) {
+          var getclient = sessionStorage.getItem('setClientInfo')
+          if(getclient) {
+            getclient = JSON.parse(getclient)
+            getclient.label = data
+            setClaimState(getclient)
+          }
+        }
+      }
+    })
+
     function setportain (e) {
       e.preventDefault()
       location.href = '/jyapp/big/page/client_portrayal?entName=' + encodeURIComponent({{.T.obj.buyer}}) + '&from=client'
@@ -1942,7 +1987,7 @@
           buyertel_show = "hide"
       }
       outhtml +='<li class="caigouunit commonUser"><p class="name">采购单位</p><div class="unitcenter"><p  class="textcontent">'+rerbuyer+'</p><div class="unitbtn '+rerbuyer_show+'">立即查看<span class="iconunit" style="display:none;"></span></div></div></li>'
-      outhtml +='<li class="entnicheUser"><p class="name">采购单位</p><div class="unitcenter sum_caigou client_caigou"><p  class="textcontent">'+rerbuyer+'</p><div class="sum_right"><div class="claim" onClick="setportain(event)"><span class="j-icon icon-porait"></span><span class="getproit" style="color:#2ABED1">查看画像</span></div><span class="columnLine"></span><div class="claim clientClaim" onClick="setClientClaim(event)"><span class="j-icon icon_state icon-add-claim"></span><span class="icon-claim-text" style="color:#2ABED1;font-size: .26rem;">认领客户</span></div></div></div></li>'
+      outhtml +='<li class="entnicheUser"><p class="name">采购单位</p><div class="unitcenter sum_caigou client_caigou"><p  class="textcontent">'+rerbuyer+'</p><div class="sum_right"><div class="claim" onClick="setportain(event)"><span class="j-icon icon-porait"></span><span class="getproit" style="color:#2ABED1">查看画像</span></div><span class="columnLine"></span><div class="claim clientClaim" onClick="setClientClaim(event)"><span class="j-icon icon_state icon-claim"></span><span class="icon-claim-text" style="color:#2ABED1;font-size: .26rem;">认领客户</span></div></div></div></li>'
       outhtml +='<li><p class="name">采购联系人</p><p class="textcontent">'+rerbuyerperson+'</p></li>'+
           '<li class="bbm0"><p class="name">采购电话</p><p class="textcontent">'+rerbuyertel+'</p><a class="border-tel_ '+buyertel_show+'" style="position: static;display:block" datalink="/jyapp/vipsubscribe/introducePage"><div class="tel"></div></a></li>'
       if(packageCon==""){
@@ -2049,7 +2094,7 @@
               }
             */
             //  大会员用户、非大会员用户都可跳转采购单位画像
-            if(window.entniche) { return }
+            if(newEntNiche) { return }
             location.href = "/jyapp/big/page/unit_portrayal?entName="+encodeURIComponent(rerbuyer)
         }
 

+ 12 - 12
src/jfw/modules/common/src/qfw/util/jy/switchService.go

@@ -53,20 +53,20 @@ func (s *switchService) Get(session *httpsession.Session, m MongodbSim) string {
 
 func (s *switchService) GetEntniche(session *httpsession.Session, m MongodbSim, sql *mysql.Mysql) string {
 	userId, _ := session.Get("userId").(string)
-	entUserId := util.IntAll(session.Get("entUserId"))
 	v, _ := session.Get(s.SessionKey).(string)
-	u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1}`)
+	u, ok := m.FindById("user", userId, `{"i_member_status":1,"i_vip_status":1,"s_phone":1,"s_m_phone":1}`)
 	entniche := false
-	if entUserId != 0 {
-		res := sql.SelectBySql(`SELECT i.isNew,i.name,i.phone,i.status,i.auth_status,u.power FROM entniche_user u LEFT JOIN entniche_info i
-			ON u.ent_id=i.id
-			 where u.id=? `, entUserId)
-		if res != nil && len(*res) > 0 {
-			//已购买企业未过期-商机管理用户
-			for _, v := range *res {
-				if util.IntAll(v["status"]) == 1 && util.IntAll(v["power"]) == 1 && util.IntAll(v["isNew"]) == 1 {
-					//d["isFree"] = false
-					//d["entniche"] = true
+	phone:=""
+	if s_phone, _ := (*u)["s_phone"].(string); s_phone != "" {
+		phone = s_phone
+	} else if s_m_phone, _ := (*u)["s_m_phone"].(string); s_m_phone != "" {
+		phone = s_m_phone
+	}
+	if phone != "" {
+		//已购买企业未过期
+		if entInfo := sql.SelectBySql(`SELECT status,isNew FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len((*entInfo)) > 0 {
+			for _, v := range (*entInfo) {
+				if util.IntAll(v["status"]) == 1 && util.IntAll(v["isNew"]) == 1{
 					entniche = true
 					break
 				}

+ 2 - 2
src/web/staticres/common-module/keep-tags/keep-ent-tags-template.js

@@ -1,4 +1,4 @@
-var tempStyleComponent = `<style>
+var tempEntStyleComponent = `<style>
 /*
 * Prefixed by https://autoprefixer.github.io
 * PostCSS: v7.0.29,
@@ -337,7 +337,7 @@ Vue.component('keep-ent-component', {
     }
   } ,
   mounted () {
-    $('head').append(tempStyleComponent)
+    $('head').append(tempEntStyleComponent)
     // if (this.first) {
     //   this.ajaxGetAllTags()
     // }