2022-10-11 15:38:44 +08:00
|
|
|
|
var browser = checkVersion();
|
|
|
|
|
const urlPrefix = getUrlPrefix();
|
2022-11-14 17:16:07 +08:00
|
|
|
|
var getUrl = getQueryString();
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// 封裝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 = '';
|
2023-08-01 16:54:12 +08:00
|
|
|
|
let chargeProdId = '';//金额:tw_payermax_1003_1000
|
2023-08-18 16:53:30 +08:00
|
|
|
|
let countryCode = "";//选择区号
|
2022-10-11 15:38:44 +08:00
|
|
|
|
let payChannel;//付款方式
|
2023-08-18 16:53:30 +08:00
|
|
|
|
let paymentType;//付款类型
|
2022-10-20 16:28:50 +08:00
|
|
|
|
let successUrl = window.location.href;//支付成功回调路径
|
2022-10-21 18:11:54 +08:00
|
|
|
|
var deviceId;//型号ID
|
2023-08-18 16:53:30 +08:00
|
|
|
|
var channelType;//参数值4:鉆石充值 || 参数值5:贵族vip充值 || 6:首充充值
|
2024-01-06 16:23:38 +08:00
|
|
|
|
var failureUrl = urlPrefix + '/peko/modules/pay/result.html?channelType=4';
|
2023-08-18 16:53:30 +08:00
|
|
|
|
var chargeGroupsArr = [];
|
|
|
|
|
let uid;
|
|
|
|
|
let openId;
|
|
|
|
|
var textLock = true;
|
|
|
|
|
var isRecommendArr = [];//记录是否推荐代充
|
2023-08-21 17:19:53 +08:00
|
|
|
|
var apply2NewLock = true;
|
2022-10-11 15:38:44 +08:00
|
|
|
|
$(function () {
|
2022-10-17 16:41:03 +08:00
|
|
|
|
if (EnvCheck() == 'test') {//degBug
|
|
|
|
|
new VConsole();
|
|
|
|
|
}
|
|
|
|
|
getInfoFromClient();//请求依赖
|
|
|
|
|
setTimeout(function () {
|
2022-10-26 14:29:26 +08:00
|
|
|
|
if (browser.app) {
|
2023-08-18 16:53:30 +08:00
|
|
|
|
erbanNo = null;
|
|
|
|
|
$('.bindingBox').hide();
|
|
|
|
|
uid = pubInfo.uid;
|
2023-08-21 17:19:53 +08:00
|
|
|
|
getSimpleUserByUid(uid);
|
|
|
|
|
} else {
|
2022-10-26 14:29:26 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
channelType = getUrl.channelType;
|
|
|
|
|
getArea();
|
2022-10-17 16:41:03 +08:00
|
|
|
|
}, 100)
|
2023-08-18 16:53:30 +08:00
|
|
|
|
})
|
|
|
|
|
// 请求地区列表
|
|
|
|
|
function getArea () {
|
|
|
|
|
$('.area .area_in p').remove();
|
2023-11-27 17:50:04 +08:00
|
|
|
|
$('.selectAddress .selectAddress_in .list_in p').remove();
|
2023-08-18 16:53:30 +08:00
|
|
|
|
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);
|
2023-11-27 17:50:04 +08:00
|
|
|
|
$('.selectAddress .selectAddress_in .list_in').append(str);
|
2023-08-18 16:53:30 +08:00
|
|
|
|
$('.header .box .right i').text(res.data[0].areaName);
|
2023-11-27 17:50:04 +08:00
|
|
|
|
$('.selectAddress .selectAddress_in .selectAddressList').html(`${res.data[0].areaName}<img src="./images/more_icon.png" alt="">`);
|
2023-08-18 16:53:30 +08:00
|
|
|
|
if (countryCode == '') {
|
2023-08-22 16:57:26 +08:00
|
|
|
|
countryCode = res.data[0].areaCode;
|
2023-08-18 16:53:30 +08:00
|
|
|
|
}
|
|
|
|
|
if (isRecommendArr[0] == 1) {
|
|
|
|
|
$('.tabs i').show();
|
|
|
|
|
} else {
|
|
|
|
|
$('.tabs i').hide();
|
|
|
|
|
}
|
|
|
|
|
getChargePageInfoForH5();
|
2023-11-27 17:55:39 +08:00
|
|
|
|
if (!browser.app) {
|
|
|
|
|
if (window.localStorage.getItem('first')) {
|
|
|
|
|
$('.selectAddress').hide();
|
|
|
|
|
} else {
|
|
|
|
|
$('.selectAddress').show();
|
|
|
|
|
bodyScroolFun(true);
|
|
|
|
|
}
|
2023-11-27 17:50:04 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
} else {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg(res.message);
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
},
|
|
|
|
|
error (err) {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg('網絡錯誤');
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
2023-11-27 17:50:04 +08:00
|
|
|
|
// 调起选择下拉
|
|
|
|
|
$('.selectAddress .selectAddress_in .selectAddressList').click(function () {
|
|
|
|
|
$('.selectAddress .selectAddress_in .list_in').css({ height: '6rem', 'padding': '0.2rem 0.53333rem' });
|
|
|
|
|
return false
|
|
|
|
|
})
|
|
|
|
|
// 首次切换地区
|
|
|
|
|
$('.selectAddress .selectAddress_in .list_in').on('click', 'p', function () {
|
|
|
|
|
countryCode = $(this).attr('areacode');
|
|
|
|
|
var texts = $(this).text();
|
|
|
|
|
$('.header .box .right i').text(texts);
|
|
|
|
|
$('.selectAddress .selectAddress_in .selectAddressList').html(`${texts}<img src="./images/more_icon.png" alt="">`);
|
|
|
|
|
$('.selectAddress .selectAddress_in .list_in').css({ height: '0', 'padding': '0' });
|
|
|
|
|
return false;
|
|
|
|
|
})
|
|
|
|
|
// 关闭切换地区
|
|
|
|
|
$('.selectAddress').click(function () {
|
|
|
|
|
window.localStorage.setItem('first', 1);
|
|
|
|
|
$('.selectAddress').hide();
|
|
|
|
|
$('.selectAddress .selectAddress_in .list_in').css({ height: '0', 'padding': '0' });
|
|
|
|
|
$('.guidd').show();
|
|
|
|
|
})
|
|
|
|
|
// 首次确认地区
|
|
|
|
|
$('.selectAddress .selectAddress_in .but').click(function () {
|
|
|
|
|
window.localStorage.setItem('first', 1);
|
|
|
|
|
getChargePageInfoForH5();
|
|
|
|
|
$('.selectAddress').hide();
|
|
|
|
|
$('.guidd').show();
|
|
|
|
|
})
|
|
|
|
|
// 关闭引导图
|
|
|
|
|
$('.guidd').click(function () {
|
|
|
|
|
$('.guidd').hide();
|
|
|
|
|
bodyScroolFun(false);
|
|
|
|
|
})
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// 渲染档位列表
|
|
|
|
|
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{
|
2022-10-17 16:41:03 +08:00
|
|
|
|
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// }
|
|
|
|
|
} else {
|
|
|
|
|
toastMsg(res.message);
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
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;
|
2022-10-17 16:41:03 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
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>
|
|
|
|
|
`
|
2022-10-17 16:41:03 +08:00
|
|
|
|
});
|
2023-08-18 16:53:30 +08:00
|
|
|
|
$('.page1 .way').append(str);
|
2022-10-17 16:41:03 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// 处理充值档位
|
|
|
|
|
$('.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>
|
|
|
|
|
`
|
2022-10-11 15:38:44 +08:00
|
|
|
|
});
|
2023-08-18 16:53:30 +08:00
|
|
|
|
$('.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 () {
|
2023-08-21 17:19:53 +08:00
|
|
|
|
apply2NewLock = false;
|
2023-08-18 16:53:30 +08:00
|
|
|
|
showLoading();
|
|
|
|
|
networkRequest({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: urlPrefix + '/charge/apply2New',
|
2024-01-06 16:11:00 +08:00
|
|
|
|
data: { erbanNo, chargeProdId, countryCode, openId, payChannel, paymentType, successUrl, deviceId: deviceId, failureUrl },
|
2023-08-18 16:53:30 +08:00
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
window.location.href = res.data.payInfo.mweb_url;
|
|
|
|
|
} else {
|
2023-08-21 17:19:53 +08:00
|
|
|
|
apply2NewLock = true;
|
2023-08-18 16:53:30 +08:00
|
|
|
|
toastMsg(res.message);
|
|
|
|
|
}
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
},
|
|
|
|
|
error (err) {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg('網絡錯誤');
|
2023-08-21 17:19:53 +08:00
|
|
|
|
apply2NewLock = true;
|
2023-08-18 16:53:30 +08:00
|
|
|
|
}
|
2022-10-17 16:41:03 +08:00
|
|
|
|
|
2023-08-18 16:53:30 +08:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 确认是否已读协议按钮
|
|
|
|
|
$('.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');
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
// 确认充值按钮
|
|
|
|
|
$('.page1 .payBut').click(function () {
|
2023-08-21 17:19:53 +08:00
|
|
|
|
if (!erbanNo) {
|
|
|
|
|
toastMsg('請先確認綁定Piko ID')
|
2023-08-18 16:53:30 +08:00
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!payChannel) {
|
|
|
|
|
toastMsg('請選擇儲值方式')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (!chargeProdId) {
|
|
|
|
|
toastMsg('請選擇您的儲值金額')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
if (textLock == false) {
|
|
|
|
|
toastMsg('請先勾選充值協議')
|
|
|
|
|
return
|
|
|
|
|
}
|
2023-08-21 17:19:53 +08:00
|
|
|
|
if (apply2NewLock) {
|
|
|
|
|
apply2New();
|
|
|
|
|
}
|
2023-08-21 14:17:51 +08:00
|
|
|
|
// if (browser.app) {
|
2023-08-21 17:19:53 +08:00
|
|
|
|
// apply2New();
|
2023-08-21 14:17:51 +08:00
|
|
|
|
// } 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(true);
|
|
|
|
|
// }
|
2023-08-18 16:53:30 +08:00
|
|
|
|
})
|
|
|
|
|
// 确定绑定按钮
|
|
|
|
|
$('.bindingBox .binding .but').click(function () {
|
|
|
|
|
if ($('.bindingBox .binding input').val() == '') {
|
|
|
|
|
toastMsg('請輸入平台號');
|
|
|
|
|
return
|
|
|
|
|
}
|
2023-08-21 17:19:53 +08:00
|
|
|
|
getSimpleUser($('.bindingBox .binding input').val());
|
|
|
|
|
})
|
|
|
|
|
// 确认绑定接口
|
|
|
|
|
function getSimpleUser (erbanNo) {
|
2023-08-18 16:53:30 +08:00
|
|
|
|
showLoading();
|
|
|
|
|
networkRequest({
|
|
|
|
|
type: 'GET',
|
|
|
|
|
url: urlPrefix + '/user/h5/getSimpleUser',
|
2023-08-21 17:19:53 +08:00
|
|
|
|
data: { erbanNo },
|
2023-08-18 16:53:30 +08:00
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.code == 200) {
|
2023-08-21 14:17:51 +08:00
|
|
|
|
$('.sure .sure_in img').attr('src', res.data.avatar);
|
|
|
|
|
$('.sure .sure_in p').text(res.data.nick);
|
|
|
|
|
$('.sure .sure_in b').html(`Piko ID: <i>${res.data.erbanNo}</i>`);
|
|
|
|
|
$('.sure').show();
|
|
|
|
|
bodyScroolFun(true);
|
2023-08-18 16:53:30 +08:00
|
|
|
|
} else if (res.code == 1404) {
|
|
|
|
|
bodyScroolFun(true);
|
|
|
|
|
$('.userNull').show();
|
|
|
|
|
} else {
|
|
|
|
|
toastMsg(res.message);
|
|
|
|
|
}
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
},
|
|
|
|
|
error (err) {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg('網絡錯誤');
|
|
|
|
|
}
|
2023-08-01 16:54:12 +08:00
|
|
|
|
|
2023-08-18 16:53:30 +08:00
|
|
|
|
});
|
2023-08-21 17:19:53 +08:00
|
|
|
|
}
|
|
|
|
|
// 自动绑定接口
|
|
|
|
|
function getSimpleUserByUid (uid) {
|
|
|
|
|
showLoading();
|
|
|
|
|
networkRequest({
|
|
|
|
|
type: 'GET',
|
|
|
|
|
url: urlPrefix + '/user/h5/getSimpleUserByUid',
|
|
|
|
|
data: { uid },
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
$('.sure .sure_in img').attr('src', res.data.avatar);
|
|
|
|
|
$('.sure .sure_in p').text(res.data.nick);
|
|
|
|
|
$('.sure .sure_in b').html(`Piko ID: <i>${res.data.erbanNo}</i>`);
|
|
|
|
|
$('.bindingBox').hide();
|
|
|
|
|
$('.bindingBox .binding input').val('');
|
|
|
|
|
$('.userinfo img').attr('src', $('.sure .sure_in img').attr('src'));
|
|
|
|
|
$('.userinfo .name').text($('.sure .sure_in p').text());
|
|
|
|
|
$('.userinfo .id').text(`Piko ID: ${$('.sure .sure_in b i').text()}`);
|
|
|
|
|
$('.userinfo').show();
|
|
|
|
|
erbanNo = $('.sure .sure_in b i').text();
|
|
|
|
|
} else if (res.code == 1404) {
|
|
|
|
|
bodyScroolFun(true);
|
|
|
|
|
$('.userNull').show();
|
|
|
|
|
} else {
|
|
|
|
|
toastMsg(res.message);
|
|
|
|
|
}
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
},
|
|
|
|
|
error (err) {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg('網絡錯誤');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// 切换地区
|
|
|
|
|
$('.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();
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2023-08-22 16:57:26 +08:00
|
|
|
|
rechargeUserList(countryCode);
|
2023-08-18 16:53:30 +08:00
|
|
|
|
return;
|
|
|
|
|
})
|
|
|
|
|
// 切换id用户按钮
|
|
|
|
|
$('.userinfo .but').click(function () {
|
|
|
|
|
erbanNo = null;
|
2023-08-21 17:19:53 +08:00
|
|
|
|
uid = null;
|
2023-08-18 16:53:30 +08:00
|
|
|
|
$('.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 = ''
|
2023-08-24 11:45:53 +08:00
|
|
|
|
if (res.data.length <= 0) {
|
2023-08-18 16:53:30 +08:00
|
|
|
|
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)
|
2022-10-11 15:38:44 +08:00
|
|
|
|
} else {
|
2023-08-18 16:53:30 +08:00
|
|
|
|
toastMsg(res.message);
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
},
|
|
|
|
|
error (err) {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg('網絡錯誤');
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
// 复制id按钮
|
|
|
|
|
$('.page2 ul').on('click', 'li .copy', function () {
|
|
|
|
|
var erbanNo = $(this).attr('erbanNo');
|
|
|
|
|
copyToClipboard(erbanNo);
|
|
|
|
|
})
|
2023-08-21 14:17:51 +08:00
|
|
|
|
// 关注接口
|
|
|
|
|
function fansLike (likedUid) {
|
|
|
|
|
// showLoading();
|
|
|
|
|
networkRequest({
|
|
|
|
|
type: 'POST',
|
|
|
|
|
url: urlPrefix + '/fans/like',
|
|
|
|
|
data: { likedUid, type: 1, uid: pubInfo.uid },
|
|
|
|
|
success: function (res) {
|
|
|
|
|
if (res.code == 200) {
|
|
|
|
|
if (browser.ios) {
|
2023-08-22 10:21:27 +08:00
|
|
|
|
window.webkit.messageHandlers.openPersonPage.postMessage(likedUid);
|
2023-08-21 14:17:51 +08:00
|
|
|
|
} else if (browser.android) {
|
|
|
|
|
if (androidJsObj && typeof androidJsObj === 'object') {
|
2023-08-22 10:21:27 +08:00
|
|
|
|
window.androidJsObj.openPersonPage(likedUid);
|
2023-08-21 14:17:51 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
toastMsg(res.message);
|
|
|
|
|
}
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
},
|
|
|
|
|
error (err) {
|
|
|
|
|
hideLoading(layerIndex);
|
|
|
|
|
toastMsg('網絡錯誤');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// 代充联系按钮
|
|
|
|
|
$('.page2 ul').on('click', 'li .but', function () {
|
|
|
|
|
var erbanNo = $(this).attr('erbanNo');
|
|
|
|
|
var uid = $(this).attr('uid');
|
|
|
|
|
if (browser.app) {
|
2023-08-21 14:17:51 +08:00
|
|
|
|
fansLike(uid)
|
|
|
|
|
// if (browser.ios) {
|
|
|
|
|
// window.webkit.messageHandlers.openPersonPage.postMessage(uid);
|
|
|
|
|
// } else if (browser.android) {
|
|
|
|
|
// if (androidJsObj && typeof androidJsObj === 'object') {
|
|
|
|
|
// window.androidJsObj.openPersonPage(uid);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
2023-08-18 16:53:30 +08:00
|
|
|
|
} else {
|
|
|
|
|
$('.toastMasge').show();
|
|
|
|
|
bodyScroolFun(true);
|
2022-10-11 15:38:44 +08:00
|
|
|
|
}
|
2022-11-14 17:16:07 +08:00
|
|
|
|
})
|
2023-08-18 16:53:30 +08:00
|
|
|
|
// 关闭信息弹窗按钮
|
|
|
|
|
$('.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];
|
2022-11-14 17:16:07 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
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('該瀏覽器不支持點擊復制到剪貼闆');
|
2022-11-14 17:16:07 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
|
|
|
|
|
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);
|
2022-11-14 17:16:07 +08:00
|
|
|
|
}
|
2023-08-18 16:53:30 +08:00
|
|
|
|
})
|
|
|
|
|
// 打开选择地区弹窗
|
|
|
|
|
$('.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);
|
2023-08-21 14:17:51 +08:00
|
|
|
|
$('.bindingBox').hide();
|
|
|
|
|
$('.bindingBox .binding input').val('');
|
|
|
|
|
$('.userinfo img').attr('src', $('.sure .sure_in img').attr('src'));
|
|
|
|
|
$('.userinfo .name').text($('.sure .sure_in p').text());
|
|
|
|
|
$('.userinfo .id').text(`Piko ID: ${$('.sure .sure_in b i').text()}`);
|
|
|
|
|
$('.userinfo').show();
|
|
|
|
|
erbanNo = $('.sure .sure_in b i').text();
|
2023-08-18 16:53:30 +08:00
|
|
|
|
})
|