Browse Source

rightBar添加优软互联按钮,店铺商品展示购买、购物车按钮功能调整

yangc 8 năm trước cách đây
mục cha
commit
9e5eda14b6

+ 38 - 0
components/default/RightBar.vue

@@ -28,6 +28,13 @@
             <p>周一至周五 9:00-18:00</p>
           </div>
         </li>
+        <li class="right-bar-item contact-menu">
+          <a href="javascript:void(0)" class="title" @click="goWebChat">
+            <i class="fa fa-comments-o" aria-hidden="true" style="font-size: 18px;color: #FFFFFF;">
+            </i>
+          </a>
+          <div class="sidebar-menu" title="优软互联"><a @click="goWebChat">优软互联</a><em><!-- ngIf: userInfo --></em></div>
+        </li>
       </ul>
       <ul class="right-bar-bottom">
         <li class="right-bar-item">
@@ -67,6 +74,7 @@
   </div>
 </template>
 <script>
+  import axios from '~/plugins/axios'
   import { scrollTo } from '~utils/scroll'
   import MessageBoard from '~components/messageBoard/MessageBoard.vue'
   export default {
@@ -97,6 +105,13 @@
       history () {
         let arr = this.$store.state.user.history.historyList.data.slice(0, 8)
         return arr
+      },
+      enterprise () {
+        let ens = this.user.data.enterprises
+        if (ens && ens.length) {
+          return ens.find(item => item.current) || ens[0]
+        }
+        return {}
       }
     },
     mounted () {
@@ -136,6 +151,29 @@
       deleteHistory (item, id) {
         this.$store.dispatch('user/deleteHistory', {id: id})
         this.loadHistorys()
+      },
+      goWebChat: function () {
+        // 获得窗口的垂直位置
+        let iTop = (window.screen.availHeight - 30 - 600) / 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')
+        axios.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
+            axios.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
+                }
+              })
+          }, err => {
+            console.log(err)
+          })
       }
     }
   }

+ 4 - 4
components/home/Search.vue

@@ -54,16 +54,16 @@
         default () {
           return [{
             name: 'SCT2080KEC',
-            url: 'product/component/1100400300009990'
+            url: '/product/component/1100400300009990'
           }, {
             name: '电池组',
-            url: 'product/kinds/346'
+            url: '/product/kinds/346'
           }, {
             name: 'Vishay',
-            url: 'product/brand/30327265e42a871be050007f01003d96'
+            url: '/product/brand/30327265e42a871be050007f01003d96'
           }, {
             name: 'Panasonic Battery',
-            url: 'product/brand/30327265e4e7871be050007f01003d96'
+            url: '/product/brand/30327265e4e7871be050007f01003d96'
           }]
         }
       }

+ 4 - 11
components/main/Search.vue

@@ -57,16 +57,16 @@
         default () {
           return [{
             name: 'SCT2080KEC',
-            url: 'product/component/1100400300009990'
+            url: '/product/component/1100400300009990'
           }, {
             name: '电池组',
-            url: 'product/kind/346'
+            url: '/product/kind/346'
           }, {
             name: 'Vishay',
-            url: 'product/brand/30327265e42a871be050007f01003d96'
+            url: '/product/brand/30327265e42a871be050007f01003d96'
           }, {
             name: 'Panasonic Battery',
-            url: 'product/brand/30327265e4e7871be050007f01003d96'
+            url: '/product/brand/30327265e4e7871be050007f01003d96'
           }]
         }
       }
@@ -83,15 +83,12 @@
     },
     methods: {
       onFocus () {
-        console.log('focus')
         this.associate.show = true
       },
       onBlur () {
-        console.log('blur')
         this.associate.show = this.associate.focus
       },
       onSelectChange (count) {
-        console.log('selectchange')
         let keywords = this.similarKeywords.data
         if (keywords && keywords.length) {
           let index = this.associate.activeIndex
@@ -109,7 +106,6 @@
         }
       },
       onChange () {
-        console.log('change')
         this.associate.activeIndex = null
         if (!this.keyword) {
           this.associate.show = false
@@ -123,12 +119,10 @@
         }
       },
       searchKeywords () {
-        console.log('searchkeywords')
         this.associate.show = true
         this.$store.dispatch('searchKeywords', { keyword: this.keyword })
       },
       onSearch () {
-        console.log('search')
         if (this.keyword) {
           this.associate.show = false
           this.$store.dispatch('resetSearchKeywords')
@@ -136,7 +130,6 @@
         }
       },
       onAssociateClick (word) {
-        console.log('assclick')
         this.click_flag = true
         this.keyword = word
         this.onSearch()

+ 3 - 7
components/store/RecommendProduct.vue

@@ -18,8 +18,8 @@
               <div class="price" v-if="commodity.minPriceRMB">¥ {{commodity.minPriceRMB}}</div>
               <div class="price" v-if="!commodity.minPriceRMB">$ {{commodity.minPriceUSD || 0}}</div>
             </a>
-            <div class="by-cart"><button title="加入购物车" @click="buy(false, commodity)"><img src="/images/store/icon/cart-blue.png"/></button></div>
-            <div class="buy-now"><button title="立即购买" @click="buy(true, commodity)">立即购买</button></div>
+            <div class="by-cart"><button title="加入购物车" @click="buyNow(false, commodity)"><img src="/images/store/icon/cart-blue.png"/></button></div>
+            <div class="buy-now"><button title="立即购买" @click="buyNow(true, commodity)">立即购买</button></div>
           </div>
         </li>
       </ul>
@@ -60,12 +60,8 @@
                 .then(response => {
                   window.location.href = '/user#/order/pay/' + this.enidfilter(response.data.orderid)
                 }, err => {
+                  Message.error('以下器件null对应的商品不存在,请您重新选择')
                   console.log(err)
-                  this.$http.get('/login/page').then(response => {
-                    if (response.data) {
-                      this.$router.push('/auth/login')
-                    }
-                  })
                 })
             } else {
               // this.$store.dispatch('user/addCar', {uuid: item.uuid, batchCode: item.batchCode, number: item.minBuyQty})

+ 3 - 1
layouts/main.vue

@@ -11,7 +11,6 @@
 <script>
   import { Header, Footer, RightBar } from '~components/default'
   import { MainHeader, MainNav } from '~components/main'
-
   export default {
     name: 'main',
     components: {
@@ -20,6 +19,9 @@
       RightBar,
       MainHeader,
       MainNav
+    },
+    created () {
+     // console.log(window.location.href)
     }
   }
 </script>