Browse Source

添加页面

master
liweiliang 2 years ago
parent
commit
69cc3923c8
  1. 53
      src/api/user/coin.js
  2. 405
      src/views/user/coin/index.vue

53
src/api/user/coin.js

@ -0,0 +1,53 @@
import request from '@/utils/request'
// 查询币种配置列表
export function listCoin(query) {
return request({
url: '/user/coin/list',
method: 'get',
params: query
})
}
// 查询币种配置详细
export function getCoin(id) {
return request({
url: '/user/coin/' + id,
method: 'get'
})
}
// 新增币种配置
export function addCoin(data) {
return request({
url: '/user/coin',
method: 'post',
data: data
})
}
// 修改币种配置
export function updateCoin(data) {
return request({
url: '/user/coin',
method: 'put',
data: data
})
}
// 删除币种配置
export function delCoin(id) {
return request({
url: '/user/coin/' + id,
method: 'delete'
})
}
// 导出币种配置
export function exportCoin(query) {
return request({
url: '/user/coin/export',
method: 'get',
params: query
})
}

405
src/views/user/coin/index.vue

@ -0,0 +1,405 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="币种名称" prop="name">
<el-input
v-model="queryParams.name"
placeholder="请输入币种名称"
clearable
size="small"
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="类型" prop="feeType">
<el-select v-model="queryParams.feeType" placeholder="请选择状态" clearable size="small">
<el-option v-for="dict in feeTypeOptions" :key="dict.dictValue" :label="dict.dictLabel"
:value="dict.dictValue" />
</el-select>
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable size="small">
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel"
:value="dict.dictValue" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
</el-form-item>
</el-form>
<el-row :gutter="10" class="mb8">
<!-- <el-col :span="1.5">
<el-button
type="primary"
plain
icon="el-icon-plus"
size="mini"
@click="handleAdd"
v-hasPermi="['user:coin:add']"
>新增</el-button>
</el-col> -->
<el-col :span="1.5">
<el-button
type="success"
plain
icon="el-icon-edit"
size="mini"
:disabled="single"
@click="handleUpdate"
v-hasPermi="['user:coin:edit']"
>修改</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="danger"
plain
icon="el-icon-delete"
size="mini"
:disabled="multiple"
@click="handleDelete"
v-hasPermi="['user:coin:remove']"
>删除</el-button>
</el-col>
<el-col :span="1.5">
<el-button
type="warning"
plain
icon="el-icon-download"
size="mini"
@click="handleExport"
v-hasPermi="['user:coin:export']"
>导出</el-button>
</el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="coinList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="币种名称" align="center" prop="name" />
<el-table-column label="中文名称" align="center" prop="nameCn" />
<el-table-column label="详细名称" align="center" prop="nameEn" />
<el-table-column label="链名称" align="center" prop="chainName" />
<!-- <el-table-column label="是否可以充值" align="center" prop="canRecharge" />
<el-table-column label="是否可以转让" align="center" prop="canTransfer" />
<el-table-column label="是否可以提现" align="center" prop="canWithdraw" />
<el-table-column label="是否为平台币" align="center" prop="isPlatformCoin" />
<el-table-column label="单日最大提币量" align="center" prop="maxDailyWithdrawRate" /> -->
<el-table-column label="类型" align="center" prop="feeType" :formatter="feeTypeFormat" />
<el-table-column label="手续费" align="center" prop="maxTxFee" />
<el-table-column label="最大提币数量" align="center" prop="maxWithdrawAmount" />
<el-table-column label="最小提现费用" align="center" prop="minTxFee" />
<el-table-column label="最小提币手续费" align="center" prop="minWithdrawAmount" />
<!-- <el-table-column label="最小充币数量" align="center" prop="minRechargeAmount" /> -->
<!-- <el-table-column label="排序" align="center" prop="sort" /> -->
<!-- <el-table-column label="人民币汇率" align="center" prop="cnyRate" />
<el-table-column label="美元汇率" align="center" prop="usdRate" /> -->
<el-table-column label="状态" align="center" prop="status" :formatter="statusFormat" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['user:coin:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['user:coin:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改币种配置对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<!-- <el-form-item label="类型" prop="feeType">
<el-select v-model="form.feeType" placeholder="请选择类型">
<el-option label="按笔" value="pen"></el-option>
<el-option label="百分比" value="percentage"></el-option>
</el-select>
</el-form-item> -->
<el-form-item label="类型" prop="feeType">
<el-select v-model="form.feeType" placeholder="请选择状态" clearable size="small">
<el-option v-for="dict in feeTypeOptions" :key="dict.dictValue" :label="dict.dictLabel"
:value="dict.dictValue" />
</el-select>
</el-form-item>
<el-form-item label="手续费" prop="maxTxFee">
<el-input v-model="form.maxTxFee" placeholder="手续费" />
</el-form-item>
<el-form-item label="最大提币数量" prop="maxWithdrawAmount">
<el-input v-model="form.maxWithdrawAmount" placeholder="请输入最大提币数量" />
</el-form-item>
<el-form-item label="最小提币手续费" prop="minWithdrawAmount">
<el-input v-model="form.minWithdrawAmount" placeholder="请输入最小提币手续费" />
</el-form-item>
<el-form-item label="状态" prop="status">
<el-select v-model="form.status" placeholder="请选择状态" clearable size="small">
<el-option v-for="dict in statusOptions" :key="dict.dictValue" :label="dict.dictLabel"
:value="dict.dictValue" />
</el-select>
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm"> </el-button>
<el-button @click="cancel"> </el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listCoin, getCoin, delCoin, addCoin, updateCoin, exportCoin } from "@/api/user/coin";
export default {
name: "Coin",
components: {
},
data() {
return {
//
loading: true,
//
ids: [],
//
single: true,
//
multiple: true,
//
showSearch: true,
//
total: 0,
//
coinList: [],
statusOptions: [],
feeTypeOptions: [],
//
title: "",
//
open: false,
//
queryParams: {
pageNum: 1,
pageSize: 10,
name: null,
nameCn: null,
nameEn: null,
chainName: null,
canRecharge: null,
canTransfer: null,
canWithdraw: null,
coldWalletAddress: null,
isPlatformCoin: null,
maxDailyWithdrawRate: null,
feeType: null,
maxTxFee: null,
maxWithdrawAmount: null,
minTxFee: null,
minWithdrawAmount: null,
minRechargeAmount: null,
minerFee: null,
sgdRate: null,
sort: null,
cnyRate: null,
usdRate: null,
status: null,
withdrawScale: null,
withdrawThreshold: null
},
//
form: {},
//
rules: {
nameCn: [
{ required: true, message: "中文名称不能为空", trigger: "blur" }
],
nameEn: [
{ required: true, message: "详细名称不能为空", trigger: "blur" }
],
maxTxFee: [
{ required: true, message: "最大提现手续费不能为空", trigger: "blur" }
],
minTxFee: [
{ required: true, message: "最小提现费用不能为空", trigger: "blur" }
],
sort: [
{ required: true, message: "排序不能为空", trigger: "blur" }
],
}
};
},
created() {
this.getList();
this.getDicts("sys_normal_disable").then(response => {
this.statusOptions = response.data;
});
this.getDicts("fee_type").then(response => {
this.feeTypeOptions = response.data;
});
},
methods: {
/** 查询币种配置列表 */
getList() {
this.loading = true;
listCoin(this.queryParams).then(response => {
this.coinList = response.rows;
this.total = response.total;
this.loading = false;
});
},
//
statusFormat(row, column) {
return this.selectDictLabel(this.statusOptions, row.status);
},
//
feeTypeFormat(row, column) {
return this.selectDictLabel(this.feeTypeOptions, row.feeType);
},
//
cancel() {
this.open = false;
this.reset();
},
//
reset() {
this.form = {
id: null,
name: null,
nameCn: null,
nameEn: null,
chainName: null,
canRecharge: null,
canTransfer: null,
canWithdraw: null,
coldWalletAddress: null,
isPlatformCoin: null,
maxDailyWithdrawRate: null,
feeType: null,
maxTxFee: null,
maxWithdrawAmount: null,
minTxFee: null,
minWithdrawAmount: null,
minRechargeAmount: null,
minerFee: null,
sgdRate: null,
sort: null,
cnyRate: null,
usdRate: null,
status: '0',
withdrawScale: null,
withdrawThreshold: null
};
this.resetForm("form");
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1;
this.getList();
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm");
this.handleQuery();
},
//
handleSelectionChange(selection) {
this.ids = selection.map(item => item.id)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset();
this.open = true;
this.title = "添加币种配置";
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset();
const id = row.id || this.ids
getCoin(id).then(response => {
this.form = response.data;
this.open = true;
this.title = "修改币种配置";
});
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.id != null) {
updateCoin(this.form).then(response => {
this.msgSuccess("修改成功");
this.open = false;
this.getList();
});
} else {
addCoin(this.form).then(response => {
this.msgSuccess("新增成功");
this.open = false;
this.getList();
});
}
}
});
},
/** 删除按钮操作 */
handleDelete(row) {
const ids = row.id || this.ids;
this.$confirm('是否确认删除币种配置编号为"' + ids + '"的数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return delCoin(ids);
}).then(() => {
this.getList();
this.msgSuccess("删除成功");
})
},
/** 导出按钮操作 */
handleExport() {
const queryParams = this.queryParams;
this.$confirm('是否确认导出所有币种配置数据项?', "警告", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning"
}).then(function() {
return exportCoin(queryParams);
}).then(response => {
this.download(response.msg);
})
}
}
};
</script>
Loading…
Cancel
Save