Files
peko-admin-web/src/views/charge/FirstChargeRewardRecordView.vue
2024-04-22 10:45:13 +08:00

264 lines
12 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<section class="content">
<div class="box box-primary">
<div class="box-body">
<!-- Content Header (Page header) -->
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<div id="toolbar">
开始时间<input type="text" name="startTime" id="startTime" class="input-sm">
结束时间<input type="text" name="endTime" id="endTime" class="input-sm">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
<div class="modal fade" id="roundDetailModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span
aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="roundDetailModalTitle">单轮明细</h4>
</div>
<div class="modal-body">
<div id="roundDetailTable"></div>
</div>
<div class="modal-footer">
<h4 id="roundDetailModalFooter"></h4>
<button type="button" class="btn btn-primary" id="exportRoundDetail">导出</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "FirstChargeRewardRecordView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
let currentDayTime;
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
{
field: 'currentDay', title: '日期', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
},
{ field: 'oneLevelNum', title: '获得档位1激励人数', align: 'center', width: '5%' },
{ field: 'twoLevelNum', title: '获得档位2激励人数', align: 'center', width: '5%' },
{ field: 'threeLevelNum', title: '获得档位3激励人数', align: 'center', width: '5%' },
{
field: 'currentDay',
title: '查看明细',
align: 'center',
width: '10%',
formatter: function (val, row, index) {
const currentDay = new Date(row.currentDay).format('yyyy-MM-dd hh:mm:ss')
const oneLevelNum = row.oneLevelNum
const twoLevelNum = row.twoLevelNum
const threeLevelNum = row.threeLevelNum
return '<button id="btnDetail" name="btnDetail" class="btn btn-sm btn-success opt-info" data-currentDay=' + currentDay +
' oneLevelNum=' + oneLevelNum + ' twoLevelNum=' + twoLevelNum + ' threeLevelNum=' + threeLevelNum
+ '>' +
'详情</button>';
}
}
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
startTime: $('#startTime').val(),
endTime: $('#endTime').val(),
};
return param;
},
toolbar: '#toolbar',
url: '/admin/first/charge/reward/statistics',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
var picker1 = $("#startTime").datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
var picker2 = $('#endTime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
})
// 获取轮次详情
$('#table').on('click', '.opt-info', function () {
const currentDay = $(this).attr("data-currentDay");
currentDayTime = currentDay;
const oneLevelNum = $(this).attr("oneLevelNum");
const twoLevelNum = $(this).attr("twoLevelNum");
const threeLevelNum = $(this).attr("threeLevelNum");
console.log("currentDay", currentDay, oneLevelNum, twoLevelNum, threeLevelNum)
$('#roundDetailModal #roundDetailModalTitle').text(`${currentDay} 首充明细`)
// $('#roundDetailModal #roundDetailModalFooter').text(`共计${memberNum}人参与 投入${userInputPieceNum} 平台价值 ${prizePieceNum} 门票${ticket}`)
$('#roundDetailTable').bootstrapTable('destroy');
$('#roundDetailTable').bootstrapTable({
columns: [
{ field: 'erbanNo', title: '平台号', align: 'center', width: '5%' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%' },
{ field: 'inviteCode', title: '邀请码', align: 'center', width: '5%' },
{
field: 'signTime', title: '注册日期', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
},
{ field: 'money', title: '充值数额', align: 'center', width: '5%' },
{
field: 'chargeTime', title: '充值时间', align: 'center', width: '5%',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format('yyyy-MM-dd hh:mm:ss');
} else {
return '-';
}
}
},
{ field: 'firstChargeLevelId', title: '获得档位', align: 'center', width: '5%', }
],
undefinedText: 0,
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
currentDay: currentDay
};
return param;
},
url: '/admin/first/charge/reward/record',
onLoadSuccess: function () { //加载成功时执行
$("#roundDetailModal").modal('show');
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
});
// 导出轮次明细
$("#exportRoundDetail").on("click", function () {
window.location.href = `/admin/first/charge/reward/export?currentDay=${currentDayTime}`
});
// 获取库存
function getStock() {
$.ajax({
type: 'get',
url: "/admin/luckySea/getStock",
success: function (json) {
if (json.success) {
console.log('data', json.data)
$("#stock").html(json.data * 10)
} else {
$("#stock").html('')
}
}
});
}
$('#editStock').on('click', function () {
$("#editStockModal").modal('show');
});
// 编辑库存
$('#editStockModelBtn').on('click', function () {
$.ajax({
type: 'get',
url: "/admin/luckySea/editStock",
data: {
stock: $("#editedStock").val(),
},
dataType: 'json',
success: function (json) {
if (json.success) {
$('#tipMsg').text('编辑成功');
$('#tipModal').modal('show');
$("#editStockModal").modal('hide');
} else {
$('#tipMsg').text('编辑失败,错误信息:' + json.message);
$('#tipModal').modal('show');
}
}
});
});
});
}
},
};
</script>
<style scoped></style>