|
|
@@ -49,20 +49,22 @@
|
|
|
<i @click="goodsSearch()" class="icon-sousuo iconfont"></i>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <ul class="product-list">
|
|
|
+ <ul class="product-list" v-if="productList.totalElements > 0">
|
|
|
<li v-for="product in searchLists">
|
|
|
<nuxt-link class="text-left" :to="'/mobile/brand/componentDetail/' + product.uuid">{{product.code}}</nuxt-link>
|
|
|
<a class="text-right" @click="toShowPdf(product.attach)">规格书 <i class="icon-chakan iconfont"></i></a>
|
|
|
</li>
|
|
|
</ul>
|
|
|
- <div class="no-product" v-if="!productList.totalPages || productList.totalPages == 0">
|
|
|
+ <div class="no-product" v-if="!productList.totalElements || productList.totalElements == 0">
|
|
|
<img :src="!isSearch?'/images/mobile/@2x/car@2x.png':'/images/mobile/@2x/search-empty.png'" alt="">
|
|
|
<div>抱歉,暂无产品信息</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
+ <loading v-show="isSearchingMore"></loading>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ import { Loading } from '~components/mobile/common'
|
|
|
export default {
|
|
|
name: 'MobileBrandsDetail',
|
|
|
data () {
|
|
|
@@ -82,9 +84,14 @@
|
|
|
isInList: false,
|
|
|
isSearch: false,
|
|
|
isSearchingMore: false,
|
|
|
- searchLists: []
|
|
|
+ searchLists: [],
|
|
|
+ isChange: false,
|
|
|
+ isFilter: false
|
|
|
}
|
|
|
},
|
|
|
+ components: {
|
|
|
+ Loading
|
|
|
+ },
|
|
|
filters: {
|
|
|
wordFilter: function (str) {
|
|
|
return str.length > 65 ? str.substring(0, 65) + '...' : str
|
|
|
@@ -114,10 +121,16 @@
|
|
|
return list
|
|
|
},
|
|
|
productList () {
|
|
|
- console.log(this.pageParams)
|
|
|
let list = this.$store.state.brandComponent.component.data
|
|
|
- this.searchLists = this.searchLists.concat(list.content)
|
|
|
- this.isSearchingMore = false
|
|
|
+ if (this.isChange || this.isFilter) {
|
|
|
+ this.searchLists = []
|
|
|
+ this.pageParams.page = 1
|
|
|
+ this.isChange = false
|
|
|
+ this.isFilter = false
|
|
|
+ } else {
|
|
|
+ this.searchLists = this.searchLists.concat(list.content)
|
|
|
+ this.isSearchingMore = false
|
|
|
+ }
|
|
|
return list
|
|
|
},
|
|
|
allPage () {
|
|
|
@@ -214,6 +227,7 @@
|
|
|
selectKind: function (data) {
|
|
|
this.showKindList = false
|
|
|
this.selectedKind = data.nameCn
|
|
|
+ this.isFilter = true
|
|
|
if (this.parentid === data.id) {
|
|
|
this.parentid = 0
|
|
|
this.ids = null
|
|
|
@@ -233,18 +247,17 @@
|
|
|
},
|
|
|
goodsSearch () {
|
|
|
this.pageParams.page = 1
|
|
|
- this.pageParams.filter.brandid = this.brandDetail.id
|
|
|
this.pageParams.filter.code = this.keyword
|
|
|
+ this.isFilter = true
|
|
|
this.pageCommodity(this.pageParams)
|
|
|
},
|
|
|
- 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)
|
|
|
-// }
|
|
|
- this.$store.dispatch('loadBrandComponent', this.pageParams)
|
|
|
+ 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)
|
|
|
+ }
|
|
|
},
|
|
|
checkShowFilter: function () {
|
|
|
if (!this.isInList) {
|
|
|
@@ -257,14 +270,18 @@
|
|
|
}
|
|
|
},
|
|
|
setActiveType: function (type) {
|
|
|
- if (type === 'product' && (this.pageParams.page !== 1 || this.keyword !== '')) {
|
|
|
- this.pageParams.page = 1
|
|
|
+// if (type === 'product' && (this.pageParams.page !== 1 || this.isFilter)) {
|
|
|
+// this.pageParams = {
|
|
|
+// page: 1,
|
|
|
+// count: 10,
|
|
|
+// filter: {brandid: this.brandDetail.id}
|
|
|
+// }
|
|
|
+// this.selectedKind = '全部分类'
|
|
|
// this.keyword = ''
|
|
|
- this.searchLists = []
|
|
|
- console.log(this.pageParams)
|
|
|
- this.$store.dispatch('loadBrandComponent', this.pageParams)
|
|
|
+// this.isChange = true
|
|
|
+// this.$store.dispatch('loadBrandComponent', this.pageParams)
|
|
|
// this.pageCommodity(this.pageParams)
|
|
|
- }
|
|
|
+// }
|
|
|
this.activeType = type
|
|
|
}
|
|
|
}
|