Browse Source

Merge remote-tracking branch 'origin/feature-201819-wangcz' into feature-201819-wangcz

shenjj 7 years ago
parent
commit
507a148274

+ 9 - 0
components/applyPurchase/SeekProduct.vue

@@ -83,6 +83,15 @@
         type: Object,
         default: {}
       }
+    },
+    watch: {
+      'showObj.show': {
+        handler: function (val) {
+          if (val) {
+            this.emptyForm()
+          }
+        }
+      }
     }
   }
 </script>

+ 76 - 0
components/base/SupplierEmpty.vue

@@ -0,0 +1,76 @@
+<template>
+  <div class="supplier-empty">
+    <el-dialog
+      title="提示"
+      :visible.sync="showObj.show">
+      <div class="form_dialog">
+        <p><span>供应商正在完善产品信息,</span>暂时不能查看更多。 </p>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <a type="button" @click="showObj.show = false">我知道了</a>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+<script>
+  export default {
+    props: {
+      showObj: {
+        type: Object,
+        default: () => {
+          return {
+            show: false
+          }
+        }
+      }
+    }
+  }
+</script>
+<style lang="scss">
+  .supplier-empty {
+    .el-dialog{
+      width: 290px!important;
+      .el-dialog__header{
+        background: #4290f7;
+        line-height: 40px;
+        padding: 0 20px 0;
+        display:block;
+        .el-dialog__title{
+          color:#fff;
+        }
+        .el-dialog__headerbtn:hover .el-dialog__close, .el-dialog__headerbtn:focus .el-dialog__close{
+          color:#fff;
+        }
+      }
+      .el-dialog__body{
+        padding: 10px 20px;
+      }
+      .el-dialog__footer{
+        text-align: center;
+        a{
+          display:inline-block;
+          background: #3c7cf5;
+          color:#fff;
+          font-size: 14px;
+          line-height: 30px;
+          height:30px;
+          padding:0 10px;
+          border-radius:5px;
+        }
+      }
+    }
+    .form_dialog{
+      p{
+        width:200px;
+        font-size: 14px;
+        color:#666666;
+        margin:0 auto;
+        padding-top:5px;
+        line-height: 20px;
+        span{
+          color:#eb6054;
+        }
+      }
+    }
+  }
+</style>

+ 2 - 0
components/base/index.js

@@ -0,0 +1,2 @@
+import SupplierEmpty from './SupplierEmpty.vue'
+export { SupplierEmpty }

+ 2 - 2
components/main/Nav.vue

@@ -83,9 +83,9 @@
       },
       goB2B () {
         if (this.user.logged) {
-          window.location.href = `${process.env.uasUrl}/#/index`
+          window.location.href = `${process.env.uasUrl}#/sale/pubinquiry`
         } else {
-          this.$router.push('/btbBusiness')
+          this.login()
         }
       }
     }

+ 55 - 17
components/main/Search.vue

@@ -3,7 +3,7 @@
     <div class="input-group">
       <template v-if="!isPcb">
         <div class="type">
-          <span class="type-item" :class="{active: newSearchType == 'code'}" @click="setNewSearchType('code')">型号</span>
+          <span class="type-item" :class="{active: newSearchType == 'component'}" @click="setNewSearchType('component')">型号</span>
           <span class="type-item" :class="{active: newSearchType == 'kind'}" @click="setNewSearchType('kind')">物料名称</span>
           <span class="type-item" :class="{active: newSearchType == 'store'}" @click="setNewSearchType('store')">卖家</span>
           <span class="type-item" :class="{active: newSearchType == 'brand'}" @click="setNewSearchType('brand')">品牌</span>
@@ -40,9 +40,9 @@
         v-show="showAssociate"
         @mouseenter="associate.focus=true"
         @mouseleave="associate.focus=false">
-      <li v-for="(k, index) in similarKeywords.data.all" class="item"
+      <li v-for="(v, index) in similarKeywords.result" class="item"
           :class="{'active': index==associate.activeIndex}"
-          @click.stop.prevent="onAssociateClick(k)">{{k}}
+          @click.stop.prevent="onAssociateClick(v.value)">{{v.value}}
       </li>
      <!-- <li v-if="similarKeywords.data.brand && similarKeywords.data.brand.length > 0" class="similar-title">品牌:</li>
       <li v-for="(k, index) in similarKeywords.data.brand" class="item"
@@ -100,7 +100,8 @@
         click_flag: false,
         searchType: 'product',
         // 新版搜索控制变量
-        newSearchType: 'code'
+        newSearchType: 'component',
+        isInit: false
       }
     },
     computed: {
@@ -111,13 +112,38 @@
         return this.$store.state.hotSearchBrand.hot.data
       },
       similarKeywords () {
-        return this.$store.state.search.keywords
+        let list = []
+        let data = this.$store.state.search.keywords.data.result
+        if (data && data.length > 0) {
+          data.forEach(item => {
+            if (this.newSearchType === 'component' && item.code) {
+              list.push({
+                value: item.code
+              })
+            } else if (this.newSearchType === 'kind' && item.nameCn) {
+              list.push({
+                value: item.nameCn
+              })
+            } else if (this.newSearchType === 'store' && item.name) {
+              list.push({
+                value: item.name
+              })
+            } else if (this.newSearchType === 'brand' && item.nameEn) {
+              list.push({
+                value: item.nameEn
+              })
+            }
+          })
+        }
+        return {
+          result: list
+        }
       },
       showAssociate () {
         return this.keyword &&
           this.associate.show &&
-          this.similarKeywords.data &&
-          (this.similarKeywords.data.brand || this.similarKeywords.data.component || this.similarKeywords.data.kind)
+          this.similarKeywords.result &&
+          this.similarKeywords.result.length
       },
       hotSearchData () {
         let list = this.$store.state.floor.list_v3.data
@@ -150,7 +176,7 @@
       placeholderByType () {
         let type
         switch (this.newSearchType) {
-          case 'code':
+          case 'component':
             type = '型号'
             break
           case 'brand':
@@ -171,11 +197,21 @@
     watch: {
       'keyword': {
         handler (val, oldVal) {
-          let keywords = this.similarKeywords.data
-          if (!keywords || !keywords.length || this.associate.activeIndex === null || val !== keywords[this.associate.activeIndex]) {
+          let keywords = this.similarKeywords
+          if (!keywords.result || !keywords.result.length || this.associate.activeIndex === null || val !== keywords[this.associate.activeIndex]) {
             this.onChange()
           }
         }
+      },
+      '$route': {
+        handler: function (route) {
+          if (route.path === '/search') {
+            this.newSearchType = route.query.type || 'component'
+            this.keyword = route.query.w || ''
+          }
+          this.isInit = true
+        },
+        immediate: true
       }
     },
     methods: {
@@ -194,7 +230,7 @@
         this.associate.show = this.associate.focus
       },
       onSelectChange (count) {
-        let keywords = this.similarKeywords.data
+        let keywords = this.similarKeywords
         if (keywords && keywords.length) {
           let index = this.associate.activeIndex
           if (index === null) {
@@ -216,7 +252,11 @@
           this.associate.show = false
           this.$store.dispatch('resetSearchKeywords')
         } else {
-          this.searchKeywords()
+          if (!this.isInit) {
+            this.searchKeywords()
+          } else {
+            this.isInit = false
+          }
         }
         if (this.click_flag) {
           this.associate.show = false
@@ -224,10 +264,8 @@
         }
       },
       searchKeywords () {
-        if (this.searchType === 'product') {
-          this.associate.show = true
-          this.$store.dispatch('searchKeywords', { keyword: this.keyword })
-        }
+        this.associate.show = true
+        this.$store.dispatch('searchKeywords', { keyword: this.keyword, type: this.newSearchType })
       },
       onSearch () {
         document.getElementsByClassName('search-input')[0].blur()
@@ -238,7 +276,7 @@
             this.$router.push({path: '/pcb/search?w=' + encodeURIComponent(this.keyword)})
           } else {
             if (this.searchType === 'product') {
-              this.$router.push({path: '/search?w=' + encodeURIComponent(this.keyword)})
+              this.$router.push({path: `/search?w=${encodeURIComponent(this.keyword)}&type=${this.newSearchType}`})
             } else if (this.searchType === 'store') {
               this.$router.push({path: '/searchStore?w=' + encodeURIComponent(this.keyword)})
             }

+ 9 - 2
components/product/brand/BrandDetail.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="brandDetail container">
-    <div class="menu-com row">
+    <div class="menu-com row" v-if="!supBrandObj">
       <div class="menu-title col-md-12">
         <a href="/product/brand/brandList/A">品牌中心</a> > <span>{{list.nameEn}}</span>
       </div>
@@ -27,6 +27,13 @@
 <script>
   export default {
     name: 'BrandsDetail',
+    // 主动传入的品牌
+    props: {
+      supBrandObj: {
+        type: Object,
+        default: null
+      }
+    },
     data () {
       return {
         applications: []
@@ -59,7 +66,7 @@
     },
     computed: {
       list () {
-        let list = this.baseUtils.deepCopy(this.$store.state.brandDetail.detail.data)
+        let list = this.supBrandObj || this.baseUtils.deepCopy(this.$store.state.brandDetail.detail.data)
         if (list.application && list.application !== '') {
           this.applications = list.application.split(',')
         }

+ 2 - 2
components/product/component/ComponentDetail.vue

@@ -17,13 +17,13 @@
             <div class="message-detail" v-if="list.brand">
               <div class="message-item">品牌</div>
               <div class="colon">:</div>
-              <div :title="list.brand.nameCn"><a class="message-body blue" target="_blank" :href="`/product/brand/${list.brand.uuid}`">{{list.brand.nameCn}}</a></div>
+              <div :title="list.brand ? list.brand.nameCn : ''"><a class="message-body blue" target="_blank" :href="`/product/brand/${list.brand.uuid}`">{{list.brand && list.brand.nameCn ?  list.brand.nameCn : ''}}</a></div>
             </div>
             <div class="message-detail">
               <div class="message-item">物料名称(类目)</div>
               <div class="colon">:</div>
               <div class="message-body body-long">
-                {{list.kind.nameCn || '-'}}
+                {{list.kind && list.kind.nameCn ? list.kind.nameCn : '-'}}
               </div>
             </div>
             <div class="message-detail">

+ 112 - 0
components/search/BrandList.vue

@@ -0,0 +1,112 @@
+<template>
+  <div class="search-brand-list">
+    <ul>
+      <nuxt-link :key="item.id" :to="`/search?w=${encodeURIComponent(item.nameEn)}&type=brand`" tag="li" v-for="item in brands">
+        <div class="img inline-block">
+          <img :src="item.logoUrl || '/images/component/default.png'" alt="">
+        </div>
+        <div class="params inline-block">
+          <p>
+            <span class="title inline-block">主营产品:</span>
+            <span class="content inline-block" :title="item.series">{{item.series}}</span>
+          </p>
+          <p>
+            <span class="title inline-block">应用领域:</span>
+            <span class="content inline-block" :title="item.applications">{{item.applications}}</span>
+          </p>
+          <p>
+            <span class="title inline-block">品牌介绍:</span>
+            <span class="content inline-block" :title="item.brief">{{item.brief}}</span>
+          </p>
+          <p>
+            <span class="title inline-block">官网地址:</span>
+            <span class="content inline-block" :title="item.url">{{item.url}}</span>
+          </p>
+        </div>
+        <button>了解详情</button>
+      </nuxt-link>
+    </ul>
+  </div>
+</template>
+<script>
+  export default {
+    computed: {
+      brands () {
+        let brands = this.baseUtils.deepCopy(this.$store.state.searchData.searchList.listNew.data.content) || []
+        if (brands.length) {
+          brands.forEach(item => {
+            if (item.application && item.application !== '') {
+              item.applications = item.application.split(',').join('|')
+            }
+          })
+        }
+        return brands
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .search-brand-list {
+    li {
+      border: 1px solid #e8e8e8;
+      border-bottom: none;
+      padding: 29px 18px 25px 30px;
+      &:last-child {
+        border-bottom: 1px solid #e8e8e8;
+      }
+      .img {
+        width: 208px;
+        height: 156px;
+        text-align: center;
+        line-height: 154px;
+        border-radius: 2px;
+        background: #fff;
+        border: 1px solid #e2e2e2;
+        img {
+          max-width: 186px;
+          max-height: 152px;
+        }
+      }
+      .params {
+        margin-left: 12px;
+        width: 743px;
+        color: #666;
+        p {
+          margin-top: 15px;
+          &:first-child {
+            margin-top: 0;
+          }
+          .title {
+            font-weight: bold;
+            vertical-align: top;
+          }
+          .content {
+            word-break: break-all;
+          }
+        }
+      }
+      button {
+        outline: none;
+        border: 1px solid #2496f1;
+        border-radius: 3px;
+        background: #fff;
+        color: #2496f1;
+        width: 100px;
+        height: 28px;
+        text-align: center;
+        margin-left: 75px;
+        &:hover {
+          background: #2496f1;
+          color: #fff;
+        }
+      }
+      &:hover {
+        background: #ecf2fd;
+        cursor: pointer;
+        .params {
+          color: #2e91f0;
+        }
+      }
+    }
+  }
+</style>

+ 26 - 12
components/search/ForwardGoodsList.vue

@@ -11,40 +11,40 @@
         </tr>
       </thead>
       <tbody>
-        <tr>
+        <tr v-for="item in forwardGood.content">
           <td>
             <div class="line">
-              <span class="title inline-block">原厂型号</span>
-              <span class="content inline-block">asdasdad</span>
+              <span class="title inline-block">型号</span>
+              <span class="content inline-block" :title="item.code" v-text="item.code || '-'"></span>
             </div>
             <div class="line">
               <span class="title inline-block">品牌</span>
-              <span class="content inline-block">asdasdad</span>
+              <span class="content inline-block" :title="item.pbrand || item.pbranden">{{item.pbrand || item.pbranden ||  '-'}}</span>
             </div>
           </td>
           <td class="single">
             <div class="line">
               <span class="title inline-block">卖家</span>
-              <span class="content inline-block">asdasdad</span>
+              <span class="content inline-block" :title="item.storeName">{{item.storeName || '-'}}</span>
             </div>
           </td>
           <td>
             <div class="line">
               <span class="title inline-block">物料名称(类目)</span>
-              <span class="content inline-block">asdasdad</span>
+              <span class="content inline-block" :title="item.kind || item.kinden">{{item.kind || item.kinden || '-'}}</span>
             </div>
             <div class="line">
               <span class="title inline-block">单位</span>
-              <span class="content inline-block">asdasdad</span>
+              <span class="content inline-block" :title="item.unit">{{item.unit || '-'}}</span>
             </div>
           </td>
           <td class="single">
             <div class="line">
               <span class="title inline-block">规格</span>
-              <span class="content inline-block text-ellipse">asdasdad</span>
+              <span class="content inline-block" :title="item.spec">{{item.spec || '-'}}</span>
             </div>
           </td>
-          <td><button @click="goSeek()">立即询价</button></td>
+          <td><button @click="authenticateInterceptor(goSeek(item))">立即询价</button></td>
         </tr>
       </tbody>
     </table>
@@ -65,8 +65,20 @@
     components: {
       SeekProduct
     },
+    computed: {
+      goods () {
+        return this.$store.state.searchData.searchList.listNew.data
+      },
+      forwardGood () {
+        return this.goods ? this.goods.futures : {}
+      }
+    },
     methods: {
-      goSeek: function () {
+      goSeek: function (item) {
+        this.productItem.cmpCode = item.code
+        this.productItem.brand = item.brand.nameEn
+        this.productItem.prodName = item.kind.nameCn
+        this.productItem.spec = item.spec
         this.showSeekObj.show = true
       }
     }
@@ -110,12 +122,12 @@
             }
             .title {
               color: #2496f1;
-              width: 27%;
+              width: 30%;
               text-align: right;
               vertical-align: top;
             }
             .content {
-              width: 73%;
+              width: 70%;
               padding-left: 10px;
               vertical-align: top;
               word-break: break-all;
@@ -133,6 +145,8 @@
             background: #2e91f0;
             border: none;
             outline: none;
+            display: block;
+            margin: 0 auto;
           }
         }
       }

+ 14 - 16
components/search/GoodList.vue

@@ -54,7 +54,7 @@
           </tr>
           </thead>
           <tbody id="productList-content">
-          <tr v-for="item in good_list.components" @click="goUnstandardDetail(item)">
+          <tr v-for="item in good_list.content" @click="goUnstandardDetail(item)">
             <!--<td>-->
             <!--<nuxt-link class="component-img-box" :to="item.batchCode?`/store/${item.storeId}/${item.batchCode}`:`/product/component/${item.uuid}`">-->
               <!--&lt;!&ndash;          <img :src="item.img?item.img:item.brand&&item.brand.logoUrl?item.brand.logoUrl:'/images/component/default.png'">&ndash;&gt;-->
@@ -64,10 +64,10 @@
           <!--</td>-->
             <td class="brand-code">
               <img v-if="item.status === 602" class="sellout-flag" src="/images/search/sellout-search.png" alt="">
-              <div class="brand" v-if="item.brand&&item.brand.nameEn"><nuxt-link :to="`/product/brand/${item.brand.uuid}`" class="text-num" v-text="item.brand.nameEn"></nuxt-link></div>
+              <div class="brand" v-if="item.branduuid"><nuxt-link :to="`/product/brand/${item.branduuid}`" class="text-num" v-text="item.brandNameCn || item.brandNameEn || '-'"></nuxt-link></div>
               <div class="brand" v-if="!item.brand||!item.brand.nameEn">{{item.brandEn||'—'}}</div>
-              <div class="brand"  v-if="item.kind&&item.kind.nameCn"><nuxt-link :to="`/product/kind/${item.kindid}`" v-text="item.kind.nameCn"></nuxt-link></div>
-              <div class="brand" v-if="!item.kind||!item.kind.nameCn">{{item.kindName || '—'}}</div>
+              <div class="brand" v-if="item.kindUuid"><nuxt-link :to="`/product/kind/${item.kindUuid}`" v-text="item.kindNameCn"></nuxt-link></div>
+              <div class="brand" v-if="!item.kindUuid">{{item.kindNameCn || '—'}}</div>
               <div class="code"  v-if="item.code">
                 <nuxt-link v-if="item.uuid" :to="`/product/component/${item.uuid}`" class="f16 text-bold text-num" v-text="item.code"></nuxt-link>
                 <span v-if="!item.uuid">{{item.code}}</span>
@@ -147,7 +147,7 @@
               </div>
             </td>
           </tr>
-          <tr v-if="good_list.components.length == 'undefined' ||good_list.components.length == 0">
+          <tr v-if="!good_list.content || !good_list.content.length">
             <td colspan="12">
               <div class="empty">
                 <p class="empty-img">
@@ -163,14 +163,12 @@
           </tbody>
         </table>
       </div>
-      <page :total="total_count" :page-size="pageSize"
-      :current="nowPage" @childEvent="listenPage"></page>
     </div>
   </div>
 </template>
 
 <script>
-  import Page from '~components/common/page/pageComponent.vue'
+//  import Page from '~components/common/page/pageComponent.vue'
   import Buy from '~components/common/buyOrCar/buyComponent.vue'
   export default {
     data () {
@@ -188,7 +186,7 @@
       }
     },
     components: {
-      Page,
+//      Page,
       Buy
     },
     props: ['crname_click_flag'],
@@ -226,13 +224,13 @@
     },
     computed: {
       good_lists () {
-        return this.$store.state.searchData.searchList.lists
+        return this.$store.state.searchData.searchList.listNew.data
       },
       good_list () {
-        return this.good_lists.data
+        return this.good_lists.stock || {}
       },
       total_count () {
-        return Math.min(this.good_list.total, 100 * this.pageSize)
+        return Math.min(this.good_list.total || 0, 100 * this.pageSize)
       },
       buy_info () {
         return this.$store.state.user.buy.buyInfo.data
@@ -261,10 +259,10 @@
           })
         }
       },
-      listenPage: function (changedPage) {
-        this.nowPage = changedPage
-        this.$emit('pageEvent', this.nowPage)
-      },
+//      listenPage: function (changedPage) {
+//        this.nowPage = changedPage
+//        this.$emit('pageEvent', this.nowPage)
+//      },
       sortBy: function (param) {
         if (param === 'normal1') {
           this.sorting = {}

+ 2 - 21
components/search/ResultTitle.vue

@@ -3,36 +3,17 @@
     搜索"<span class="text-inverse" >{{keyword}}</span>"
     <!--<span v-if="status != 1">暂无此型号</span>-->
     <span>,为您找到
-    <span class="text-num" v-text="good_list.total"></span> 个<span v-if="status == 2">相关</span>信息
+    <span class="text-num" v-text="count || 0"></span> 条信息
     </span>:
   </div>
 </template>
 <script>
   export default{
-    props: ['keyword', 'page'],
+    props: ['keyword', 'page', 'count'],
     data () {
       return {
         status: 1
       }
-    },
-    computed: {
-      good_lists () {
-        return this.$store.state.searchData.searchList.lists
-      },
-      good_list () {
-//        if (this.page === 1) {
-//          if (this.good_lists.data.components && this.good_lists.data.components.length > 0) {
-//            if (this.keyword.toUpperCase() === this.good_lists.data.components[0].code.toUpperCase()) {
-//              this.status = 1
-//            } else {
-//              this.status = 2
-//            }
-//          } else {
-//            this.status = 3
-//          }
-//        }
-        return this.good_lists.data
-      }
     }
   }
 </script>

+ 188 - 0
components/search/SupplierList.vue

@@ -0,0 +1,188 @@
+<template>
+  <div class="search-suppliers-list">
+    <ul class="list-inline">
+      <li class="clearfix" v-for="item in currentGoods.content" @click="goSup(item)">
+        <div class="img">
+          <img :src="item.storeLogoUrl || item.enLogoUrl || item.logoUrl || '/images/all/default.png'">
+          <!--<span class="has_shop"></span>-->
+        </div>
+        <div class="content">
+          <h3 class="enterprise_name">{{item.enName}}</h3>
+          <p>
+            <span>企业执照号:</span><span :title="item.enBusinesscode">{{item.enBusinesscode || '暂无信息'}}</span>
+            <span class="split_line">|</span>
+            <span>地址:</span><span :title="item.enAddress">{{item.enAddress || '暂无信息'}}</span>
+          </p>
+          <p>
+            <span>邮箱:</span><span :title="item.enEmail">{{item.enEmail || '暂无信息'}}</span>
+            <span class="split_line">|</span>
+            <span>电话:</span><span :title="item.enTel">{{item.enTel || '暂无信息'}}</span>
+            <span class="split_line">|</span>
+            <span>行业:</span><span :title="item.enIndustry">{{item.enIndustry || '暂无信息'}}</span>
+          </p>
+        </div>
+        <div class="select_btn">{{resultType === 'current' ? '进入店铺' : '了解详情'}}</div>
+      </li>
+    </ul>
+    <supplier-empty :showObj="showDialogObj"></supplier-empty>
+  </div>
+</template>
+<script>
+  import { SupplierEmpty } from '~components/base'
+  export default {
+    props: {
+      resultType: {
+        type: String,
+        default: 'current'
+      }
+    },
+    components: {
+      SupplierEmpty
+    },
+    data () {
+      return {
+        showSeekObj: {
+          show: false
+        },
+        productItem: {},
+        showDialogObj: {
+          show: false
+        }
+      }
+    },
+    computed: {
+      goods () {
+        return this.$store.state.searchData.searchList.listNew.data
+      },
+      currentGoods () {
+        if (this.goods) {
+          if (this.resultType === 'current') {
+            return this.goods.stock || {}
+          } else {
+            return this.goods.futures || {}
+          }
+        } else {
+          return {}
+        }
+      }
+    },
+    methods: {
+      goSup (item) {
+        if (this.resultType === 'current') {
+          if (item.storeUuid) {
+            this.$router.push(`/store/${item.storeUuid}`)
+          }
+        } else {
+          this.$http.get('vendor/introduction/product/count', {params: {vendUU: item.enUU}})
+            .then(res => {
+              if (res.data.count > 0) {
+                this.$router.push('supplier/' + item.enUU)
+              } else {
+                this.showDialogObj.show = true
+              }
+            }, err => {
+              console.log(err)
+            })
+        }
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  $border: 1px solid #e8e8e8;
+  .search-suppliers-list {
+    ul{
+      margin:0;
+      border: {
+        left: $border;
+        right: $border;
+        top: $border;
+      }
+      li{
+        position:relative;
+        width:100%;
+        vertical-align: top;
+        height:112px;
+        padding:15px;
+        border-bottom: $border;
+        .img{
+          position:relative;
+          float:left;
+          width:80px;
+          height:80px;
+          border:1px solid #ccc;
+          img{
+            width:100%;
+            height:100%;
+            vertical-align: top;
+          }
+          .has_shop {
+            position:absolute;
+            left:0;
+            top:0;
+            width:68px;
+            height:22px;
+            background: url(/images/supplier/icon/top_left.png)no-repeat;
+            color:#fff;
+            font-weight: bold;
+            text-align: center;
+            line-height: 22px;
+          }
+        }
+        .content{
+          margin-left:100px;
+          color:#333;
+          padding-top:2px;
+          .enterprise_name{
+            width:690px;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space:nowrap;
+            font-weight: bold;
+            color:#333;
+            font-size: 16px;
+            margin:0 0 10px;
+          }
+          p{
+            width:690px;
+            overflow: hidden;
+            text-overflow: ellipsis;
+            white-space:nowrap;
+            font-size: 14px;
+            color:#333;
+            margin:0 0 5px;
+            span{
+              &.split_line{
+                margin:0 5px;
+              }
+            }
+          }
+        }
+        .select_btn{
+          position:absolute;
+          top:40%;
+          right:20px;
+          z-index:250;
+          padding:5px 10px;
+          text-align: center;
+          background: #1891e4;
+          color:#fff;
+          border-radius:3px;
+        }
+        &:hover{
+          cursor:pointer;
+          background: #ecf2fd;
+          .content{
+            color:#2496f1;
+            .enterprise_name{
+              color:#2496f1;
+            }
+            p{
+              color:#2496f1;
+            }
+          }
+        }
+      }
+    }
+  }
+</style>

+ 3 - 1
components/search/index.js

@@ -2,5 +2,7 @@ import GoodList from './GoodList.vue'
 import Kind from './Kind.vue'
 import ResultTitle from './ResultTitle.vue'
 import ForwardGoodsList from './ForwardGoodsList.vue'
+import SupplierList from './SupplierList.vue'
+import BrandList from './BrandList.vue'
 
-export { GoodList, Kind, ResultTitle, ForwardGoodsList }
+export { GoodList, Kind, ResultTitle, ForwardGoodsList, SupplierList, BrandList }

+ 2 - 2
layouts/main.vue

@@ -43,7 +43,7 @@
           }
           return ''
         } else if (path.startsWith('/product/component/')) {
-          if (this.componentDetail) {
+          if (this.componentDetail && this.componentDetail.brand) {
             return this.componentDetail.brand.nameCn + this.componentDetail.code + '参数|供应商|数据手册中文资料|规格书-优软商城'
           } else {
             return ''
@@ -81,7 +81,7 @@
           }
           return ''
         } else if (path.startsWith('/product/component/')) {
-          if (this.componentDetail) {
+          if (this.componentDetail && this.componentDetail.brand) {
             return '优软商城提供' + this.componentDetail.brand.nameCn + this.componentDetail.code + '数据手册中文资料规格书下载,' + this.componentDetail.code + '供应商及参数报价。'
           } else {
             return ''

+ 1 - 1
pages/product/component/_uuid.vue

@@ -1,6 +1,6 @@
 <template>
   <div class="detail">
-    <div v-if="componentDetail">
+    <div v-if="componentDetail && componentDetail.uuid">
       <component-menu/>
       <component-detail/>
       <store-info/>

+ 216 - 138
pages/search/_keyword.vue

@@ -1,18 +1,19 @@
 <template>
 <div class="container" id="searchResult">
   <!--<detail-brand></detail-brand>-->
-  <result-title :keyword="key" :page="nowPage"></result-title>
+  <result-title :keyword="key" :page="nowPage" :count="count"></result-title>
   <!--  <kind @kindFilterEvent="listenKindFilter"
           @brandFilterEvent="listenBrandFilter"
           @typeFilterEvent="listenTypeFilter"
           @crnameFilterEvent="listenCrnameFilter"
           @crnameFlagEvent="listenCrnameFlag"
     ></kind>-->
-  <div class="search-result-type">
-    <span class="inline-block" :class="{active: resultType == 'current'}" @click="setResultType('current')">现货(5条)</span>
-    <span class="inline-block" :class="{active: resultType == 'forward'}" @click="setResultType('forward')">期货(5条)</span>
+  <brand-detail :supBrandObj="goods.brand" v-if="searchType == 'brand' && goods.brand"></brand-detail>
+  <div class="search-result-type" v-if="!goods.content">
+    <span class="inline-block" :class="{active: resultType == 'current'}" @click="setResultType('current')">现货({{stockTotal}}条)</span>
+    <span class="inline-block" :class="{active: resultType == 'forward'}" @click="setResultType('forward')">期货({{futureTotal}}条)</span>
   </div>
-  <template v-if="searchType == 'code'">
+  <template v-if="searchType == 'component'">
     <good-list v-if="resultType === 'current'"
                @pageEvent="listenPage"
                @sortEvent="listenSort"
@@ -21,17 +22,31 @@
     ></good-list>
     <forward-goods-list v-else></forward-goods-list>
   </template>
+  <template v-if="searchType == 'kind' || searchType == 'store' || (searchType == 'brand' && goods.brand)">
+    <supplier-list :resultType="resultType"></supplier-list>
+  </template>
+  <template v-if="searchType == 'brand' && !goods.brand">
+    <brand-list></brand-list>
+  </template>
+  <page :total="currentCount" :page-size="pageSize"
+        :current="nowPage" @childEvent="listenPage"></page>
+  <div class="empty" v-if="currentCount === 0">
+    <img src="/images/all/empty-cart.png" alt="">
+    <span>暂无搜索结果</span>
+  </div>
 </div>
 </template>
 <script>
-  import { GoodList, ResultTitle, ForwardGoodsList } from '~components/search'
+  import { GoodList, ResultTitle, ForwardGoodsList, SupplierList, BrandList } from '~components/search'
+  import { BrandDetail } from '~components/product'
+  import Page from '~components/common/page/pageComponent.vue'
 //  import DetailBrand from '~components/search/DetailBrand.vue'
   export default{
     layout: 'main',
     data () {
       return {
         key: this.$route.query.w,
-        pageSize: 15,
+        pageSize: 10,
         nowPage: 1,
         sorting: {},
         filter: {},
@@ -46,73 +61,113 @@
     },
     fetch ({store, route}) {
       return Promise.all([
-        store.dispatch('searchData/searchForKinds', {collectList: 'goods_kind', keyword: route.query.w, paramJSON: {}}),
-        store.dispatch('searchData/searchForBrands', {collectList: 'goods_brand', keyword: route.query.w, paramJSON: {}}),
-        store.dispatch('searchData/searchForList', {count: 15, filter: {}, keyword: route.query.w, page: 1, sorting: {}}),
-        store.dispatch('searchData/searchForStoreType', {collectList: 'goods_store_type', keyword: route.query.w, paramJSON: {}}),
-        store.dispatch('searchData/searchForCrname', {collectList: 'goods_crname', keyword: route.query.w, paramJSON: {}})
+        store.dispatch('searchData/searchForListNew', {count: 10, keyword: route.query.w, page: 1, type: route.query.type || 'component'})
       ])
     },
     components: {
       ResultTitle,
       GoodList,
-      ForwardGoodsList
+      ForwardGoodsList,
+      SupplierList,
+      Page,
+      BrandList,
+      BrandDetail
 //      DetailBrand
     },
     watch: {
-      '$route.query.w': {
+      '$route.query': {
         handler: function (val) {
-          this.key = val
+          this.key = val.w
           this.reloadAll()
         },
         immediate: false
       }
     },
     computed: {
+      // 搜索类型
       searchType () {
-        return this.$route.query.searchType || 'code'
+        return this.$route.query.type || 'component'
+      },
+      // 搜索结果
+      goods () {
+        return this.$store.state.searchData.searchList.listNew.data
+      },
+      // 现货数量
+      stockTotal () {
+        return this.goods.stock ? this.goods.stock.total : 0
+      },
+      // 期货数量
+      futureTotal () {
+        return this.goods.futures ? this.goods.futures.total : 0
+      },
+      // 当前分页数
+      currentCount () {
+        if (this.goods.content) {
+          return this.goods.total
+        } else {
+          return this.resultType === 'current' ? this.stockTotal : this.futureTotal
+        }
+      },
+      // 总数
+      count () {
+        if (this.goods.content) {
+          return this.goods.total
+        } else {
+          return this.stockTotal + this.futureTotal
+        }
       }
     },
     methods: {
+      initParams: function () {
+        this.resultType = 'current'
+        this.nowPage = 1
+      },
       reloadAll: function () {
         this.filter = {}
         this.sorting = {}
         this.paramJSON = {}
         this.reloadList()
-        this.reloadKind()
-        this.reloadBrand()
-        this.reloadStoreType()
-        this.reloadCrname()
+//        this.reloadKind()
+//        this.reloadBrand()
+//        this.reloadStoreType()
+//        this.reloadCrname()
       },
       reloadList: function () {
-        if (this.sorting === {}) {
-          this.sorting = {}
+        let params = {
+          count: this.pageSize,
+          keyword: this.$route.query.w,
+          page: this.nowPage,
+          type: this.searchType
         }
-        this.$store.dispatch('searchData/searchForList', {count: this.pageSize, filter: this.filter, keyword: this.$route.query.w, page: this.nowPage, sorting: this.sorting})
-      },
-      reloadKind: function () {
-        if (!this.filter.goods_kindId) {
-          this.$store.dispatch('searchData/searchForKinds', {collectList: 'goods_kind', keyword: this.$route.query.w, paramJSON: this.paramJSON})
-        }
-      },
-      reloadBrand: function () {
-        if (!this.filter.goods_brandId) {
-          this.$store.dispatch('searchData/searchForBrands', {collectList: 'goods_brand', keyword: this.$route.query.w, paramJSON: this.paramJSON})
-        }
-      },
-      reloadStoreType: function () {
-        if (!this.filter.goods_store_type) {
-          this.$store.dispatch('searchData/searchForStoreType', {collectList: 'goods_store_type', keyword: this.$route.query.w, paramJSON: this.paramJSON})
-        }
-      },
-      reloadCrname: function () {
-        if (!this.filter.goods_crname) {
-          this.$store.dispatch('searchData/searchForCrname', {collectList: 'goods_crname', keyword: this.$route.query.w, paramJSON: this.paramJSON})
+        if (this.searchType === 'component') {
+          params.filter = this.filter
+          params.sorting = this.sorting
         }
+        return this.$store.dispatch('searchData/searchForListNew', params)
       },
+//      reloadKind: function () {
+//        if (!this.filter.goods_kindId) {
+//          this.$store.dispatch('searchData/searchForKinds', {collectList: 'goods_kind', keyword: this.$route.query.w, paramJSON: this.paramJSON})
+//        }
+//      },
+//      reloadBrand: function () {
+//        if (!this.filter.goods_brandId) {
+//          this.$store.dispatch('searchData/searchForBrands', {collectList: 'goods_brand', keyword: this.$route.query.w, paramJSON: this.paramJSON})
+//        }
+//      },
+//      reloadStoreType: function () {
+//        if (!this.filter.goods_store_type) {
+//          this.$store.dispatch('searchData/searchForStoreType', {collectList: 'goods_store_type', keyword: this.$route.query.w, paramJSON: this.paramJSON})
+//        }
+//      },
+//      reloadCrname: function () {
+//        if (!this.filter.goods_crname) {
+//          this.$store.dispatch('searchData/searchForCrname', {collectList: 'goods_crname', keyword: this.$route.query.w, paramJSON: this.paramJSON})
+//        }
+//      },
       listenPage: function (nPage) {
         this.nowPage = nPage
-        this.reloadList()
+        return this.reloadList()
       },
       listenSort: function (sortType) {
         this.sorting = sortType
@@ -131,108 +186,131 @@
         }
         this.reloadList()
       },
-      listenKindFilter: function (kindarr) {
-        this.nowPage = 1
-        if (kindarr.length === 0) {
-          delete this.filter.goods_kindId
-          delete this.paramJSON.goods_kindid
-          this.reloadKind()
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadStoreType()
-          this.reloadCrname()
-        } else {
-          this.filter.goods_kindId = kindarr
-          this.paramJSON.goods_kindid = kindarr
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadStoreType()
-          this.reloadCrname()
-        }
-      },
-      listenBrandFilter: function (brandarr) {
-        this.nowPage = 1
-        if (brandarr.length === 0) {
-          delete this.filter.goods_brandId
-          delete this.paramJSON.goods_brandid
-          this.reloadKind()
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadStoreType()
-          this.reloadCrname()
-        } else {
-          this.filter.goods_brandId = brandarr
-          this.paramJSON.goods_brandid = brandarr
-          this.reloadKind()
-          this.reloadList()
-          this.reloadStoreType()
-          this.reloadCrname()
-        }
-      },
-      listenTypeFilter: function (typearr) {
-        this.nowPage = 1
-        if (typearr.length === 0) {
-          delete this.filter.goods_store_type
-          delete this.paramJSON.goods_store_type
-          this.reloadKind()
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadCrname()
-        } else {
-          this.filter.goods_store_type = typearr
-          this.paramJSON.goods_store_type = typearr
-          this.reloadKind()
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadCrname()
-        }
-      },
-      listenCrnameFilter: function (crnamearr) {
-        this.nowPage = 1
-        if (crnamearr.length === 0) {
-          delete this.filter.goods_crname
-          delete this.paramJSON.goods_crname
-          this.reloadKind()
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadStoreType()
-        } else {
-          this.filter.goods_crname = crnamearr
-          this.paramJSON.goods_crname = crnamearr
-          this.reloadKind()
-          this.reloadBrand()
-          this.reloadList()
-          this.reloadStoreType()
-        }
-      },
-      listenCrnameFlag: function (obj) {
-        if (obj.rmb_click_flag && obj.usd_click_flag) {
-          this.crname_click_flag.rmb_click_flag = false
-          this.crname_click_flag.usd_click_flag = false
+//      listenKindFilter: function (kindarr) {
+//        this.nowPage = 1
+//        if (kindarr.length === 0) {
+//          delete this.filter.goods_kindId
+//          delete this.paramJSON.goods_kindid
+//          this.reloadKind()
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadStoreType()
+//          this.reloadCrname()
+//        } else {
+//          this.filter.goods_kindId = kindarr
+//          this.paramJSON.goods_kindid = kindarr
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadStoreType()
+//          this.reloadCrname()
+//        }
+//      },
+//      listenBrandFilter: function (brandarr) {
+//        this.nowPage = 1
+//        if (brandarr.length === 0) {
+//          delete this.filter.goods_brandId
+//          delete this.paramJSON.goods_brandid
+//          this.reloadKind()
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadStoreType()
+//          this.reloadCrname()
+//        } else {
+//          this.filter.goods_brandId = brandarr
+//          this.paramJSON.goods_brandid = brandarr
+//          this.reloadKind()
+//          this.reloadList()
+//          this.reloadStoreType()
+//          this.reloadCrname()
+//        }
+//      },
+//      listenTypeFilter: function (typearr) {
+//        this.nowPage = 1
+//        if (typearr.length === 0) {
+//          delete this.filter.goods_store_type
+//          delete this.paramJSON.goods_store_type
+//          this.reloadKind()
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadCrname()
+//        } else {
+//          this.filter.goods_store_type = typearr
+//          this.paramJSON.goods_store_type = typearr
+//          this.reloadKind()
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadCrname()
+//        }
+//      },
+//      listenCrnameFilter: function (crnamearr) {
+//        this.nowPage = 1
+//        if (crnamearr.length === 0) {
+//          delete this.filter.goods_crname
+//          delete this.paramJSON.goods_crname
+//          this.reloadKind()
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadStoreType()
+//        } else {
+//          this.filter.goods_crname = crnamearr
+//          this.paramJSON.goods_crname = crnamearr
+//          this.reloadKind()
+//          this.reloadBrand()
+//          this.reloadList()
+//          this.reloadStoreType()
+//        }
+//      },
+//      listenCrnameFlag: function (obj) {
+//        if (obj.rmb_click_flag && obj.usd_click_flag) {
+//          this.crname_click_flag.rmb_click_flag = false
+//          this.crname_click_flag.usd_click_flag = false
+//        } else {
+//          this.crname_click_flag.rmb_click_flag = obj.rmb_click_flag
+//          this.crname_click_flag.usd_click_flag = obj.usd_click_flag
+//        }
+//      },
+      setResultType: function (resultType) {
+        if (this.nowPage > 1) {
+          this.listenPage(1).then(() => {
+            this.resultType = resultType
+          })
         } else {
-          this.crname_click_flag.rmb_click_flag = obj.rmb_click_flag
-          this.crname_click_flag.usd_click_flag = obj.usd_click_flag
+          this.resultType = resultType
         }
-      },
-      setResultType: function (resultType) {
-        this.resultType = resultType
+//        this.listenPage(1).then(() => {
+//          this.resultType = resultType
+//        })
       }
     }
   }
 </script>
 <style lang="scss" scoped>
-  .search-result-type {
-    border-bottom: 2px solid #2e91f0;
-    span {
-      padding: 12px 37px;
-      color: #666;
-      font-size: 14px;
-      border: 1px solid #ccc;
-      cursor: pointer;
-      &.active {
-        color: #fff;
-        background: #2e91f0;
-        border-color: #2e91f0;
+  #searchResult {
+    margin-bottom: 36px;
+    .search-result-type {
+      border-bottom: 2px solid #2e91f0;
+      span {
+        padding: 12px 37px;
+        color: #666;
+        font-size: 14px;
+        border: 1px solid #ccc;
+        cursor: pointer;
+        &.active {
+          color: #fff;
+          background: #2e91f0;
+          border-color: #2e91f0;
+        }
+      }
+    }
+    .empty {
+      text-align: center;
+      height: 200px;
+      line-height: 200px;
+      border: 1px solid #e8e8e8;
+      margin-bottom: 10px;
+      span {
+        color: #999;
+        margin-left: 10px;
       }
     }
   }

+ 8 - 1
plugins/mixin.js

@@ -100,7 +100,7 @@ Vue.mixin({
       }
     },
     login: function (url) {
-      this.$router.push(`/auth/login${url ? '?returnUrl=' + url : ''}`)
+      this.$router.push(`/auth/login${url ? '?returnUrl=' + encodeURIComponent(url) : ''}`)
     },
     goStoreApply: function () {
       if (this.user.logged) {
@@ -128,6 +128,13 @@ Vue.mixin({
     },
     authorityInterceptor: function (url, callback) {
       this.baseUtils.getAuthority(this, url, callback, this.isMobile)
+    },
+    authenticateInterceptor: function (callback) {
+      if (this.user.logged) {
+        callback.call(this)
+      } else {
+        this.login(window.location.href)
+      }
     }
   },
   filters: {

+ 10 - 0
store/searchData.js

@@ -118,6 +118,16 @@ export const actions = {
       }, err => {
         commit('searchHistory/GET_SEARCH_HISTORY_FAILURE', err)
       })
+  },
+  // 获取搜索历史
+  searchForListNew ({ commit }, params = {}) {
+    commit('searchList/REQUEST_LIST_NEW', params)
+    return axios.get(`/search/201819`, {params})
+      .then(response => {
+        commit('searchList/GET_LIST_NEW_SUCCESS', response.data)
+      }, err => {
+        commit('searchList/GET_LIST_NEW_FAILURE', err)
+      })
   }
 }
 

+ 14 - 0
store/searchData/searchList.js

@@ -2,6 +2,10 @@ export const state = () => ({
   lists: {
     fetching: false,
     data: []
+  },
+  listNew: {
+    fetching: false,
+    data: []
   }
 })
 
@@ -15,5 +19,15 @@ export const mutations = {
   GET_LIST_SUCCESS (state, result) {
     state.lists.fetching = false
     state.lists.data = result
+  },
+  REQUEST_LIST_NEW (state) {
+    state.listNew.fetching = true
+  },
+  GET_LIST_NEW_FAILURE (state) {
+    state.listNew.fetching = false
+  },
+  GET_LIST_NEW_SUCCESS (state, result) {
+    state.listNew.fetching = false
+    state.listNew.data = result
   }
 }

+ 1 - 1
utils/mixin.js

@@ -337,8 +337,8 @@ export const seekProduct = {
         this.$http.post('/inquiry/buyer/save', inquiry)
           .then(res => {
             this.$message.success('发布成功')
-            this.hasDialog = false
             this.emptyForm()
+            this.showObj.show = false
           }, error => {
             console.log(error)
             this.$message.error('发布失败')