You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

134 lines
3.0 KiB

3 years ago
<template>
<div style="padding: 0 20px">
<div ref="lxHeader">
<lx-header icon="md-apps" text="门店管理" style="margin-bottom: 10px; border: 0px; margin-top: 15px">
<div slot="content"></div>
<slot>
<div>
3 years ago
<Input style="width: 200px; margin-right: 10px" v-model="select.keywords" placeholder="关键字搜索" />
<Button type="primary" @click="getStores"></Button>
<Button type="primary" style="margin-left: 10px" @click="$refs['addStore'].isShow = true,$refs['addStore'].type = 'add'">新增门店</Button>
3 years ago
</div>
</slot>
</lx-header>
</div>
3 years ago
<xy-table :list="list" :table-item="tableItem" @delete="deleteStore" @editor="editorStore"></xy-table>
3 years ago
<div style="display: flex;justify-content: flex-end;">
3 years ago
<Page :total="total" show-elevator @on-change="pageChange"/>
3 years ago
</div>
3 years ago
<!-- 新增门店-->
3 years ago
<add-store ref="addStore" @refresh="getStores"></add-store>
3 years ago
</div>
</template>
<script>
3 years ago
import {index,destroy} from '@/api/shop'
3 years ago
import addStore from '@/views/business/component/addStore'
3 years ago
import { Message } from 'element-ui'
3 years ago
export default {
3 years ago
components:{
addStore
},
3 years ago
data() {
return {
3 years ago
select:{
pageIndex:1,
pageSize:10,
keywords:''
},
total:0,
list:[],
3 years ago
tableItem:[
{
prop:'name',
label:'名称/用户名',
3 years ago
align:'left',
width:140
3 years ago
},
{
prop:'merchant.name',
label:'所属商户',
3 years ago
width:220
3 years ago
},
{
prop:'address',
label:'地址',
3 years ago
width: 300,
align:'left'
3 years ago
},
{
prop:'contact',
label:'联系人',
3 years ago
width: 120
3 years ago
},
{
prop:'phone',
label:'联系电话',
3 years ago
width: 160
3 years ago
},
{
prop:'state',
3 years ago
label:'状态',
width: 120
3 years ago
},
{
label:'是否为主营门店',
prop:'is_default',
3 years ago
width: 150,
formatter:(row, column, cellValue)=>{
3 years ago
if(cellValue){
return '是'
}else{
return '否'
}
}
}
]
}
},
3 years ago
methods: {
3 years ago
async getStores(){
const res = await index({
page_size:this.select.pageSize,
page:this.select.pageIndex
})
this.list = res.data
this.total = res.total
},
pageChange(e){
this.select.pageIndex = e
this.getStores()
},
deleteStore(row){
destroy({
id:row.id
}).then(res => {
Message({
type:'success',
message:'删除成功'
})
this.getStores()
})
},
editorStore(row){
this.$refs['addStore'].type = 'editor'
this.$refs['addStore'].id = row.id
this.$refs['addStore'].isShow = true
3 years ago
}
3 years ago
},
mounted() {
this.getStores()
3 years ago
}
3 years ago
}
</script>
<style scoped lang="scss">
</style>