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.
499 lines
9.9 KiB
499 lines
9.9 KiB
layui.use(['laydate', 'form', 'layer', 'table', 'element'], function() {
|
|
const laydate = layui.laydate //日期
|
|
const form = layui.form; //表单
|
|
const layer = layui.layer //弹层
|
|
const table = layui.table //表格
|
|
const element = layui.element //元素操作
|
|
|
|
$('[name="amount"]').on('input propertychange change', function() {
|
|
const amount = new BigNumber($(this).val() || 0)
|
|
const fees = new BigNumber($('[name="fees"]').val() || 0)
|
|
$('[name="arrivalAmount"]').val(amount.minus(fees).toFixed(4))
|
|
})
|
|
|
|
/********资产中心start*****************/
|
|
// 资产中心表格
|
|
table.render({
|
|
elem: '#assetsTable',
|
|
url: '',
|
|
data: [{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
},
|
|
{
|
|
field: 'BTC'
|
|
}
|
|
],
|
|
cols: [
|
|
[{
|
|
field: 'field',
|
|
title: 'Coin',
|
|
width: '18.5%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'field',
|
|
title: 'Available',
|
|
width: '18.5%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'field',
|
|
title: 'Frozen',
|
|
width: '18.5%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'field',
|
|
title: 'Frozen',
|
|
width: '18.5%',
|
|
align: 'center'
|
|
}, {
|
|
title: 'Operation',
|
|
width: '26%',
|
|
toolbar: '#toolbar',
|
|
align: 'center'
|
|
}]
|
|
],
|
|
skin: 'line',
|
|
page: false
|
|
})
|
|
|
|
|
|
// 资产中心监听工具条
|
|
table.on('tool(assetsTable)', function(obj) {
|
|
var data = obj.data
|
|
if (obj.event === 'charge') {
|
|
$('#tabUl li[name="charge"]').click()
|
|
} else if (obj.event === 'recovery') {
|
|
$('#tabUl li[name="withdraw"]').click()
|
|
}
|
|
})
|
|
/********资产中心end*****************/
|
|
|
|
/********账单start*****************/
|
|
//日期范围
|
|
laydate.render({
|
|
elem: '#time',
|
|
range: true,
|
|
lang: 'en'
|
|
})
|
|
// 账单表格
|
|
table.render({
|
|
elem: '#billTable',
|
|
url: '',
|
|
data: [{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55'
|
|
}
|
|
],
|
|
cols: [
|
|
[{
|
|
field: 'date',
|
|
title: 'Time',
|
|
width: '20%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'date',
|
|
title: 'Type',
|
|
width: '15%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'date',
|
|
title: 'Coin',
|
|
width: '15%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'date',
|
|
title: 'Num',
|
|
width: '15%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'date',
|
|
title: 'Fee',
|
|
width: '15%',
|
|
align: 'center'
|
|
}, {
|
|
field: 'date',
|
|
title: 'Status',
|
|
width: '20%',
|
|
align: 'center'
|
|
}]
|
|
],
|
|
skin: 'line',
|
|
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
|
layout: ['count', 'prev', 'page', 'next'], //自定义分页布局
|
|
groups: 7, // 只显示 1 个连续页码
|
|
first: false, //不显示首页
|
|
last: false //不显示尾页
|
|
}
|
|
})
|
|
// 账单监听工具条
|
|
table.on('tool(billTable)', function(obj) {
|
|
var data = obj.data
|
|
if (obj.event === 'charge') {
|
|
|
|
alert(JSON.stringify(data))
|
|
} else if (obj.event === 'recovery') {
|
|
alert('回收')
|
|
}
|
|
})
|
|
/********账单 end***************/
|
|
|
|
/********充值 start***************/
|
|
//充值历史记录表格
|
|
const s=table.render({
|
|
elem: '#payHistoryTable',
|
|
url: '',
|
|
data: [
|
|
{
|
|
date: '2020-09-23 01:36:55',
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
money: '0.01'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55',
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
money: '0.01'
|
|
},
|
|
{
|
|
date: '2020-09-23 01:36:55',
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
money: '0.01'
|
|
},
|
|
],
|
|
cols: [
|
|
[{
|
|
field: 'date',
|
|
title: 'Arrival time',
|
|
width: '25%'
|
|
}, {
|
|
field: 'cuy',
|
|
title: 'Coin',
|
|
width: '25%'
|
|
}, {
|
|
field: 'address',
|
|
title: 'Address',
|
|
width: '25%'
|
|
}, {
|
|
field: 'money',
|
|
title: 'Amount',
|
|
width: '25%'
|
|
}]
|
|
],
|
|
skin: 'line',
|
|
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
|
layout: ['count', 'prev', 'page', 'next'], //自定义分页布局
|
|
groups: 7, // 只显示 1 个连续页码
|
|
first: false, //不显示首页
|
|
last: false //不显示尾页
|
|
}
|
|
})
|
|
// if(s.config.data==''||s.config.data==undefined){
|
|
// $('.layui-table-view').hide();
|
|
// $('.nodata').show()
|
|
// }else{
|
|
// $('.layui-table-view').show();
|
|
// $('.nodata').hide()
|
|
// }
|
|
|
|
|
|
// 复制
|
|
$('#copy').on('click', function() {
|
|
let content = $('#address').val()
|
|
if (content) {
|
|
var aux = document.createElement("input");
|
|
aux.setAttribute("value", content);
|
|
document.body.appendChild(aux);
|
|
aux.select();
|
|
document.execCommand("copy");
|
|
document.body.removeChild(aux);
|
|
alert("复制成功" + content);
|
|
}
|
|
})
|
|
//二维码
|
|
$('#code').on('click', function() {
|
|
layer.open({
|
|
title: 'QR code for deposit address',
|
|
type: 2,
|
|
shadeClose: true,
|
|
area: ['522px', '320px'],
|
|
fixed: false, //不固定
|
|
content: 'dialog/codeBox.html'
|
|
});
|
|
})
|
|
/********充值 end***************/
|
|
|
|
/********提现 start***************/
|
|
//提现记录表格
|
|
table.render({
|
|
elem: '#chshHistoryTable',
|
|
url: '',
|
|
data: [
|
|
{
|
|
index: 1,
|
|
date: '2020-09-23 01:36:55',
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
money: '0.01',
|
|
fee: '0.01',
|
|
txHash: 'xxxxxxx',
|
|
status: 'Success',
|
|
pl: 'xxxxxxxx'
|
|
},
|
|
],
|
|
cols: [
|
|
[{
|
|
field: 'index',
|
|
title: 'NO.',
|
|
width: '7%'
|
|
},
|
|
{
|
|
field: 'date',
|
|
title: 'Time',
|
|
width: '15%'
|
|
}, {
|
|
field: 'cuy',
|
|
title: 'Coin',
|
|
width: '8%'
|
|
}, {
|
|
field: 'address',
|
|
title: 'Address',
|
|
width: '15%'
|
|
}, {
|
|
field: 'money',
|
|
title: 'Amount',
|
|
width: '10%'
|
|
}, {
|
|
field: 'fee',
|
|
title: 'Fees',
|
|
width: '10%'
|
|
}, {
|
|
field: 'txHash',
|
|
title: 'Tx Hash',
|
|
width: '15%'
|
|
}, {
|
|
field: 'status',
|
|
title: 'Status',
|
|
width: '10%'
|
|
}, {
|
|
field: 'pl',
|
|
title: 'Remark',
|
|
width: '10%'
|
|
}
|
|
]
|
|
],
|
|
skin: 'line',
|
|
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
|
layout: ['count', 'prev', 'page', 'next'], //自定义分页布局
|
|
groups: 7, // 只显示 1 个连续页码
|
|
first: false, //不显示首页
|
|
last: false //不显示尾页
|
|
}
|
|
})
|
|
//撤回地址管理
|
|
$('#withdraw').on('click', function() {
|
|
$('#tabUl li[name="address"]').click()
|
|
})
|
|
//选择币种
|
|
form.on('select(currency)', function(data) {
|
|
if (data.value) {
|
|
$('#cashForm').find('.currencySpan').text(data.value)
|
|
}
|
|
})
|
|
/********提现 end***************/
|
|
|
|
/********提款地址管理 start******/
|
|
table.render({
|
|
elem: '#addressHistory',
|
|
url: '',
|
|
data: [{
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
comment: '0.01'
|
|
},
|
|
{
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
comment: '0.01'
|
|
},
|
|
{
|
|
cuy: 'ETH',
|
|
address: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
comment: '0.01'
|
|
},
|
|
],
|
|
cols: [
|
|
[, {
|
|
field: 'cuy',
|
|
title: 'Coin',
|
|
width: '25%'
|
|
}, {
|
|
field: 'address',
|
|
title: 'Address',
|
|
width: '25%'
|
|
}, {
|
|
field: 'comment',
|
|
title: 'Remark',
|
|
width: '25%'
|
|
}, {
|
|
title: 'Operate',
|
|
width: '25%',
|
|
toolbar: '#toolbarAddress'
|
|
}]
|
|
],
|
|
skin: 'line',
|
|
page: { //支持传入 laypage 组件的所有参数(某些参数除外,如:jump/elem) - 详见文档
|
|
layout: ['count', 'prev', 'page', 'next'], //自定义分页布局
|
|
groups: 7, // 只显示 1 个连续页码
|
|
first: false, //不显示首页
|
|
last: false //不显示尾页
|
|
}
|
|
})
|
|
//确定
|
|
form.on('submit(addressBtn)', function(){
|
|
layer.open({
|
|
title: 'Safety verification',
|
|
type: 2,
|
|
shadeClose: true,
|
|
area: ['482px', '316px'],
|
|
fixed: false, //不固定
|
|
content: 'dialog/checkBox.html'
|
|
});
|
|
|
|
return false
|
|
})
|
|
|
|
// 删除 提款地址管理
|
|
table.on('tool(addressHistory)', function(obj) {
|
|
var data = obj.data
|
|
if (obj.event === 'delete') {
|
|
alert('删除')
|
|
}
|
|
})
|
|
/********提款地址管理 end******/
|
|
})
|
|
|
|
|
|
$(function(){
|
|
$('#cashForm .inputAddress').keyup( function(){
|
|
if($('.inputAddress').val() && $('.inputAmount').val()){
|
|
$('.WithdrawSureBtn').removeClass('disabledSubmit').addClass('activeSubmit')
|
|
}else{
|
|
$('.WithdrawSureBtn').removeClass('activeSubmit').addClass('disabledSubmit')
|
|
}
|
|
})
|
|
$('#cashForm .inputAmount').keyup( function(){
|
|
if($('.inputAddress').val() && $('.inputAmount').val()){
|
|
$('.WithdrawSureBtn').removeClass('disabledSubmit').addClass('activeSubmit')
|
|
}else{
|
|
$('.WithdrawSureBtn').removeClass('activeSubmit').addClass('disabledSubmit')
|
|
}
|
|
})
|
|
|
|
$('.chash-form .addAddress').keyup( function(){
|
|
if($('.addAddress').val() && $('.addRemark').val()){
|
|
$('.AddSureBtn').removeClass('disabledSubmit').addClass('activeSubmit')
|
|
}else{
|
|
$('.AddSureBtn').removeClass('activeSubmit').addClass('disabledSubmit')
|
|
}
|
|
})
|
|
$('.chash-form .addRemark').keyup( function(){
|
|
if($('.addAddress').val() && $('.addRemark').val()){
|
|
$('.AddSureBtn').removeClass('disabledSubmit').addClass('activeSubmit')
|
|
}else{
|
|
$('.AddSureBtn').removeClass('activeSubmit').addClass('disabledSubmit')
|
|
}
|
|
})
|
|
});
|
|
|