Browse Source

搜索页面修改

yangc 7 years ago
parent
commit
2961bd9d16

+ 1 - 1
components/news/Detail.vue

@@ -30,7 +30,7 @@
         const hour = d.getHours()
         const minutes = d.getMinutes()
         const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' ' + hour + ':' + minutes
-        return year + '-' + month + '-' + day
+        return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
       }
     }
   }

+ 1 - 9
components/product/CategoryProperty.vue

@@ -71,7 +71,7 @@
         </table>
       </div>
           <ul v-show="list_exp_flag" @mouseenter="show_exp_list()" @mouseleave="hide_exp_list()" class="parameter-selection-ul drop-down-list" role="menu" aria-labelledby="dropdownMenu1">
-            <li v-for="v in selectedProperties.values"><a @click="selectPropertyValue(selectedProperties, value)" class="a-color"><span>{{v.value}}</span></a></li>
+            <li v-for="v in selectedProperties.values"><a @click="selectPropertyValue(selectedProperties, v)" class="a-color"><span>{{v.value}}</span></a></li>
           </ul>
     </div>
   </div>
@@ -90,14 +90,6 @@
         list_exp_flag: false
       }
     },
-    mounted () {
-//      var list = document.getElementsByClassName('list-menu')
-//      var container = document.getElementsByClassName('div-table')
-//      list.onmouseover = function () {
-//        var id = list[0].getAttribute['split-dropdown-trigger']
-//        console.log(id)
-//      }
-    },
     computed: {
       kind () {
         return this.$store.state.product.kind.kindsParentWithBother.data[this.$store.state.product.kind.kindsParentWithBother.data.length - 1]

+ 21 - 0
components/search/DetailBrand.vue

@@ -0,0 +1,21 @@
+<template>
+  <div>
+    <h1>啊哈哈哈</h1>
+    <h1>啊哈哈哈</h1>
+    <h1>啊哈哈哈</h1>
+    <h1>啊哈哈哈</h1>
+    <h1>啊哈哈哈</h1><h1>啊哈哈哈</h1><h1>啊哈哈哈</h1>
+    <h1>啊哈哈哈</h1><h1>啊哈哈哈</h1>
+    <h1>啊哈哈哈</h1>
+  </div>
+</template>
+
+<script>
+  created: {
+      console.log(1)
+  }
+</script>
+
+<style>
+
+</style>

+ 10 - 4
components/search/GoodList.vue

@@ -41,8 +41,8 @@
           <thead>
           <tr style="height: 40px;">
             <th width="80"></th>
-            <th width="160">品牌/型号</th>
-            <th width="90">类目</th>
+            <th width="160">品牌/型号/类目</th>
+            <th width="90">公司名称</th>
             <th width="100">封装/生产日期</th>
             <th width="110">库存</th>
             <th width="90">阶梯</th>
@@ -62,11 +62,14 @@
             <td class="brand-code">
               <div class="brand"><nuxt-link :to="`/product/brand/${item.brand.uuid}`" class="text-num" v-text="item.brand.nameEn"></nuxt-link></div>
               <div class="code"><nuxt-link :to="`/product/component/${item.uuid}`" class="f16 text-bold text-num" v-text="item.code"></nuxt-link></div>
+              <div class="brand"><nuxt-link :to="`/product/kind/${item.kindid}`" v-text="item.kind.nameCn">
+              </nuxt-link></div>
             </td>
             <td>
-              <div><i class="fa fa-th-large f14" aria-hidden="true"></i>&nbsp;&nbsp;
-                <nuxt-link :to="`/product/kind/${item.kindid}`" v-text="item.kind.nameCn">
+              <div>
+                <nuxt-link :to="`/product/kind/${item.kindid}`" v-text="item.storeName">
                 </nuxt-link>
+                <span v-if="!item.storeName">—</span>
               </div>
             </td>
             <td>
@@ -631,4 +634,7 @@
     color: #fff;
     float: right;
   }
+  tbody a:hover{
+    color: #f39801;
+  }
 </style>

+ 4 - 2
pages/search/_keyword.vue

@@ -1,5 +1,6 @@
 <template>
 <div class="container" id="searchResult">
+  <detail-brand></detail-brand>
   <result-title :keyword="key"></result-title>
     <kind @kindFilterEvent="listenKindFilter"
           @brandFilterEvent="listenBrandFilter"
@@ -15,7 +16,7 @@
 </div>
 </template>
 <script>
-  import { GoodList, Kind, ResultTitle } from '~components/search'
+  import { GoodList, Kind, ResultTitle, DetailBrand } from '~components/search'
   export default{
     layout: 'main',
     data () {
@@ -44,7 +45,8 @@
     components: {
       ResultTitle,
       Kind,
-      GoodList
+      GoodList,
+      DetailBrand
     },
     methods: {
       reloadList: function () {

+ 19 - 0
store/searchData.js

@@ -21,12 +21,31 @@ export const actions = {
         commit('searchBrands/GET_BRANDS_FAILURE', err)
       })
   },
+  // 获取命中详情
+  searchForDetail ({ commit }, params = {}) {
+    commit('searchDetail/REQUEST_DETAIL', params)
+    return axios.get(`/search/componentGoods/collect`, {params})
+      .then(response => {
+        commit('searchDetail/GET_DETAIL_SUCCESS', response.data)
+      }, err => {
+        commit('searchDetail/GET_DETAIL_FAILURE', err)
+      })
+  },
   // 获取搜索list
   searchForList ({ commit }, params = {}) {
     commit('searchList/REQUEST_LIST', params)
     return axios.get(`/api/product/component/search/compGoods`, {params})
       .then(response => {
         commit('searchList/GET_LIST_SUCCESS', response.data)
+        if (response.data.brands) {
+          commit('searchDetail/REQUEST_DETAIL', params)
+          return axios.get(`/api/product/brand/${response.data.brands.uuid}`)
+            .then(response => {
+              commit('searchDetail/GET_DETAIL_SUCCESS', response.data)
+            }, err => {
+              commit('searchDetail/GET_DETAIL_FAILURE', err)
+            })
+        }
       }, err => {
         commit('searchList/GET_LIST_FAILURE', err)
       })

+ 19 - 0
store/searchData/searchDetail.js

@@ -0,0 +1,19 @@
+export const state = () => ({
+  detail: {
+    fetching: false,
+    data: []
+  }
+})
+
+export const mutations = {
+  REQUEST_DETAIL (state) {
+    state.detail.fetching = true
+  },
+  GET_DETAIL_FAILURE (state) {
+    state.detail.fetching = false
+  },
+  GET_DETAIL_SUCCESS (state, result) {
+    state.detail.fetching = false
+    state.detail.data = result
+  }
+}