邓洁 : 找店地址下拉刷新重置数据
This commit is contained in:
@@ -13,7 +13,10 @@
|
|||||||
<SearchShopList :showStyle="1" :searchInfoList="searchInfoList"/>
|
<SearchShopList :showStyle="1" :searchInfoList="searchInfoList"/>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view v-if="showNull" class="showNull">
|
||||||
|
<text>没有符合条件的数据, 请下拉刷新重置数据~
|
||||||
|
</text>
|
||||||
|
</view>
|
||||||
<TabBar :current-page="3"></TabBar>
|
<TabBar :current-page="3"></TabBar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -26,27 +29,65 @@
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
pageSize: 5,
|
pageSize: 3,
|
||||||
pageNum: 1,
|
pageNum: 1,
|
||||||
searchInfoList: [],
|
searchInfoList: [],
|
||||||
customQuery: {},
|
customQuery: {},
|
||||||
searchListLength: '',
|
searchListLength: '',
|
||||||
|
showNull: false,
|
||||||
|
refresh: false
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
onPullDownRefresh() {
|
||||||
|
this.refresh=true
|
||||||
|
// if (this.showNull = true) {
|
||||||
|
const q = this.$u.queryParams({
|
||||||
|
type: 2,
|
||||||
|
pageSize: this.pageSize,
|
||||||
|
pageNum: 1,
|
||||||
|
})
|
||||||
|
// if(this.showNull=true){
|
||||||
|
// this.pageNum=1
|
||||||
|
// }
|
||||||
|
this.getShopList(q, "refresh")
|
||||||
|
|
||||||
|
// }
|
||||||
|
},
|
||||||
onReachBottom() {
|
onReachBottom() {
|
||||||
if (this.searchListLength !== 0) {
|
if (!this.refresh&&this.searchListLength !== 0) {
|
||||||
this.pageNum++
|
this.pageNum++
|
||||||
this.getShopList()
|
this.getShopList()
|
||||||
console.log("触底加载");
|
console.log("触底加载");
|
||||||
|
}else if(this.searchListLength == 0){
|
||||||
|
this.pageNum=1
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getShopList(q){
|
getShopList(q, type){
|
||||||
let query = this.getQueryInfo(q)
|
let query = {}
|
||||||
|
if (type == "refresh") {
|
||||||
|
query = q
|
||||||
|
} else {
|
||||||
|
query = this.getQueryInfo(q)
|
||||||
|
}
|
||||||
console.log("listquery",query);
|
console.log("listquery",query);
|
||||||
this.$api.getShopList(query).then(res => {
|
this.$api.getShopList(query).then(res => {
|
||||||
this.searchListLength = res.data.data.length
|
this.searchListLength = res.data.data.length
|
||||||
this.searchInfoList = [...this.searchInfoList, ...res.data.data]
|
if (query.includes('business') || query.includes('areatype') || query.includes('sortType') || query
|
||||||
|
.includes('region')||this.refresh) {
|
||||||
|
console.log('筛选');
|
||||||
|
// this.resetQuery(q)
|
||||||
|
this.searchInfoList = res.data.data
|
||||||
|
this.refresh=false
|
||||||
|
if (res.data.data.length == 0) {
|
||||||
|
this.showNull = true
|
||||||
|
} else {
|
||||||
|
this.showNull = false
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
console.log('查询');
|
||||||
|
this.searchInfoList = [...this.searchInfoList, ...res.data.data]
|
||||||
|
}
|
||||||
console.log(this.searchInfoList);
|
console.log(this.searchInfoList);
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
@@ -58,9 +99,8 @@
|
|||||||
pageNum: this.pageNum,
|
pageNum: this.pageNum,
|
||||||
...query
|
...query
|
||||||
})
|
})
|
||||||
this.customQuery = q
|
|
||||||
return q
|
return q
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getShopList()
|
this.getShopList()
|
||||||
@@ -69,6 +109,13 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.showNull {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
height: 100rpx;
|
||||||
|
color: darkgray;
|
||||||
|
}
|
||||||
page {
|
page {
|
||||||
background-color: $uni-bg-color-grey;
|
background-color: $uni-bg-color-grey;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -93,7 +93,6 @@
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getQueryInfo(query) {
|
getQueryInfo(query) {
|
||||||
console.log('this.',this.refresh);
|
|
||||||
const q = this.$u.queryParams({
|
const q = this.$u.queryParams({
|
||||||
type: 1,
|
type: 1,
|
||||||
pageSize: this.pageSize,
|
pageSize: this.pageSize,
|
||||||
@@ -101,16 +100,7 @@
|
|||||||
...query
|
...query
|
||||||
})
|
})
|
||||||
return q
|
return q
|
||||||
},
|
}
|
||||||
// resetQuery(query){
|
|
||||||
// console.log('ddd',query);
|
|
||||||
// const q = this.$u.queryParams({
|
|
||||||
// type: 1,
|
|
||||||
// pageSize: 5,
|
|
||||||
// pageNum: 1,
|
|
||||||
// ...query
|
|
||||||
// })
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getShopList()
|
this.getShopList()
|
||||||
|
|||||||
Reference in New Issue
Block a user