|
|
@@ -70,7 +70,13 @@
|
|
|
<p>抱歉,暂无店铺简介</p>
|
|
|
<nuxt-link to="/">返回首页</nuxt-link>
|
|
|
</div>-->
|
|
|
- <div class="product-store" v-if="activeType == 'product'">
|
|
|
+ <div class="product-store">
|
|
|
+ <div class="search-content">
|
|
|
+ <input type="text" v-model="keyword" placeholder="请输入品牌/类目/型号/规格" @keyup.13="search">
|
|
|
+ <span @click="search">
|
|
|
+ <i class="iconfont icon-sousuo"></i>
|
|
|
+ </span>
|
|
|
+ </div>
|
|
|
<table v-if="commodities.content&&commodities.content.length > 0">
|
|
|
<thead id="product-head" >
|
|
|
<tr>
|
|
|
@@ -127,18 +133,19 @@
|
|
|
</tr>
|
|
|
</tbody>
|
|
|
</table>
|
|
|
- <div v-if="!commodities.content || commodities.content.length == 0" class="no-product">
|
|
|
- <img src="/images/mobile/@2x/car@2x.png" alt="">
|
|
|
- <div>抱歉,暂无上架产品信息</div>
|
|
|
- </div>
|
|
|
+ <empty-status :type="isSearch ? 'search' : 'collect'"
|
|
|
+ :text="isSearch ? `抱歉,暂无与“${keyword}”匹配的产品信息`: '抱歉,暂无产品信息'"
|
|
|
+ :showLink="false"
|
|
|
+ v-else
|
|
|
+ ></empty-status>
|
|
|
</div>
|
|
|
<remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
|
|
|
- <loading v-show="isSearchingMore"></loading>
|
|
|
<login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox" :url="url"></login-box>
|
|
|
+ <pull-up :searchMore="fetching" :allPage="allPage" :page="page" @pullUpAction="getMoreSearch"></pull-up>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
- import {RemindBox, Loading, LoginBox} from '~components/mobile/common'
|
|
|
+ import {RemindBox, LoginBox, PullUp, EmptyStatus} from '~components/mobile/common'
|
|
|
export default {
|
|
|
data () {
|
|
|
return {
|
|
|
@@ -147,26 +154,22 @@
|
|
|
timeoutCount: 0,
|
|
|
clickTel: false,
|
|
|
clickPhone: false,
|
|
|
- isSearchingMore: false,
|
|
|
searchLists: [],
|
|
|
page: 1,
|
|
|
+ count: 10,
|
|
|
showLoginBox: false,
|
|
|
isScrollOverTab: false,
|
|
|
- url: ''
|
|
|
+ url: '',
|
|
|
+ keyword: '',
|
|
|
+ isChange: false,
|
|
|
+ isSearch: false
|
|
|
}
|
|
|
},
|
|
|
components: {
|
|
|
RemindBox,
|
|
|
- Loading,
|
|
|
- LoginBox
|
|
|
- },
|
|
|
- mounted: function () {
|
|
|
- let _this = this
|
|
|
- _this.$nextTick(function () {
|
|
|
- window.addEventListener('scroll', function () {
|
|
|
- _this.scroll()
|
|
|
- }, false)
|
|
|
- })
|
|
|
+ LoginBox,
|
|
|
+ PullUp,
|
|
|
+ EmptyStatus
|
|
|
},
|
|
|
filters: {
|
|
|
currency: function (num) {
|
|
|
@@ -204,10 +207,19 @@
|
|
|
},
|
|
|
commodities () {
|
|
|
let list = this.$store.state.shop.storeInfo.storeCommodity.data
|
|
|
- this.searchLists = this.searchLists.concat(list.content)
|
|
|
- this.isSearchingMore = false
|
|
|
+ if (this.isChange) {
|
|
|
+ this.searchLists = []
|
|
|
+ this.page = 1
|
|
|
+ this.isChange = false
|
|
|
+ } else {
|
|
|
+ this.searchLists = [...this.searchLists, ...list.content]
|
|
|
+ this.isSearchSearchingMore = false
|
|
|
+ }
|
|
|
return list
|
|
|
},
|
|
|
+ fetching () {
|
|
|
+ return this.$store.state.shop.storeInfo.storeCommodity.fetching
|
|
|
+ },
|
|
|
allPage () {
|
|
|
return this.commodities.totalPages
|
|
|
},
|
|
|
@@ -223,25 +235,18 @@
|
|
|
},
|
|
|
methods: {
|
|
|
scroll: function () {
|
|
|
- let scrolled = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop
|
|
|
- if (Math.ceil(scrolled + window.screen.availHeight) >= document.body.scrollHeight && !this.isSearchingMore && this.page < this.allPage && this.activeType === 'product') {
|
|
|
- this.getMoreCom()
|
|
|
- }
|
|
|
let tbodyObj = document.getElementById('product-body')
|
|
|
let theadObj = document.getElementById('product-head')
|
|
|
if (theadObj) {
|
|
|
this.isScrollOverTab = tbodyObj.getBoundingClientRect().top - theadObj.getBoundingClientRect().height - 5 <= theadObj.getBoundingClientRect().height
|
|
|
}
|
|
|
},
|
|
|
- getMoreCom: function () {
|
|
|
- if (!this.isSearchingMore) {
|
|
|
- this.page++
|
|
|
- this.isSearchingMore = true
|
|
|
- this.pageCommodity({ page: this.page, count: 6 })
|
|
|
- }
|
|
|
+ getMoreSearch: function () {
|
|
|
+ this.page++
|
|
|
+ this.pageCommodity({ page: this.page, count: this.count })
|
|
|
},
|
|
|
- async pageCommodity (pageParams, kindId, keyword) {
|
|
|
- let params = { storeid: this.$route.params.uuid, origin: 'store', kindUuid: kindId, code: keyword }
|
|
|
+ async pageCommodity (pageParams) {
|
|
|
+ let params = { storeid: this.$route.params.uuid, origin: 'store', code: this.keyword }
|
|
|
params.page = pageParams.page
|
|
|
params.count = pageParams.count
|
|
|
try {
|
|
|
@@ -280,6 +285,12 @@
|
|
|
this.url = this.$route.fullPath
|
|
|
this.showLoginBox = true
|
|
|
}
|
|
|
+ },
|
|
|
+ search: function () {
|
|
|
+ this.page = 1
|
|
|
+ this.isChange = true
|
|
|
+ this.isSearch = true
|
|
|
+ this.pageCommodity({ page: this.page, count: this.count })
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -303,7 +314,7 @@
|
|
|
background: url('/images/mobile/@2x/brand-bg.png') no-repeat;
|
|
|
background-size: cover;
|
|
|
.store-logo-box {
|
|
|
- border: .04rem solid #c7e5fd;
|
|
|
+ border: .01rem solid #c7e5fd;
|
|
|
border-radius: .1rem;
|
|
|
height: 2.21rem;
|
|
|
width: 3.73rem;
|
|
|
@@ -557,10 +568,14 @@
|
|
|
}
|
|
|
}
|
|
|
.com-none-state {
|
|
|
- padding: .6rem;
|
|
|
- p {
|
|
|
- margin: 0;
|
|
|
- font-size: .28rem;
|
|
|
+ background: #fff !important;
|
|
|
+ }
|
|
|
+ .search-content {
|
|
|
+ background: #fff;
|
|
|
+ padding: .07rem 0;
|
|
|
+ input {
|
|
|
+ width: 6.37rem;
|
|
|
+ border: .01rem solid #376ff3;
|
|
|
}
|
|
|
}
|
|
|
</style>
|