You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

546 lines
15 KiB
Vue

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<script setup>
import controlform from '@/components/controlform/control.vue'
import check from "@/components/check/check.vue";
import * as control from "@/api/control.js";
const { proxy } = getCurrentInstance();
import useUserStore from "@/store/modules/user";
const userStore = useUserStore();
// 引入路由进行跳转
import { useRouter } from "vue-router";
const router = useRouter();
const loading=ref(false)
// 验证
const dialogVisible = ref(false);
// 查看额度
const dialogQuotaVisible = ref(false);
const QuotaVisible = ref(false);
// 解密
const decodeVisible = ref(false);
// 生成数字货币total
const total = ref(0);
// 货币生成params
const queryParams = reactive({
userId: userStore.userId,
size: 5,
index: 1,
});
const lookid = ref("");
// 存储数字货币生成的数据
const moneyData = ref(null);
// 获取数字货币生成
const getlist = async () => {
try {
const res = await control.getmoney(queryParams);
moneyData.value = res.data.list;
total.value = res.data.total;
} catch (error) {}
};
let controlData = reactive([]);
const look = async (val) => {
QuotaVisible.value = true;
coding.value=val.detailId
};
// 表格面额乘数量
const getSummaries = (params) => {
const { columns, data } = params;
const sums = [];
let sum = 0;
columns.forEach((column, index) => {
console.log(index);
if (index == 0) {
sums[index] = "合计:" + sum;
return;
}
const values = data.map((item) => Number(item[column.property]));
const denomination = data.map((item) => Number(item.name));
denomination.reduce((prev, curr, idex) => {
let summation = (curr *= values[idex]);
sum += summation;
}, 0);
console.log(sum);
if (!values.every((value) => Number.isNaN(value))) {
sums[index] = `${values.reduce((prev, curr) => {
const value = Number(curr);
if (!Number.isNaN(value)) {
return prev + curr;
} else {
return prev;
}
}, 0)}`;
} else {
sums[index] = "N/A";
}
});
sums[0] = "合计: " + sum; // 更新合计值
return sums;
};
// 获取私钥
// 存储私钥
const privateKey = ref("");
const getPrivateKey = async () => {
try {
const res = await control.getPrivate();
privateKey.value = res.data;
} catch (error) {}
};
// 生成数字弹窗按钮
// 存储数字货币信息
const digitalCurrency = reactive({
detailId: "",
ownerName: "",
rmbAmount: "",
});
const coding=ref('')
// 表格回显
const handleClose = (val) => {
decodeVisible.value = true;
digitalCurrency.detailId = val.detailId;
digitalCurrency.ownerName = val.ownerWalletAddress;
digitalCurrency.rmbAmount = val.rmbAmount;
};
// 生成数字货币
const generate = () => {
decodeVisible.value = false;
loading.value=true
control.generateMoney({ detailId: digitalCurrency.detailId}).then(res=>{
loading.value=false
getlist();
proxy.$modal.msgSuccess(res.msg);
}).catch(err=>{
loading.value=false
})
};
// 查看数字货币total
const encoding = ref("");
// 存储查看数字货币数据
// const checkData=ref(null)
//获取查看数字货币数据
const getDigitalCurrency = (code) => {
encoding.value = code;
dialogVisible.value = true;
};
// 投放申请函数
const put = async (id) => {
digitalCurrency.detailId = id;
try {
const res = await control.putApply({ detailId: digitalCurrency.detailId });
getlist();
proxy.$modal.msgSuccess(res.msg);
} catch (error) {}
};
// 存储找零数字货币数据
const tableData = ref(null);
// 获取找零生成数字货币数据
function getChange() {
control.changeMoney(queryParams).then(res=>{
tableData.value = res.data.list;
})
};
// 销毁弹窗
const destroy = () => {
lookid.value = "";
encoding.value="";
coding.value=''
dialogVisible.value = false;
if(dialogVisible.value==false){
controlData=[]
}else if(dialogVisible.value==false){
encoding.value=''
}else if(QuotaVisible.value==false){
coding.value=''
}
console.log(coding.value,"coding.value");
};
// 查看额度弹窗显示隐藏
// 查看额度
const getQuota = () => {
nextTick(()=>{
// 这个coding没传过去
coding.value= digitalCurrency.detailId
console.log(coding.vlaue,"digitalCurrency.detailId");
QuotaVisible.value=true
})
};
getPrivateKey();
getChange();
getlist();
</script>
<template>
<div class="app-central">
<div class="central-ban-information">
<el-row>
<el-col :span="24">
<img src="../../../assets/images/06.png" alt="" />
<span>兑换生成数字货币</span>
</el-col>
</el-row>
<div class="el-tab el-tab1">
<el-table :data="moneyData" style="width: 100%" stripe v-loading="loading" >
<el-table-column
align="center"
prop="transactionCode"
label="交易编码"
width="160"
>
</el-table-column>
<el-table-column
align="center"
prop="rmbAmount"
label="交易金额"
width="180"
>
</el-table-column>
<el-table-column
align="center"
prop="ownerName"
label="属主名称"
width="90"
>
</el-table-column>
<el-table-column
align="center"
prop="ownerWalletAddress"
label="属主钱包地址"
>
</el-table-column>
<el-table-column
align="center"
prop="exchangeBankName"
label="兑换行名称"
>
</el-table-column>
<el-table-column
align="center"
prop="exchangeBankWalletAddress"
label="兑换行钱包地址"
>
</el-table-column>
<el-table-column align="center" prop="address" label="控制位信息">
<template #default="scope">
<el-button
link
type="success"
@click="look(scope.row)"
>
<svg-icon icon-class="look" />查看
</el-button>
</template>
</el-table-column>
<el-table-column align="center" prop="initiationTime" label="时间戳">
<template #default="scope">
<span>{{ parseTime(scope.row.initiationTime) }}</span>
</template>
</el-table-column>
<el-table-column
align="center"
prop="address"
label="操作"
width="360"
>
<template #default="scope">
<el-button
:disabled="scope.row.digitalCurrencyGenerationStatus == 'true'"
link
type="primary"
@click="handleClose(scope.row)"
>
<!-- :disabled="scope.row.digitalCurrencyGenerationStatus == 'true'" -->
<svg-icon icon-class="generate" />生成数字货币
</el-button>
<el-button
link
type="success"
@click="getDigitalCurrency(scope.row.transactionCode)"
>
<svg-icon icon-class="look" />查看数字货币
</el-button>
<el-button
link
type="warning"
@click="put(scope.row.detailId)"
:disabled="
scope.row.digitalCurrencyLaunchApplicationStatus == 'true'
"
>
<svg-icon icon-class="put" />投放申请
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<pagination
v-show="total > 0"
:total="total"
v-model:page="queryParams.index"
v-model:limit="queryParams.size"
@pagination="getlist"
/>
<div class="central-ban-information">
<el-row>
<el-col :span="24">
<img src="../../../assets/images/07.png" alt="" />
<span>找零生成数字货币系统自动生成</span>
</el-col>
</el-row>
<div class="el-tab el-tab1">
<el-table :data="tableData" style="width: 100%" stripe>
<el-table-column
align="center"
prop="transactionCode"
label="交易编码"
width="160"
>
</el-table-column>
<el-table-column
align="center"
prop="cryptocurrencyAmount"
label="交易金额"
width="180"
>
</el-table-column>
<el-table-column
align="center"
prop="recipientName"
label="属主名称"
width="90"
>
</el-table-column>
<el-table-column
align="center"
prop="recipientWalletAddress"
label="属主钱包地址"
width="300"
>
</el-table-column>
<el-table-column align="center" prop="senderName" label="兑换行名称">
</el-table-column>
<el-table-column
align="center"
prop="senderWalletAddress"
label="兑换行钱包地址"
>
</el-table-column>
<el-table-column align="center" prop="address" label="控制位信息">
</el-table-column>
<el-table-column align="center" prop="transactionTime" label="时间戳" width="160">
<template #default="scope">
<span>{{ parseTime(scope.row.transactionTime) }}</span>
</template>
</el-table-column>
<el-table-column
align="center"
label="操作"
width="300"
>
<template #default="scope">
<el-button
link
type="success"
@click="getDigitalCurrency(scope.row.transactionCode)"
>
<svg-icon icon-class="look" />查看数字货币
</el-button>
</template>
</el-table-column>
</el-table>
</div>
</div>
<pagination :total="20" />
<!-- 查看数字货币 -->
<el-dialog v-model="dialogVisible" title="查看数字货币" width="56%" @close="destroy" draggable>
<check :code="encoding" v-if="encoding!==''"/>
</el-dialog>
<!-- 生成数字货币 -->
<el-dialog v-model="decodeVisible" title="生成数字货币" width="34%" draggable>
<el-form class="demo-form-inline">
<el-form-item label="额度控制位:">
<el-button type="primary" @click="getQuota" link>选择</el-button>
<!-- <el-input clearable v-model=" digitalCurrency.rmbAmount" /> -->
</el-form-item>
<el-form-item label="署 主 信 息 ">
<el-input v-model="digitalCurrency.ownerName" clearable />
</el-form-item>
<el-form-item label="央 行 私 钥 ">
<el-input v-model="privateKey" clearable />
</el-form-item>
</el-form>
<template #footer>
<span class="dialog-footer">
<el-button type="primary" @click="generate"
v-preReClick
>数字签名 生成数字货币</el-button
>
</span>
</template>
</el-dialog>
<!-- 查看额度 -->
<el-dialog v-model="QuotaVisible" title="控制位" width="34%" @close="destroy" draggable>
<controlform :ID="coding" v-if="coding!==''"/>
</el-dialog>
<!-- <el-dialog v-model="QuotaVisible" title="查看数字货币" width="34%" draggable>
<check :code="coding" />
</el-dialog> -->
</div>
</template>
<style lang="scss" scoped>
.app-central {
// background-color: #fff;
color: #ffffff;
.central-ban-information {
.el-col-24 {
height: 69px;
padding: 15px 13px;
display: flex;
align-items: center;
span {
padding-left: 15px;
font-weight: bold;
font-size: 14px;
}
}
.el-tab {
padding: 0 13px;
}
.el-tab1 {
border: 1px solid #1854a6;
padding: 6px;
--el-table-row-hover-bg-color: transparent;
:deep(.el-table .el-table__header-wrapper th) {
background-color: #05b675 !important;
color: #ffffff !important;
font-weight: 600;
}
:deep(.el-table td.el-table__cell) {
border-bottom: none;
}
:deep(.el-table tr) {
background-color: #133364 !important;
color: #ffffff;
}
:deep(.el-table tr.el-table__row--striped td.el-table__cell) {
background-color: #104e86 !important;
color: #ffffff;
}
:deep(.el-table th.el-table__cell.is-leaf) {
border-bottom: none !important;
}
:deep(.el-table__inner-wrapper::before) {
background-color: transparent !important;
}
}
}
}
.svg-icon {
margin-right: 6px;
}
:deep(.el-dialog) {
margin-top: 10% !important;
background: url("../../../assets/images/dialogimg.png") no-repeat !important ;
background-size: 100% 100% !important;
.el-dialog__header {
padding: 0px;
display: flex;
justify-content: center;
.el-dialog__headerbtn {
.el-dialog__close {
// background-color: pink !important;
// 插入照片上去
background: url("../../../assets/images/x.png") no-repeat !important ;
background-size: 100% 100% !important;
width: 28px;
height: 28px;
margin-right: 15px;
cursor: pointer;
}
}
.el-dialog__title {
margin-top: -20px;
text-align: center;
width: 216px;
height: 59px;
line-height: 59px;
background: url("../../../assets/images/中央银行-切图/验证+解密弹窗-切图/弹窗标题.png")
no-repeat !important ;
background-size: 100% 100% !important;
color: #ffffff;
}
}
.el-dialog__body {
padding: 30px 60px;
.el-table .el-table__header-wrapper th {
background-color: #13b7da !important;
color: #ffffff !important;
font-weight: 600;
}
.df {
display: flex;
justify-content: space-between;
align-items: center;
color: #ffffff;
}
.el-form {
.el-form-item__label {
color: #ffffff;
height: 46px;
line-height: 46px;
}
.el-input__wrapper {
background-color: transparent;
box-shadow: none;
caret-color: #ffffff;
}
.el-input {
height: 46px;
background: url("../../../assets/images/中央银行-切图/验证+解密弹窗-切图/输入框.png")
no-repeat !important ;
background-size: 100% 100% !important;
.el-input__inner {
color: #ffffff;
}
}
}
.pagination-container .el-pagination {
position: static !important;
}
}
.el-dialog__footer {
text-align: center;
padding-bottom: 30px;
.dialog-footer {
.el-button {
// width: 244px;
padding: 0 107px;
height: 38px;
border: 2px solid #25f4f9;
background: linear-gradient(
0deg,
#0654b5 0%,
#003155 50%,
#2cd1e4 100%
);
box-shadow: 0px 5px 6px 0px rgba(0, 48, 255, 0.77);
border-radius: 8px;
// background: url('../../../assets/images/中央银行-切图/验证+解密弹窗-切图/确定.png') no-repeat !important ;
// background-size:100% 100% !important;
}
}
}
}
</style>