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; this.activeIndex = -1;
} else } else
this.activeIndex = index this.activeIndex = index
this.$emit('changeDrop')
}, },
cancelDrop() { cancelDrop() {
this.activeIndex = -1; this.activeIndex = -1;
@@ -79,7 +81,7 @@
...querys ...querys
} }
const query = this.$u.queryParams(this.queryInfo) const query = this.$u.queryParams(this.queryInfo)
console.log(query, 'query'); console.log(query, 'dropquery');
this.$emit('getQueryInfo', query) this.$emit('getQueryInfo', query)
return query return query
} }

View File

@@ -1,7 +1,7 @@
<template> <template>
<view> <view>
<SearchShopListItem <SearchShopListItem
v-for="item in shopInfoList" v-for="item in searchInfoList"
:key="searchid" :key="searchid"
:shopInfo="item" :shopInfo="item"
:show-style="showStyle" :show-style="showStyle"
@@ -24,10 +24,15 @@
return { return {
pageSize: 5, pageSize: 5,
pageNum: 1, pageNum: 1,
shopInfoList: []
}; };
}, },
props: { props: {
searchInfoList:{
type: Array,
default(){
return []
}
},
showStyle:{ showStyle:{
type: Number, type: Number,
default() { default() {
@@ -53,9 +58,6 @@
} }
} }
}, },
created() {
this.getList()
},
methods: { methods: {
handleDel(shopid){ handleDel(shopid){
console.log("删除了商铺", shopid); console.log("删除了商铺", shopid);
@@ -63,19 +65,6 @@
// TODO不能直接修改 // TODO不能直接修改
// if(delindex !== -1) this.shopInfoList = this.shopInfoList.slice(delindex,1) // if(delindex !== -1) this.shopInfoList = this.shopInfoList.slice(delindex,1)
// console.log(this.shopInfoList); // 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 { return {
pageSize: 5, pageSize: 5,
pageNum: 1, pageNum: 1,
shopInfoList: []
}; };
}, },
@@ -70,8 +69,13 @@
default() { default() {
return {} return {}
} }
},
shopInfoList: {
type: Array,
default() {
return []
}
} }
}, },
methods: { methods: {
@@ -99,9 +103,7 @@
}) })
} }
}, },
created() {
this.getList()
}
} }
</script> </script>

View File

@@ -18,8 +18,8 @@
<text>找店列表</text> <text>找店列表</text>
</view> </view>
</view> </view>
<SearchShopList v-if="chooseIndex" /> <SearchShopList v-if="chooseIndex" :searchInfoList="searchInfoList"/>
<ShowShopList v-else /> <ShowShopList v-else :shopInfoList = "shopInfoList"/>
</view> </view>
<TabBar :current-page="0"></TabBar> <TabBar :current-page="0"></TabBar>
</view> </view>
@@ -43,12 +43,21 @@
chooseIndex: 0, chooseIndex: 0,
statNum: {}, statNum: {},
swiperList: [], swiperList: [],
shopInfoList: [],
searchInfoList: [],
shopPageSize: 5,
searchPageSize: 5,
shopPageNum: 1,
searchPageNum: 1,
} }
}, },
onLoad() { onLoad() {
this.getBanner() this.getBanner()
this.getNotice() this.getNotice()
this.getStat() this.getStat()
this.getShopList()
this.getSearchList()
this.open() this.open()
this.getClassList() this.getClassList()
}, },
@@ -72,6 +81,31 @@
this.statNum = res.data.data 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() { getClassList() {
this.$api.getClassList().then(res => { this.$api.getClassList().then(res => {
let data = res.data.data let data = res.data.data

View File

@@ -7,10 +7,10 @@
</view> </view>
<view class="marginLR10"> <view class="marginLR10">
<DropDown></DropDown> <DropDown :getQueryInfo = "setQueryInfo" @changeDrop="getShopList"></DropDown>
</view> </view>
<view class="marginLR10"> <view class="marginLR10">
<ShowShopList :showStyle="1"></ShowShopList> <ShowShopList :showStyle="1" :shopInfoList="shopInfoList"></ShowShopList>
</view> </view>
</view> </view>
@@ -26,11 +26,37 @@
}, },
data() { data() {
return { 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> </script>