parent
4eece51ee0
commit
135d24eaff
3 changed files with 270 additions and 0 deletions
@ -0,0 +1,228 @@ |
||||
<template> |
||||
<section> |
||||
<section class="table-c"> |
||||
<nav class="table-top-tools"> |
||||
<el-button-group> |
||||
<el-button type="primary" size="mini" @click="beforeAdd('add','')"><i class="iconfont iconadd"></i> 新增</el-button> |
||||
</el-button-group> |
||||
</nav> |
||||
<!--列表--> |
||||
<el-table :data="tableData.rows" border highlight-current-row v-loading="listLoading" style="width: 100%;"> |
||||
<el-table-column type="index" width="60"></el-table-column> |
||||
<el-table-column prop="coin" label="币种" ></el-table-column> |
||||
<el-table-column prop="walletType" label="钱包类型" > |
||||
<template slot-scope="scope"> |
||||
<span v-if="scope.row.walletType == 'CCT'">币币钱包</span> |
||||
<span v-else>法币钱包</span> |
||||
</template> |
||||
</el-table-column> |
||||
<el-table-column prop="balance" label="可用额度"></el-table-column> |
||||
<el-table-column prop="createTime" label="创建时间"></el-table-column> |
||||
<el-table-column prop="updateTime" label="修改时间"></el-table-column> |
||||
<el-table-column label="操作" width="150"> |
||||
<template slot-scope="scope"> |
||||
<el-button type="text" @click="delRow = true;setDelId(scope.row.id)">删除</el-button> |
||||
<el-button type="text" @click="beforeAdd('update',scope.row)">编辑</el-button> |
||||
</template> |
||||
</el-table-column> |
||||
</el-table> |
||||
</section> |
||||
<!--工具条--> |
||||
<el-col :span="24" class="toolbar"> |
||||
<el-pagination layout="total, prev, pager, next,jumper" @current-change="handleCurrentChange" |
||||
:page-size="tableData.pageSize" |
||||
:total="tableData.total" style="float:right;"> |
||||
</el-pagination> |
||||
</el-col> |
||||
<div class="clear"></div> |
||||
|
||||
<!-- 新增的弹出层 --> |
||||
<el-dialog |
||||
:title="type=='add'?'新增':'编辑'" |
||||
:visible.sync="dialogVisible" |
||||
width="60%" |
||||
height="60%" |
||||
class="add-dialog" |
||||
@close="resetAddData()"> |
||||
<el-form :model="addData" class="add-form" :rules="rules" ref="addForm" label-width="120px"> |
||||
<el-form-item label="币种" prop="coin"> |
||||
<el-input v-model="addData.coin" placeholder=""></el-input> |
||||
</el-form-item> |
||||
<el-form-item label="钱包类型" v-if="type=='add'"> |
||||
<el-radio v-model="addData.walletType" label="CCT">币币钱包</el-radio> |
||||
<el-radio v-model="addData.walletType" label="OTC">法币钱包</el-radio> |
||||
</el-form-item> |
||||
<el-form-item label="可用额度" prop="balance"> |
||||
<el-input v-model="addData.balance" placeholder=""></el-input> |
||||
</el-form-item> |
||||
</el-form> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="dialogVisible = false">取 消</el-button> |
||||
<el-button type="primary" @click="addNotice(addData)">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
|
||||
<!-- 删除 --> |
||||
<el-dialog title="删除" :visible.sync="delRow " width="30%" center> |
||||
<div class="del-dialog-cnt">删除不可恢复,是否确定删除?</div> |
||||
<span slot="footer" class="dialog-footer"> |
||||
<el-button @click="delRow = false">取 消</el-button> |
||||
<el-button type="primary" @click="delNotice">确 定</el-button> |
||||
</span> |
||||
</el-dialog> |
||||
</section> |
||||
</template> |
||||
|
||||
<script> |
||||
import {SysConf} from '@/api/server.js'; |
||||
export default { |
||||
data() { |
||||
return { |
||||
Y: true, |
||||
N: false, |
||||
delRow: false, |
||||
delId: null, |
||||
searchData: { |
||||
pageNum: 1 |
||||
}, |
||||
tableData:[ |
||||
{ |
||||
rank:'1' |
||||
} |
||||
], |
||||
addData:{ |
||||
id:null, |
||||
coin:null, |
||||
walletType:'CCT', |
||||
balance:null, |
||||
}, |
||||
rules:{ |
||||
coin: [ |
||||
{required: true, message: '请输入币种', trigger: 'blur'} |
||||
], |
||||
balance: [ |
||||
{required: true, message: '请输入可用额度', trigger: 'blur'} |
||||
] |
||||
}, |
||||
listLoading: false, |
||||
dialogVisible:false, |
||||
type:'update', |
||||
} |
||||
}, |
||||
created(){ |
||||
this.getList(); |
||||
}, |
||||
methods: { |
||||
handleCurrentChange(val) { |
||||
this.searchData.pageNum = val; |
||||
this.getList(this.searchData); |
||||
}, |
||||
beforeAdd(params,row){ |
||||
if (row){ |
||||
this.addData.id = row.id; |
||||
this.addData.coin = row.coin; |
||||
this.addData.walletType = row.walletType; |
||||
this.addData.balance = row.balance; |
||||
} |
||||
this.dialogVisible=true; |
||||
this.type = params; |
||||
}, |
||||
resetAddData(){ |
||||
this.addData.id = null; |
||||
this.addData.coin = null; |
||||
this.addData.walletType = 'CCT'; |
||||
this.addData.balance = null; |
||||
}, |
||||
// 获取列表 |
||||
getList(params) { |
||||
this.listLoading = true; |
||||
SysConf.getWalletInitList(params).then((res) => { |
||||
if (res.code == 200) { |
||||
this.listLoading = false; |
||||
this.tableData = res.data; |
||||
} else { |
||||
this.$message.error(res.msg); |
||||
} |
||||
}); |
||||
}, |
||||
delNotice() { |
||||
SysConf.delWalletInit({id: this.delId}).then(data => { |
||||
let {msg, code} = data; |
||||
if (code !== 200) { |
||||
this.$message({ |
||||
message: msg, |
||||
type: 'error' |
||||
}) |
||||
} else { |
||||
this.delRow = false;//关闭删除提示模态框 |
||||
this.getList(); |
||||
this.$message.success('删除成功') |
||||
} |
||||
}).catch(error => { |
||||
this.delRow = false;//关闭删除提示模态框 |
||||
}) |
||||
}, |
||||
addNotice(addData) { |
||||
this.$refs.addForm.validate((valid) => { |
||||
if (valid) { |
||||
if(!addData.id){ |
||||
SysConf.insertWalletInit(addData).then(data => { |
||||
let {msg, code} = data; |
||||
if (code !== 200) { |
||||
this.$message({ |
||||
message: msg, |
||||
type: 'error' |
||||
}) |
||||
} else { |
||||
this.dialogVisible = false;//关闭删除提示模态框 |
||||
this.getList(); |
||||
this.$message.success('添加成功') |
||||
} |
||||
}).catch(error => { |
||||
this.dialogVisible = false;//关闭删除提示模态框 |
||||
}) |
||||
}else { |
||||
SysConf.updWalletInit(addData).then(data => { |
||||
let {msg, code} = data; |
||||
if (code !== 200) { |
||||
this.$message({ |
||||
message: msg, |
||||
type: 'error' |
||||
}) |
||||
} else { |
||||
this.dialogVisible = false;//关闭删除提示模态框 |
||||
this.getList(); |
||||
this.$message.success('修改成功'); |
||||
} |
||||
}).catch(error => { |
||||
this.dialogVisible = false;//关闭删除提示模态框 |
||||
}) |
||||
} |
||||
} else { |
||||
return false; |
||||
} |
||||
}); |
||||
}, |
||||
setDelId(id) { |
||||
this.delId = id; |
||||
}, |
||||
} |
||||
} |
||||
|
||||
</script> |
||||
|
||||
<style scoped lang="scss"> |
||||
@import '../../styles/link.scss'; |
||||
.add-form { |
||||
.el-input { |
||||
width: 340px; |
||||
} |
||||
} |
||||
</style> |
||||
<style lang="scss" > |
||||
.add-dialog{ |
||||
.el-dialog { |
||||
width: 30%; |
||||
} |
||||
} |
||||
</style> |
Loading…
Reference in new issue