let urlPrefix = getUrlPrefix() let browser = checkVersion() let env = EnvCheck(); var urlData = getQueryString(); 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 agencyRoleType = urlData.agencyRoleType var hallId = urlData.hallId var region = urlData.region var gender = urlData.gender var personUsbToGoldRate // 个人薪资兑换金币比例 var agentUsbToGoldRate // 充值代理结算兑换金币比例 var tradeUsb = null var myusb = null var tabPersonalArr = []; var tabAgentArr = []; var transfer_dollars_Arr; var transfer_dollars_ArrType; var typeTabType = ''; var ratio; var usGold; var accountListName; var accountObj = {}; var withdrawRate; var partitionId = window.localStorage.getItem('partitionId') $(function () { getInfoFromClient(); fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言 setTimeout(function () { // 頁面全屏 if (browser.app) { if (browser.android) { window.androidJsObj.initShowNav(false) } else { window.webkit.messageHandlers.initShowNav.postMessage(0) } }; // 頂部返回事件 $('.nav .back').click(() => { window.history.back(); }) fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言 langReplace = window.lang.replace; localLang = window.lang; translateFun(); getTab(); }, 100); function translateFun() { const langReplace = window.lang.replace; const localLang = window.lang; $('.text1').text(langReplace(localLang.GameSalary.Diamond_account)); $('.text2').text(langReplace(localLang.GameSalary.Diamond_salary)); $('.text3').text(langReplace(localLang.salary.text3)); $('.text4').text(langReplace(localLang.salary.text4)); $('.text5').text(langReplace(localLang.salary.text5)); $('.text6').text(langReplace(localLang.salary.text6)); $('.text7').text(langReplace(localLang.salary.text7)); $('.text8').text(langReplace(localLang.salary.text8)); $('.text9').text(langReplace(localLang.salary.text9)); $('.text10').text(langReplace(localLang.salary.text10)); $('.text11').text(langReplace(localLang.salary.text11)); $('.text12').text(langReplace(localLang.salary.text12)); $('.text13').text(langReplace(localLang.salary.text13)); $('.text14').html(langReplace(localLang.salary.text14)); $('.text15').text(langReplace(localLang.salary.text15)); $('.text16').text(langReplace(localLang.salary.text16)); $('.text17').html(langReplace(localLang.salary.text17)); $('.text18').html(langReplace(localLang.salary.text18)); $('.textnew1').html(langReplace(localLang.salary.textnew1)); $('.textnew2').html(langReplace(localLang.salary.textnew2)); $('.textnew3').html(langReplace(localLang.salary.textnew3)); $('.textnew4').html(langReplace(localLang.salary.textnew4)); $('.textnew5').html(langReplace(localLang.salary.textnew5)); $('.textnew6').html(langReplace(localLang.salary.textnew6)); $('.textnew7').html(langReplace(localLang.salary.textnew7)); $('.textnew8').html(langReplace(localLang.salary.textnew8)); $('.textnew9').html(langReplace(localLang.salary.textnew9)); $('.textnew10').html(langReplace(localLang.salary.textnew10)); $('.textnew11').html(langReplace(localLang.salary.textnew11)); $('.textnew12').html(langReplace(localLang.salary.textnew12)); $('.textnew15').html(langReplace(localLang.salary.textnew15)); $('.textnew17').html(langReplace(localLang.salary.textnew17)); $('.Reminder').html(langReplace(localLang.salary.Reminder)); $('.tip_txt2').html(langReplace(localLang.salary.tip_txt2)); if(partitionId !=16){ $('.textnew16').html(langReplace(localLang.salary.textnew16)); }else{ $('.textnew16').html(langReplace(localLang.newENsalary.textnew16)); } } }); var rechargeUserLimitTip; // 获取usd操作的功能标签tab function getTab() { tabPersonalArr = []; tabAgentArr = []; showLoading() networkRequest({ type: 'get', url: urlPrefix + '/guild/usd/getTab', success(res) { if (res.code === 200) { // 渲染公会长结算弹窗数据 var guildOwner = res.data.guildOwner; $('.president_pop .avatar').attr('src', guildOwner.avatar); $('.president_pop .sure').attr('uid', guildOwner.uid); $('.president_pop .name p').text(`${guildOwner.nick}`); $('.president_pop .id').text(`ID:${guildOwner.erbanNo}`); // 代理弹窗数据 $('.agent_pop .wrap li').remove() var agent_popStr = ''; rechargeUserLimitTip = res.data.rechargeUserLimitTip; var rechargeUserList = res.data.rechargeUserLimitTip?[]:res.data.rechargeUserList; if (rechargeUserList.length <= 0 ) { $('.agent_pop .wrap').append(`
  • ${langReplace(localLang.salary.text10)}
  • `); } else { rechargeUserList.forEach((res, i) => { agent_popStr += `
  • ${res.nick}

    ID:${res.erbanNo}

    ${langReplace(localLang.salary.textnew18)} ${starFun(res)}
  • ` }) $('.agent_pop .wrap').append(agent_popStr); $('.agent_pop .sure').attr('uid', rechargeUserList[0].uid); } // 渲染账户列表 var accountListStr = ''; $('.selectAccount .selectAccount_in .accountBox .account').remove(); res.data.withdrawAccountList.forEach(res => { accountListStr += `
    ${res.name}${res.hasBound ? '' : '(Unbound)'}
    ` }) $('.selectAccount .selectAccount_in .accountBox').append(accountListStr); // 当前可提现余额 usGold = res.data.guildUsdNum $('.my_salary p b').text(`${usGold}ÜS`); // 处理tab对应列表 var tabStr = '' $('.tab .item').remove(); if (res.data.typeTab.length <= 1) { $('.tab').css('background', 'none') } res.data.typeTab.forEach((res, i) => { if (res.tabKey == 'personal') { tabPersonalArr.push(res.channelList); } else { tabAgentArr.push(res.channelList); } tabStr += `
    ${res.tabKey == 'personal' ? langReplace(localLang.salary.text4) : langReplace(localLang.salary.text5)}
    ` }) $('.tab').append(tabStr); typeTabType = res.data.typeTab[0].tabKey typeTabFun(typeTabType); } else { toastMsg(res.message) } hideLoading(layerIndex) }, error(err) { hideLoading(layerIndex) // toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } // 处理星级 function starFun(res) { var str = ''; var starNum = 5; for (let index = 1; index <= res.starLevel; index++) { str += ` ` } for (let index = 1; index <= starNum - res.starLevel; index++) { str += ` ` } return str; } // 选择代理人列表 $('.agent_pop .wrap').on('click', 'li', function () { var uid = $(this).attr('uid'); $(this).addClass('li_act').siblings().removeClass('li_act') $('.agent_pop .btn_wrap .sure').attr('uid', uid); }) // 选择会长结算 $('.president_pop .btn_wrap .sure').click(function () { than = $(this); operateValue(than); }) // 处理tab分类 function typeTabFun(type) { transfer_dollars_Arr = {}; $('.transfer_method li').remove(); $('.transfer_dollars li').remove(); $('.withdrawalAccount').hide(); var str = ''; var arr = type == 'personal' ? tabPersonalArr[0] : tabAgentArr[0]; // 处理方式 transfer_dollars_ArrType = arr[0].type ratio = arr[0].ratio $('.confirm').attr('type', transfer_dollars_ArrType); $('.custom_pop .sure').attr('type', transfer_dollars_ArrType); $('.president_pop .btn_wrap .sure').attr('type', transfer_dollars_ArrType); $('.agent_pop .btn_wrap .sure').attr('type', transfer_dollars_ArrType); arr.forEach((res, i) => { transfer_dollars_Arr[res.type] = res; if (res.type == 1) { str += `
  • ${langReplace(localLang.salary.text19)}

    ( 1ÜS = ${res.ratio} )
  • ` } else if (res.type == 2) { //
  • //

    // // Recharge agent settlement //

    //
  • str += `
  • ${langReplace(localLang.salary.text19)}

    ( 1ÜS = ${res.ratio} )
  • ` } else if (res.type == 5 || res.type == 8) { $('.withdrawalAccount').show(); str += `
  • ${langReplace(localLang.salary.text20)}

  • ` } else if (res.type == 4) { str += `
  • ${langReplace(localLang.salary.text22)}

  • ` } else if (res.type == 3) { str += `
  • ${langReplace(localLang.salary.text23)}

  • ` } }) $('.transfer_method').append(str); dollarsFun(transfer_dollars_ArrType); } // 处理金额 function dollarsFun(type) { $('.withdrawalAccount').hide(); $('.transfer_dollars li').remove(); var str2 = ''; if (transfer_dollars_Arr[type].canCustom) { str2 += `
  • ${langReplace(localLang.salary.text15)}

  • ` } transfer_dollars_Arr[type].prodList.forEach((res, i) => { if (i == 0) { $('.confirm').attr('guildusdnum', res.guildUsdNum); $('.custom_pop .sure').attr('guildusdnum', res.guildUsdNum); $('.president_pop .btn_wrap .sure').attr('guildusdnum', res.guildUsdNum); $('.agent_pop .btn_wrap .sure').attr('guildusdnum', res.guildUsdNum); } if (res.type == 5 || res.type == 8) { $('.withdrawalAccount').show(); } if (res.type == 2) { str2 += `
  • ${res.guildUsdNum} ÜS

    ${res.currencyNum} ${langReplace(localLang.salary.text25)}
    +${res.extraCurrencyNum}
  • ` } else { str2 += `
  • ${res.guildUsdNum} ÜS

  • ` } }) $('.transfer_dollars').append(str2) } // 关闭公会长结算弹窗 $('.president_pop .cancel').click(function () { $('.president_pop').hide(); bodyScroolFun(false); }) // 确定公会长结算弹窗 $('.president_pop .sure').click(function () { var than = $(this); var guildUsdNum = than.attr('guildUsdNum'); var targetUid = than.attr('uid'); var type = than.attr('type'); var obj = { guildUsdNum, targetUid: targetUid, type, }; // operate(obj) // 打开二次确认弹窗 let avatar = $('.president_pop .avatar').attr('src'); let name = $('.president_pop .name p').text(); let id = $('.president_pop .id').text(); $('.secondary_pop .avatar').attr('src',avatar); $('.secondary_pop .name p').text(`${name}`); $('.secondary_pop .id').text(`${id}`); $('.tip_txt1').html(langReplace(localLang.salary.tip_txt1(guildUsdNum))); $('.secondary_pop .sure').attr('obj',JSON.stringify(obj)) $('.president_pop').hide(); $('.secondary_pop').show() bodyScroolFun(false); }) // 二次弹窗确认 $('.secondary_pop .sure').click(function () { var obj = JSON.parse($(this).attr('obj')); operate(obj) $('.secondary_pop').hide() bodyScroolFun(false); }) // 关闭二次确认弹窗 $('.secondary_pop .cancel').click(function () { $('.secondary_pop').hide(); bodyScroolFun(false); }) // 关闭代理结算弹窗 $('.agent_pop .cancel').click(function () { $('.agent_pop').hide(); bodyScroolFun(false); }) // 确定代理结算弹窗 $('.agent_pop .sure').click(function () { var than = $(this); var guildUsdNum = than.attr('guildUsdNum'); var targetUid = than.attr('uid'); var type = than.attr('type'); var obj = { guildUsdNum, targetUid: targetUid, type, }; // operate(obj) // 打开二次确认弹窗 let avatar = $('.agent_pop .li_act .avatar').attr('src'); let name = $('.agent_pop .li_act .name p').text(); let id = $('.agent_pop .li_act .id').text(); $('.secondary_pop .avatar').attr('src',avatar); $('.secondary_pop .name p').text(`${name}`); $('.secondary_pop .id').text(`${id}`); $('.tip_txt1').html(langReplace(localLang.salary.tip_txt1(guildUsdNum))); $('.secondary_pop .sure').attr('obj',JSON.stringify(obj)) $('.secondary_pop').show() $('.agent_pop').hide(); bodyScroolFun(false); }) // 切换tab $('.tab').on('click', '.item', function () { // var i = $(this).index() + 1; var tabKey = $(this).attr('tabKey'); $(this).addClass('act').siblings().removeClass('act'); // typeTabType = i == 1 ? 'personal' : 'agent'; typeTabType = tabKey; typeTabFun(typeTabType) $('.confirm').show(); }) // 切换方式 $('.transfer_method').on('click', 'li', function () { $(this).addClass('li_act').siblings().removeClass('li_act'); var type = $(this).attr("type"); ratio = $(this).attr("ratio"); $('.confirm').attr('type', type); $('.custom_pop .sure').attr('type', type); $('.president_pop .btn_wrap .sure').attr('type', type); $('.agent_pop .btn_wrap .sure').attr('type', type); transfer_dollars_ArrType = type; dollarsFun(transfer_dollars_ArrType); $('.confirm').show(); }) $('.transfer_method').on('click', 'li .wenhao', function () { $('.pop').show(); }) $('.transfer_method').on('click', 'li .pop', function () { $('.pop').hide(); }) // 选择金额方式 $('.transfer_dollars').on('click', 'li', function () { $(this).addClass('li_act').siblings().removeClass('li_act'); var custom_amount = $(this).attr('custom_amount'); var guildUsdNum = $(this).attr('guildusdnum'); if (custom_amount) { $('.confirm').hide(); $('.custom_pop').show(); var type = $('.custom_pop .sure').attr('type'); if (type == 3) { $('.custom_pop .custom_pop_in h2').hide() } else { $('.custom_pop .custom_pop_in h2').show() } bodyScroolFun(true); } else { console.log(guildUsdNum); $('.confirm').attr('guildusdnum', guildUsdNum); $('.custom_pop .sure').attr('guildusdnum', guildUsdNum); $('.president_pop .btn_wrap .sure').attr('guildusdnum', guildUsdNum); $('.agent_pop .btn_wrap .sure').attr('guildusdnum', guildUsdNum); $('.confirm').show(); } }) // 取消自定义金额弹窗 $('.custom_pop .custom_pop_in .btn_wrap .cancel').click(function () { $(".custom_pop .ipt input").val('') $(".custom_pop h2 b").html('0') $('.custom_pop').hide(); bodyScroolFun(false); }) // 确认自定义金额弹窗 $('.custom_pop .custom_pop_in .btn_wrap .sure').click(function () { let value = $(".custom_pop .ipt input").val().trim(); if (value == 0) { toastMsg(langReplace(localLang.salary.text24)) return } than = $(this); operateValue(than); $(".custom_pop .ipt input").val('') $(".custom_pop h2 b").html('0'); $('.custom_pop').hide(); bodyScroolFun(false); }) // 监听输入框 $(".custom_pop .ipt input").on("input", function () { let value = $(this).val().trim(); // 使用正则表达式限制最多两位小数 let match = value.match(/^\d+(\.\d{0,2})?/); if (match) { value = match[0]; } else { value = ""; } // 设置输入框的值为匹配的结果 $(this).val(value); if (value !== "") { // 计算并更新 gold 值 let gold; // if (transfer_dollars_ArrType == 1) { // gold = value * personUsbToGoldRate; // } else { // gold = value * agentUsbToGoldRate; // } gold = value * ratio; $(".custom_pop h2 b").html(gold); tradeUsb = value } else { gold = value * ratio; $(".custom_pop h2 b").html(gold); tradeUsb = value } $('.custom_pop .sure').attr('guildUsdNum', value); $('.agent_pop .sure').attr('guildUsdNum', value); $('.president_pop .sure').attr('guildUsdNum', value); }); // 自定义金额全部按钮 $('.custom_pop .custom_pop_in .ipt e').click(function () { $('.custom_pop .custom_pop_in .ipt input').val(usGold); $(".custom_pop h2 b").html(usGold * ratio); $('.custom_pop .sure').attr('guildUsdNum', usGold); $('.agent_pop .sure').attr('guildUsdNum', usGold); $('.president_pop .sure').attr('guildUsdNum', usGold); }) // 跳转记录页面 $('.my_salary p').click(function () { window.location.href = `./bill.html` }) // 确认按钮 $('.confirm').click(function () { than = $(this); operateValue(than) }) // 处理提交数据 function operateValue(than) { var guildUsdNum = than.attr('guildUsdNum'); var targetUid = than.attr('uid'); var type = than.attr('type'); if (type == 3) { if(rechargeUserLimitTip){ toastMsg(rechargeUserLimitTip); return; } $('.agent_pop').show(); bodyScroolFun(true); } else if (type == 4) { console.log(666666); $('.president_pop').show(); bodyScroolFun(true); } else if (type == 5 || type == 8) { if (accountListName) { $('.pubWithdrawal .pubWithdrawal_in .ok').attr('guildusdnum', guildUsdNum); $('.pubWithdrawal .pubWithdrawal_in .ok').attr('type', type); $('.pubWithdrawal .pubWithdrawal_in .ok').attr('accountType', accountObj.type); if (accountObj.type == 'VODAFONE') { $('.pubWithdrawal .pubWithdrawal_in .box3 .left p strong').text(localLang.salary.textnew8); $('.pubWithdrawal .pubWithdrawal_in .box3 .left p span').text(accountObj.usdRatio); var num = numberFun(((than.attr('guildUsdNum')) - (than.attr('guildUsdNum') * accountObj.withdrawRate)) * accountObj.usdRatio) $('.pubWithdrawal .pubWithdrawal_in .box4 .right').text(`${num} ${accountObj.currency}`); $('.pubWithdrawal .pubWithdrawal_in .box3 .left p').show(); } else if (accountObj.type == 'BANK_TRANSFER_LIRA') { $('.pubWithdrawal .pubWithdrawal_in .box3 .left p strong').text(localLang.salary.textnew8_TRY); $('.pubWithdrawal .pubWithdrawal_in .box3 .left p span').text(accountObj.usdRatio); var num = numberFun(((than.attr('guildUsdNum')) - (than.attr('guildUsdNum') * accountObj.withdrawRate)) * accountObj.usdRatio) $('.pubWithdrawal .pubWithdrawal_in .box4 .right').text(`${num} ${accountObj.currency}`); $('.pubWithdrawal .pubWithdrawal_in .box3 .left p').show(); // Math.floor(((than.attr('guildUsdNum')) - (than.attr('guildUsdNum') * withdrawRate)) * accountObj.usdRatio * 100) / 100 } else { $('.pubWithdrawal .pubWithdrawal_in .box3 .left p').hide(); console.log(accountObj.usdRatio); var num = numberFun(((than.attr('guildUsdNum')) - (than.attr('guildUsdNum') * accountObj.withdrawRate)) * accountObj.usdRatio) $('.pubWithdrawal .pubWithdrawal_in .box4 .right').text(`${num} ${accountObj.currency}`); } $('.pubWithdrawal .pubWithdrawal_in .box1 .right').text(`${than.attr('guildUsdNum')} USD`); $('.pubWithdrawal .pubWithdrawal_in .box2 .right').text(accountObj.withdrawRate * 100 + '%'); $('.pubWithdrawal .pubWithdrawal_in .box3 .right').text(`${than.attr('guildUsdNum') * accountObj.withdrawRate} USD`); $('.pubWithdrawal').show(); } else { toastMsg(langReplace(localLang.salary.textnew13)) } } else { var obj = { guildUsdNum, targetUid: targetUid, type, }; operate(obj) } } // 保留两位小数函数 function numberFun(num) { // 將數字轉為字符串 var numStr = num.toString(); // 分割整數部分和小數部分 var parts = numStr.split('.'); // 如果有小數部分,截取前兩位,否則直接返回整數部分 var result = parts[0]; // 整數部分 if (parts[1]) { // 存在小數部分時 result += '.' + parts[1].substring(0, 2); } return parseFloat(result); // 返回數字 } // 确认提现按钮 $('.pubWithdrawal .pubWithdrawal_in .ok').click(function () { var guildUsdNum = $(this).attr('guildUsdNum'); var type = $(this).attr('type'); var accountType = $(this).attr('accountType'); var obj = { guildUsdNum, accountType, type, }; if ($(this).attr('accountType') == 'VODAFONE' && $(this).attr('guildUsdNum') > 1000) { toastMsg(langReplace(localLang.salary.textnew14)) } else { operate(obj) } }) // 取消提现按钮 $('.pubWithdrawal .pubWithdrawal_in .close').click(function () { $('.pubWithdrawal').hide(); }) // 确认提交接口 function operate(obj) { showLoading() networkRequest({ type: 'post', url: urlPrefix + '/guild/usd/operate', data: obj, success(res) { if (res.code === 200) { getTab(); // window.location.href = `./salary_account.html?type=${obj.type}&createTime=${dateFormat(res.data.createTime,'yyyy/MM/dd hh:mm:ss')}&guildUsdNum=${res.data.guildUsdNum}` if (obj.type == 5 || obj.type == 8) { $('.pubWithdrawal').hide(); $('.success').show(); } else { window.location.href = `./successful.html?type=${obj.type}&data=${JSON.stringify(res.data)}` } } else { toastMsg(res.message) } hideLoading(layerIndex) }, error(err) { hideLoading(layerIndex) toastMsg(langReplace(localLang.demoModule.layerIndex3)) } }) } // 打开账户按钮 $('.withdrawalAccount').click(function name(params) { $('.selectAccount').show(); }) // 关闭账户按钮 $('.selectAccount').click(function () { $('.selectAccount').hide(); }) // 选择账户按钮 $('.selectAccount .selectAccount_in .accountBox').on('click', ' .account', function () { return false; }) // 选择账户按钮 $('.selectAccount .selectAccount_in .accountBox').on('click', ' .account .sel', function () { $('.selectAccount .selectAccount_in .accountBox .account .sel').attr("src", './images/not.png'); $(this).attr("src", './images/yes.png'); accountListName = $(this).attr("name"); accountObj = JSON.parse($(this).attr('obj')); $('.withdrawalAccount .right b').text(accountListName); $('.selectAccount').hide(); }) // 选择账户编辑 $('.selectAccount .selectAccount_in .accountBox').on('click', ' .account .eid', function () { var type = $(this).attr('type'); var name = $(this).attr('name'); if (partitionId != 16) { if(type == 'BANK' || type == 'VODAFONE' || type == 'PAYONNER'){ location.href = `./${type}.html?type=${type}` }else{ location.href = `./generalSalary.html?type=${type}&name=${name}` } } else { if (name == 'bank') { location.href = `./BANK.html?type=${type}` } else if (name == 'payonner') { location.href = `./PAYONNER.html?type=${type}` } else { location.href = `./generalSalary.html?type=${type}&name=${name}` } } }) // 关闭成功按钮 $('.success .success_in .but').click(function () { $('.success').hide(); })