소스 검색

Merge branch 'brandDetailVendorList-1220'

# Conflicts:
#	components/default/Header.vue
#	components/default/RightBar.vue
#	components/product/brand/BrandComponent.vue
#	components/store/CommodityInfo.vue
#	nuxt.config.js
hangb 7 년 전
부모
커밋
7cd2cc5589
7개의 변경된 파일161개의 추가작업 그리고 13개의 파일을 삭제
  1. 1 0
      README.md
  2. 2 0
      components/home/News.vue
  3. 123 7
      components/product/brand/BrandComponent.vue
  4. 2 6
      pages/product/brand/_code.vue
  5. BIN
      static/images/store/common/goIn.png
  6. 15 0
      store/product.js
  7. 18 0
      store/product/supplierInformation.js

+ 1 - 0
README.md

@@ -20,3 +20,4 @@ $ npm run generate
 ```
 
 For detailed explanation on how things work, checkout the [Nuxt.js docs](https://github.com/nuxt/nuxt.js).
+

+ 2 - 0
components/home/News.vue

@@ -57,6 +57,8 @@
 </script>
 <style lang="scss" scoped>
   .news {
+    width: 100%;
+    margin: 0 auto;
     height: 280px;
     width: 100%;
     margin: 0 auto;

+ 123 - 7
components/product/brand/BrandComponent.vue

@@ -1,14 +1,15 @@
 <template>
   <div class="component-list container">
-    <div class="type-list">型号列表</div>
-    <div class="input-group">
+    <div :class="activeTab == 0 ? 'type-list active' : 'type-list'" @click="activeTab = 0">型号列表</div>
+    <div :class="activeTab == 1 ? 'type-list active' : 'type-list'" @click="activeTab = 1">代理商</div>
+    <div class="input-group" v-if="activeTab == 0">
       <input  type="search" class="input-sm form-control" placeholder="请输入型号" title="code"
       v-model="searchCode" @search="goodsSearch(searchCode)"/>
       <span class="input-group-btn">
 					<button class="search btn btn-default" type="button" @click="goodsSearch(searchCode)">搜索器件</button>
 			</span>
     </div>
-    <table class="table">
+    <table class="table" v-if="activeTab == 0">
       <thead>
         <tr class="bgf7">
           <th width="500">型号</th>
@@ -39,10 +40,63 @@
         </tr>
       </tbody>
     </table>
-    <div style="float: right;">
+    <div style="float: right;" v-if="activeTab == 0">
       <page :total="list.totalElements" :page-size="pageParams.count"
             :current="pageParams.page" @childEvent="handleCurrentChange"></page>
     </div>
+    <table class="table supper-table" v-if="activeTab == 1">
+      <thead>
+      <tr class="bgf7">
+        <th width="100"></th>
+        <th width="200">代理商</th>
+        <th width="200">地址</th>
+        <th width="110">电话</th>
+        <th width="110">传真</th>
+        <th width="110">邮箱</th>
+        <th width="120">网址</th>
+      </tr>
+      </thead>
+      <tbody>
+      <tr class="text-center" v-for="item in supplier.content">
+        <td v-if="item.storeuuid">
+          <a class='add-link' :href="'/store/' + item.storeuuid">
+            <img :src="item.img || '/images/store/common/default.png'" alt="" class="showImg">
+            <img src="/images/store/common/goIn.png" alt="" class="goIn">
+          </a>
+        </td>
+        <td v-if="!item.storeuuid"><img :src="item.img || '/images/store/common/default.png'" alt="" class="showImg"></td>
+        <td :title='item.vendorName'  v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.vendorName || '-'}}</a></td>
+        <td :title='item.vendorName' v-if="!item.storeuuid">{{item.vendorName || '-'}}</td>
+        <td :title='item.detailAddress' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.detailAddress || '-'}}</a></td>
+        <td :title='item.detailAddress' v-if="!item.storeuuid">{{item.detailAddress || '-'}}</td>
+        <td :title='item.tel' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.tel || '-'}}</a></td>
+        <td :title='item.tel' v-if="!item.storeuuid">{{item.tel || '-'}}</td>
+        <td :title='item.fax' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.fax || '-'}}</a></td>
+        <td :title='item.fax' v-if="!item.storeuuid">{{item.fax || '-'}}</td>
+        <td :title='item.email' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.email || '-'}}</a></td>
+        <td :title='item.email' v-if="!item.storeuuid">{{item.email || '-'}}</td>
+        <td :title='item.website' v-if="item.storeuuid"><a class='add-link' :href="'/store/' + item.storeuuid">{{item.website || '-'}}</a></td>
+        <td :title='item.website' v-if="!item.storeuuid">{{item.website || '-'}}</td>
+      </tr>
+      <tr v-if="!supplier.content || supplier.content.length === 0">
+        <td colspan="10" class="text-center">
+          <div class="empty">
+            <div class="empty-img">
+              <img src="/images/brandList/empty-cart.png">
+            </div>
+            <div class="empty-info">
+              <p class="grey f16"> 暂无供应商信息 </p>
+              <i class="fa fa-mail-reply fa-xs"></i>&nbsp;<a href="javascript:history.go(-1)">返回上一页</a>
+            </div>
+          </div>
+        </td>
+      </tr>
+      </tbody>
+    </table>
+    <div style="float: right;" v-if="activeTab == 1">
+      <page :total="supplier.totalElements" :page-size="supplierPageParams.size"
+            :current="supplierPageParams.page" @childEvent="handleChange"></page>
+    </div>
   </div>
 </template>
 <script>
@@ -56,7 +110,13 @@
           count: 10,
           filter: {}
         },
-        searchCode: ''
+        supplierPageParams: {
+          page: 1,
+          size: 5,
+          sort: {'updatetime': 'DESC'}
+        },
+        searchCode: '',
+        activeTab: 0
       }
     },
     components: {
@@ -71,6 +131,9 @@
       },
       brand () {
         return this.$store.state.brandDetail.detail.data
+      },
+      supplier () {
+        return this.$store.state.product.supplierInformation.information.data
       }
     },
     methods: {
@@ -98,6 +161,19 @@
         this.pageParams.filter.brandid = this.brand.id
         this.pageCmpGoods(this.pageParams)
       },
+//      获取供应商分页
+      async pageSupplier (params) {
+        let uuid = this.$route.params.code
+        let { data } = await this.$http.get(`/api/produce/vendorlist/${uuid}`, { params })
+        this.$store.commit('product/supplierInformation/GET_INFORMATION_SUCCESS', data)
+      },
+      handleChange (page) {
+        this.supplierPageParams.page = page
+        this.pageSupplier(this.supplierPageParams)
+      },
+      listenChild: function (brand) {
+        this.$store.dispatch('loadBrandPages', {count: 10, filter: { brandid: brand.id }, page: brand.page})
+      },
       toAttach: function (url) {
         if (url === '1') {
           this.$http.get('/login/page', {params: {returnUrl: window.location.href}}).then(response => {
@@ -126,12 +202,17 @@
     height: 34px;
     width: 150px;
     border: 1px solid #5078cb;
-    background-color: #5078CB;
+    /*background-color: #5078CB;*/
     float: left;
-    color: #fff;
+    color: #5078cb;
     line-height: 34px;
     text-align: center;
     font-size: 14px;
+    cursor: pointer ;
+  }
+  .component-list .type-list.active{
+    background-color: #5078CB;
+    color: #fff;
   }
   .component-list .input-group {
     width: 300px;
@@ -169,6 +250,12 @@
     color: #337ab7;
     font-size: 12px;
   }
+  .component-list table tbody tr td a.add-link {
+    width: 100%;
+    color: #474443;
+    font-size: 14px;
+    cursor: pointer;
+  }
   .component-list .btn-default {
     color: #214797;
     font-size: 12px;
@@ -219,4 +306,33 @@
     font-size: 14px;
     color: #5078cb;
   }
+  .component-list .supper-table thead th.text-left{
+    text-align: left;
+  }
+  .component-list .supper-table tbody tr{
+    height: 74px;
+    vertical-align:middle ;
+  }
+  .component-list .supper-table tbody tr:hover{
+    background: #eee;
+  }
+  .component-list .supper-table tbody tr td{
+    position: relative;
+    overflow: hidden;
+    text-overflow: ellipsis;
+    white-space: nowrap;
+    max-width: 100px;
+  }
+  .component-list .supper-table tbody tr img.showImg{
+    width: 90px;
+    height: 49px;
+    border: 1px solid #dcdcdc;
+  }
+  .component-list .supper-table tbody tr img.goIn {
+    position: absolute;
+    top: 13px;
+    right: 3px;
+    width: 35px;
+    height: 35px;
+  }
 </style>

+ 2 - 6
pages/product/brand/_code.vue

@@ -25,13 +25,9 @@
     },
     fetch ({ store, params }) {
       return Promise.all([
-        store.dispatch('loadBrandDetail', { id: params.code })
+        store.dispatch('loadBrandDetail', { id: params.code }),
+        store.dispatch('product/loadSupplierInformation', { uuid: params.code, count: 5, page: 1 })
       ])
-    },
-    methods: {
-      listenChild: function (brand) {
-        this.$store.dispatch('loadBrandPages', {count: 10, filter: { brandid: brand.id }, page: brand.page})
-      }
     }
   }
 </script>

BIN
static/images/store/common/goIn.png


+ 15 - 0
store/product.js

@@ -134,5 +134,20 @@ export const actions = {
       }, err => {
         commit('common/GET_COLLECTLIST_FAILURE', err)
       })
+  },
+  // 供应商维护
+  loadSupplierInformation ({ commit }, params = {}) {
+    let uuid = params.uuid
+    let param = {
+      page: params.page,
+      count: params.count
+    }
+    commit('supplierInformation/REQUEST_INFORMATION')
+    return axios.get(`/api/produce/vendorlist/${uuid}`, {params: param})
+      .then(response => {
+        commit('supplierInformation/GET_INFORMATION_SUCCESS', response.data)
+      }, err => {
+        commit('supplierInformation/GET_INFORMATION_FAILURE', err)
+      })
   }
 }

+ 18 - 0
store/product/supplierInformation.js

@@ -0,0 +1,18 @@
+export const state = () => ({
+  information: {
+    fetching: false,
+    data: []
+  }
+})
+export const mutations = {
+  REQUEST_INFORMATION (state) {
+    state.information.fetching = true
+  },
+  GET_INFORMATION_FAILURE (state) {
+    state.information.fetching = false
+  },
+  GET_INFORMATION_SUCCESS (state, result) {
+    state.information.fetching = false
+    state.information.data = result
+  }
+}