Sfoglia il codice sorgente

UU互联和店铺联系卖家打开

yangc 8 anni fa
parent
commit
e7ef3d44d3
2 ha cambiato i file con 89 aggiunte e 10 eliminazioni
  1. 23 10
      components/default/RightBar.vue
  2. 66 0
      components/store/common/StoreHeader.vue

+ 23 - 10
components/default/RightBar.vue

@@ -26,13 +26,13 @@
             <p>周一至周五 9:00-18:00</p>
           </div>
         </li>
-        <!--<li class="right-bar-item contact-menu">
+        <li class="right-bar-item contact-menu">
           <a href="javascript:void(0)" class="title" @click="goWebChat" @mouseenter="getChatCount">
             <i class="fa fa-comments-o" aria-hidden="true" style="color: #FFFFFF;">
             </i>
           </a>
           <div class="sidebar-menu" title="优软互联"><a @click="goWebChat">优软互联<span v-if="user.logged">({{chatCount}})</span></a></div>
-        </li>-->
+        </li>
       </ul>
       <ul class="right-bar-bottom">
         <li class="right-bar-item" @mouseenter="loadHistorys()">
@@ -176,28 +176,41 @@
           })
         } else {
           // 获得窗口的垂直位置
-          let iTop = (window.screen.availHeight - 30 - 600) / 2
+          let iTop = (window.screen.availHeight - 30 - 780) / 2
           // 获得窗口的水平位置
           let iLeft = (window.screen.availWidth - 10 - 1030) / 2
-          let newTab = window.open('', '即时对话框', 'height=600, width=1030, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+          let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
           this.$http.get('/basic/enterprise/' + this.enterprise.uu + '/info')
             .then(response => {
               let obj = {}
               obj.enUU = response.data.uu
               obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
               obj.type = 'LIST'
-              obj.userPhone = this.user.data.userTel
-              this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
-                .then(response => {
-                  if (response.data.success) {
-                    newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
-                  }
+              if (!(/^1\d{10}$/).test(this.user.data.userTel)) {
+                this.$http.get('/basic/enterprise/' + obj.enUU + '/admin').then(response => {
+                  obj.userPhone = response.userTel
+                  this.openWebChat(newTab, obj)
+                }, err => {
+                  console.log(err)
+                  this.$message.error('暂无卖家管理员手机号!')
                 })
+              } else {
+                obj.userPhone = this.user.data.userTel
+                this.openWebChat(newTab, obj)
+              }
             }, err => {
               console.log(err)
             })
         }
       },
+      openWebChat: function (newTab, obj) {
+        this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+          .then(response => {
+            if (response.data.success) {
+              newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
+            }
+          })
+      },
       getChatCount: function () {
         if (this.user.logged) {
           this.$http.get('http://im.ubtob.com/api/chat/message', {params: {enUU: this.enterprise.uu, operate: 'count_unread', phone: this.user.data.userTel}})

+ 66 - 0
components/store/common/StoreHeader.vue

@@ -21,6 +21,10 @@
                   <span v-else-if="storeInfo.type == 'AGENCY'">&nbsp;<img src="/images/store/icon/icon-agent.png"/></span>
                   <span v-else-if="storeInfo.type == 'DISTRIBUTION'">&nbsp;<img src="/images/store/icon/icon-distribution.png"/></span>
                   <span v-else-if="storeInfo.type == 'CONSIGNMENT'">&nbsp;<img src="/images/store/icon/consignment.png"/></span>
+                  <span class="link-seller">
+                    <img src="/images/all/songguo.png">
+							      <a @click="goWebChat()" class="contact_btn">联系卖家</a>
+                  </span>
                 </div>
               </div>
               <div class="clearfix"></div>
@@ -108,6 +112,50 @@ export default {
         this.$store.dispatch('shop/StoreFocus', {storeName: name, storeid: id})
         this.isFocus = true
       }
+    },
+    goWebChat: function () {
+      if (!this.user.logged) {
+        this.$http.get('/login/page').then(response => {
+          if (response.data) {
+            this.$router.push('/auth/login')
+          }
+        })
+      } else {
+        // 获得窗口的垂直位置
+        let iTop = (window.screen.availHeight - 30 - 780) / 2
+        // 获得窗口的水平位置
+        let iLeft = (window.screen.availWidth - 10 - 1030) / 2
+        let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+        this.$http.get('/basic/enterprise/' + this.storeInfo.enUU + '/info')
+          .then(response => {
+            let obj = {}
+            obj.enUU = response.data.uu
+            obj.enterprise = {enUU: response.data.uu, name: response.data.enName}
+            obj.type = 'STORE'
+            if (!(/^1\d{10}$/).test(this.user.data.userTel)) {
+              this.$http.get('/basic/enterprise/' + obj.enUU + '/admin').then(response => {
+                obj.userPhone = response.userTel
+                this.openWebChat(newTab, obj)
+              }, err => {
+                console.log(err)
+                this.$message.error('暂无卖家管理员手机号!')
+              })
+            } else {
+              obj.userPhone = this.user.data.userTel
+              this.openWebChat(newTab, obj)
+            }
+          }, err => {
+            console.log(err)
+          })
+      }
+    },
+    openWebChat: function (newTab, obj) {
+      this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+        .then(response => {
+          if (response.data.success) {
+            newTab.location.href = 'http://im.ubtob.com/chat/visit?gid=' + response.data.content
+          }
+        })
     }
   }
 }
@@ -388,4 +436,22 @@ export default {
 		position: relative;
 		top: -9px;
 	}
+  .icon-style >span {
+    margin-right: 5px;
+  }
+  .icon-style .link-seller {
+    cursor: pointer;
+  }
+  .icon-style .link-seller img {
+    top: -2px;
+  }
+  .icon-style .link-seller a {
+    font-size: 12px;
+    color: #fff;
+    line-height: 20px;
+    height: 20px;
+    padding: 0 7px;
+    background: #ef7f03;
+    border-radius: 2px;
+  }
 </style>