qlg.tsgz.moe/static/app/js/ect_transfer_accounts.html.js
2019-09-06 23:53:10 +08:00

138 lines
4.2 KiB
JavaScript
Executable File
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

mui.plusReady(function() {
// function hyhUrl(url) {
// return 'http://192.168.1.101/hyh/' + url;
// }
var token = localStorage.getItem('token');
$('input').eq(0).attr('id','ectNum');
$('input').eq(1).attr('id','payPwd');
$('.num p').html('');
$('input').eq(0).attr('placeholder','ect数量至少为500');
// alert(token);
mui.ajax(hyhUrl('app/Ectwallets/listQuery'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
var html = '';
if(data.data != '') {
$.each(data.data, function() {
html += '<option value="' + this.eAddress + '">' + this.eAddress + '</option>'
});
$('#select').html(html);
}
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
mui.ajax(hyhUrl('app/Ectwallets/index'), { 
headers: { 
"HYH-Token": token
},
data: {},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
var data = toJson(data, 1);
if(data.status == 1) {
$('.num p').html(data.data.ectNum);
} else {
// console.log(data.status)
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
mui('body').on('tap', '.btn_ture', function() {
var eAddress = $('#select').val();
var ectNum = $('#ectNum').val();
var payPwd = $('#payPwd').val();
if(eAddress == '') {
plus.nativeUI.toast('未选择钱包地址');
return;
}
if(!(ectNum >= 500)) {
plus.nativeUI.toast('ect数量必须大于500');
return;
}
if(payPwd == '') {
plus.nativeUI.toast('未填写支付密码');
return;
}
$('.btn_ture').attr('disabled', 'disabled');
mui.ajax(hyhUrl('app/Ectwallets/withdraw'), { 
headers: { 
"HYH-Token": token
},
data: {
eAddress: eAddress,
ectNum: ectNum,
payPwd: payPwd
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功; 
var data = toJson(data, 1);
if(data.status == 1) {
// console.log(data.data.id)
var id =data.data.id;
// $('.btn_ture').removeAttr('disabled');
mui.ajax('http://moacapi.heyuanhui.cn/api/ect/ect_transfer', { 
data: {
id:id
},
dataType: 'json', //服务器返回json格式数据  
type: 'post', //HTTP请求类型  
timeout: 10000, //超时时间设置为10秒  
success: function(data) {           //服务器返回响应,根据响应结果,分析是否登录成功;  
// console.log(data)
var data = toJson(data, 1);
if(data.status == 1) {
mui.fire(plus.webview.getWebviewById('templete/my.html'), 'refresh');
mui.fire(plus.webview.getWebviewById('ect_index.html'), 'refresh');
alert(data.msg);
location.reload();
} else {
// console.log(data.status)
}
$('.btn_ture').removeAttr('disabled');
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
} else {
alert(data.msg);
location.reload();
$('.btn_ture').removeAttr('disabled');
}
},
error: function(xhr, type, errorThrown) {           //异常处理;  
// alert(errorThrown);      
}  
}); 
})
})