Prechádzať zdrojové kódy

页面链接 分页 获取数据

hangb 8 rokov pred
rodič
commit
80b8c64c0e

+ 38 - 11
components/product/brand/BrandComponent.vue

@@ -2,9 +2,10 @@
   <div class="component-list container">
     <div class="type-list">型号列表</div>
     <div class="input-group">
-      <input  type="text" class="input-sm form-control" placeholder="请输入型号"/>
+      <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">搜索器件</button>
+					<button class="search btn btn-default" type="button" @click="goodsSearch(searchCode)">搜索器件</button>
 			</span>
     </div>
     <table class="table">
@@ -17,7 +18,7 @@
       </thead>
       <tbody>
         <tr class="text-center" v-for="item in list.content">
-          <td><a :href="'product/component/'+item.uuid"><span>{{item.code}}</span></a></td>
+          <td><a :href="'/product/component/' + item.uuid"><span>{{item.code}}</span></a></td>
           <td><a :href="item.attach"><button class="btn btn-default"  :disabled="!item.attach" :class="{'disabledbtn':!item.attach}">Datasheet手册</button></a></td>
           <td>
             <button class="btn btn-default disabledbtn" :disabled="true">申请样片</button>
@@ -39,24 +40,29 @@
       </tbody>
     </table>
     <div style="float: right;">
-      <page :total="totalCount" :page-size="pageSize" :current="nowPage"
-            v-on:childEvent="listenPage"></page>
+      <el-pagination
+        :current-page.sync="pageParams.page"
+        :page-size="pageParams.count"
+        layout="prev, pager, next, jumper"
+        :total="list.totalElements"
+        @current-change="handleCurrentChange">
+      </el-pagination>
     </div>
   </div>
 </template>
 <script>
-  import Page from '~components/common/page/pageComponent.vue'
   export default {
     name: 'BrandComponent',
     data () {
       return {
-        pageSize: 10,
-        nowPage: 1
+        pageParams: {
+          page: 1,
+          count: 10,
+          filter: {}
+        },
+        searchCode: ''
       }
     },
-    components: {
-      Page
-    },
     computed: {
       lists () {
         return this.$store.state.brandComponent.component
@@ -64,11 +70,32 @@
       list () {
         return this.lists.data
       },
+      brand () {
+        return this.$store.state.brandDetail.detail.data
+      },
       totalCount () {
         return this.list.totalElements
       }
     },
     methods: {
+      goodsSearch (keyword) {
+        this.pageParams.page = 1
+        this.pageParams.filter.code = keyword
+        this.pageCmpGoods(this.pageParams)
+      },
+      handlerCurrentNode () {
+        this.searchCode = ''
+        this.pageParams.page = 1
+        this.pageCmpGoods(this.pageParams)
+      },
+      async pageCmpGoods (params) {
+        let { data } = await this.$http.get('/api/product/component/list', { params })
+        this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
+      },
+      handleCurrentChange (page) {
+        this.pageParams.page = page
+        this.pageParams.filter.brandid = this.brand.id
+        this.pageCmpGoods(this.pageParams)
       listenPage: function (parm) {
         this.$emit('childEvent', parm)
       }

+ 71 - 10
components/product/brand/CategoriesList.vue

@@ -67,6 +67,9 @@
           }
         }
         return brands[0] || []
+      },
+      brand () {
+        return this.$store.state.brandDetail.detail.data
       }
     },
     data () {
@@ -74,26 +77,84 @@
         defaultProps: {
           children: 'children',
           label: 'nameCn'
+        },
+        parentid: 0,
+        ids: null,
+        pageParams: {
+          page: 1,
+          count: 10,
+          filter: {}
         }
       }
     },
     methods: {
       handlerCurrentNode (data, node) {
-//        if (this.parentId === data.id) {
-//          this.parentId = 0
-//          this.ids = null
-//          console.log('取消选中状态')
-//        } else {
-//          if (data.level === 1) {
-//            this.parentId = data.id
-//          }
-//        }
-        console.log('data', data.id + '-' + data.nameCn)
+        if (this.parentid === data.id) {
+          this.parentid = 0
+          this.ids = null
+        } else {
+          if (data.level === 1) {
+            this.parentid = data.id
+          }
+        }
+        this.pageParams.page = 1
+        this.pageParams.filter.brandid = this.brand.id
+        this.pageParams.filter.kindid = data.id
+        this.pageCommodity(this.pageParams, this.ids)
+      },
+      async pageCommodity (params) {
+        try {
+          let { data } = await this.$http.get('/api/product/component/list', { params })
+          this.$store.commit('brandComponent/GET_COMPONENT_SUCCESS', data)
+        } catch (err) {
+          this.$store.commit('brandComponent/GET_COMPONENT_FAILURE', err)
+        }
       }
     }
   }
 </script>
 <style scoped>
+  /*  产品分类调整*/
+  .el-tree {
+    border: none;
+    /*min-height: 300px;*/
+  }
+  .el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content,.el-tree-node:hover{
+    background: none !important;
+  }
+  .el-tree-node__content:hover{
+    background: none !important;
+  }
+  .el-tree-node__content:hover span{
+    color: #5078cb;
+  }
+  .el-pagination .el-pager li.active{
+    background-color: #5078cb;
+    border-color: #337ab7;
+  }
+  .el-tree-node__expand-icon{
+    font-family: "iconfont" !important;
+    font-size: 14px;
+    font-style: normal;
+    -webkit-font-smoothing: antialiased;
+    width: inherit;
+    height: inherit;
+    border: inherit;
+    font-weight: bold;
+    text-shadow: -1px 0px 0 #333;
+    margin-right: 3px !important;
+  }
+  .el-tree-node__content{
+    line-height: 30px;
+    height: 30px;
+  }
+  .el-tree-node__expand-icon.is-leaf{
+    visibility: hidden;
+  }
+  .el-tree-node__expand-icon:before{
+    content: "\E621";
+  }
+
   .no-record{
     font-size: 14px;
     color: #999;

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

@@ -17,12 +17,12 @@
             <div class="form-group row" v-if="list.brand">
               <div class="message-item">类目</div>
               <div class="colon">:</div>
-              <div><a class="message-body blue" target="_blank">{{list.brand.nameCn}}</a></div>
+              <div><a class="message-body blue" target="_blank" :href="`/product/kind/${list.brand.id}`">{{list.brand.nameCn}}</a></div>
             </div>
             <div class="form-group row" v-if="list.kind">
               <div class="message-item">品牌</div>
               <div class="colon">:</div>
-              <div><a class="message-body blue" target="_blank">{{list.kind.nameCn}}</a></div>
+              <div><a class="message-body blue" target="_blank" :href="`/product/brand/${list.brand.uuid}`">{{list.kind.nameCn}}</a></div>
             </div>
             <div class="form-group row">
               <div class="message-item">总库存量</div>
@@ -57,7 +57,6 @@
         return this.$store.state.componentDetail.detail
       },
       list () {
-        console.log(this.lists.data.kind.level)
         return this.lists.data
       }
     },

+ 2 - 3
components/product/component/ComponentMenu.vue

@@ -2,9 +2,9 @@
   <div class="componentMenu container">
     <div class="menu-com row">
       <div class="menu-title col-md-12">
-        <a>器件选型</a> >
+        <a href="/product/kind/home">器件选型</a> >
         <span v-for="item in list">
-					<a><span>{{item.nameCn}}</span></a>
+					<a :href="`/product/kind/${item.id}`"><span>{{item.nameCn}}</span></a>
           <span> > </span>
 				  </span>
         <span>器件详情</span>
@@ -20,7 +20,6 @@
         return this.$store.state.componentMenu.menu
       },
       list () {
-        console.log(this.lists)
         return this.lists.data
       }
     }

+ 67 - 50
components/product/component/StoreInfo.vue

@@ -10,8 +10,7 @@
           </a>
           </div>
         </div>
-        <!--<div class="storeInList" ng-if="storeIns.length == 0" style="font-size: 14px">-->
-        <div class="storeInList" style="font-size: 14px">
+        <div class="storeInList" style="font-size: 14px" v-if="!store || store.length == 0">
           暂无商家信息
         </div>
       </div>
@@ -20,12 +19,13 @@
       <div>
         <div style="font-size: 14px">
           <span>产品匹配:</span>
-          <input type="checkbox">
-          <span>&nbsp;库存寄售</span>
-          <input type="checkbox">
-          <span>&nbsp;店铺自营</span>
-          <!--<span v-if="storeIns.length==0">暂无可匹配的信息</span>-->
-          <span>暂无可匹配的信息</span>
+          <span v-if="store && store.length > 0">
+            <input type="checkbox">
+            <span>&nbsp;库存寄售</span>
+            <input type="checkbox">
+            <span>&nbsp;店铺自营</span>
+          </span>
+          <span v-if="!store || store.length == 0">暂无可匹配的信息</span>
         </div>
       </div>
     </div>
@@ -34,64 +34,79 @@
       <table class="table">
         <thead>
           <tr class="height54">
-            <th class="text-center" width="115">制造商型号</th>
-            <th class="text-center" width="138">生产日期</th>
-            <th class="text-center" width="92">包装方式</th>
-            <th class="text-center" width="173">库存</th>
-            <th class="text-center" width="92">数量</th>
-            <th class="text-center" width="116">香港交货<span style="font-size: 12px;">($)</span></th>
-            <th class="text-center" width="150">大陆交货<span style="font-size: 12px;">(¥)</span></th>
-            <th class="text-center" width="139">交期</span></th>
-            <th class="text-center" width="175">操作</th>
+            <th class="text-center" width="100">制造商型号</th>
+            <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="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></th>
+            <th class="text-center" width="150">操作</th>
           </tr>
         </thead>
         <tbody class="text-center">
-          <tr style="cursor: pointer;" v-for="list in storeList">
-            <td>{{list.code}}</td>
-            <td>{{list.produceDate}}</td>
-            <td>{{list.packaging || '暂无包装方式'}}</td>
+          <tr style="cursor: pointer;" v-for="list in storeList.content">
+            <td><a :href="'/store/' + list.storeid + '/' + list.batchCode">{{list.code}}</a></td>
+            <td><a :href="'/store/' + list.storeid + '/' + list.batchCode">{{list.produceDate}}</a></td>
+            <td><a :href="'/store/' + list.storeid + '/' + list.batchCode">{{list.packaging || '暂无包装方式'}}</a></td>
             <td style="text-align: left;padding-left: 25px;">
-              <div>
-                <span>库存:</span>
-                <span>{{list.reserve}}</span>
-              </div>
-              <div>
-                <span>起拍:</span>
-                <span>{{list.minBuyQty}}</span>
-              </div>
-              <div>
-                <span>倍数:</span>
-                <span>{{list.minPackQty}}</span>
-              </div>
+              <a :href="'/store/' + list.storeid + '/' + list.batchCode">
+                <div>
+                  <span>库存:</span>
+                  <span>{{list.reserve}}</span>
+                </div>
+                <div>
+                  <span>起拍:</span>
+                  <span>{{list.minBuyQty}}</span>
+                </div>
+                <div>
+                  <span>倍数:</span>
+                  <span>{{list.minPackQty}}</span>
+                </div>
+              </a>
             </td>
             <td>
-              <div v-for="price in list.prices">
-                <span>{{price.start}}</span>+
-              </div>
+              <a :href="'/store/' + list.storeid + '/' + list.batchCode">
+                <div v-for="price in list.prices">
+                  <span>{{price.start}}</span>+
+                </div>
+              </a>
             </td>
             <td>
-              <div v-for="price in list.prices">
-                <span>{{price.rMBPrice | formateNumber : 6 || ''}}</span>
-              </div>
+              <a :href="'/store/' + list.storeid + '/' + list.batchCode">
+                <div v-show="list.currencyName.indexOf('USD')==-1 || !list.prices">
+                  <span>—</span>
+                </div>
+                <div v-for="price in list.prices">
+                  <span>{{price.uSDPrice}}</span>
+                </div>
+              </a>
             </td>
             <td>
-              <div v-for="price in list.prices">
-                <span>{{price.rMBPrice | formateNumber : 6 || ''}}</span>
-              </div>
+              <a :href="'/store/' + list.storeid + '/' + list.batchCode">
+                <div v-show="list.currencyName.indexOf('RMB')==-1 || !list.prices">
+                  <span>—</span>
+                </div>
+                <div v-for="price in list.prices">
+                  <span>{{price.rMBPrice}}</span>
+                </div>
+              </a>
             </td>
             <td>
-              <div v-show="list.b2cMinDelivery">
-                <span>香港:</span>
-                <span>{{list.b2cMinDelivery}}</span>-<span>{{list.b2cMaxDelivery}}</span>
-              </div>
+              <a :href="'/store/' + list.storeid + '/' + list.batchCode">
+                <div v-show="list.b2cMinDelivery">
+                  <span>交期:</span>
+                  <span>{{list.b2cMinDelivery}}</span>-<span>{{list.b2cMaxDelivery}}</span>
+                </div>
+              </a>
             </td>
             <td>
               <button class="btn btn-buyNow">立即购买</button>
               <button class="btn btn-default">加入购物车</button>
             </td>
           </tr>
-          <!--<tr ng-if="$data.length == 0">-->
-          <tr>
+          <tr v-if="!storeList.content || storeList.content.length == 0">
             <td colspan="10" class="text-center" style="line-height: 40px; font-size: 14px;"><i class="fa fa-smile-o fa-lg"></i> 暂无现货</td>
           </tr>
         </tbody>
@@ -107,7 +122,6 @@
         return this.$store.state.componentStore.store
       },
       store () {
-        console.log(this.stores.data)
         return this.stores.data
       },
       storeLists () {
@@ -186,6 +200,9 @@
     vertical-align: middle;
     text-align: center;
   }
+  .container .goodsList tbody tr td:hover a{
+    color: #474443;
+  }
   .container .goodsList .btn{
     border-radius: 4px;
     width: 80px;
@@ -231,7 +248,7 @@
     border-right: #ddd 1px solid;
   }
   .container .table tbody td div{
-    text-align: left;
+    text-align: center;
     margin-left: 10%;
   }
   .container .table tbody tr:hover{

+ 1 - 2
components/product/original/OriginalDetail.vue

@@ -9,7 +9,7 @@
         <div class="hot-center clearfix">
           <div class="hot-center-1 clearfix">
             <div class="hot-pro" v-for="item in list1">
-              <a title="">
+              <a :title="item.code" :href="'/store/' + item.storeid + '/' + item.batchCode">
                 <p><img :src="item.img" alt=""></p>
                 <span><em>{{item.code}}</em></span>
               </a>
@@ -59,7 +59,6 @@
         return this.$store.state.original.hot
       },
       list1 () {
-        console.log(this.lists.data)
         return this.lists.data.slice(0, 3)
       },
       list2 () {

+ 0 - 1
components/provider/Suppliers.vue

@@ -94,7 +94,6 @@ export default {
 
       try {
         let { data } = await this.$http.get('/api/store-service/stores', { params: pageParams })
-        console.log('DATA', data)
         this.$store.commit('provider/stores/GET_STORE_LIST_SUCCESS', data)
       } catch (err) {
         this.$store.commit('provider/stores/GET_STORE_LIST_FAILURE', err)

+ 0 - 1
components/store/BaseInfo.vue

@@ -97,7 +97,6 @@ export default {
       for (let i = 0; i < qualifications.length; i++) {
         qualifications[i].isPdf = isPdf(qualifications[i].resourceUrl)
       }
-      console.log(qualifications)
       return qualifications || []
     }
   },

+ 0 - 1
components/store/CommodityInfo.vue

@@ -135,7 +135,6 @@ function initFragment (commodity) {
   } else {
     fragment.price = prices.uSDPrice
   }
-  console.log(fragment)
   return fragment
 }
 

+ 0 - 6
components/store/CommodityList.vue

@@ -171,22 +171,18 @@ export default {
       if (this.parentKindId === data.id) {
         this.parentKindId = 0
         this.ids = null
-        console.log('取消选中状态')
       } else {
         if (data.level === 1) {
           this.parentKindId = data.id
         }
         this.ids = getAllLeafIds(data)
       }
-      console.log('data', data.id + '-' + data.nameCn)
       this.pageParams.page = 1
 
       this.pageCommodity(this.pageParams, this.ids)
     },
     goodsSearch (keyword) {
-      console.log(keyword)
       this.pageParams.page = 1
-
       this.pageCommodity(this.pageParams, this.ids, keyword)
     },
     async pageCommodity (pageParams, kindId, keyword) {
@@ -202,9 +198,7 @@ export default {
       }
     },
     handleCurrentChange (page) {
-      console.log(page)
       this.pageParams.page = page
-
       this.pageCommodity(this.pageParams, this.ids, this.searchCode)
     }
   }

+ 9 - 1
pages/product/brand/_code.vue

@@ -4,7 +4,7 @@
       <brand-detail/>
       <div class="comm-list">
         <categories-list/>
-        <brand-component v-on:childEvent="listenChild"/>
+        <brand-component/>
       </div>
     </div>
   </div>
@@ -13,6 +13,11 @@
   import { BrandDetail, CategoriesList, BrandComponent } from '~components/product'
   export default {
     layout: 'main',
+    data () {
+      return {
+        code: ''
+      }
+    },
     components: {
       BrandDetail,
       CategoriesList,
@@ -22,11 +27,14 @@
       return Promise.all([
         store.dispatch('loadBrandDetail', {id: params.code}),
         store.dispatch('loadBrandComponent', {page: 1})
+        store.dispatch('loadBrandDetail', { id: params.code })
       ])
     },
     methods: {
       listenChild: function (parm) {
         this.store.dispatch('loadBrandComponent', {page: parm})
+      listenChild: function (brand) {
+        this.$store.dispatch('loadBrandPages', {count: 10, filter: { brandid: brand.id }, page: brand.page})
       }
     }
   }

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

@@ -15,15 +15,13 @@
       StoreInfo
     },
     fetch ({ store, route }) {
-      console.log(route.params.uuid)
       return Promise.all([
         store.dispatch('loadComponentDetail', {id: route.params.uuid}),
         store.dispatch('loadComponentStore', {id: route.params.uuid}),
-        store.dispatch('loadComponentInformation', {count: 10, filter: { uuid: 332233434, ignoreUMall: false, ignoreStore: true, storeIds: route.params.uuid.storeIds }, page: 1, sorting: {minPriceRMB: route.params.uuid.minPriceRMB}})
+        store.dispatch('loadComponentInformation', {uuid: route.params.uuid})
       ])
     },
     created () {
-      console.log(this.$route.params.uuid)
     }
   }
 </script>

+ 18 - 0
store/brandPages.js

@@ -0,0 +1,18 @@
+export const state = () => ({
+  pages: {
+    fetching: false,
+    data: []
+  }
+})
+export const mutations = {
+  REQUEST_PAGES (state) {
+    state.pages.fetching = true
+  },
+  GET_PAGES_FAILURE (state) {
+    state.pages.fetching = false
+  },
+  GET_PAGES_SUCCESS (state, result) {
+    state.pages.fetching = false
+    state.pages.data = result
+  }
+}

+ 21 - 17
store/index.js

@@ -142,17 +142,14 @@ export const actions = {
   // 获得器件详情信息
   loadComponentDetail ({commit}, params = {}) {
     let id = params.id
-    // console.log(id)
     commit('componentDetail/REQUEST_DETAIL', params)
     return axios.get(`/api/product/component/${id}`)
       .then(response => {
-        console.log('response', response.data)
         commit('componentDetail/GET_DETAIL_SUCCESS', response.data)
         if (response.data) {
           commit('componentMenu/REQUEST_MENU', params)
           return axios.get(`/api/product/kind/structing/${response.data.kindid}`)
             .then(response => {
-              console.log('response', response.data)
               commit('componentMenu/GET_MENU_SUCCESS', response.data)
             }, err => {
               commit('componentMenu/GET_MENU_FAILURE', err)
@@ -165,11 +162,9 @@ export const actions = {
   // 获取器件详情页面包屑导航
   loadComponentMenu ({commit}, params = {}) {
     let pid = params.id
-    console.log(pid)
     commit('componentMenu/REQUEST_MENU', params)
     return axios.get(`/api/product/kind/structing/${pid}`)
       .then(response => {
-        console.log('response', response.data)
         commit('componentMenu/GET_MENU_SUCCESS', response.data)
       }, err => {
         commit('componentMenu/GET_MENU_FAILURE', err)
@@ -177,29 +172,27 @@ export const actions = {
   },
   // 器件详情页选择商家
   loadComponentStore ({commit}, params = {}) {
-    let sid = params.uuid
+    let id = params.uuid
     commit('componentStore/REQUEST_STORE', params)
-    return axios.get(`/api/store-service/stores/uuid/${sid}`)
+    return axios.get(`/api/store-service/stores/uuid/${id}`)
       .then(response => {
-        console.log('response', response.data)
         commit('componentStore/GET_STORE_SUCCESS', response.data)
       }, err => {
         commit('componentStore/GET_STORE_FAILURE', err)
       })
   },
-  // 器件详情页商家信息列表
-  loadComponentInformation ({commit}, uuid = '', ignoreUMALL = '', pageParams = { page: 1, count: 10 }) {
-    // let params = { uuid: uuid.uuid, ignoreUMALL: 'uuid.ignoreUMALL', ignoreStore: uuid.ignoreStore, storeIds: uuid.storeId, minPriceRMB: uuid.minPriceRMB }
+  // 器件详情页商家列表
+  loadComponentInformation ({commit}, uuid = '', pageParams = { page: 1, count: 10 }) {
     let params = {}
-    console.log('ComponentInformation', params)
-    console.log('ComponentInformation', uuid)
-    console.log('ComponentInformation', ignoreUMALL)
+    let filter = {uuid: uuid.uuid, ignoreUMall: false, ignoreStore: false}
+    // let sorting = {minPriceRMB: 'ASC'}
+    params.filter = filter
+    // params.sorting = sorting
     params.page = pageParams.page
     params.count = pageParams.count
-    commit('componentInformation/REQUEST_INFORMATION', params)
+    commit('componentInformation/REQUEST_INFORMATION')
     return axios.get('/api/commodity/goods/page', { params })
       .then(response => {
-        console.log('loadComponentInformation', response.data)
         commit('componentInformation/GET_INFORMATION_SUCCESS', response.data)
       }, err => {
         commit('componentInformation/GET_INFORMATION_FAILURE', err)
@@ -213,9 +206,10 @@ export const actions = {
     return axios.get(`/api/product/brand/${id}`)
       .then(response => {
         let brand = response.data || {}
-        console.log('loadBrandDetail', response.data !== null)
         commit('brandDetail/GET_DETAIL_SUCCESS', response.data)
         return Promise.all([
+          loadBrandCategories({ commit }, { id: brand.id }),
+          loadBrandComponent({ commit }, {count: 10, filter: { brandid: brand.id }, page: 1})
           loadBrandCategories({ commit }, {id: brand.id}),
           loadBrandComponent({ commit }, {count: 10, filter: { brandid: brand.id }})
         ])
@@ -244,6 +238,16 @@ export const actions = {
         commit('brandComponent/GET_COMPONENT_FAILURE', err)
       })
   },
+  // 获取品牌详情分页信息
+  loadBrandPages ({commit}, params = {}) {
+    commit('brandPages/REQUEST_PAGES', params)
+    return axios.get('/api/product/PAGES/list', { params })
+      .then(response => {
+        commit('brandPages/GET__SUCCESS', response.data)
+      }, err => {
+        commit('brandPages/GET_COMPONENT_FAILURE', err)
+      })
+  },
   // 获取帮助中心信息
   loadHelpSnapsho ({ commit }, params = {}) {
     commit('help/REQUEST_SNAPSHO')

+ 0 - 1
store/newsData.js

@@ -13,7 +13,6 @@ export const actions = {
   },
   // 获取详细新闻
   loadDetailNews ({ commit }, params = {}) {
-    console.log(params.id)
     let id = params.id
     commit('detailNews/REQUEST_DETAILNEWS', params)
     return axios.get(`/api/news/${id}`)