Browse Source

联系卖家弹框

yangc 7 years ago
parent
commit
e4113e4b93

+ 16 - 54
components/applyPurchase/ApplyInfo.vue

@@ -113,23 +113,17 @@
     ></say-price>
     <page :total="totalCount" :page-size="pageSize"
           :current="nowPage" v-on:childEvent="listenPage"></page>
-    <div class="com-del-box link-saler-box" v-if="linkBoxIndex > -1">
-      <div class="title">
-        <i @click="setLinkBoxIndex(-1)"></i>
-      </div>
-      <div class="content">
-        <p><i class="fa fa-exclamation-circle"></i>抱歉,暂时无法与买家在线沟通!</p>
-        <p>买家联系电话:<span v-text="purchaseManList.content[linkBoxIndex].userTel"></span></p>
-        <div>
-          <a @click="setLinkBoxIndex(-1)">我知道了</a>
-        </div>
-      </div>
-    </div>
+    <!--<link-saler-box
+    :tel="purchaseManList.content[linkBoxIndex].userTel"
+    v-if="linkBoxIndex > -1"
+    @cancelAction="setLinkBoxIndex(-1)">
+  </link-saler-box>-->
   </div>
 </template>
 <script>
   import Page from '~components/common/page/pageComponent.vue'
   import SayPrice from './SayPrice.vue'
+//  import LinkSalerBox from '~components/common/LinkSalerBox.vue'
   export default {
     data () {
       return {
@@ -137,13 +131,14 @@
         nowPage: 1,
         keyWord: '',
         sorting: {},
-        currentSayPriceIndex: -1,
-        linkBoxIndex: -1
+        currentSayPriceIndex: -1
+//        linkBoxIndex: -1
       }
     },
     components: {
       Page,
       SayPrice
+//      LinkSalerBox
     },
     filters: {
       date: function (date) {
@@ -251,14 +246,14 @@
         }
         this.nowPage = 1
         this.resetList()
-      },
-      setLinkBoxIndex: function (index) {
-        if (!this.user.logged) {
-          this.$router.push('/auth/login?returnUrl=' + window.location.href)
-        } else {
-          this.linkBoxIndex = index
-        }
       }
+//      setLinkBoxIndex: function (index) {
+//        if (!this.user.logged) {
+//          this.$router.push('/auth/login?returnUrl=' + window.location.href)
+//        } else {
+//          this.linkBoxIndex = index
+//        }
+//      }
     }
   }
 </script>
@@ -727,38 +722,5 @@
       text-align: right;
       float: none;
     }
-    .link-saler-box {
-      width: 289px;
-      height: auto;
-      min-height: auto;
-      border-radius: 2px;
-      .title {
-        background-color: #4290f7;
-        height: 22px;
-        line-height: 22px;
-        margin-bottom: 20px;
-      }
-      .content {
-        p {
-          line-height: 20px;
-          padding-top: 0;
-          i {
-            color: #4290f7;
-            margin-right: 4px;
-          }
-          span {
-            color: #f62d37;
-          }
-        }
-        div {
-          a {
-            width: 78px;
-            background: #4290f7;
-            margin: 18px 0 13px 0;
-            border-radius: 2px;
-          }
-        }
-      }
-    }
   }
 </style>

+ 68 - 0
components/common/LinkSalerBox.vue

@@ -0,0 +1,68 @@
+<template>
+  <div class="com-del-box link-saler-box">
+    <div class="title">
+      <i @click="cancel()"></i>
+    </div>
+    <div class="content">
+      <p><i class="fa fa-exclamation-circle"></i>抱歉,暂时无法与{{target == 'saler' ? '卖' : '买'}}家在线沟通!</p>
+      <p>{{target == 'saler' ? '卖' : '买'}}家联系电话:<span v-text="tel"></span></p>
+      <div>
+        <a @click="cancel()">我知道了</a>
+      </div>
+    </div>
+  </div>
+</template>
+<script>
+  export default {
+    props: {
+      tel: {
+        default: '',
+        type: String
+      },
+      target: {
+        default: 'saler',
+        type: String
+      }
+    },
+    methods: {
+      cancel: function () {
+        this.$emit('cancelAction')
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .link-saler-box {
+    width: 289px;
+    height: auto;
+    min-height: auto;
+    border-radius: 2px;
+    .title {
+      background-color: #4290f7;
+      height: 22px;
+      line-height: 22px;
+      margin-bottom: 20px;
+    }
+    .content {
+      p {
+        line-height: 20px;
+        padding-top: 0;
+        i {
+          color: #4290f7;
+          margin-right: 4px;
+        }
+        span {
+          color: #f62d37;
+        }
+      }
+      div {
+        a {
+          width: 78px;
+          background: #4290f7;
+          margin: 18px 0 13px 0;
+          border-radius: 2px;
+        }
+      }
+    }
+  }
+</style>

+ 17 - 4
components/store/CommodityList.vue

@@ -27,7 +27,7 @@
               </span>
             </div>
           </div>
-          
+
         </div>
 
         <!-- 列表展示 -->
@@ -134,12 +134,17 @@
         <div class="remind-area">
           <img src="/images/store/store-remind.png" alt="">
           所有报价、库存信息的真实性及准确性均由店铺负责,如有疑问请点击
-          <a @click="goWebChat()" class="link-seller">联系卖家</a>
+          <a @click="goLink" class="link-seller">联系卖家</a>
         </div>
         <page :total="commodities.totalElements" :page-size="pageParams.count"
               :current="pageParams.page" @childEvent="handleCurrentChange"></page>
       </div>
     </div>
+    <link-saler-box
+      :tel="tel"
+      v-if="showLinkBox"
+      @cancelAction="showLinkBox = false">
+    </link-saler-box>
   </div>
 </template>
 <script>
@@ -165,12 +170,15 @@ function getAllLeafIds (kind) {
 }
 import Buy from '~components/common/buyOrCar/buyComponent.vue'
 import Page from '~components/common/page/pageComponent.vue'
+import LinkSalerBox from '~components/common/LinkSalerBox.vue'
+import { goLinkUser } from '~utils/baseUtils'
 export default {
   name: 'commodity-list',
   props: ['kinds'],
   components: {
     Buy,
-    Page
+    Page,
+    LinkSalerBox
   },
   data () {
     return {
@@ -184,7 +192,9 @@ export default {
       },
       searchCode: '',
       parentKindId: 0,
-      ids: null
+      ids: null,
+      showLinkBox: false,
+      tel: ''
     }
   },
   filters: {
@@ -384,6 +394,9 @@ export default {
       } else {
         this.$router.push('/auth/login?returnUrl=' + window.location.href)
       }
+    },
+    goLink: function () {
+      goLinkUser(this)
     }
   }
 }

+ 37 - 9
components/store/ComponentInfo.vue

@@ -13,25 +13,53 @@
         </li>
         <li v-if="!commodity.uuid || !component.properties || component.properties.length === 0" class="text-info">
           <!--<i class="fa fa-smile-o fa-lg"></i> 暂无参数信息-->
-          <span class="info">卖家上传的产品暂无参数,请 <a href="">联系卖家</a> 了解具体详情</span>
+          <span class="info">卖家上传的产品暂无参数,请 <a @click="goLink">联系卖家</a> 了解具体详情</span>
         </li>
       </ul>
     </div>
+    <link-saler-box
+      :tel="tel"
+      v-if="showLinkBox"
+      @cancelAction="showLinkBox = false">
+    </link-saler-box>
   </div>
 </template>
 <script>
 
-export default {
-  name: 'component-info',
-  computed: {
-    component () {
-      return this.$store.state.shop.storeInfo.component.data
+  import LinkSalerBox from '~components/common/LinkSalerBox.vue'
+  import { goLinkUser } from '~utils/baseUtils'
+
+  export default {
+    name: 'component-info',
+    data () {
+      return {
+        showLinkBox: false,
+        tel: ''
+      }
+    },
+    components: {
+      LinkSalerBox
+    },
+    computed: {
+      storeInfo () {
+        return this.$store.state.shop.storeInfo.store.data
+      },
+      user () {
+        return this.$store.state.option.user
+      },
+      component () {
+        return this.$store.state.shop.storeInfo.component.data
+      },
+      commodity () {
+        return this.$store.state.shop.storeInfo.commodity.data
+      }
     },
-    commodity () {
-      return this.$store.state.shop.storeInfo.commodity.data
+    methods: {
+      goLink: function () {
+        goLinkUser(this)
+      }
     }
   }
-}
 </script>
 <style scoped>
   .component-info {

+ 80 - 67
components/store/common/StoreHeader.vue

@@ -23,7 +23,7 @@
                   <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>
+							      <a @click="goLink()" class="contact_btn">联系卖家</a>
                   </span>
                   <div class="share">
                     <span @click="setShowShare(!showShare, $event)">生成手机版链接</span>
@@ -78,11 +78,18 @@
         </button>
       </div>
     </el-dialog>
+    <link-saler-box
+      :tel="tel"
+      v-if="showLinkBox"
+      @cancelAction="showLinkBox = false">
+    </link-saler-box>
   </div>
 </template>
 <script>
 import Clipboard from 'clipboard'
 import SearchBox from '~components/main/Search.vue'
+import LinkSalerBox from '~components/common/LinkSalerBox.vue'
+import { goLinkUser } from '~utils/baseUtils'
 
 let QRCode = require('qrcode')
 
@@ -93,11 +100,14 @@ export default {
       isOpen: false,
       dialogVisible: false,
       clipboard: {},
-      showShare: false
+      showShare: false,
+      showLinkBox: false,
+      tel: ''
     }
   },
   components: {
-    SearchBox
+    SearchBox,
+    LinkSalerBox
   },
   mounted () {
     let _this = this
@@ -166,71 +176,74 @@ export default {
         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
-        if (this.tab.close) {
-          this.tab.close()
-        }
-        let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
-        newTab.close()
-        newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
-        this.$store.dispatch('chat/setChatTab', {tab: newTab})
-        this.$http.get('/basic/enterprise/' + this.storeInfo.enUU + '/info')
-          .then(response => {
-            let obj = {}
-            obj.userPhone = this.user.data.userTel
-            obj.userType = 'ENTERPRISE'
-            this.user.data.enterprises.forEach(function (item, index) {
-              if (item.current) {
-                obj.enUU = item.uu
-                obj.enterprise = {enUU: item.uu, name: item.enName}
-              }
-            })
-            obj.otherEnUU = response.data.uu
-            obj.otherUserType = 'STORE'
-            obj.otherEnterprise = {enUU: response.data.uu, name: response.data.enName}
-            obj.type = 'CHAT'
-            if (!(/^1\d{10}$/).test(response.data.enTel)) {
-              this.$http.get('/basic/enterprise/' + response.data.uu + '/admin').then(response => {
-                console.log(response)
-                obj.toPhone = response.data.userTel
-                console.log(obj)
-                this.openWebChat(newTab, obj)
-              }, err => {
-                console.log(err)
-                this.$message.error('暂无卖家管理员手机号!')
-              })
-            } else {
-              obj.toPhone = response.data.enTel
-              console.log(obj)
-              this.openWebChat(newTab, obj)
-            }
-          }, err => {
-            console.log(err)
-          })
-      }
-    },
-    openWebChat: function (newTab, obj) {
-      this.$http.post('https://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
-        .then(response => {
-          if (response.data.success) {
-            newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
-          } else {
-            newTab.close()
-            this.$message.error(response.data.message)
-          }
-        })
+    goLink: function () {
+      goLinkUser(this)
     },
+//    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
+//        if (this.tab.close) {
+//          this.tab.close()
+//        }
+//        let newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+//        newTab.close()
+//        newTab = window.open('', '即时对话框', 'height=750, width=1000, top=' + iTop + ', left=' + iLeft + ', toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, status=no')
+//        this.$store.dispatch('chat/setChatTab', {tab: newTab})
+//        this.$http.get('/basic/enterprise/' + this.storeInfo.enUU + '/info')
+//          .then(response => {
+//            let obj = {}
+//            obj.userPhone = this.user.data.userTel
+//            obj.userType = 'ENTERPRISE'
+//            this.user.data.enterprises.forEach(function (item, index) {
+//              if (item.current) {
+//                obj.enUU = item.uu
+//                obj.enterprise = {enUU: item.uu, name: item.enName}
+//              }
+//            })
+//            obj.otherEnUU = response.data.uu
+//            obj.otherUserType = 'STORE'
+//            obj.otherEnterprise = {enUU: response.data.uu, name: response.data.enName}
+//            obj.type = 'CHAT'
+//            if (!(/^1\d{10}$/).test(response.data.enTel)) {
+//              this.$http.get('/basic/enterprise/' + response.data.uu + '/admin').then(response => {
+//                console.log(response)
+//                obj.toPhone = response.data.userTel
+//                console.log(obj)
+//                this.openWebChat(newTab, obj)
+//              }, err => {
+//                console.log(err)
+//                this.$message.error('暂无卖家管理员手机号!')
+//              })
+//            } else {
+//              obj.toPhone = response.data.enTel
+//              console.log(obj)
+//              this.openWebChat(newTab, obj)
+//            }
+//          }, err => {
+//            console.log(err)
+//          })
+//      }
+//    },
+//    openWebChat: function (newTab, obj) {
+//      this.$http.post('https://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+//        .then(response => {
+//          if (response.data.success) {
+//            newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
+//          } else {
+//            newTab.close()
+//            this.$message.error(response.data.message)
+//          }
+//        })
+//    },
     setShowShare: function (flag, event) {
       event.stopPropagation()
       this.loadQRcode()

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://192.168.253.121:9090/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://10.1.51.124:8080/platform-b2c/')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 
 module.exports = {

+ 25 - 0
utils/baseUtils.js

@@ -120,3 +120,28 @@ export const formatDate = (date, fmt) => {
   }
   return fmt
 }
+
+export const goLinkUser = ($this) => {
+  if ($this.user.logged) {
+    $this.$http.get('/basic/enterprise/' + $this.storeInfo.enUU + '/info').then(response => {
+      if (response.data.enTel) {
+        $this.tel = response.data.enTel
+        $this.showLinkBox = true
+      } else {
+        $this.$http.get('/basic/enterprise/' + response.data.uu + '/admin').then(response => {
+          $this.tel = response.data.userTel
+          $this.showLinkBox = true
+        }, err => {
+          $this.$message.error('获取卖家联系方式失败')
+          console.log(err)
+        })
+      }
+      $this.showLinkBox = true
+    }, err => {
+      $this.$message.error('获取卖家联系方式失败')
+      console.log(err)
+    })
+  } else {
+    $this.$router.push(`/auth/login?returnUrl=${window.location.href}`)
+  }
+}