|
|
@@ -9,7 +9,7 @@
|
|
|
@crnameFlagEvent="listenCrnameFlag"
|
|
|
></kind>-->
|
|
|
<brand-detail :supBrandObj="goods.brand" v-if="searchType == 'brand' && goods.brand"></brand-detail>
|
|
|
- <div class="search-result-type" v-if="!goods.brands">
|
|
|
+ <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>
|
|
|
@@ -22,14 +22,18 @@
|
|
|
></good-list>
|
|
|
<forward-goods-list v-else></forward-goods-list>
|
|
|
</template>
|
|
|
- <template v-if="searchType == 'product' || searchType == 'store' || (searchType == 'brand' && goods.brand)">
|
|
|
- <supplier-list></supplier-list>
|
|
|
+ <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>
|
|
|
@@ -57,7 +61,7 @@
|
|
|
},
|
|
|
fetch ({store, route}) {
|
|
|
return Promise.all([
|
|
|
- store.dispatch('searchData/searchForListNew', {count: 10, filter: {}, keyword: route.query.w, page: 1, type: route.query.type || 'component'})
|
|
|
+ store.dispatch('searchData/searchForListNew', {count: 10, keyword: route.query.w, page: 1, type: route.query.type || 'component'})
|
|
|
])
|
|
|
},
|
|
|
components: {
|
|
|
@@ -98,7 +102,7 @@
|
|
|
},
|
|
|
// 当前分页数
|
|
|
currentCount () {
|
|
|
- if (this.goods.brands) {
|
|
|
+ if (this.goods.content) {
|
|
|
return this.goods.total
|
|
|
} else {
|
|
|
return this.resultType === 'current' ? this.stockTotal : this.futureTotal
|
|
|
@@ -106,7 +110,7 @@
|
|
|
},
|
|
|
// 总数
|
|
|
count () {
|
|
|
- if (this.goods.brands) {
|
|
|
+ if (this.goods.content) {
|
|
|
return this.goods.total
|
|
|
} else {
|
|
|
return this.stockTotal + this.futureTotal
|
|
|
@@ -114,6 +118,10 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ initParams: function () {
|
|
|
+ this.resultType = 'current'
|
|
|
+ this.nowPage = 1
|
|
|
+ },
|
|
|
reloadAll: function () {
|
|
|
this.filter = {}
|
|
|
this.sorting = {}
|
|
|
@@ -125,10 +133,17 @@
|
|
|
// 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
|
|
|
+ }
|
|
|
+ if (this.searchType === 'component') {
|
|
|
+ params.filter = this.filter
|
|
|
+ params.sorting = this.sorting
|
|
|
}
|
|
|
- return 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})
|
|
|
+ return this.$store.dispatch('searchData/searchForListNew', params)
|
|
|
},
|
|
|
// reloadKind: function () {
|
|
|
// if (!this.filter.goods_kindId) {
|
|
|
@@ -270,18 +285,32 @@
|
|
|
}
|
|
|
</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;
|
|
|
}
|
|
|
}
|
|
|
}
|