426 lines
19 KiB
Vue
426 lines
19 KiB
Vue
<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>
|
||
<!-- .content -->
|
||
<div id="table"></div>
|
||
<div id="toolbar" style="height: auto;">
|
||
<form id="searchForm" class="col-sm-12" action="/admin/user/diamond/give/detailListExport" method="post"
|
||
target="_blank">
|
||
<div class="col-sm-12">
|
||
<label for="fromErbanNo" class="col-sm-1 control-label">转赠ID:</label>
|
||
<div class="col-sm-2">
|
||
<input type="text" class="input-sm" name="fromErbanNo" id="fromErbanNo">
|
||
</div>
|
||
|
||
|
||
<label for="type" class="col-sm-1 control-label">转赠类型:</label>
|
||
<div class="col-sm-1">
|
||
<select id="type" name="type" class="form-control">
|
||
<option value="">请选择...</option>
|
||
<option value="0">金币</option>
|
||
<option value="1">背包礼物</option>
|
||
<option value="2">web-api金币</option>
|
||
</select>
|
||
</div>
|
||
|
||
<label class="col-sm-2 control-label">统计时间:</label>
|
||
<div class="col-sm-2"><input type="text" class="form-control" name="beginTime" id="beginTime"></div>
|
||
<span class="col-sm-1">至</span>
|
||
<div class="col-sm-2"><input type="text" class="form-control" name="endTime" id="endTime"></div>
|
||
|
||
</div>
|
||
</form>
|
||
<div class="col-sm-12">
|
||
<button id="btnSearch" class="btn btn-default">
|
||
<i class="glyphicon glyphicon-search"></i>查询
|
||
</button>
|
||
<button id="btnReset" class="btn btn-default">
|
||
<i class="glyphicon glyphicon-remove"></i>重置
|
||
</button>
|
||
<button id="exportBtn" class="btn btn-default">
|
||
<i class="glyphicon glyphicon-export"></i>导出
|
||
</button>
|
||
</div>
|
||
<div class="summary col-sm-12">
|
||
<div class="col-sm-3">
|
||
<span>总转增金币:</span>
|
||
<span class="totalDiamondNum"></span>
|
||
</div>
|
||
</div>
|
||
<div class="summary col-sm-12">
|
||
<div class="col-sm-3">
|
||
<span>礼物总价值:</span>
|
||
<span class="totalGiftGoldNum"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
<!-- 查看弹框
|
||
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
||
<div class="modal-dialog" role="document">
|
||
<div class="modal-content" style="width: 1000px;margin-left: -25%;">
|
||
<div class="modal-header">
|
||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span>
|
||
</button>
|
||
<h4 class="modal-title" id="editModalLabel"></h4>
|
||
</div>
|
||
<div class="modal-body" style="width: 1000px;">
|
||
<form id="form2" action="" method="post" target="_blank">
|
||
|
||
</form>
|
||
<div id="toolbar2">
|
||
<input type="hidden" name="uid" id="fromUid">
|
||
<div class="col-sm-12">
|
||
<label for="beginTime" class="col-sm-2 control-label">开始时间:</label>
|
||
<div class="col-sm-3">
|
||
<input type="text" class="form-control" name="editStartTime" id="editStartTime">
|
||
</div>
|
||
|
||
<label for="endTime" class="col-sm-2 control-label">结束时间:</label>
|
||
<div class="col-sm-3">
|
||
<input type="text" class="form-control" name="editEndTime" id="editEndTime">
|
||
</div>
|
||
</div>
|
||
<div class="col-sm-12">
|
||
<button id="btnSearch2" class="btn btn-sm btn-primary">查询</button>
|
||
</div>
|
||
|
||
<div class="summary col-sm-12">
|
||
<div class="col-sm-3">
|
||
<span>总转增金币:</span>
|
||
<span class="totalSendDiamondNum"></span>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div id="table2"></div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
-->
|
||
</template>
|
||
|
||
<script>
|
||
import TableHelper from '@/utils/bootstrap-table-helper';
|
||
|
||
|
||
|
||
/*picker1.on('changeDate', function () {
|
||
var date = $('#beginDate').datetimepicker('getDate');
|
||
picker2.datetimepicker('setStartDate', date);
|
||
});
|
||
picker2.on('changeDate', function () {
|
||
var date = $('#endDate').datetimepicker('getDate');
|
||
picker1.datetimepicker('setEndDate', date);
|
||
});*/
|
||
export default {
|
||
name: "DiamondGiveHistoryView",
|
||
setup() {
|
||
return {};
|
||
},
|
||
created() {
|
||
this.$nextTick(function () {
|
||
this.initData();
|
||
});
|
||
},
|
||
methods: {
|
||
initData() {
|
||
$(function () {
|
||
$('#table').bootstrapTable('destroy');
|
||
$('#table').bootstrapTable({
|
||
columns: [
|
||
|
||
{ field: 'erbanNo', title: '转赠人ID', align: 'center', width: '5%' },
|
||
{ field: 'nick', title: '转赠人昵称', align: 'center', width: '5%' },
|
||
{ field: 'targetErbanNo', title: '获赠人ID', align: 'center', width: '5%' },
|
||
{ field: 'targetNick', title: '获赠人昵称', align: 'center', width: '5%' },
|
||
{
|
||
field: 'type', title: '转赠类型', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 0) {
|
||
return '金币'
|
||
}else if(row.type == 2){
|
||
return 'web-api金币';
|
||
} else {
|
||
return '背包礼物';
|
||
}
|
||
}
|
||
},
|
||
{
|
||
field: 'diamondNum', title: '转赠金币数', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 1) {
|
||
return '-'
|
||
}
|
||
return val;
|
||
}
|
||
},
|
||
{
|
||
field: 'rate', title: '手续费', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 1) {
|
||
return '-'
|
||
}
|
||
return val * 100 + "%";
|
||
}
|
||
},
|
||
{
|
||
field: 'realDiamondNum', title: '实际总消耗砖石', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 1) {
|
||
return '-'
|
||
}
|
||
return val;
|
||
}
|
||
},
|
||
{
|
||
field: 'giftName', title: '礼物名称', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 0) {
|
||
return '-'
|
||
}
|
||
return val;
|
||
}
|
||
},
|
||
{
|
||
field: 'giftNum', title: '礼物个数', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 0) {
|
||
return '-'
|
||
}
|
||
return val;
|
||
}
|
||
},
|
||
{
|
||
field: 'totalGiftGoldNum', title: '礼物总价值', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
if (row.type == 0) {
|
||
return '-'
|
||
}
|
||
return val;
|
||
}
|
||
},
|
||
{ field: 'createTime', title: '时间', align: 'center', width: '5%', formatter: formatTime },
|
||
|
||
// {field: 'erbanNo', title: '平台ID', align: 'center', width: '5%'},
|
||
// {field: 'nick', title: '昵称', align: 'center', width: '5%'},
|
||
// {field: 'totalSendDiamondNum', title: '总转增金币数', align: 'center', width: '5%'},
|
||
/*{
|
||
field: 'uid',
|
||
title: '操作',
|
||
align: 'center',
|
||
width: '10%',
|
||
formatter: function (val, row, index) {
|
||
return '<button id="btnView" name="btnView" class="btn btn-sm btn-success opt-edit" data-id=' + val + '>' +
|
||
'<i class="glyphicon glyphicon-edit"></i>明细</button>';
|
||
}
|
||
}*/
|
||
],
|
||
cache: false,
|
||
striped: true,
|
||
showRefresh: false,
|
||
pageSize: 10,
|
||
pagination: true,
|
||
pageList: [10, 20, 50, 100],
|
||
search: false,
|
||
sidePagination: "server", //表示服务端请求
|
||
//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
|
||
//设置为limit可以获取limit, offset, search, sort, order
|
||
queryParamsType: "-",
|
||
queryParams: function queryParams(params) { //设置查询参数
|
||
var param = {
|
||
fromErbanNo: $('#fromErbanNo').val(),
|
||
beginTime: $('#beginTime').val(),
|
||
endTime: $('#endTime').val(),
|
||
type: $('#type').val(),
|
||
pageSize: params.pageSize,
|
||
pageNumber: params.pageNumber
|
||
};
|
||
return param;
|
||
},
|
||
toolbar: '#toolbar',
|
||
ajax: function (request) { //使用ajax请求
|
||
$.ajax({
|
||
type: "GET",
|
||
url: '/admin/user/diamond/give/detailList',
|
||
contentType: 'application/json;charset=utf-8',
|
||
dataType: 'json',
|
||
data: request.data,
|
||
success: function (res) {
|
||
request.success({
|
||
rows: res.rows,
|
||
total: res.total,
|
||
});
|
||
|
||
//设置其他统计信息
|
||
$('.totalDiamondNum').html((res.totalDiamondNum == undefined || res.totalDiamondNum == null) ? 0 : res.totalDiamondNum);
|
||
$('.totalGiftGoldNum').html((res.totalGiftGoldNum == undefined || res.totalGiftGoldNum == null) ? 0 : res.totalGiftGoldNum);
|
||
},
|
||
})
|
||
},
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
console.log("load success");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.log("load fail");
|
||
}
|
||
});
|
||
var picker1 = $("#beginTime").datetimepicker({
|
||
format: 'yyyy-mm-dd hh:mm:ss',
|
||
autoclose: true,
|
||
todayBtn: true,
|
||
});
|
||
var picker2 = $("#endTime").datetimepicker({
|
||
format: 'yyyy-mm-dd hh:mm:ss',
|
||
autoclose: true,
|
||
todayBtn: true
|
||
});
|
||
// 查询刷新
|
||
$('#btnSearch').on('click', function () {
|
||
TableHelper.doRefresh('#table');
|
||
});
|
||
|
||
// 查询刷新
|
||
$('#btnSearch2').on('click', function () {
|
||
TableHelper.doRefresh('#table2');
|
||
});
|
||
|
||
//重置
|
||
$('#btnReset').on('click', function () {
|
||
$('#fromErbanNo').val("");
|
||
$('#beginTime').val("");
|
||
$('#endTime').val("");
|
||
});
|
||
|
||
// 查看组员信息
|
||
$("#table").on("click", '.opt-edit', function () {
|
||
let uid = $(this).attr("data-id");
|
||
$("#fromUid").val(uid);
|
||
|
||
let startTime = $("#beginTime").val();
|
||
let endTime = $("#endTime").val();
|
||
if (!isEmpty(startTime)) {
|
||
$("#editStartTime").val(startTime)
|
||
}
|
||
if (!isEmpty(endTime)) {
|
||
$("#editEndTime").val(endTime)
|
||
}
|
||
$('#table2').bootstrapTable('destroy');
|
||
$('#table2').bootstrapTable({
|
||
columns: [
|
||
{ field: 'erbanNo', title: '转赠人ID', align: 'center', width: '5%' },
|
||
{ field: 'nick', title: '转赠人昵称', align: 'center', width: '5%' },
|
||
{ field: 'diamondNum', title: '转赠金币数', align: 'center', width: '5%' },
|
||
{
|
||
field: 'rate', title: '手续费', align: 'center', width: '5%',
|
||
formatter: function (val, row, index) {
|
||
return val * 100 + "%";
|
||
}
|
||
},
|
||
{ field: 'realDiamondNum', title: '实际总消耗砖石', align: 'center', width: '5%' },
|
||
{ field: 'targetErbanNo', title: '获赠人ID', align: 'center', width: '5%' },
|
||
{ field: 'targetNick', title: '获赠人昵称', align: 'center', width: '5%' },
|
||
{ field: 'createTime', title: '时间', align: 'center', width: '5%', formatter: formatTime },
|
||
],
|
||
undefinedText: "-",
|
||
cache: false,
|
||
striped: true,
|
||
showRefresh: false,
|
||
pageSize: 20,
|
||
pageList: [20, 50, 100],
|
||
pagination: true,
|
||
search: false,
|
||
sidePagination: "server", //表示服务端请求
|
||
queryParamsType: "undefined",
|
||
queryParams: function queryParams(params) { //设置查询参数
|
||
var param = {
|
||
uid: uid,
|
||
beginTime: $('#editStartTime').val(),
|
||
endTime: $('#editEndTime').val(),
|
||
pageSize: params.pageSize,
|
||
pageNumber: params.pageNumber
|
||
};
|
||
return param;
|
||
},
|
||
ajax: function (request) { //使用ajax请求
|
||
$.ajax({
|
||
type: "GET",
|
||
url: '/admin/user/diamond/give/detailList',
|
||
contentType: 'application/json;charset=utf-8',
|
||
dataType: 'json',
|
||
data: request.data,
|
||
success: function (res) {
|
||
request.success({
|
||
rows: res.rows,
|
||
total: res.total,
|
||
});
|
||
//设置标题信息
|
||
var headTxt = '转赠统计-明细';
|
||
//设置其他统计信息
|
||
$('.totalSendDiamondNum').html((res.totalSendDiamondNum == undefined || res.totalSendDiamondNum == null) ? 0 : res.totalSendDiamondNum.sum);
|
||
|
||
$('#editModalLabel').text(headTxt);
|
||
$("#editModal").modal('show');
|
||
},
|
||
})
|
||
},
|
||
onLoadSuccess: function () { //加载成功时执行
|
||
console.log("load success");
|
||
},
|
||
onLoadError: function () { //加载失败时执行
|
||
console.log("load fail");
|
||
}
|
||
});
|
||
})
|
||
|
||
|
||
// 导出EXCEL
|
||
$('#exportBtn').on('click', function () {
|
||
$("#searchForm").submit();
|
||
});
|
||
});
|
||
}
|
||
},
|
||
|
||
};
|
||
|
||
//判断空值
|
||
function isEmpty(data) {
|
||
if (data == null || data == undefined || data == "") {
|
||
return true;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
|
||
function formatTime(val) {
|
||
if (val) {
|
||
var date = new Date(val);
|
||
return date.format('yyyy-MM-dd hh:mm:ss');
|
||
} else {
|
||
return '';
|
||
}
|
||
}
|
||
|
||
function serverError(req) {
|
||
$("#tipMsg").text(req.responseJSON.message);
|
||
$("#tipModal").modal('show');
|
||
}
|
||
|
||
function formatHourLength(val) {
|
||
if (val > 24) {
|
||
return (val - val % 24) / 24 + '天' + val % 24 + '时'
|
||
}
|
||
return val + '时'
|
||
}
|
||
</script>
|
||
|
||
<style scoped></style> |