<template>
<app-container>
<search-area :need-clear="false" :need-search-more="false" type="seperate" size="small" search-more-type="default" @search="fetchData">
<!--一般查询条件-->
<search-item>
<el-input v-model.trim="listQuery.keyword" size="small" placeholder="请输入关键字" clearable/>
</search-item>
</search-area>
<normal-table :data="list" :head="tableOption.head" :query="listQuery" :total="total" :columns="columns" :list-loading="listLoading" :options="tableOption.options" :tools-option="tableOption.toolsOption" size="small" @change="changePage"/>
</app-container>
</template>
<script>
import { merchantListPage } from '@/api/server'
import NormalTable from '@/components/NomalTable'
import AppContainer from '@/components/layout/AppContainer'
import SearchArea from '@/components/SearchArea/SearchArea'
import SearchItem from '@/components/SearchArea/SearchItem'
export default {
name: 'Address',
components: { SearchItem, SearchArea, AppContainer, NormalTable },
data() {
return {
listQuery: {
keyword: '',
rentStatus: '',
streetName: '',
startTime: '',
endTime: '',
offset: 1,
limit: 10,
sort: '',
order: ''
}, // 筛选条件
columns: [
{
text: '名称',
value: 'merchantName',
align: 'center',
width: 200
},
{
text: '详细地址',
value: 'address',
align: 'center'
},
{
text: '地址编码',
value: 'shopCode',
align: 'center'
}
], // 显示列
timeRange: [], // 时间范围
list: [], // 列表数据
total: 0, // 数据总数
listLoading: true, // 列表加载动画
tableOption: {
head: {
show: true, // 是否需要标题栏,
text: '数据列表' // 标题名称
},
options: {
needIndex: false // 是否需要序号列
},
toolsOption: {
selectColumns: false, // 是否需要筛选列
refresh: false // 是否需要刷新按钮
}
} // 表格属性
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.listLoading = true
merchantListPage(this.listQuery).then(res => {
this.list = res.data.rows
this.total = parseInt(res.data.total)
this.listLoading = false
})
},
// 页数发生变化后的操作,可能是页码变化,可能是每页容量变化,此函数必写
changePage(val) {
if (val && val.size) {
this.listQuery.limit = val.size
}
if (val && val.page) {
this.listQuery.offset = val.page
}
this.fetchData()
},
// 重置后的操作, 若不需要显示重置按钮则不需要写
clearInput() {
this.$message.success('clearInput')
}
}
}
</script>
<style scoped>
</style>