Merge pull request '罗世杰:fixed:修改列表组件发送网络请求的位置' (#81) from lj into master

Reviewed-on: http://git.feashow.cn/odjbin/city-store-transfer/pulls/81
This commit is contained in:
odjbin
2023-11-19 07:17:33 +00:00
5 changed files with 83 additions and 30 deletions

View File

@@ -18,8 +18,8 @@
<text>找店列表</text>
</view>
</view>
<SearchShopList v-if="chooseIndex" />
<ShowShopList v-else />
<SearchShopList v-if="chooseIndex" :searchInfoList="searchInfoList"/>
<ShowShopList v-else :shopInfoList = "shopInfoList"/>
</view>
<TabBar :current-page="0"></TabBar>
</view>
@@ -43,12 +43,21 @@
chooseIndex: 0,
statNum: {},
swiperList: [],
shopInfoList: [],
searchInfoList: [],
shopPageSize: 5,
searchPageSize: 5,
shopPageNum: 1,
searchPageNum: 1,
}
},
onLoad() {
this.getBanner()
this.getNotice()
this.getStat()
this.getShopList()
this.getSearchList()
this.open()
this.getClassList()
},
@@ -72,6 +81,31 @@
this.statNum = res.data.data
})
},
getShopList(){
const query = this.$u.queryParams({
type: 1,
pageSize: this.shopPageSize,
pageNum: this.shopPageNum
})
this.$api.getShopList(query).then(res => {
this.shopInfoList = res.data.data
this.shopInfoList.forEach(item=>{
item.pics =this.$api.imgUrl + item.pics
})
})
},
getSearchList(){
const query = this.$u.queryParams({
type: 2,
pageSize: this.searchPageSize,
pageNum: this.searchPageNum
})
this.$api.getShopList(query).then(res => {
this.searchInfoList = res.data.data
console.log(this.searchInfoList);
})
}
,
getClassList() {
this.$api.getClassList().then(res => {
let data = res.data.data

View File

@@ -7,10 +7,10 @@
</view>
<view class="marginLR10">
<DropDown></DropDown>
<DropDown :getQueryInfo = "setQueryInfo" @changeDrop="getShopList"></DropDown>
</view>
<view class="marginLR10">
<ShowShopList :showStyle="1"></ShowShopList>
<ShowShopList :showStyle="1" :shopInfoList="shopInfoList"></ShowShopList>
</view>
</view>
@@ -26,11 +26,37 @@
},
data() {
return {
pageSize: 5,
pageNum: 1,
shopInfoList: [],
}
},
methods: {
computed: {
},
methods: {
getShopList(){
let query = this.getQueryInfo()
console.log("query",query);
this.$api.getShopList(query).then(res => {
this.shopInfoList = res.data.data
console.log(this.shopInfoList);
this.shopInfoList.forEach(item=>{
item.pics =this.$api.imgUrl + item.pics
});
})
},
getQueryInfo(query){
return this.$u.queryParams({
type: 1,
pageSize: this.pageSize,
pageNum: this.pageNum,
...query
})
}
},
created() {
this.getShopList()
}
}
</script>