|
|
@@ -1,7 +1,7 @@
|
|
|
<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"
|
|
|
@@ -9,10 +9,10 @@
|
|
|
@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>
|
|
|
+ <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,6 +21,9 @@
|
|
|
></good-list>
|
|
|
<forward-goods-list v-else></forward-goods-list>
|
|
|
</template>
|
|
|
+ <template v-if="searchType == 'product'">
|
|
|
+ 123
|
|
|
+ </template>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
@@ -31,7 +34,7 @@
|
|
|
data () {
|
|
|
return {
|
|
|
key: this.$route.query.w,
|
|
|
- pageSize: 15,
|
|
|
+ pageSize: 10,
|
|
|
nowPage: 1,
|
|
|
sorting: {},
|
|
|
filter: {},
|
|
|
@@ -46,11 +49,7 @@
|
|
|
},
|
|
|
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, filter: {}, keyword: route.query.w, page: 1, type: route.query.type || 'component'})
|
|
|
])
|
|
|
},
|
|
|
components: {
|
|
|
@@ -70,7 +69,19 @@
|
|
|
},
|
|
|
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.total || 0
|
|
|
+ },
|
|
|
+ futureTotal () {
|
|
|
+ return this.goods.futures.total || 0
|
|
|
+ },
|
|
|
+ count () {
|
|
|
+ return this.stockTotal + this.futureTotal
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
@@ -88,7 +99,7 @@
|
|
|
if (this.sorting === {}) {
|
|
|
this.sorting = {}
|
|
|
}
|
|
|
- this.$store.dispatch('searchData/searchForList', {count: this.pageSize, filter: this.filter, keyword: this.$route.query.w, page: this.nowPage, sorting: this.sorting})
|
|
|
+ this.$store.dispatch('searchData/searchForListNew', {count: this.pageSize, filter: this.filter, keyword: this.$route.query.w, page: this.nowPage, sorting: this.sorting, type: this.searchType})
|
|
|
},
|
|
|
reloadKind: function () {
|
|
|
if (!this.filter.goods_kindId) {
|