Files
peko-admin-web/src/views/statistic/UserDetailAdminView.vue
2024-04-26 14:12:48 +08:00

287 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">
<section class="content-header">
<h1 id="itemTitle"></h1>
</section>
<form id="form" action="" method="post" target="_blank">
<input type="hidden" name="flowChannelType" id="exportFlowChannelType">
<input type="hidden" name="erbanNo" id="exportErbanNo">
<input type="hidden" name="phone" id="exportPhone">
<input type="hidden" name="startDate" id="exportStartDate">
<input type="hidden" name="endDate" id="exportEndDate">
</form>
<div id="toolbar">
<div class="col-lg-12">
<div class="col-sm-3">
<label htmlFor="flowChannelType" class="col-sm-4 control-label">流量渠道:</label>
<div class="col-sm-8">
<select name="flowChannelType" id="flowChannelType" class="form-control"
data-btn-class="btn-warning">
<option value="0">全部</option>
<option value="1">流量团队</option>
<option value="2">直播导流</option>
</select>
</div>
</div>
<div class="col-sm-3">
<label htmlFor="erbanNo" class="col-sm-4 control-label">平台号:</label>
<div class="col-sm-8">
<input type="text" class="input-sm form-control" name="erbanNo" id="erbanNo">
</div>
</div>
<div class="col-sm-3">
<label htmlFor="phone" class="col-sm-4 control-label">手机号:</label>
<div class="col-sm-8">
<input type="text" class="input-sm form-control" name="phone" id="phone">
</div>
</div>
<div class="col-sm-3">
<label class="col-sm-4 control-label">开始时间:</label>
<div class="col-sm-8">
<input type="text" class="input-sm datetime" name="startDate" id="startDate">
</div>
</div>
<div class="col-sm-3">
<label class="col-sm-4 control-label">结束时间:</label>
<div class="col-sm-8">
<input type="text" class="input-sm datetime" name="endDate" id="endDate">
</div>
</div>
</div>
<div class="col-sm-12">
<label for="partitionId" class="col-sm-1 control-label">地区</label>
<div class="col-sm-2">
<select name="partitionId" id="partitionId" class="form-control">
</select>
</div>
</div>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnExport" class="btn btn-default">
<i class="glyphicon glyphicon-export"></i>导出
</button>
</div>
</div>
</div>
<!-- .content -->
<div id="table"></div>
</div>
</section>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { getPartitionInfoList } from '@/api/partition/partitionInfo';
import { buildSelectOption } from '@/utils/system-helper';
export default {
name: "UserDetailAdminView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initPartition();
this.initData();
});
},
methods: {
initData() {
$(function () {
$('.datetime').datetimepicker({
format: 'yyyy-mm-dd hh:ii:00',
autoclose: true
});
$("#startDate").datetimepicker({
minView: "month",
language: 'zh-CN',
todayBtn: 1,
autoclose: 1
}).on("changeDate", function (event) {
$("#endDate").datetimepicker('setStartDate', event.date);
});
$("#endDate").datetimepicker({
minView: "month",
language: 'zh-CN',
todayBtn: 1,
autoclose: 1,
useCurrent: false
}).on("changeDate", function (event) {
$("#startDate").datetimepicker('setEndDate', event.date);
});
initDefaultDate();
function initDefaultDate() {
var today = new Date();
today.setHours(0);
today.setMinutes(0);
today.setSeconds(0);
today.setMilliseconds(0);
var oneDay = 1000 * 24 * 60 * 60;
var startDate = new Date(today.getTime() - (30 * oneDay));
var endDate = new Date(today.getTime() + oneDay);
$('#startDate').val(startDate.format("yyyy-MM-dd hh:mm:ss"));
$('#endDate').val(endDate.format("yyyy-MM-dd hh:mm:ss"));
}
buildTable();
// 列表设置
function buildTable() {
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
cache: false,
striped: true,
showRefresh: false,
pageSize: 10,
pagination: true,
pageList: [10, 20, 30, 50],
sidePagination: "server", //表示服务端请求
queryParamsType: "undefined",
queryParams: function queryParams(params) {
var param = {
pageNumber: params.pageNumber,
pageSize: params.pageSize,
flowChannelType: $('#flowChannelType').val(),
erbanNo: $('#erbanNo').val(),
phone: $('#phone').val(),
startDate: $('#startDate').val(),
endDate: $('#endDate').val(),
partitionId: $('#partitionId').val(),
};
return param;
},
uniqueId: 'id',
toolbar: '#toolbar',
url: '/admin/stats/userDetail/list',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
},
columns: [
{ field: 'uid', title: 'uid', align: 'center', valign: 'middle' },
{ field: 'partitionDesc', title: '地区', align: 'center', valign: '15%' },
{ field: 'erbanNo', title: '平台号', align: 'center', valign: '10%' },
{ field: 'nick', title: '昵称', align: 'center', valign: '15%' },
{
field: 'createTime',
title: '新增时间',
align: 'center',
valign: 'middle',
width: '10%',
formatter: function (val, row, index) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:ss");
}
},
{ field: 'inviteCodeinfo', title: '邀请码信息', align: 'center', valign: '15%' },
{ field: 'flowChannel', title: '流量渠道', align: 'center', valign: '15%' },
{ field: 'channel', title: '新增渠道', align: 'center', valign: '10%' },
{ field: 'model', title: '设备信息', align: 'center', valign: '10%' },
{
field: 'newDevice',
title: '是否有同设备',
align: 'center',
valign: 'middle',
width: '5%',
formatter: function (val) {
if (val == null || val == undefined) return '-';
if (val == false) {
return '是';
} else {
return '否';
}
}
},
{ field: 'registerIp', title: 'ip', align: 'center', valign: '10%' },
{ field: 'firstChargeInfo', title: '首充情况', align: 'center', valign: '15%' }
]
});
}
// 查询刷新
$('#btnSearch').on('click', function () {
TableHelper.doRefresh('#table');
});
// 导出excel
$('#btnExport').on('click', function () {
var form = $("#form");
form.attr("action", "/admin/stats/userDetail/export");
$('#exportFlowChannelType').val($('#flowChannelType').val());
$('#exportErbanNo').val($('#erbanNo').val());
$('#exportPhone').val($('#phone').val());
$('#exportStartDate').val($('#startDate').val());
$('#exportEndDate').val($('#endDate').val());
form.submit();
})
});
},
initPartition() {
getPartitionInfoList().then(res => {
let data = res.data;
buildSelectOption(
"#partitionId",
null,
[{
value: '',
text: '全部'
}].concat(data.map((v) => {
return {
value: v.id,
text: v.desc,
};
}))
);
});
},
},
};
</script>
<style scoped>
.operateBtn {
margin-right: 5px;
}
.control-label {
padding-right: 0;
margin-right: 0;
}
.col-sm-3 {
padding-right: 0;
padding-left: 0;
}
.col-sm-8 {
padding-right: 0;
padding-left: 0;
}</style>