172 lines
7.5 KiB
JavaScript
172 lines
7.5 KiB
JavaScript
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 date_obj = lay_picker_date.getDateTime();
|
||
var date_obj2 = lay_picker_date.getDateTime();
|
||
var startDates;
|
||
var endDates;
|
||
// 初始化函數
|
||
$(function () {
|
||
getInfoFromClient();
|
||
fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言
|
||
setTimeout(function () {
|
||
// 頁面全屏
|
||
if (browser.app) {
|
||
if (browser.android) {
|
||
window.androidJsObj.initShowNav(false)
|
||
} else {
|
||
window.webkit.messageHandlers.initShowNav.postMessage(0)
|
||
}
|
||
};
|
||
// 頂部返回事件
|
||
$('.back .backs').click(() => {
|
||
window.location.href = './index.html';
|
||
})
|
||
fuzzyMatchUpdateQueryStringParameterFun(); // 判断语言
|
||
langReplace = window.lang.replace;
|
||
localLang = window.lang;
|
||
translateFun();
|
||
// 选择日期1
|
||
layPicker.init({
|
||
elem: '#date', // 绑定元素
|
||
type: 2, // 类型2微信效果, 类型3自定义,不设置则默认效果
|
||
radius: 15,
|
||
options: 'date', // 设置为日期选择器(日期选择器可设置:year、month、date、time、timesecond、datetime、datetimesecond),不设置默认取data作为选择值
|
||
onSuccess: function (index, elem) { // 渲染成功回调
|
||
$('.header .time div').eq(0).children('b').text(`${date_obj.year}-${date_obj.month}-${date_obj.day}`)
|
||
startDates = `${date_obj.year}-${date_obj.month}-${date_obj.day}`
|
||
// 选择日期2
|
||
layPicker.init({
|
||
elem: '#date2', // 绑定元素
|
||
type: 2, // 类型2微信效果, 类型3自定义,不设置则默认效果
|
||
radius: 15,
|
||
options: 'date', // 设置为日期选择器(日期选择器可设置:year、month、date、time、timesecond、datetime、datetimesecond),不设置默认取data作为选择值
|
||
onSuccess: function (index, elem) { // 渲染成功回调
|
||
endDates = `${date_obj2.year}-${date_obj2.month}-${date_obj2.day}`
|
||
$('.header .time div').eq(1).children('b').text(`${date_obj2.year}-${date_obj2.month}-${date_obj2.day}`)
|
||
memberIncome();
|
||
},
|
||
onConfirm: function (index, value, result) { // 点击确认回调
|
||
endDates = `${result[0].value}-${result[1].value}-${result[2].value}`
|
||
if (Date.parse(startDates) > Date.parse(endDates)) {
|
||
toastMsg(langReplace(localLang.memberFlow.text15))
|
||
} else if ((Date.parse(endDates) - Date.parse(startDates)) > (30 * 24 * 60 * 60 * 1000)) {
|
||
toastMsg(langReplace(localLang.memberFlow.text16))
|
||
} else {
|
||
$('.header .time div').eq(1).children('b').text(`${result[0].value}-${result[1].value}-${result[2].value}`)
|
||
memberIncome();
|
||
}
|
||
|
||
},
|
||
})
|
||
},
|
||
onConfirm: function (index, value, result) { // 点击确认回调
|
||
startDates = `${result[0].value}-${result[1].value}-${result[2].value}`;
|
||
if (Date.parse(startDates) > Date.parse(endDates)) {
|
||
toastMsg(langReplace(localLang.memberFlow.text4))
|
||
} else if ((Date.parse(endDates) - Date.parse(startDates)) > (30 * 24 * 60 * 60 * 1000) * 3) {
|
||
toastMsg(langReplace(localLang.memberFlow.text5))
|
||
} else {
|
||
$('.header .time div').eq(0).children('b').text(`${result[0].value}-${result[1].value}-${result[2].value}`)
|
||
memberIncome();
|
||
}
|
||
|
||
},
|
||
})
|
||
}, 100)
|
||
})
|
||
function translateFun() {
|
||
var langReplace = window.lang.replace;
|
||
var localLang = window.lang;
|
||
$('.text1').text(langReplace(localLang.memberFlow.text1));
|
||
$('.text2').text(langReplace(localLang.memberFlow.text2));
|
||
$('.text3').text(langReplace(localLang.memberFlow.text3));
|
||
}
|
||
// 获取数据接口
|
||
function memberIncome() {
|
||
$('.box .box_in .fistBox .fist').remove();
|
||
$('.box .box_in .ordinaryBox .ordinaryBox_in').remove();
|
||
networkRequest({
|
||
type: 'get',
|
||
url: urlPrefix + '/family/memberIncome',
|
||
data: { startDate: startDates, endDate: endDates },
|
||
success(res) {
|
||
if (res.code === 200) {
|
||
// 处理头部数值
|
||
$('.totalGoldIncome').text(res.data.totalGoldIncome);
|
||
// $('.totalGoldIncome').text(unitProcessingAr(res.data.totalGoldIncome, 0));
|
||
var strLeft = '';
|
||
var strRight = '';
|
||
res.data.memberIncomeList.forEach((res, i) => {
|
||
strLeft += `
|
||
<div class="fist ${i > 0 ? 'fistAct' : ''}">
|
||
<div class="title">${localLang.memberFlow2.text10}</div>
|
||
<div class="user">
|
||
<img src="${res.member.avatar}" alt="" class="tx">
|
||
<div class="ts ${res.member.roleType == 1 ? 'i' : ''}"><i>${langReplace(localLang.memberFlow.text9)}</i></div>
|
||
<p>${res.member.nick}</p>
|
||
<b>ID:${res.member.erbanNo}${res.member.enable ? '' : `(${langReplace(localLang.lay.departed)})`}</b>
|
||
</div>
|
||
</div>
|
||
`
|
||
strRight += `
|
||
<div class="ordinaryBox_in ${i > 0 ? 'ordinaryBox_inAct' : ''}">
|
||
<div class="ordinary">
|
||
<div class="title">${langReplace(localLang.memberFlow.text6)}</div>
|
||
<p class="">${res.goldIncome}</p>
|
||
</div>
|
||
<div class="ordinary">
|
||
<div class="title">${langReplace(localLang.memberFlow.text7)}</div>
|
||
<p class="">${res.micRemainTime}</p>
|
||
</div>
|
||
<div class="ordinary">
|
||
<div class="title">${langReplace(localLang.memberFlow.text8)}</div>
|
||
<p class="">${res.sendGiftUserNum}</p>
|
||
</div>
|
||
</div>
|
||
`
|
||
})
|
||
$('.box .box_in .fistBox').append(strLeft);
|
||
$('.box .box_in .ordinaryBox').append(strRight);
|
||
} else {
|
||
toastMsg(res.message)
|
||
}
|
||
hideLoading(layerIndex)
|
||
},
|
||
error(err) {
|
||
hideLoading(layerIndex)
|
||
toastMsg(langReplace(localLang.demoModule.layerIndex3))
|
||
}
|
||
})
|
||
|
||
}
|
||
|
||
|