200 lines
6.6 KiB
Vue
200 lines
6.6 KiB
Vue
|
|
<template>
|
|
<div class="pf-warpper avlist">
|
|
<el-row class="table-form">
|
|
<el-form :inline="true" :model="searchData" class="form-inline" size="mini">
|
|
<el-form-item>
|
|
<el-button @click="add" icon="el-icon-circle-plus-outline" plain type="success">新增</el-button>
|
|
<el-button @click="refreshView" icon="el-icon-refresh" plain type="info">刷新</el-button>
|
|
</el-form-item>
|
|
</el-form>
|
|
</el-row>
|
|
<el-row>
|
|
<el-col>
|
|
<el-table :data="resData" element-loading-text="拼命加载中" border height="750" highlight-current-row style="width: 100%" v-loading="loading" :row-style="{ height: '70px' }">
|
|
<el-table-column align="center" label="ID">
|
|
<template slot-scope="scope">{{ scope.row.id }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="名称">
|
|
<template slot-scope="scope">{{ scope.row.name }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="描述" width="120">
|
|
<template slot-scope="scope">{{ scope.row.desc }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="排序" width="120">
|
|
<template slot-scope="scope">{{ scope.row.sort }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="图片" width="120px">
|
|
<template slot-scope="scope">
|
|
<ShowImg style="width: 70px; height: 40px; margin: 0 auto" :urls="scope.row.image"></ShowImg>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="积分数量">
|
|
<template slot-scope="scope">{{ scope.row.score }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="赠送积分数量">
|
|
<template slot-scope="scope">{{ scope.row.giftScore }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="现价(单位:分)" width="150px">
|
|
<template slot-scope="scope">{{ scope.row.payAmount | changeMoneyYuan }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="原价(单位:分)" width="150px">
|
|
<template slot-scope="scope">{{ scope.row.prePayAmount | changeMoneyYuan }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="是否上架">
|
|
<template slot-scope="scope">
|
|
<el-button :type="scope.row.isEnb ? 'success' : 'danger'" plain size="mini">{{ scope.row.isEnb ? '上架' : '未上架' }}</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="创建时间" width="160px">
|
|
<template slot-scope="scope">{{ scope.row.createdAt | BeiJingTime }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" label="更新时间" width="160px">
|
|
<template slot-scope="scope">{{ scope.row.updatedAt | BeiJingTime }}</template>
|
|
</el-table-column>
|
|
<el-table-column align="center" fixed="right" label="操作" width="200">
|
|
<template slot-scope="scope">
|
|
<el-button @click="handleEdit(scope.$index, scope.row)" size="mini" type="primary">编辑</el-button>
|
|
<el-button @click="handleDelete(scope.$index, scope.row)" size="mini" type="danger">删除</el-button>
|
|
</template>
|
|
</el-table-column>
|
|
</el-table>
|
|
</el-col>
|
|
</el-row>
|
|
<div class="table-pagination">
|
|
<el-pagination
|
|
:current-page="searchData.pageNum"
|
|
:page-size="searchData.pageSize"
|
|
:page-sizes="[10, 20, 30, 50, 100]"
|
|
:total="total"
|
|
@current-change="handleCurrentChange"
|
|
@size-change="handleSizeChange"
|
|
layout="total, sizes, prev, pager, next, jumper"/>
|
|
</div>
|
|
<!-- 新增及编辑 -->
|
|
<Edit :data="editData" v-if="editVisible" @close="closeEdit" />
|
|
</div>
|
|
</template>
|
|
<script>
|
|
// 引入模块
|
|
import Edit from './components/AddOrEdit'
|
|
import ShowImg from '@/components/ShowImg/index.vue'
|
|
import { aiMateScoreConfList, aiMateScoreConfDel } from '@/api/aiManagement/aiGirlFriendConfig'
|
|
export default {
|
|
name: 'Gold',
|
|
components: {
|
|
Edit,
|
|
ShowImg
|
|
},
|
|
data() {
|
|
return {
|
|
// 请求列表参数
|
|
searchData: {
|
|
pageNum: 1,
|
|
pageSize: 10
|
|
},
|
|
resData: [], // el-table表格数据
|
|
editVisible: false, // 新增或编辑弹出框
|
|
total: 0, // 数据总条数
|
|
loading: true, // 列表加载状态
|
|
// 编辑数据
|
|
editData: {
|
|
title: '新增',
|
|
data: {}
|
|
}
|
|
}
|
|
},
|
|
|
|
mounted() {
|
|
this.getGoldList()
|
|
},
|
|
methods: {
|
|
// TODO:请求金币管理数据列表
|
|
getGoldList() {
|
|
this.loading = true
|
|
aiMateScoreConfList(this.searchData).then(res => {
|
|
if (res.code === 200) {
|
|
this.resData = res.data.list
|
|
this.total = res.data.total
|
|
} else {
|
|
this.resData = []
|
|
this.total = 0
|
|
this.$message.error('请求列表失败!')
|
|
}
|
|
this.loading = false
|
|
})
|
|
},
|
|
// TODO:删除金币管理列表数据
|
|
handleDelete(index, row) {
|
|
this.$confirm('确定删除?', '警告', {
|
|
confirmButtonText: '确定',
|
|
cancelButtonText: '取消',
|
|
type: 'warning'
|
|
}).then(() => {
|
|
aiMateScoreConfDel({ id: row.id }).then(res => {
|
|
if (res.code === 200) {
|
|
this.getGoldList()
|
|
this.$message.success('成功删除!')
|
|
} else {
|
|
this.$message.error('操作失败')
|
|
}
|
|
})
|
|
})
|
|
},
|
|
|
|
onSearch() {
|
|
this.searchData.pageNum = 1
|
|
this.searchData.pageSize = 10
|
|
this.getGoldList()
|
|
},
|
|
// 刷新数据
|
|
refreshView() {
|
|
this.searchData = {
|
|
pageNum: 1,
|
|
pageSize: 10
|
|
}
|
|
this.getGoldList()
|
|
},
|
|
|
|
// 切换每页数据量
|
|
handleSizeChange(val) {
|
|
this.searchData.pageSize = val
|
|
this.getGoldList()
|
|
},
|
|
// 切换页数
|
|
handleCurrentChange(val) {
|
|
this.searchData.pageNum = val
|
|
this.getGoldList()
|
|
},
|
|
|
|
// 新增按钮
|
|
add() {
|
|
this.editVisible = true
|
|
this.editData = {
|
|
title: '新增',
|
|
data: {}
|
|
}
|
|
},
|
|
// 编辑按钮
|
|
handleEdit(index, row) {
|
|
this.editVisible = true
|
|
this.editData = {
|
|
title: '编辑',
|
|
data: row
|
|
}
|
|
},
|
|
|
|
// 关闭编辑弹窗
|
|
closeEdit() {
|
|
this.editData = {
|
|
title: '新增',
|
|
data: {}
|
|
}
|
|
this.editVisible = false
|
|
this.refreshView()
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|