改造充值页面
This commit is contained in:
@@ -1,295 +1,428 @@
|
||||
var browser = checkVersion();
|
||||
const urlPrefix = getUrlPrefix();
|
||||
var getUrl = getQueryString();
|
||||
const urlTest = "https://api.pekolive.com";
|
||||
const urlProduct = "https://beta.api.pekolive.com";
|
||||
let arr = [];
|
||||
let arr2 = [];
|
||||
let countryCode = "";//选择区号
|
||||
var channelType;//参数值4:鉆石充值 || 参数值5:贵族vip充值 || 6:首充充值
|
||||
let erbanNo;//账号
|
||||
// 封裝layer消息提醒框
|
||||
let layerIndex
|
||||
const showLoading = (content = '加載中...') => {
|
||||
layer.open({
|
||||
type: 2,
|
||||
shadeClose: false,
|
||||
content,
|
||||
success (e) {
|
||||
layerIndex = $(e).attr('index')
|
||||
}
|
||||
})
|
||||
}
|
||||
const hideLoading = (index) => {
|
||||
layer.close(index)
|
||||
}
|
||||
const toastMsg = (content = '操作完成', time = 2) => {
|
||||
layer.open({
|
||||
content,
|
||||
time,
|
||||
skin: 'msg'
|
||||
})
|
||||
}
|
||||
var erbanNo = '';
|
||||
let chargeProdId = '';//金额:tw_payermax_1003_1000
|
||||
let openId;
|
||||
let countryCode = "";//选择区号
|
||||
let payChannel;//付款方式
|
||||
let paymentType;//付款码
|
||||
var host = window.location.host;
|
||||
// let successUrl = `${window.location.protocol}//${host}/peko/modules/pay/index.html`;//支付成功回调路径
|
||||
let paymentType;//付款类型
|
||||
let successUrl = window.location.href;//支付成功回调路径
|
||||
let uid;
|
||||
let modeOfPayment = false;//判断是否有选择支付方式
|
||||
let paymentAmount = false;//判断是否有选择付款金额
|
||||
var deviceId;//型号ID
|
||||
var channelType;//参数值4:鉆石充值 || 参数值5:贵族vip充值 || 6:首充充值
|
||||
var chargeGroupsArr = [];
|
||||
let uid;
|
||||
let openId;
|
||||
var textLock = true;
|
||||
var isRecommendArr = [];//记录是否推荐代充
|
||||
$(function () {
|
||||
if (EnvCheck() == 'test') {//degBug
|
||||
new VConsole();
|
||||
}
|
||||
getInfoFromClient();//请求依赖
|
||||
setTimeout(function () {
|
||||
listChargeAreaInfo();
|
||||
if (browser.app) {
|
||||
erbanNo == null;
|
||||
$('body .pay_method, html .pay_method').css('margin', '-4.5rem auto 0');
|
||||
$('body .header .user, html .header .user').hide();
|
||||
$('.but1').hide();
|
||||
$('.but2').show();
|
||||
erbanNo = null;
|
||||
$('.bindingBox').hide();
|
||||
} else {
|
||||
uid = pubInfo.uid;
|
||||
}
|
||||
channelType = getUrl.channelType;
|
||||
getArea();
|
||||
}, 100)
|
||||
function get_param (param) {
|
||||
var query = location.search.substring(1).split('&');
|
||||
for (var i = 0; i < query.length; i++) {
|
||||
var kv = query[i].split('=');
|
||||
if (kv[0] == param) {
|
||||
return kv[1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
// if (get_param('countryCodeURL') == "TW") {
|
||||
// countryCode = "TW";
|
||||
// $('.header_top_right b').text(langReplace(localLang.demoModule.pop_up_in_p1));//'臺灣'
|
||||
// } else if (get_param('countryCodeURL') == "CN") {
|
||||
// if (EnvCheck() == 'test') {
|
||||
// if (host != "anan.uat.lecheng163.com") {
|
||||
// window.location.href = ifCNFun() + '/peko/modules/pay/index.html?countryCodeURL=CN'
|
||||
// }
|
||||
// } else {
|
||||
// if (host != "anan.lecheng163.com") {
|
||||
// window.location.href = ifCNFun() + '/peko/modules/pay/index.html?countryCodeURL=CN'
|
||||
// }
|
||||
// }
|
||||
// countryCode = "CN";
|
||||
// $('.header_top_right b').text(langReplace(localLang.demoModule.pop_up_in_p2));//'大陸'
|
||||
// }
|
||||
$('.logingActive').hide();
|
||||
if (browser.weixin) {
|
||||
$('.wx_skip').show();
|
||||
} else {
|
||||
$('.wx_skip').hide();
|
||||
}
|
||||
function getChargePageInfoForH5 (countryCode) {
|
||||
deviceId = get_param('deviceId')
|
||||
channelType = get_param('channelType');
|
||||
let is_CN = countryCode == "CN" ? true : false;
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/charge/getChargePageInfoForH5',
|
||||
data: { countryCode, channelType, },
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
$('.methods').remove();
|
||||
$('.methods span').remove();
|
||||
console.log(res)
|
||||
let strT = '';
|
||||
let strB = '';
|
||||
// $('.methods0 p').text(res.data.chargeGroups[0].groupName ? res.data.chargeGroups[0].groupName : '');
|
||||
// $('.methods1 p').text(res.data.chargeGroups[1] ? res.data.chargeGroups[1].groupName : '');
|
||||
res.data.chargeGroups.forEach((res1, index1) => {
|
||||
arr = res.data.chargeGroups;
|
||||
// strB +=
|
||||
$('.pay_method .methodBox').append(`
|
||||
<div class="methods methods${index1}">
|
||||
<p style="width: 100%;color: #000;height: 0.8rem;display: none;">${res1.groupName}</p>
|
||||
</div>
|
||||
`);
|
||||
res.data.chargeGroups[index1].chargeWays.forEach((res, index) => {
|
||||
// arr[index] = res.chargeProds;
|
||||
// strT +=
|
||||
$(`.methods${index1}`).append(`
|
||||
<span index=${index} type='${index1}' desc="${res.desc}" paymentType="${res.paymentType}" payChannel="${res.payChannel}">
|
||||
<img src="${res.logo}" alt="">
|
||||
<p>${res.desc}</p>
|
||||
</span>
|
||||
`);
|
||||
});
|
||||
|
||||
});
|
||||
coloursFun(0, 0);
|
||||
// 选择支付方式按钮
|
||||
$('.methods span').click(function () {
|
||||
modeOfPayment = true;
|
||||
console.log($(this))
|
||||
paymentType = $(this).attr('paymentType');
|
||||
payChannel = $(this).attr('payChannel');
|
||||
// $(this).parent().addClass('active').siblings().removeClass('active');
|
||||
chargeProdId = '';
|
||||
$('.methods span').removeClass('active');
|
||||
$(this).addClass('active');
|
||||
coloursFun($(this).attr('index'), $(this).attr('type'));
|
||||
})
|
||||
console.log(countryCode)
|
||||
$('.but2').off();
|
||||
$('.but2').on('click', function () {
|
||||
console.log(countryCode)
|
||||
if (modeOfPayment == false) {
|
||||
logingFun("請選擇儲值方式")//''
|
||||
} else if (paymentAmount == false || chargeProdId == '') {
|
||||
logingFun("請選擇您的儲值金額")//''
|
||||
} else {
|
||||
console.log(countryCode)
|
||||
networkRequest({
|
||||
type: 'POST',
|
||||
url: urlPrefix + '/charge/apply2New',
|
||||
data: { erbanNo, chargeProdId, countryCode, openId, payChannel, paymentType, successUrl, uid, deviceId: deviceId },
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
console.log(res)
|
||||
$('.logingActive').text("請稍等");//""
|
||||
$('.logingActive').show();
|
||||
window.location.href = res.data.payInfo.mweb_url;
|
||||
} else {
|
||||
logingFun(res.message)
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
} else if (res.code == 1900) {
|
||||
countryCode = "TW";
|
||||
getChargePageInfoForH5(countryCode);
|
||||
})
|
||||
// 请求地区列表
|
||||
function getArea () {
|
||||
$('.area .area_in p').remove();
|
||||
showLoading();
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/charge/listChargeAreaInfo',
|
||||
data: { countryCode },
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
var str = '';
|
||||
res.data.forEach((res, i) => {
|
||||
str += `
|
||||
<p areaCode=${res.areaCode}>${res.areaName}</p>
|
||||
`
|
||||
isRecommendArr[i] = res.isRecommend;
|
||||
});
|
||||
$('.area .area_in').append(str);
|
||||
$('.header .box .right i').text(res.data[0].areaName);
|
||||
if (countryCode == '') {
|
||||
countryCode = res.data[0].areaCode
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
function listChargeAreaInfo () {
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/charge/listChargeAreaInfo',
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
var str = ``;
|
||||
var countryCodeIndexs = 0;
|
||||
res.data.forEach((res, i) => {
|
||||
str += `
|
||||
<p countryCode="${res.areaCode}" id="pop_up_in_p2">${res.areaName}</p>
|
||||
`
|
||||
if (getUrl.countryCode && res.areaCode == getUrl.countryCode) {
|
||||
countryCodeIndexs = i;
|
||||
}
|
||||
})
|
||||
if (getUrl.countryCode) {
|
||||
$('.header_top_right b').text(res.data[countryCodeIndexs].areaName);
|
||||
countryCode = res.data[countryCodeIndexs].areaCode;
|
||||
} else {
|
||||
$('.header_top_right b').text(res.data[0].areaName);
|
||||
countryCode = res.data[0].areaCode
|
||||
}
|
||||
$('.pop_up_in').append(str)
|
||||
getChargePageInfoForH5(countryCode);
|
||||
successUrl = updateQueryStringParameter(window.location.href, "countryCode", countryCode)
|
||||
console.log(successUrl);
|
||||
$('.pop_up_in p').click(function () {
|
||||
$('.header_top_right b').text($(this).text());
|
||||
countryCode = $(this).attr("countryCode");
|
||||
$('.pop_up').hide();
|
||||
// if (countryCode == "CN") {
|
||||
// if (EnvCheck() == 'test') {
|
||||
// if (host != "anan.uat.lecheng163.com") {
|
||||
// window.location.href = ifCNFun() + '/peko/modules/pay/index.html?countryCodeURL=CN'
|
||||
// }
|
||||
// } else {
|
||||
// if (host != "anan.lecheng163.com") {
|
||||
// window.location.href = ifCNFun() + '/peko/modules/pay/index.html?countryCodeURL=CN'
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// window.location.href = urlPrefix + '/peko/modules/pay/index.html?countryCodeURL=' + countryCode;
|
||||
// }
|
||||
successUrl = updateQueryStringParameter(window.location.href, "countryCode", countryCode)
|
||||
console.log(successUrl);
|
||||
getChargePageInfoForH5(countryCode);
|
||||
})
|
||||
if (isRecommendArr[0] == 1) {
|
||||
$('.tabs i').show();
|
||||
} else {
|
||||
logingFun(res.message)
|
||||
$('.tabs i').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.header_top_right').click(function () {
|
||||
$('.pop_up').show();
|
||||
});
|
||||
|
||||
$('.pop_up').click(function () {
|
||||
$('.pop_up').hide();
|
||||
})
|
||||
|
||||
function coloursFun (index, type) {
|
||||
$('.pay_number .number span').remove();
|
||||
var str = '';
|
||||
console.log(arr[type]);
|
||||
arr[type].chargeWays[index].chargeProds.forEach(res => {//金幣
|
||||
// <b>${res.chargeGoldNum.toLocaleString()} ${"金幣"}</b>
|
||||
str += `
|
||||
<span channel="${res.channel}" chargeProdId="${res.chargeProdId}" seqNo="${res.seqNo}">
|
||||
<b>${res.prodName}</b>
|
||||
<i>${res.currencySign} ${res.money.toLocaleString()}</i>
|
||||
</span>
|
||||
`
|
||||
})
|
||||
$('.pay_number .number').append(str);
|
||||
// 选择支付金额按钮
|
||||
$('.pay_number .number span').click(function () {
|
||||
paymentAmount = true;
|
||||
console.log($(this));
|
||||
chargeProdId = $(this).attr('chargeProdId');
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
})
|
||||
}
|
||||
$('.user').on('input', function () {
|
||||
var val = $(this).val();
|
||||
// console.log(val)
|
||||
if (isNumber(val)) {
|
||||
console.log('不是数字')
|
||||
$(this).val("");
|
||||
al = $(this).val();
|
||||
$('.but1').show();
|
||||
$('.but2').hide();
|
||||
} else {
|
||||
if (val != '') {
|
||||
$('.but1').hide();
|
||||
$('.but2').show();
|
||||
erbanNo = val;
|
||||
getChargePageInfoForH5();
|
||||
} else {
|
||||
$('.but1').show();
|
||||
$('.but2').hide();
|
||||
hideLoading(layerIndex);
|
||||
toastMsg(res.message);
|
||||
}
|
||||
},
|
||||
error (err) {
|
||||
hideLoading(layerIndex);
|
||||
toastMsg('網絡錯誤');
|
||||
}
|
||||
})
|
||||
function isNumber (string) {
|
||||
var r = string.match(/^[0-9]*$/);
|
||||
if (r == null) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
});
|
||||
}
|
||||
// 渲染档位列表
|
||||
function getChargePageInfoForH5 () {
|
||||
showLoading();
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/charge/getChargePageInfoForH5',
|
||||
data: { countryCode, channelType, },
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
chargeGroupsArr = res;
|
||||
// if (countryCode == '') {
|
||||
getChargePageInfoForH5Html(res, 0, true);
|
||||
// }else{
|
||||
|
||||
// }
|
||||
} else {
|
||||
toastMsg(res.message);
|
||||
}
|
||||
hideLoading(layerIndex);
|
||||
},
|
||||
error (err) {
|
||||
hideLoading(layerIndex);
|
||||
toastMsg('網絡錯誤');
|
||||
}
|
||||
});
|
||||
}
|
||||
// 渲染h5
|
||||
function getChargePageInfoForH5Html (res, id, bool) {
|
||||
// 处理充值方式
|
||||
if (bool) {
|
||||
$('.page1 .way div').remove();
|
||||
var str = '';
|
||||
res.data.chargeGroups.forEach((res, i) => {
|
||||
if (i == 0) {
|
||||
payChannel = res.chargeWays[0].payChannel;
|
||||
paymentType = res.chargeWays[0].paymentType;
|
||||
}
|
||||
str += `
|
||||
<div style="${(i + 1) % 3 == 0 ? 'margin-right:0rem' : ''}" class="${i == 0 ? 'active' : ''}" id=${i} payChannel=${res.chargeWays[0].payChannel} paymentType=${res.chargeWays[0].paymentType}>
|
||||
<img src="${res.chargeWays[0].logo}" alt="">
|
||||
<p>${res.groupName}</p>
|
||||
<span style="display:${res.chargeWays[0].recommend == 1 ? 'block' : 'none'}">推薦</span>
|
||||
</div>
|
||||
`
|
||||
});
|
||||
$('.page1 .way').append(str);
|
||||
}
|
||||
function logingFun (res) {
|
||||
$('.logingActive').text(res.message == undefined ? res : res.message);
|
||||
$('.logingActive').show();
|
||||
setTimeout(function () {
|
||||
$('.logingActive').hide();
|
||||
}, 1500)
|
||||
}
|
||||
function ifCNFun () {
|
||||
var envChecks;
|
||||
const url = window.location.href;
|
||||
console.log(url)
|
||||
if (!url) return undefined;
|
||||
if (url.match(/uat/) || url.match(/127.0.0.1:/) || (url.match(/beta.api/))) { envChecks = "test" } else { envChecks = "live" };
|
||||
if (!envChecks) return undefined;
|
||||
return envChecks === 'live' ? urlProduct : urlTest;
|
||||
// 处理充值档位
|
||||
$('.page1 .position div').remove();
|
||||
var str2 = '';
|
||||
res.data.chargeGroups[id].chargeWays[0].chargeProds.forEach((res, i) => {
|
||||
if (i == 0) {
|
||||
chargeProdId = res.chargeProdId;
|
||||
}
|
||||
str2 += `
|
||||
<div class="${i == 0 ? 'active' : ''}" chargeProdId=${res.chargeProdId} style=${(i + 1) % 3 == 0 ? "margin-right:0rem" : ''}>
|
||||
<p><img src="./images/gold.png" alt="">${res.chargeGoldNum}</p>
|
||||
<span>${res.currencySign} ${res.money}</span>
|
||||
</div>
|
||||
`
|
||||
});
|
||||
$('.page1 .position').append(str2);
|
||||
}
|
||||
// 点击充值方式按钮
|
||||
$('.page1 .way ').on('click', 'div', function () {
|
||||
$(this).addClass('active').siblings().removeClass('active')
|
||||
var id = $(this).attr('id');
|
||||
payChannel = $(this).attr('paychannel');
|
||||
paymentType = $(this).attr('paymenttype');
|
||||
getChargePageInfoForH5Html(chargeGroupsArr, id, false);
|
||||
})
|
||||
// 点击充值金额方式
|
||||
$('.page1 .position').on('click', 'div', function () {
|
||||
$(this).addClass('active').siblings().removeClass('active')
|
||||
chargeProdId = $(this).attr('chargeProdId');
|
||||
})
|
||||
// 充值接口
|
||||
function apply2New () {
|
||||
showLoading();
|
||||
networkRequest({
|
||||
type: 'POST',
|
||||
url: urlPrefix + '/charge/apply2New',
|
||||
data: { erbanNo, chargeProdId, countryCode, openId, payChannel, paymentType, successUrl, uid, deviceId: deviceId },
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
window.location.href = res.data.payInfo.mweb_url;
|
||||
} else {
|
||||
toastMsg(res.message);
|
||||
}
|
||||
hideLoading(layerIndex);
|
||||
},
|
||||
error (err) {
|
||||
hideLoading(layerIndex);
|
||||
toastMsg('網絡錯誤');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
// 确认是否已读协议按钮
|
||||
$('.rule p img').click(function () {
|
||||
textLock = !textLock;
|
||||
if (textLock) {
|
||||
$('.rule p img').attr('src', './images/trueIcon.png');
|
||||
} else {
|
||||
$('.rule p img').attr('src', './images/falseIcon.png');
|
||||
}
|
||||
})
|
||||
function updateQueryStringParameter (uri, key, value) {
|
||||
if (!value) {
|
||||
return uri;
|
||||
// 确认充值按钮
|
||||
$('.page1 .payBut').click(function () {
|
||||
if (!erbanNo && !browser.app) {
|
||||
toastMsg('請先綁定Piko ID')
|
||||
return
|
||||
}
|
||||
var re = new RegExp("([?&])" + key + "=.*?(&|$)", "i");
|
||||
var separator = uri.indexOf('?') !== -1 ? "&" : "?";
|
||||
if (uri.match(re)) {
|
||||
return uri.replace(re, '$1' + key + "=" + value + '$2');
|
||||
if (!payChannel) {
|
||||
toastMsg('請選擇儲值方式')
|
||||
return
|
||||
}
|
||||
else {
|
||||
return uri + separator + key + "=" + value;
|
||||
if (!chargeProdId) {
|
||||
toastMsg('請選擇您的儲值金額')
|
||||
return
|
||||
}
|
||||
}
|
||||
if (textLock == false) {
|
||||
toastMsg('請先勾選充值協議')
|
||||
return
|
||||
}
|
||||
if (browser.app) {
|
||||
apply2New();
|
||||
} else {
|
||||
$('.sure .sure_in img').attr('src', $('.userinfo img').attr('src'));
|
||||
$('.sure .sure_in p').text($('.userinfo .name').text());
|
||||
$('.sure .sure_in b').text($('.userinfo .id').text());
|
||||
$('.sure').show();
|
||||
bodyScroolFun(ture);
|
||||
}
|
||||
})
|
||||
// 确定绑定按钮
|
||||
$('.bindingBox .binding .but').click(function () {
|
||||
if ($('.bindingBox .binding input').val() == '') {
|
||||
toastMsg('請輸入平台號');
|
||||
return
|
||||
}
|
||||
showLoading();
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/user/h5/getSimpleUser',
|
||||
data: { erbanNo: $('.bindingBox .binding input').val(), },
|
||||
success: function (res) {
|
||||
if (res.code == 200) {
|
||||
$('.bindingBox').hide();
|
||||
$('.bindingBox .binding input').val('');
|
||||
$('.userinfo img').attr('src', res.data.avatar);
|
||||
$('.userinfo .name').text(res.data.nick);
|
||||
$('.userinfo .id').text(`Piko ID: ${res.data.erbanNo}`);
|
||||
$('.userinfo').show();
|
||||
erbanNo = res.data.erbanNo;
|
||||
} else if (res.code == 1404) {
|
||||
bodyScroolFun(true);
|
||||
$('.userNull').show();
|
||||
} else {
|
||||
toastMsg(res.message);
|
||||
}
|
||||
hideLoading(layerIndex);
|
||||
},
|
||||
error (err) {
|
||||
hideLoading(layerIndex);
|
||||
toastMsg('網絡錯誤');
|
||||
}
|
||||
|
||||
});
|
||||
})
|
||||
// 切换地区
|
||||
$('.area .area_in').on('click', 'p', function () {
|
||||
countryCode = $(this).attr('areacode');
|
||||
var texts = $(this).text();
|
||||
var id = $(this).index() - 1;
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
$('.header .box .right i').text(texts);
|
||||
getChargePageInfoForH5();
|
||||
bodyScroolFun(false);
|
||||
$('.area').hide();
|
||||
if (isRecommendArr[id] == 1) {
|
||||
$('.tabs i').show();
|
||||
} else {
|
||||
$('.tabs i').hide();
|
||||
}
|
||||
return;
|
||||
})
|
||||
// 切换id用户按钮
|
||||
$('.userinfo .but').click(function () {
|
||||
erbanNo = null;
|
||||
$('.bindingBox').show();
|
||||
$('.userinfo').hide();
|
||||
})
|
||||
// 关闭id有误弹窗
|
||||
$('.userNull .userNull_in .but').click(function () {
|
||||
bodyScroolFun(false);
|
||||
$('.userNull').hide();
|
||||
})
|
||||
// 代充列表接口
|
||||
function rechargeUserList (regionCode) {
|
||||
showLoading();
|
||||
networkRequest({
|
||||
type: 'GET',
|
||||
url: urlPrefix + '/recharge/user/list',
|
||||
data: { regionCode },
|
||||
success: function (res) {
|
||||
$('.page2 ul li').remove();
|
||||
if (res.code == 200) {
|
||||
var str = ''
|
||||
if (res.data.lenght <= 0) {
|
||||
str = '<li class="null"><img src="./images/null.png" alt=""><p>該地區暫無簽約代儲</p></li>'
|
||||
} else {
|
||||
res.data.forEach((res) => {
|
||||
str += `
|
||||
<li>
|
||||
<div class="left">
|
||||
<div class="name">
|
||||
<b>${res.nick.length > 9 ? res.nick.slice(0, 9) + '...' : res.nick}</b>
|
||||
<span style="display:${res.isOnline == 0 ? 'none' : 'block'}"><i></i>在線</span>
|
||||
</div>
|
||||
<div class="id">Piko ID:${res.erbanNo}</div>
|
||||
</div>
|
||||
<div class="but" uid=${res.uid} erbanNo=${res.erbanNo}>聯系</div>
|
||||
<div id="copy" class="copy" uid=${res.uid} erbanNo=${res.erbanNo}>復製ID</div>
|
||||
</li>
|
||||
`
|
||||
});
|
||||
}
|
||||
$('.page2 ul').append(str)
|
||||
} else {
|
||||
toastMsg(res.message);
|
||||
}
|
||||
hideLoading(layerIndex);
|
||||
},
|
||||
error (err) {
|
||||
hideLoading(layerIndex);
|
||||
toastMsg('網絡錯誤');
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
// 复制id按钮
|
||||
$('.page2 ul').on('click', 'li .copy', function () {
|
||||
var erbanNo = $(this).attr('erbanNo');
|
||||
copyToClipboard(erbanNo);
|
||||
})
|
||||
// 代充联系按钮
|
||||
$('.page2 ul').on('click', 'li .but', function () {
|
||||
var erbanNo = $(this).attr('erbanNo');
|
||||
var uid = $(this).attr('uid');
|
||||
if (browser.app) {
|
||||
if (browser.ios) {
|
||||
window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
||||
} else if (browser.android) {
|
||||
if (androidJsObj && typeof androidJsObj === 'object') {
|
||||
window.androidJsObj.openPersonPage(uid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$('.toastMasge').show();
|
||||
bodyScroolFun(true);
|
||||
}
|
||||
})
|
||||
// 关闭信息弹窗按钮
|
||||
$('.toastMasge .toastMasge_in .but').click(function () {
|
||||
$('.toastMasge').hide();
|
||||
bodyScroolFun(false);
|
||||
})
|
||||
//复制方法
|
||||
function copyToClipboard (text) {
|
||||
if (text.indexOf('-') !== -1) {
|
||||
let arr = text.split('-');
|
||||
text = arr[0] + arr[1];
|
||||
}
|
||||
var textArea = document.createElement("textarea");
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.top = '0';
|
||||
textArea.style.left = '0';
|
||||
textArea.style.width = '2em';
|
||||
textArea.style.height = '2em';
|
||||
textArea.style.padding = '0';
|
||||
textArea.style.border = 'none';
|
||||
textArea.style.outline = 'none';
|
||||
textArea.style.boxShadow = 'none';
|
||||
textArea.style.background = 'transparent';
|
||||
textArea.value = text;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.select();
|
||||
|
||||
try {
|
||||
var successful = document.execCommand('copy');
|
||||
var msg = successful ? '復制成功' : '該瀏覽器不支持點擊復制到剪貼闆';
|
||||
toastMsg(msg);
|
||||
} catch (err) {
|
||||
toastMsg('該瀏覽器不支持點擊復制到剪貼闆');
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
}
|
||||
// 充值代充切换
|
||||
$('.tab div').click(function () {
|
||||
var i = $(this).index() + 1;
|
||||
$(this).addClass('active').siblings().removeClass('active');
|
||||
$('.tab').removeClass('tab1').removeClass('tab2');
|
||||
$('.tab').addClass(`tab${i}`);
|
||||
$('.page1').hide();
|
||||
$('.page2').hide();
|
||||
$(`.page${i}`).show();
|
||||
if (i == 1) {
|
||||
} else {
|
||||
rechargeUserList(countryCode);
|
||||
}
|
||||
})
|
||||
// 打开选择地区弹窗
|
||||
$('.header .box .right').click(function () {
|
||||
bodyScroolFun(true);
|
||||
$('.area').show();
|
||||
})
|
||||
// 关闭选择地区弹窗
|
||||
$('.area').click(function () {
|
||||
bodyScroolFun(false);
|
||||
$('.area').hide();
|
||||
return;
|
||||
})
|
||||
// 取消二次确认弹窗
|
||||
$('.sure .sure_in .close').click(function () {
|
||||
$('.sure').hide();
|
||||
bodyScroolFun(false);
|
||||
})
|
||||
// 确认二次确认弹窗
|
||||
$('.sure .sure_in .ok').click(function () {
|
||||
$('.sure').hide();
|
||||
bodyScroolFun(false);
|
||||
apply2New();
|
||||
})
|
||||
|
Reference in New Issue
Block a user