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.

172 lines
4.9 KiB

<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>
<Input v-model="select.keywords" style="width: 200px; margin-right: 10px" placeholder="关键字搜索" />
<Select placeholder="类型搜索" v-model="select.type" style="width: 140px;margin-right: 10px">
</Select>
<Button type="primary">查询</Button>
<Button type="primary" style="margin-left: 10px" @click="$refs['addConfinementClub'].type = 'add',$refs['addConfinementClub'].isShow = true">新增</Button>
</div>
</slot>
</lx-header>
</div>
<xy-table
:total="total"
:list="list"
:table-item="table"
@pageSizeChange="e => select.pageSize = e">
<template v-slot:btns>
<el-table-column fixed="right" label="操作" :width="130" align="left" header-align="center">
<template slot-scope="scope">
<Button ghost size="small" type="primary" @click="editorClub(scope.row)" style="margin: 0 6px 4px 0">编辑</Button>
<Poptip confirm transfer title="确认要删除吗" @on-ok="clubDelete(scope.row)">
<Button ghost size="small" type="primary" style="margin: 0 6px 4px 0">删除</Button>
</Poptip>
<Button ghost size="small" type="primary" @click="showInfo(scope.row)" style="margin: 0 6px 4px 0;width: 95px">商户信息</Button>
<Button ghost size="small" type="primary" @click="showPic(scope.row)" style="margin: 0 6px 4px 0;width: 95px">商户图片</Button>
</template>
</el-table-column>
</template>
</xy-table>
<addConfinementClub ref="addConfinementClub" @refresh="getClubs"></addConfinementClub>
<addClubInfo ref="addClubInfo"></addClubInfo>
<addClubPic ref="addClubPic"></addClubPic>
</div>
</template>
<script>
import {index,destroy} from '@/api/confinementClub'
import {parseTime} from '@/utils'
import { Message } from 'element-ui'
import addConfinementClub from '@/views/productService/components/confinement/addConfinementClub'
import addClubInfo from '@/views/productService/components/confinement/addClubInfo'
import addClubPic from '@/views/productService/components/confinement/addClubPic'
export default {
components:{
addConfinementClub,
addClubInfo,
addClubPic
},
data() {
return {
select:{
page:1,
pageSize:10,
keywords:'',
type:''
},
total:0,
list:[],
table:[
{
prop:'name',
label:'名称',
width:200,
align:'left'
},
{
prop:'reach',
label:'是否到店',
width: 160,
customFn:(row)=>{
return (
<div style={{'color': row.reach === 1 ? 'green' : 'red'}}>{row.reach === 1 ? '已到店' : '未到店'}</div>
)
}
},
{
label:'特色标签',
width: 260,
align:'left',
prop:'featured_label',
customFn:(row) => {
return (
<div>
{
row.featured_label ?
row.featured_label?.split(',').map(item => {
return <el-tag type="border" style={{'margin':'0 6px 4px 0'}}>{item}</el-tag>
}) : <div style={{'text-align':'center'}}>无</div>
}
</div>
)
}
},
{
label:'排序',
width: 120,
prop:'sort_number'
},
{
label:'提交人',
prop:'admin.name',
width:180
},
{
label:'提交日期',
prop:'created_at',
minWidth: 200,
formatter:(cell,data,value)=>{
return parseTime(new Date(value),'{y}-{m}-{d}')
}
}
],
}
},
methods: {
async getClubs(){
const res = await index({
page:this.select.page,
pageSize:this.select.pageSize
})
console.log(res)
this.list = res.rows
this.total = res.total
},
clubDelete(row){
destroy({
id:row.id
}).then(res => {
Message({
type:'success',
message:'删除月子商户成功'
})
this.getClubs()
})
},
editorClub(row){
this.$refs['addConfinementClub'].type = 'editor'
this.$refs['addConfinementClub'].id = row.id
this.$refs['addConfinementClub'].isShow = true
},
showInfo(row){
this.$refs['addClubInfo'].id = row.id
this.$refs['addClubInfo'].isShow = true
},
showPic(row){
this.$refs['addClubPic'].id = row.id
this.$refs['addClubPic'].isShow = true
}
},
mounted() {
this.getClubs()
}
}
</script>
<style scoped lang="scss">
</style>