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.

167 lines
3.7 KiB

3 years ago
<template>
<div style="padding: 0px 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 clearable style="width: 200px; margin-right: 10px" v-model="select.keywords" placeholder="关键字搜索" />
3 years ago
<Button type="primary" @click="getMerchant"></Button>
3 years ago
<Button type="primary" style="margin-left: 10px" @click="$refs['addMerchant'].type = 'add',$refs['addMerchant'].isShow = true">新增商户</Button>
3 years ago
</div>
</slot>
</lx-header>
</div>
3 years ago
<xy-table
:list="list"
:table-item="tableItem"
:total="total"
@pageSizeChange="select.pageSize = $event"
@pageIndexChange="pageChange"
@editor="editorShow"
@delete="deleteMerchant">
</xy-table>
3 years ago
3 years ago
<!-- 新增商户-->
3 years ago
<add-merchant ref="addMerchant" @refresh="getMerchant"></add-merchant>
3 years ago
</div>
</template>
<script>
3 years ago
import {index,destroy} from "@/api/merchant"
import addMerchant from './component/addMerchant'
import { Message } from 'element-ui'
3 years ago
export default {
3 years ago
components:{
addMerchant
},
3 years ago
data() {
return {
3 years ago
select:{
pageSize:10,
pageIndex:1,
3 years ago
keywords:''
3 years ago
},
3 years ago
total:0,
list:[],
3 years ago
tableItem:[
{
prop:'username',
label:'简称/用户名',
3 years ago
width:190,
3 years ago
sortable:false,
align:'left',
fixed:"left"
3 years ago
},
{
prop:'name',
label:'全名',
3 years ago
width: 280,
3 years ago
sortable:false,
3 years ago
align:'left',
fixed:"left"
3 years ago
},
{
prop:'business_number',
label:'营业执照号码',
3 years ago
width: 200
3 years ago
},
{
prop:"address",
label:"地址",
3 years ago
minWidth: 320,
3 years ago
align:'left'
3 years ago
},
{
prop:"boss",
label:"法人/老板",
3 years ago
width:120
3 years ago
},
{
prop:"boss_phone",
label:"法人/老板电话",
3 years ago
width:160
3 years ago
},
{
prop:"contact",
label:"联系人",
width: 110
},
{
prop:"phone",
label:"联系电话",
width: 150
},
{
3 years ago
prop:"shops_num",
3 years ago
label:"门店数",
3 years ago
width: 100,
formatter:(cell,data,value)=>{
if(value){
return value
}else{
return 0
}
}
3 years ago
},
{
prop:"state",
3 years ago
label: "状态",
customFn:(row)=>{
if(row.state == 1 || row.state === 'active'){
return (<div style={{'color':'green'}}>启用</div>)
}else{
return (<div style={{'color':'red'}}>禁用</div>)
}
}
3 years ago
}
]
}
},
3 years ago
methods: {
3 years ago
pageChange(e){
this.select.pageIndex = e
this.getMerchant()
},
async getMerchant(){
const res = await index({
page_size:this.select.pageSize,
3 years ago
page:this.select.pageIndex,
keyword:this.select.keywords
3 years ago
})
this.list = res.data
this.total = res.total
},
deleteMerchant(row){
console.log(row.id)
destroy({ id: row.id }).then(res => {
Message({
type:'success',
message:'删除成功'
})
this.getMerchant()
})
},
3 years ago
3 years ago
editorShow(row){
this.$refs['addMerchant'].id = row.id
this.$refs['addMerchant'].type = 'editor'
this.$refs['addMerchant'].isShow = true
}
},
mounted() {
this.getMerchant()
3 years ago
}
3 years ago
}
</script>
<style scoped lang="scss">
</style>