317 lines
10 KiB
JavaScript
317 lines
10 KiB
JavaScript
const urlData = getQueryString();
|
|
let urlPrefix = getUrlPrefix()
|
|
let browser = checkVersion()
|
|
let env = EnvCheck();
|
|
if (env == 'test') {
|
|
new VConsole();
|
|
}
|
|
// 封裝layer消息提醒框
|
|
let layerIndex
|
|
var langReplace;
|
|
var localLang;
|
|
const showLoading = (content = langReplace(localLang.demoModule.layerIndex1)) => {
|
|
layer.open({
|
|
type: 2,
|
|
shadeClose: false,
|
|
content,
|
|
success(e) {
|
|
layerIndex = $(e).attr('index')
|
|
}
|
|
})
|
|
}
|
|
const hideLoading = (index) => {
|
|
layer.close(index)
|
|
}
|
|
const toastMsg = (content = langReplace(localLang.demoModule.layerIndex2), time = 2) => {
|
|
layer.open({
|
|
content,
|
|
time,
|
|
skin: 'msg'
|
|
})
|
|
}
|
|
var fields = {};
|
|
$(function () {
|
|
getInfoFromClient();
|
|
fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言
|
|
setTimeout(function () {
|
|
// 頁面全屏
|
|
if (browser.app) {
|
|
if (browser.android) {
|
|
window.androidJsObj.initShowNav(false)
|
|
} else {
|
|
window.webkit.messageHandlers.initShowNav.postMessage(0)
|
|
}
|
|
};
|
|
// 頂部返回事件
|
|
$('.back img').click(() => {
|
|
window.history.back();
|
|
})
|
|
fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言
|
|
langReplace = window.lang.replace;
|
|
localLang = window.lang;
|
|
translateFun();
|
|
get()
|
|
}, 100);
|
|
|
|
});
|
|
var typeName = urlData.name
|
|
function translateFun() {
|
|
langReplace = window.lang.replace;
|
|
localLang = window.lang;
|
|
$('.text1').text(typeName);
|
|
$('.text2').text(langReplace(localLang.payonner.text2));
|
|
$('.text3').text(langReplace(localLang.payonner.text3));
|
|
$('.text4').text(langReplace(localLang.payonner.text4));
|
|
$('.text5').text(langReplace(localLang.payonner.text5));
|
|
$('.text6').attr('placeholder', langReplace(localLang.payonner.text6));
|
|
$('.text7').attr('placeholder', langReplace(localLang.payonner.text7));
|
|
$('.text8').attr('placeholder', langReplace(localLang.pTitle.p7));
|
|
$('.text9').attr('placeholder', langReplace(localLang.payonner.text9));
|
|
$('.p1').text(langReplace(localLang.pTitle.p1));
|
|
$('.p7').text(langReplace(localLang.pTitle.p7));
|
|
$('.p5').text(langReplace(localLang.pTitle.p5));
|
|
if (typeName == 'epay') {
|
|
$('.payeeName').hide();
|
|
$('.payeeName_top').hide();
|
|
|
|
}
|
|
$('.DocumentID').text(langReplace(localLang.pTitle.DocumentID));
|
|
$('.Document_input').attr('placeholder', langReplace(localLang.pTitle.DocumentID));
|
|
$('.AccountType').text(langReplace(localLang.pTitle.AccountType));
|
|
|
|
$('.AccountType_input').attr('placeholder', langReplace(localLang.pTitle.AccountType));
|
|
|
|
if (typeName == 'pix') {
|
|
$('.p7').text(langReplace(localLang.pTitle.AccountNo));
|
|
$('.text8').attr('placeholder', langReplace(localLang.pTitle.AccountNo));
|
|
}else{
|
|
$('.pix_box').hide()
|
|
}
|
|
|
|
if(typeName == 'gcash'){
|
|
$('.p7').text(langReplace(localLang.pTitle.p71));
|
|
$('.text8').attr('placeholder', langReplace(localLang.pTitle.p72));
|
|
}
|
|
if(typeName == 'zalo'){
|
|
$('.p7').text(langReplace(localLang.pTitle.AccountNo));
|
|
$('.text8').attr('placeholder', langReplace(localLang.pTitle.p73));
|
|
}
|
|
if(typeName == 'usdt'){
|
|
$('.p7').text(langReplace(localLang.pTitle.payeeAccount));
|
|
$('.text8').attr('placeholder', langReplace(localLang.pTitle.payeeAccount));
|
|
$('.payeeName_top span').hide()
|
|
}
|
|
|
|
}
|
|
var salaryType = urlData.salaryType; //1游戏薪资 2钻石薪资
|
|
// 获取
|
|
function get() {
|
|
let demaned = salaryType==1?'/game/usd/withdrawAccount/get':'/guild/usd/withdrawAccount/get'
|
|
showLoading();
|
|
networkRequest({
|
|
type: "GET",
|
|
url: urlPrefix + demaned,
|
|
data: { type: getQueryString().type },
|
|
success: function (res) {
|
|
if (res.code == 200) {
|
|
// 回显数据
|
|
if(res.data.country && res.data.country != ''){
|
|
let list = res.data.countryOptionalList.filter(item => item.value == res.data.country);
|
|
console.log(list)
|
|
$('.currencyType input').val(langReplace(localLang.payonner.text6)+list[0].currency);
|
|
}else{
|
|
$('.currencyType input').val(langReplace(localLang.payonner.text6));
|
|
}
|
|
fields = res.data.fields;
|
|
if (fields.country == '') {
|
|
$('.but .determine').hide();
|
|
$('.but .ok').show();
|
|
$('.box input').attr('disabled', false)
|
|
} else {
|
|
$('.but .determine').show();
|
|
$('.but .ok').hide();
|
|
$('.box input').attr('disabled', true)
|
|
}
|
|
$('.currencyType input').attr('disabled', true)
|
|
$('.country input').val(fields.country);
|
|
$('.payeeAccountNo input').val(fields.bank_account);
|
|
$('.payeeName input').val(fields.full_name);
|
|
// 渲染国家
|
|
$('.pub .pub_in .countryPub').remove();
|
|
var str = '';
|
|
res.data.countryOptionalList.forEach(res => {
|
|
str += `
|
|
<div country='${res.value}' name="${res.name}" currency="${res.currency}" class="countryPub">${res.name}</div>
|
|
`
|
|
})
|
|
$('.pub .pub_in').append(str);
|
|
|
|
if(typeName == 'pix'){
|
|
$('.payeeAccountNo input').val(fields.account_name);
|
|
$('.payeeName input').val(fields.account_no);
|
|
$('.Document_input').val(fields.document_id);
|
|
$('.AccountType_box input').val(fields.account_type);
|
|
}
|
|
|
|
} else {
|
|
toastMsg(res.message);
|
|
}
|
|
hideLoading(layerIndex);
|
|
},
|
|
error: function (res) {
|
|
console.log(res, "报错啦");
|
|
hideLoading(layerIndex);
|
|
},
|
|
});
|
|
}
|
|
// 选择类型
|
|
$('.AccountType_box').click(function () {
|
|
$('.pub_type').show();
|
|
})
|
|
// 关闭选择类型
|
|
$('.pub_type').click(function (params) {
|
|
$('.pub_type').hide();
|
|
})
|
|
// 选择国家
|
|
$('.country').click(function () {
|
|
if(fields.country !='')return
|
|
$('.pub').show();
|
|
})
|
|
// 关闭选择国家
|
|
$('.pub').click(function (params) {
|
|
$('.pub').hide();
|
|
})
|
|
|
|
var typeTitle;
|
|
// 选中类型
|
|
$('.pub_type .pub_in').on('click', '.countryPub', function name(params) {
|
|
$(this).addClass('act').siblings().removeClass('act');
|
|
typeTitle = $(this).text();
|
|
fields.account_type = $(this).attr('account_type');
|
|
return false;
|
|
})
|
|
$('.pub_type .pub_in .soure').click(function name(params) {
|
|
$('.AccountType_box input').val(typeTitle);
|
|
$('.pub').hide();
|
|
})
|
|
|
|
// 选中国家
|
|
var nameTitle
|
|
var currency;
|
|
$('.pub .pub_in').on('click', '.countryPub', function name(params) {
|
|
$(this).addClass('act').siblings().removeClass('act');
|
|
nameTitle = $(this).attr('name');
|
|
var country = $(this).attr('country');
|
|
currency = $(this).attr('currency');
|
|
fields.country = country;
|
|
return false;
|
|
})
|
|
// 确认选中国家
|
|
$('.pub .pub_in .soure').click(function name(params) {
|
|
$('.country input').val(nameTitle);
|
|
$('.pub').hide();
|
|
$('.currencyType input').val(langReplace(localLang.payonner.text6) + currency);
|
|
|
|
})
|
|
// 确认绑定按钮
|
|
$('.but .ok').click(function (params) {
|
|
console.log(fields);
|
|
var obj = {}
|
|
obj.country = fields.country;
|
|
// 类型是pix的时候
|
|
if (typeName == 'pix') {
|
|
obj.account_name = $('.payeeAccountNo input').val();
|
|
obj.account_no = $('.payeeName input').val();
|
|
obj.account_type = fields.account_type;
|
|
obj.document_id = $('.Document_input').val();
|
|
if (obj.country && obj.account_name && obj.account_no && obj.account_type && obj.document_id) {
|
|
fields = obj;
|
|
var objJson = {
|
|
uid: pubInfo.uid,
|
|
// uid: 3838,
|
|
type: getQueryString().type,
|
|
fields,
|
|
}
|
|
update(JSON.stringify(objJson));
|
|
} else {
|
|
toastMsg(langReplace(localLang.payonner.text10));
|
|
}
|
|
|
|
} else {
|
|
obj.bank_account = $('.payeeAccountNo input').val();
|
|
if (typeName !== 'epay') {
|
|
obj.full_name = $('.payeeName input').val();
|
|
}
|
|
if (obj.country && obj.bank_account && ((typeName !== 'epay' ? obj.full_name : true)||(typeName !== 'usdt' ? obj.full_name : true))) {
|
|
fields = obj;
|
|
var objJson = {
|
|
uid: pubInfo.uid,
|
|
// uid: 3840,
|
|
type: getQueryString().type,
|
|
fields,
|
|
}
|
|
update(JSON.stringify(objJson));
|
|
} else {
|
|
toastMsg(langReplace(localLang.payonner.text10));
|
|
}
|
|
}
|
|
|
|
|
|
})
|
|
// 绑定更新信息
|
|
function update(obj) {
|
|
let demaned = salaryType==1?'/game/usd/withdrawAccount/bound':'/guild/usd/withdrawAccount/bound'
|
|
showLoading();
|
|
networkRequest({
|
|
type: "post",
|
|
url: urlPrefix + demaned,
|
|
contentType: 'application/json;charset=UTF-8',
|
|
data: obj,
|
|
success: function (res) {
|
|
if (res.code == 200) {
|
|
get();
|
|
toastMsg('success');
|
|
// location.href = './salary_account.html'
|
|
window.history.back();
|
|
} else {
|
|
toastMsg(res.message);
|
|
}
|
|
hideLoading(layerIndex);
|
|
},
|
|
error: function (res) {
|
|
hideLoading(layerIndex);
|
|
},
|
|
});
|
|
}
|
|
// 解绑
|
|
$('.but .determine').click(function () {
|
|
var objJson = {
|
|
uid: pubInfo.uid,
|
|
// uid: 3839,
|
|
type: getQueryString().type,
|
|
}
|
|
unbound(JSON.stringify(objJson));
|
|
})
|
|
// 解绑
|
|
function unbound(obj) {
|
|
let demaned = salaryType==1?'/game/usd/withdrawAccount/unbound':'/guild/usd/withdrawAccount/unbound'
|
|
showLoading();
|
|
networkRequest({
|
|
type: "post",
|
|
url: urlPrefix + demaned,
|
|
contentType: 'application/json;charset=UTF-8',
|
|
data: obj,
|
|
success: function (res) {
|
|
if (res.code == 200) {
|
|
get();
|
|
toastMsg('success');
|
|
} else {
|
|
toastMsg(res.message);
|
|
}
|
|
hideLoading(layerIndex);
|
|
},
|
|
error: function (res) {
|
|
hideLoading(layerIndex);
|
|
},
|
|
});
|
|
} |