Browse Source

Merge remote-tracking branch 'origin/release-20170915' into release-20170915

wangdy 8 years ago
parent
commit
b7d0dbfac9

+ 13 - 0
app.html

@@ -10,6 +10,10 @@
   {{ HEAD }}
   <script>
     var _hmt = _hmt || [];
+    var _paq = _paq || [];
+    /* tracker methods like "setCustomDimension" should be called before "trackPageView" */
+    _paq.push(['trackPageView']);
+    _paq.push(['enableLinkTracking']);
     (function (w, d) {
       if (/(MSIE)|(Trident)/.test(w.navigator.userAgent)) {
         var head = d.getElementsByTagName('head')[0]
@@ -41,6 +45,15 @@
       }
       var s = document.getElementsByTagName("script")[0];
       s.parentNode.insertBefore(bp, s);
+
+      // 用户浏览统计
+      <!-- Piwik -->
+        var u="//piwik.ubtob.com/";
+        _paq.push(['setTrackerUrl', u+'piwik.php']);
+        _paq.push(['setSiteId', '1']);
+        var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
+        g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
+      <!-- End Piwik Code -->
     })(window, document)
   </script>
   <script type="text/javascript">

+ 36 - 0
components/common/loading/Loading.vue

@@ -0,0 +1,36 @@
+<template lang="html">
+  <div class="loading" v-if="loading">
+    <img src="/images/all/loading.gif" alt="">
+  </div>
+</template>
+<script>
+  export default {
+    data: () => ({
+      loading: false
+    }),
+    methods: {
+      start () {
+        this.loading = true
+      },
+      finish () {
+        this.loading = false
+      }
+    }
+  }
+</script>
+<style scoped>
+  .loading {
+    position: fixed;
+    top: 0;
+    left: 0;
+    right: 0;
+    width:  100%;
+    height: 100%;
+    z-index: 1000;
+    text-align: center;
+  }
+  .loading img {
+    position: relative;
+    top: 40%;
+  }
+</style>

+ 116 - 36
components/default/Header.vue

@@ -10,28 +10,35 @@
         </div>
         <div class="navbar-right">
           <template v-if="user.logged">
-            <div class="item-wrap dropdown" @mouseleave="showEnterprises = false">
+            <div class="item-wrap dropdown">
               <div class="item dropdown-toggle">
                 欢迎您,{{ user.data.userName }}&nbsp;|&nbsp;
                 <a @click="logout()">[退出]</a>
                 <span>{{enterprise.enName}}</span>
               </div>
-              <ul class="dropdown-menu">
-                <li class="menu-item-first">
-                  <span class="member-text" :title="enterprise.enName"><i class="fa fa-map-marker"></i>&nbsp;{{ enterprise.uu?enterprise.enName: user.data.userName + '(个人账户)' }}</span>
-                  <a class="pull-right" @click="toggleEnterprises()" v-if="user.data.enterprises && user.data.enterprises.length > 0">
+              <div class="dropdown-menu">
+                <div class="menu-item-first">
+                  <span>您可切换至以下账户:</span>
+                </div>
+                <ul>
+                 <!-- <li class="menu-item-first">
+                    <span class="member-text" :title="enterprise.enName"><i class="fa fa-map-marker"></i>&nbsp;{{ enterprise.uu?enterprise.enName: user.data.userName + '(个人账户)' }}</span>
+                    <a class="pull-right" @click="toggleEnterprises()" v-if="user.data.enterprises && user.data.enterprises.length > 0">
                     {{ showEnterprises ? '取消' : '切换' }}
-                  </a>
-                </li>
-                <li class="menu-item"
-                    v-for="en in user.data.enterprises"
-                    v-if="showEnterprises && en.uu!=enterprise.uu">
-                  <a @click="switchEnterprise(en)" :title="en.enName">{{ en.enName }}</a>
-                </li>
-                <li class="menu-item"  v-if="showEnterprises && enterprise.uu">
-                  <a @click="switchEnterprise({uu: 0})"><span v-text="user.data.userName"></span>(个人账户)</a>
-                </li>
-              </ul>
+                    </a>
+                    <span>您可切换至以下账户:</span>
+                    <input type="text" placeholder="请输入公司名称" v-model="keyword"><span class="search-enterprise" @click="searchEnterprise()">搜索</span>
+                  </li>-->
+                  <li class="menu-item"
+                      v-for="en in sortEnterprises"
+                      v-if="en.uu!=enterprise.uu">
+                    <a @click="switchEnterprise(en)" :title="en.enName">{{ en.enName }}</a>
+                  </li>
+                  <li class="menu-item"  v-if="enterprise.uu">
+                    <a @click="switchEnterprise({uu: 0})"><span v-text="user.data.userName"></span>(个人账户)</a>
+                  </li>
+                </ul>
+              </div>
             </div>
             <nuxt-link class="item" :to="'/'">商城首页</nuxt-link>
             <!--<nuxt-link class="item" to="/user">买家中心</nuxt-link>
@@ -58,7 +65,11 @@
     name: 'header',
     data () {
       return {
-        showEnterprises: false
+//        showEnterprises: false
+//        searchEnterpriseArr: [],
+//        keyword: '',
+//        isSearching: false
+        showEnterpriseToggle: false
       }
     },
     computed: {
@@ -73,6 +84,15 @@
           return {enName: '个人账户'}
         }
       },
+      sortEnterprises () {
+        let ens = this.user.data.enterprises
+        if (ens && ens.length) {
+          ens.sort(function (a, b) {
+            return b.lastLoginTime - a.lastLoginTime
+          })
+        }
+        return ens
+      },
       url () {
         return this.$store.state.option.url
       }
@@ -100,12 +120,13 @@
           }
         })
       },
-      toggleEnterprises () {
-        this.showEnterprises = !this.showEnterprises
-      },
+//      toggleEnterprises () {
+//        this.showEnterprises = !this.showEnterprises
+//      },
       // 切换当前企业
       switchEnterprise (en) {
-        this.toggleEnterprises()
+//        this.toggleEnterprises()
+        this.showEnterpriseToggle = false
         this.$http.get(`/user/authentication/${en.uu}`).then(() => {
           this.$store.dispatch('loadUserInfo')
 //          let href = window.location.href
@@ -142,9 +163,21 @@
           }
         }
       }
-    },
-    beforeMount () {
-      // this.$store.dispatch('loadUserInfo')
+//      searchEnterprise () {
+//        let key = this.keyword
+//        let enterprise = this.user.data.enterprises
+//        this.isSearching = true
+//        this.searchEnterpriseArr = []
+//        if (this.keyword === '') {
+//          this.isSearching = false
+//        } else {
+//          for (let i = 0; i < enterprise.length; i++) {
+//            if (enterprise[i].enName.indexOf(key) !== -1) {
+//              this.searchEnterpriseArr.push(enterprise[i])
+//            }
+//          }
+//        }
+//      }
     }
   }
 </script>
@@ -162,7 +195,7 @@
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
-    height: 30px;
+    height: 25px;
   }
   .header .navbar .navbar-container .navbar-right .dropdown .dropdown-menu .menu-item{
     height: 30px;
@@ -239,9 +272,11 @@
           }
 
           .dropdown {
-
             .dropdown-toggle {
               line-height: $nav-height;
+              border-left: 1px solid $black-light;
+              border-right: 1px solid $black-light;
+              height: 35px;
               a {
                 margin-left: 15px;
                 float: right;
@@ -249,6 +284,10 @@
                   color: $red !important;
                 }
               }
+              &:hover {
+                border-left: 1px solid #999;
+                border-right: 1px solid #999;
+              }
               span {
                 display: inline-block;
                 max-width: 190px;
@@ -258,25 +297,66 @@
                 float: right;
               }
             }
+            .menu-item-first {
+              background: #eee;
+              padding: 0 12px;
+              line-height: 30px;
+              font-size: 12px;
+              >span:nth-child(1) {
+                cursor: default;
+              }
+              input {
+                width: 174px;
+                height: 24px;
+                margin-left: 35px;
+                background: #fff;
+                border: 1px solid #5078cb;
+                padding-left: 4px;
+              }
+              .search-enterprise {
+                display: inline-block;
+                width: 36px;
+                height: 24px;
+                color: #fff;
+                background: #5078cb;
+                text-align: center;
+                line-height: 24px;
+                cursor: pointer;
+              }
+            }
 
             .dropdown-menu {
-              min-width: 220px;
-              margin-left: -1px;
-              border: $border;
-              border-top: none;
-              padding: 1em;
+              padding: 0 6px 13px;
               margin:0;
-              border: none;
               border-radius: 0;
+              right: unset;
+              background: #fff;
+              border: 1px solid #999999;
+              border-top: none;
+              -webkit-box-shadow: none;
+              -moz-box-shadow: none;
+              box-shadow: none;
+
+              ::-webkit-scrollbar {
+                background: #f6f6f6;
+              }
 
-              .menu-item-first {
-                margin-bottom: 10px;
+              ul {
+                max-height: 300px;
+                overflow-y: auto;
+                background: #f6f6f6;
               }
 
               .menu-item {
-                line-height: 30px;
+                padding: 0 12px;
                 a {
-                  color: $accent;
+                  color: #333;
+                  max-width: 300px;
+                  line-height: 30px;
+                  &:hover {
+                    color: #5078cb;
+                    text-decoration: none!important;
+                  }
                 }
               }
             }

+ 3 - 3
components/default/RightBar.vue

@@ -233,16 +233,16 @@
         }
       },
       openWebChat: function (newTab, obj) {
-        this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+        this.$http.post('https://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
+              newTab.location.href = 'https://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}})
+          this.$http.get('https://im.ubtob.com/api/chat/message', {params: {enUU: this.enterprise.uu, operate: 'count_unread', phone: this.user.data.userTel}})
             .then(response => {
               this.chatCount = response.data.count
             })

+ 1 - 1
components/product/ComponentGoods.vue

@@ -12,7 +12,7 @@
         <th width="160">品牌/型号</th>
         <th width="100">包装/生产日期</th>
         <th width="110">库存</th>
-        <th width="90">数量</th>
+        <th width="90">梯度/pcs</th>
         <th width="90">香港交货<span style="font-size: 12px;">($)</span></th>
         <th width="100">大陆交货<span style="font-size: 12px;">(¥)</span></th>
         <th width="100">交期(天)</th>

+ 1 - 1
components/product/component/StoreInfo.vue

@@ -38,7 +38,7 @@
             <th class="text-center" width="120">生产日期</th>
             <th class="text-center" width="80">包装方式</th>
             <th class="text-center" width="150">库存</th>
-            <th class="text-center" width="80">数量</th>
+            <th class="text-center" width="80">梯度/pcs</th>
             <th class="text-center" width="100">香港交货<span style="font-size: 12px;">($)</span></th>
             <th class="text-center" width="130">大陆交货<span style="font-size: 12px;">(¥)</span></th>
             <th class="text-center" width="120">交期<span style="font-size: 12px;">(天)</span></th>

+ 3 - 1
components/provider/Carousel.vue

@@ -3,7 +3,9 @@
     <div v-swiper:mySwiper="swiperOption">
       <div class="swiper-wrapper">
         <div class="swiper-slide" v-for="banner in banners">
-          <img :src="banner.pictureUrl">
+          <a :href="banner.hrefUrl" target="_blank">
+            <img :src="banner.pictureUrl">
+          </a>
         </div>
       </div>
       <div class="swiper-pagination swiper-pagination-bullets"></div>

+ 1 - 1
components/search/GoodList.vue

@@ -45,7 +45,7 @@
             <th width="100">封装/生产日期</th>
             <th width="110">店铺名称</th>
             <th width="110">库存</th>
-            <th width="90">梯</th>
+            <th width="90">梯度/pcs</th>
             <th width="90" v-if="!crname_click_flag.rmb_click_flag">香港交货</th>
             <th width="110" v-if="!crname_click_flag.usd_click_flag">大陆交货<span style="font-size: 12px;">(含税)</span></th>
             <th width="110">交期<span style="font-size: 12px;">(天)</span></th>

+ 1 - 1
components/search/ResultTitle.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="result-title text-muted">
-    搜索"<span class="text-inverse" >{{keyword}}</span>"<span v-if="status != 1">暂无结果</span>
+    搜索"<span class="text-inverse" >{{keyword}}</span>"<span v-if="status != 1">暂无此型号</span>
     <span v-if="status != 3">,为您找到
     <span class="text-num" v-text="good_list.total"></span> 个<span v-if="status == 2">相关</span>产品</span>:
   </div>

+ 64 - 44
components/store/CommodityInfo.vue

@@ -63,7 +63,7 @@
               <span class="name">数&nbsp;量</span>:
               <div class="input-group" style="width: 120px">
                 <div :class="fragment.canSub ? ' input-group-addon operate':'input-group-addon'" @click="fragment.canSub ?subNum():''" :style="!fragment.canSub ?'cursor: not-allowed;':''">-</div>
-                <input type="text" class="form-control" placeholder="数量" v-model="fragment.num" @change="inputNum()"style="padding: 0;min-width: 100px;text-align: center;"/>
+                <input type="text" class="form-control" placeholder="数量" v-model="fragment.num" @change="inputNum()" @input="onInput()" style="padding: 0;min-width: 100px;text-align: center;"/>
                 <div :class="fragment.canAdd ?'input-group-addon operate':'input-group-addon'" @click="fragment.canAdd ?addNum():''" :style="!fragment.canAdd ?'cursor: not-allowed;':''">+</div>
                 <!--   <div class="input-group-addon operate" @click="subNum()">-</div>
                    <input type="text" class="form-control" placeholder="数量" v-model="fragment.num" @change="inputNum()"style="padding: 0;min-width: 100px;text-align: center;"/>
@@ -99,7 +99,7 @@
               <div class="title">价格梯度</div>
               <div class="table">
                 <div class="head">
-                  <div class="fragment">数量</div>
+                  <div class="fragment">梯度/pcs</div>
                   <div class="price">单价¥(含税)</div>
                   <div class="price">单价$</div>
                 </div>
@@ -176,6 +176,10 @@
           canSub: true}
       }
     },
+    watch: {
+      fragment: function (val, oldVal) {
+      }
+    },
     filters: {
       currency: function (num) {
         if (typeof num === 'number' && num > 0) {
@@ -228,6 +232,18 @@
       })
     },
     methods: {
+      onInput () {
+        let prices = this.commodity.prices
+        if (prices && prices.length) {
+          let _this = this
+          for (let i = 0; i < prices.length; i++) {
+            if (_this.fragment.num >= prices[i].start && _this.fragment.num < prices[i].end) {
+              _this.fragment.price = _this.fragment.currency === 'RMB' ? prices[i].rMBPrice : prices[i].uSDPrice
+              break
+            }
+          }
+        }
+      },
       loadSaveHistory () {
         if (this.user.logged) {
           this.$store.dispatch('shop/saveHistory', {id: this.commodity.batchCode})
@@ -245,55 +261,59 @@
         let buy = this.commodity.minBuyQty
         let reserve = this.commodity.reserve
         let breakUp = this.commodity.breakUp
-        newNum = parseInt(newNum)
-        if (breakUp) {
-          if (newNum < buy) {
-            this.$message.error('最小起订量为' + buy)
-            this.fragment.num = buy
-            this.fragment.canSub = false
-            this.fragment.canAdd = true
-          } else if (newNum > reserve) {
-            this.$message.error('库存不足')
-            this.fragment.num = reserve
-            this.fragment.canAdd = false
-            this.fragment.canSub = true
-          } else {
-            this.fragment.canSub = true
-            this.fragment.canAdd = true
-            this.fragment.num = newNum
-            newNum === buy && (this.fragment.canSub = false)
-            newNum === reserve && (this.fragment.canAdd = false)
-          }
+        if (!newNum) {
+          this.fragment.num = buy
         } else {
-          if (newNum < buy) {
-            this.$message.error('最小起订量为' + buy)
-            this.fragment.num = buy
-            this.fragment.canSub = false
-            if (newNum > reserve) {
+          newNum = parseInt(newNum)
+          if (breakUp) {
+            if (newNum < buy) {
+              this.$message.error('最小起订量为' + buy)
+              this.fragment.num = buy
+              this.fragment.canSub = false
+              this.fragment.canAdd = true
+            } else if (newNum > reserve) {
               this.$message.error('库存不足')
-              this.fragment.num = reserve - (reserve % pack)
+              this.fragment.num = reserve
               this.fragment.canAdd = false
+              this.fragment.canSub = true
+            } else {
+              this.fragment.canSub = true
+              this.fragment.canAdd = true
+              this.fragment.num = newNum
+              newNum === buy && (this.fragment.canSub = false)
+              newNum === reserve && (this.fragment.canAdd = false)
             }
-          } else if (newNum > reserve) {
-            this.fragment.canSub = true
-            this.fragment.canAdd = false
-            this.$message.error('库存不足')
-            this.fragment.num = reserve - (reserve % pack)
           } else {
-            this.fragment.canSub = true
-            this.fragment.canAdd = true
-            let remainder = newNum % pack
-            if (remainder !== 0) {
-              console.log(this.fragment.num)
-              this.$message.error('不支持拆包且包装量为' + pack)
-              // 这个直接赋值的,应该给这个值进行判断(Math.floor(newNum / pack) + 1) * pack
-              let res = (Math.floor(newNum / pack) + 1) * pack
-              this.fragment.num = res > reserve ? Math.floor(newNum / pack) * pack : res
+            if (newNum < buy) {
+              this.$message.error('最小起订量为' + buy)
+              this.fragment.num = buy
+              this.fragment.canSub = false
+              if (newNum > reserve) {
+                this.$message.error('库存不足')
+                this.fragment.num = reserve - (reserve % pack)
+                this.fragment.canAdd = false
+              }
+            } else if (newNum > reserve) {
+              this.fragment.canSub = true
+              this.fragment.canAdd = false
+              this.$message.error('库存不足')
+              this.fragment.num = reserve - (reserve % pack)
             } else {
-              this.fragment.num = newNum
+              this.fragment.canSub = true
+              this.fragment.canAdd = true
+              let remainder = newNum % pack
+              if (remainder !== 0) {
+//                console.log(this.fragment.num)
+                this.$message.error('不支持拆包且包装量为' + pack)
+                // 这个直接赋值的,应该给这个值进行判断(Math.floor(newNum / pack) + 1) * pack
+                let res = (Math.floor(newNum / pack) + 1) * pack
+                this.fragment.num = res > reserve ? Math.floor(newNum / pack) * pack : res
+              } else {
+                this.fragment.num = newNum
+              }
+              newNum === buy && (this.fragment.canSub = false)
+              newNum === reserve && (this.fragment.canAdd = false)
             }
-            newNum === buy && (this.fragment.canSub = false)
-            newNum === reserve && (this.fragment.canAdd = false)
           }
         }
       },

+ 1 - 1
components/store/CommodityList.vue

@@ -34,7 +34,7 @@
             <th width="150">品牌/型号</th>
             <th width="100">包装/生产日期</th>
             <th width="90">库存</th>
-            <th width="90">数量</th>
+            <th width="90">梯度/pcs</th>
             <th width="90">香港交货<span style="font-size: 12px;">($)</span></th>
             <th width="100">大陆交货<span style="font-size: 12px;">(¥)</span></th>
             <th width="100">交期(天)</th>

+ 2 - 2
components/store/common/StoreHeader.vue

@@ -171,10 +171,10 @@ export default {
       }
     },
     openWebChat: function (newTab, obj) {
-      this.$http.post('http://im.ubtob.com/api/chat/infos?condition=chat_info', obj)
+      this.$http.post('https://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
+            newTab.location.href = 'https://im.ubtob.com/chat/visit?gid=' + response.data.content
           }
         })
     }

+ 3 - 3
layouts/shop.vue

@@ -46,7 +46,7 @@
       },
       title () {
         let path = this.$route.path
-        if (path.startsWith('/store/') && getCount(path, '/') === 2) {
+        if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
           if (path.indexOf('33069557578d44e69bd91ad12d28a8d4') === -1) {
             return this.storeInfo.storeName + this.getStoreType(this.storeInfo.type) + '专卖店-优软商城'
           } else {
@@ -60,7 +60,7 @@
       },
       description () {
         let path = this.$route.path
-        if (path.startsWith('/store/') && getCount(path, '/') === 2) {
+        if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
           if (path.indexOf('33069557578d44e69bd91ad12d28a8d4') === -1) {
             return this.storeInfo.storeName + '官方' + this.getStoreType(this.storeInfo.type) + '专卖店,提供最新IC电子元器件现货在线销售。'
           } else {
@@ -74,7 +74,7 @@
       },
       keywords () {
         let path = this.$route.path
-        if (path.startsWith('/store/') && getCount(path, '/') === 2) {
+        if ((path.startsWith('/store/') && getCount(path, '/') === 2) || path.endsWith('/description')) {
           if (path.indexOf('33069557578d44e69bd91ad12d28a8d4') === -1) {
             return '电子元器件' + this.getStoreType(this.storeInfo.type) + '专卖店'
           } else {

+ 4 - 4
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://10.10.100.107:8081/platform-b2c/' : 'http://192.168.253.121:8887/b2c-im/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://10.10.100.107:8081/platform-b2c/' : 'http://192.168.253.60:9090/platform-b2c/')
 
 module.exports = {
   router: {
@@ -23,9 +23,9 @@ module.exports = {
     ]
   },
   /*
-  ** Customize the progress-bar color
+  ** loading Style
   */
-  loading: { color: '#3B8070' },
+  loading: '~components/common/loading/Loading.vue',
   /*
   ** Build configuration
   */
@@ -107,5 +107,5 @@ module.exports = {
     ssr: false
   }],
   /* TODO 暂时代理到商城测试版,之后再做出调整 */
-  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**']
+  proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/register/**', '/logout/**', '/static/**', '/vendor**', '/user**', '/trade/**', '/recommendation/**', '/store-service/**', '/basic/**', '/logout**', '/operation/**', '/help**', '/product**', '/store**', '/order/proxy**', '/report/**', '/store/**#/**', '/kdn/**', '/product/**Submit', '/admin**', '/product/**Submit/**', '/release/**', '/auth/store/**', '/produce/**', '/file**', '/rate/**', '/log/**', '/help-service/**', '/keyword/**', '/tip/**']
 }