代充设置-查询-分区
This commit is contained in:
@@ -1,37 +1,58 @@
|
||||
<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">
|
||||
<div class="col-sm-12">
|
||||
<label for="searchValue" class="col-sm-3 control-label">Peko ID:</label>
|
||||
<div class="col-sm-3"><input type="text" class="form-control" name="searchValue" id="searchValue">
|
||||
</div>
|
||||
<label for="searchType" class="col-sm-3 control-label">地区:</label>
|
||||
<div class="col-sm-3">
|
||||
<select name="searchType" id="searchType" data-btn-class="btn-warning" class="form-control">
|
||||
<option value="0" selected="selected">全部</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<button id="btnSearch" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-search"></i>查询
|
||||
</button>
|
||||
<button id="btnAdd" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
<div class="col-sm-12">
|
||||
<label for="searchValue" class="col-sm-1 control-label">ID:</label>
|
||||
<div class="col-sm-2">
|
||||
<input
|
||||
type="text"
|
||||
class="form-control"
|
||||
name="searchValue"
|
||||
id="searchValue"
|
||||
/>
|
||||
</div>
|
||||
<label for="partitionId" class="col-sm-1 control-label">分区:</label>
|
||||
<div class="col-sm-2">
|
||||
<select
|
||||
name="partitionId"
|
||||
id="partitionId"
|
||||
data-btn-class="btn-warning"
|
||||
class="form-control"
|
||||
>
|
||||
</select>
|
||||
</div>
|
||||
<label for="searchType" class="col-sm-1 control-label">地区:</label>
|
||||
<div class="col-sm-2">
|
||||
<select
|
||||
name="searchType"
|
||||
id="searchType"
|
||||
data-btn-class="btn-warning"
|
||||
class="form-control"
|
||||
>
|
||||
<option value="0" selected="selected">全部</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-12">
|
||||
<button id="btnSearch" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-search"></i>查询
|
||||
</button>
|
||||
<button id="btnAdd" class="btn btn-default">
|
||||
<i class="glyphicon glyphicon-plus-sign"></i>新增
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="modalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
@@ -79,168 +100,230 @@
|
||||
<script>
|
||||
import TableHelper from '@/utils/bootstrap-table-helper';
|
||||
|
||||
var partitionArray;
|
||||
var regionArray;
|
||||
export default {
|
||||
name: "RechargeUserView",
|
||||
setup() {
|
||||
//切换只读
|
||||
function editSeqText(obj) {
|
||||
if (!regionArray) {
|
||||
return;
|
||||
}
|
||||
var $input = $(obj);
|
||||
const typeArray = $("input:checkbox[name='type']:checked").serializeArray();
|
||||
if (!typeArray) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < regionArray.length; i++) {
|
||||
var region = regionArray[i];
|
||||
var type = region.type;
|
||||
var isCheck = false;
|
||||
for (let j = 0; j < typeArray.length; j++) {
|
||||
var value = typeArray[j].value;
|
||||
if (type == value) {
|
||||
isCheck = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var $seq = $('#seq' + type);
|
||||
if (isCheck) {
|
||||
$seq.removeAttr('readonly');
|
||||
} else {
|
||||
$seq.attr('readonly', 'true');
|
||||
}
|
||||
}
|
||||
name: "RechargeUserView",
|
||||
setup() {
|
||||
//切换只读
|
||||
function editSeqText(obj) {
|
||||
if (!regionArray) {
|
||||
return;
|
||||
}
|
||||
var $input = $(obj);
|
||||
const typeArray = $(
|
||||
"input:checkbox[name='type']:checked"
|
||||
).serializeArray();
|
||||
if (!typeArray) {
|
||||
return;
|
||||
}
|
||||
for (let i = 0; i < regionArray.length; i++) {
|
||||
var region = regionArray[i];
|
||||
var type = region.type;
|
||||
var isCheck = false;
|
||||
for (let j = 0; j < typeArray.length; j++) {
|
||||
var value = typeArray[j].value;
|
||||
if (type == value) {
|
||||
isCheck = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
window.editSeqText = editSeqText;
|
||||
return {
|
||||
editSeqText
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(function () {
|
||||
this.initData();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
$(function () {
|
||||
//地区
|
||||
regionArray = chargeRegion();
|
||||
$('#table').bootstrapTable('destroy');
|
||||
$('#table').bootstrapTable({
|
||||
columns: [
|
||||
{ field: 'erbanNo', title: 'Peko ID', align: 'center', width: '5%' },
|
||||
{ field: 'nick', title: '昵称', align: 'center', width: '5%' },
|
||||
{ field: 'createTime', title: '首次加入代充时间', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'type',
|
||||
title: '地区',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (regionArray) {
|
||||
for (var i = 0, len = regionArray.length; i < len; i++) {
|
||||
var region = regionArray[i];
|
||||
var name = region.name;
|
||||
var type = region.type;
|
||||
if ((val & type) != 0) {
|
||||
value += name;
|
||||
if (i != len - 1) {
|
||||
value += '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'userRegions',
|
||||
title: '排序',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
formatter: function (val, row, index) {
|
||||
var value = '';
|
||||
if (row.userRegions) {
|
||||
for (var i = 0, len = row.userRegions.length; i < len; i++) {
|
||||
var userRegion = row.userRegions[i];
|
||||
var name = userRegion.name;
|
||||
var seq = userRegion.seq;
|
||||
value += name + ':' + seq;
|
||||
if (i != len - 1) {
|
||||
value += '<br>';
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
}
|
||||
},
|
||||
{ field: 'outDiamondNum', title: '最近30天转出金币', align: 'center', width: '5%' },
|
||||
{
|
||||
field: 'id',
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
width: '5%',
|
||||
valign: 'middle',
|
||||
formatter: function (val, row, index) {
|
||||
return '<button class="btn btn-sm btn-default opt-edit" data-index="' + index + '">编辑</button>' + '<button class="btn btn-sm btn-default opt-del" data-index="' + index + '">删除</button>';
|
||||
}
|
||||
}
|
||||
],
|
||||
cache: false,
|
||||
striped: true,
|
||||
showRefresh: false,
|
||||
pageSize: 20,
|
||||
pagination: true,
|
||||
pageList: [20, 50, 100],
|
||||
search: false,
|
||||
sidePagination: "server", //表示服务端请求
|
||||
//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
|
||||
//设置为limit可以获取limit, offset, search, sort, order
|
||||
queryParamsType: "undefined",
|
||||
queryParams: function queryParams(params) { //设置查询参数
|
||||
var param = {
|
||||
page: params.pageNumber,
|
||||
pageSize: params.pageSize,
|
||||
erbanNo: $('#searchValue').val(),
|
||||
regionType: $('#searchType').val()
|
||||
};
|
||||
return param;
|
||||
},
|
||||
toolbar: '#toolbar',
|
||||
url: '/admin/recharge/user/page',
|
||||
onLoadSuccess: function () { //加载成功时执行
|
||||
console.log("load success");
|
||||
},
|
||||
onLoadError: function () { //加载失败时执行
|
||||
console.log("load fail");
|
||||
}
|
||||
});
|
||||
var $seq = $("#seq" + type);
|
||||
if (isCheck) {
|
||||
$seq.removeAttr("readonly");
|
||||
} else {
|
||||
$seq.attr("readonly", "true");
|
||||
}
|
||||
}
|
||||
}
|
||||
window.editSeqText = editSeqText;
|
||||
return {
|
||||
editSeqText,
|
||||
};
|
||||
},
|
||||
created() {
|
||||
this.$nextTick(function () {
|
||||
this.initData();
|
||||
});
|
||||
},
|
||||
methods: {
|
||||
initData() {
|
||||
$(function () {
|
||||
//分区
|
||||
partitionArray = listPartitionInfo();
|
||||
//地区
|
||||
regionArray = chargeRegion();
|
||||
|
||||
//地区
|
||||
function chargeRegion() {
|
||||
var array;
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/admin/charge/region/list",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (json) {
|
||||
if (json.success == 'true' || json.code == 200) {
|
||||
array = json.data;
|
||||
}
|
||||
}
|
||||
});
|
||||
var $select = $('#searchType');
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
var $option = $('<option value="' + array[i].type + '" />');
|
||||
$option.html(array[i].name);
|
||||
$select.append($option);
|
||||
$("#table").bootstrapTable("destroy");
|
||||
$("#table").bootstrapTable({
|
||||
columns: [
|
||||
{
|
||||
field: "erbanNo",
|
||||
title: "Peko ID",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{ field: "nick", title: "昵称", align: "center", width: "5%" },
|
||||
{
|
||||
field: "starLevel",
|
||||
title: "信誉值",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "createTime",
|
||||
title: "首次加入代充时间",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "type",
|
||||
title: "地区",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
formatter: function (val, row, index) {
|
||||
var value = "";
|
||||
if (regionArray) {
|
||||
for (var i = 0, len = regionArray.length; i < len; i++) {
|
||||
var region = regionArray[i];
|
||||
var name = region.name;
|
||||
var type = region.type;
|
||||
if ((val & type) != 0) {
|
||||
value += name;
|
||||
if (i != len - 1) {
|
||||
value += "<br>";
|
||||
}
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "userRegions",
|
||||
title: "排序",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
formatter: function (val, row, index) {
|
||||
var value = "";
|
||||
if (row.userRegions) {
|
||||
for (var i = 0, len = row.userRegions.length; i < len; i++) {
|
||||
var userRegion = row.userRegions[i];
|
||||
var name = userRegion.name;
|
||||
var seq = userRegion.seq;
|
||||
value += name + ":" + seq;
|
||||
if (i != len - 1) {
|
||||
value += "<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
return value;
|
||||
},
|
||||
},
|
||||
{
|
||||
field: "outDiamondNum",
|
||||
title: "最近30天转出金币",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
},
|
||||
{
|
||||
field: "id",
|
||||
title: "操作",
|
||||
align: "center",
|
||||
width: "5%",
|
||||
valign: "middle",
|
||||
formatter: function (val, row, index) {
|
||||
return (
|
||||
'<button class="btn btn-sm btn-default opt-edit" data-index="' +
|
||||
index +
|
||||
'">编辑</button>' +
|
||||
'<button class="btn btn-sm btn-default opt-del" data-index="' +
|
||||
index +
|
||||
'">删除</button>'
|
||||
);
|
||||
},
|
||||
},
|
||||
],
|
||||
cache: false,
|
||||
striped: true,
|
||||
showRefresh: false,
|
||||
pageSize: 20,
|
||||
pagination: true,
|
||||
pageList: [20, 50, 100],
|
||||
search: false,
|
||||
sidePagination: "server", //表示服务端请求
|
||||
//设置为undefined可以获取pageNumber,pageSize,searchText,sortName,sortOrder
|
||||
//设置为limit可以获取limit, offset, search, sort, order
|
||||
queryParamsType: "undefined",
|
||||
queryParams: function queryParams(params) {
|
||||
//设置查询参数
|
||||
var param = {
|
||||
page: params.pageNumber,
|
||||
pageSize: params.pageSize,
|
||||
erbanNo: $("#searchValue").val(),
|
||||
partitionId: $("#partitionId").val(),
|
||||
regionType: $("#searchType").val(),
|
||||
starLevel: $("#starLevel").val(),
|
||||
};
|
||||
return param;
|
||||
},
|
||||
toolbar: "#toolbar",
|
||||
url: "/admin/recharge/user/page",
|
||||
onLoadSuccess: function () {
|
||||
//加载成功时执行
|
||||
console.log("load success");
|
||||
},
|
||||
onLoadError: function () {
|
||||
//加载失败时执行
|
||||
console.log("load fail");
|
||||
},
|
||||
});
|
||||
|
||||
//分区
|
||||
function listPartitionInfo() {
|
||||
var array;
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/partition/listPartitionInfo",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (json) {
|
||||
if (json.success == "true" || json.code == 200) {
|
||||
array = json.data;
|
||||
}
|
||||
},
|
||||
});
|
||||
var $select = $("#partitionId");
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
var $option = $('<option value="' + array[i].id + '" />');
|
||||
$option.html(array[i].desc);
|
||||
$select.append($option);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
//地区
|
||||
function chargeRegion() {
|
||||
var array;
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/admin/charge/region/list",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
success: function (json) {
|
||||
if (json.success == "true" || json.code == 200) {
|
||||
array = json.data;
|
||||
}
|
||||
},
|
||||
});
|
||||
var $select = $("#searchType");
|
||||
for (let i = 0; i < array.length; i++) {
|
||||
var $option = $('<option value="' + array[i].type + '" />');
|
||||
$option.html(array[i].desc);
|
||||
$select.append($option);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
//新增
|
||||
$('#btnAdd').on('click', function () {
|
||||
|
Reference in New Issue
Block a user