86 lines
1.7 KiB
Vue
86 lines
1.7 KiB
Vue
<template>
|
||
<view>
|
||
<SearchShopListItem
|
||
v-for="item in shopInfoList"
|
||
:key="searchid"
|
||
:shopInfo="item"
|
||
:show-style="showStyle"
|
||
:isEdit="isEdit"
|
||
@delItem="handleDel"
|
||
></SearchShopListItem>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
/**
|
||
* @property {Number} showStyle 展示商铺的样式类型(0为首页默认)
|
||
* @property {Boolean} isEdit 是否显示编辑和删除
|
||
* @property {Number} listType 获取列表类型传递参数部分
|
||
* @property {Object} customQuery 自定义查询参数
|
||
*/
|
||
export default {
|
||
name:"SearchShopList",
|
||
data() {
|
||
return {
|
||
pageSize: 5,
|
||
pageNum: 1,
|
||
shopInfoList: []
|
||
};
|
||
},
|
||
props: {
|
||
showStyle:{
|
||
type: Number,
|
||
default() {
|
||
return 0
|
||
}
|
||
},
|
||
isEdit: {
|
||
type: Boolean,
|
||
default() {
|
||
return false
|
||
}
|
||
},
|
||
listType:{
|
||
type: Number,
|
||
default(){
|
||
return 2
|
||
}
|
||
},
|
||
customQuery:{
|
||
type: Object,
|
||
default(){
|
||
return {}
|
||
}
|
||
}
|
||
},
|
||
created() {
|
||
this.getList()
|
||
},
|
||
methods: {
|
||
handleDel(shopid){
|
||
console.log("删除了商铺", shopid);
|
||
// const delindex = this.shopInfoList.findIndex((item,index)=> item.shopid === shopid)
|
||
// 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
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
|
||
</style> |