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

@@ -69,6 +69,8 @@
this.activeIndex = -1;
} else
this.activeIndex = index
this.$emit('changeDrop')
},
cancelDrop() {
this.activeIndex = -1;
@@ -79,7 +81,7 @@
...querys
}
const query = this.$u.queryParams(this.queryInfo)
console.log(query, 'query');
console.log(query, 'dropquery');
this.$emit('getQueryInfo', query)
return query
}

View File

@@ -1,7 +1,7 @@
<template>
<view>
<SearchShopListItem
v-for="item in shopInfoList"
v-for="item in searchInfoList"
:key="searchid"
:shopInfo="item"
:show-style="showStyle"
@@ -24,10 +24,15 @@
return {
pageSize: 5,
pageNum: 1,
shopInfoList: []
};
},
props: {
searchInfoList:{
type: Array,
default(){
return []
}
},
showStyle:{
type: Number,
default() {
@@ -53,9 +58,6 @@
}
}
},
created() {
this.getList()
},
methods: {
handleDel(shopid){
console.log("删除了商铺", shopid);
@@ -63,19 +65,6 @@
// TODO不能直接修改
// if(delindex !== -1) this.shopInfoList = this.shopInfoList.slice(delindex,1)
// console.log(this.shopInfoList);
},
getList() {
const query = this.$u.queryParams({
type: this.listType,
pageSize: this.pageSize,
pageNum: this.pageNum,
...this.customQuery
})
console.log(query, 'query');
this.$api.getShopList(query).then(res => {
console.log(this.shopInfoList);
this.shopInfoList = res.data.data
})
}
}
}

View File

@@ -29,7 +29,6 @@
return {
pageSize: 5,
pageNum: 1,
shopInfoList: []
};
},
@@ -70,8 +69,13 @@
default() {
return {}
}
},
shopInfoList: {
type: Array,
default() {
return []
}
}
},
methods: {
@@ -99,9 +103,7 @@
})
}
},
created() {
this.getList()
}
}
</script>

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>