Files
peko-admin-web/src/views/anchor/AnchorReleaseGoldView.vue

261 lines
12 KiB
Vue
Raw Normal View History

2023-09-19 10:55:46 +08:00
<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="toolbar">
<div class="col-sm-12">
<label for="erbanNo" class="col-sm-1 control-label">平台号:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="erbanNo" id="erbanNo" /></div>
<label for="remark" class="col-sm-1 control-label">备注:</label>
<div class="col-sm-2"><input type="text" class="form-control" name="remark" id="remark" /></div>
<!-- <label for="sendStatus" class="col-sm-1 control-label" style="display: inline"></label>-->
<div class="col-sm-2" style="display: inline">
<div class="col-sm-2"><input type="hidden" class="form-control" style="display: inline" /></div>
</div>
</div>
<div class="col-sm-12">
<button id="btnSearch" class="btn btn-default">
<i class="glyphicon glyphicon-search"></i>查询
</button>
<button id="btnImport" class="btn btn-default">
<i class="glyphicon glyphicon-import"></i>导入
</button>
<button id="btnSend1" class="btn btn-default opt-apply disabled" style="display: inline">
<i class="glyphicon glyphicon-adjust"></i>批量发送
</button>
<button id="btnBatchSend" class="btn btn-default opt-apply disabled" style="display: inline">
<i class="glyphicon glyphicon-adjust"></i>批量发送
</button>
</div>
</div>
</div>
<div id="table"></div>
</div>
</section>
<div class=" modal fade" id="fileUpload" 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="modalLabel1">上传文件</h4>
</div>
<div class="modal-body">
<form class="form-horizontal" id="uploadForm">
<div class="form-group">
<label for="uploadFile" class="col-sm-3 control-label">上传文件:</label>
<div class="col-sm-9">
<input type="file" class="form-control validate[required]" name="uploadFile"
id="uploadFile" />
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">注意:</label>
<div class="col-sm-9">
<span>
<font color="#dd4b39">1.上传文件仅支持.xlsx格式的文件<br>
2024-04-28 10:26:06 +08:00
2.文件内容第一行为标题(:平台号,钻石,金币)<br>
3.第一列为用户平台号,第二列为用户要添加的钻石数量,第三列为用户要添加的金币数量
2023-09-19 10:55:46 +08:00
</font>
</span>
</div>
</div>
</form>
</div>
<div class="modal-footer" style="height: 20%">
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
<button type="button" class="btn btn-primary" id="upload">确定</button>
</div>
</div>
</div>
</div>
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
import { showLoading, hideLoading } from '@/utils/maintainer';
export default {
name: "AnchorReleaseGoldView",
setup() {
return {};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
//获取模板列表
//初始化表格
$('#table').bootstrapTable('destroy');
$('#table').bootstrapTable({
columns: [
// {field: 'temp', title: 'id', align: 'center', checkbox: true, width: '5%'},
{ field: 'erbanNo', title: '平台号', align: 'center', width: '5%' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%' },
2024-04-28 10:26:06 +08:00
{ field: 'goldNum', title: '钻石数量', align: 'center', width: '5%' },
{ field: 'diamondNum', title: '金币数量', align: 'center', width: '5%' },
2023-09-19 10:55:46 +08:00
{
field: 'createTime',
title: '创建时间',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val) {
var date = new Date(val);
return date.format("yyyy-MM-dd hh:mm:00");
} else {
return '-';
}
}
},
{ field: 'adminName', title: '操作者', align: 'center', width: '5%' },
{ field: 'remark', title: '备注', align: 'center', width: '5%' }
// {
// field: 'recordId',
// title: '操作',
// align: 'center',
// width: '15%',
// formatter: function (val, row, index) {
// return '<button id="send" name="send" class="btn btn-sm btn-success opt-send" data-id=' + val + '>' +
// '<i class="glyphicon glyphicon-edit"></i> 发送</button>&nbsp;&nbsp;' +
// '<button id="del" name="del" class="btn btn-sm btn-success opt-del" data-id=' + val + '>' +
// '<i class="glyphicon glyphicon-warning-sign"></i> 删除</button>&nbsp;&nbsp;';
// }
// }
],
cache: false,
striped: true,
showRefresh: false,
pageSize: 20,
pagination: true,
pageList: [20, 50, 100, 200, 300, 500],
search: false,
sidePagination: "server", //表示服务端请求
//设置为undefined可以获取pageNumberpageSizesearchTextsortNamesortOrder
//设置为limit可以获取limit, offset, search, sort, order
queryParamsType: "undefined",
queryParams: function queryParams(params) { //设置查询参数
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
erbanNo: $('#erbanNo').val(),
templateId: $('#templateId').val(),
sendStatus: $('#sendStatus').val(),
createTime: $('#createTime').val(),
sendTime: $('#sendTime').val()
};
return param;
},
toolbar: '#toolbar',
url: '/admin/anchor/billList',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
});
var picker1 = $("#createTime").datetimepicker({
format: 'yyyy-mm-dd',
autoclose: true,
});
var picker2 = $("#sendTime").datetimepicker({
format: 'yyyy-mm-dd',
autoclose: true
});
$("#btnSearch").click(function () {
TableHelper.doRefresh('#table');
})
$("#btnImport").click(function () {
$("#uploadFile").val("");
$("#fileUpload").modal('show');
});
$("#upload").click(function () {
var file = $("#uploadFile").val();
if (file == null || file == undefined || file == '') {
$("#tipMsg").text("上传文件不能为空.");
$("#tipModal").modal('show');
}
debugger;
$("#fileUpload").modal('hide');
showLoading();
var option = ({
type: "POST",
url: "/admin/anchor/uploadExcel",
cache: false,
contentType: false, //不可缺
processData: false, //不可缺
dataType: "json",
success: function (json) {
hideLoading();
console.log(json)
if (json.code == 200) {
$("#tipMsg").text("上传成功");
$("#tipModal").modal('show');
TableHelper.doRefresh('#table');
} else {
$("#tipMsg").text("上传失败.");
$("#tipModal").modal('show');
}
},
error: function () {
hideLoading();
$("#tipMsg").text("上传失败.");
$("#tipModal").modal('show');
}
});
$("#uploadForm").ajaxSubmit(option);
});
$("#table").on('click', '.opt-del', function () {
var id = $(this).attr("data-id");
if (confirm("删除的数据将不能找回,确定删除吗?")) {
$.ajax({
type: "post",
2024-04-22 10:44:52 +08:00
url: "/admin/sms/del",
2023-09-19 10:55:46 +08:00
data: { recordId: id },
dataType: "json",
success: function (json) {
if (json.code == '200') {
$("#withdrawModal").modal('hide');
$("#tipMsg").text("删除成功");
$("#tipModal").modal('show');
TableHelper.doRefresh("#table");
} else {
$("#tipMsg").text("删除失败" + json.msg);
$("#tipModal").modal('show');
}
}
});
}
})
});
}
},
2023-11-14 17:59:51 +08:00
2023-09-19 10:55:46 +08:00
};
</script>
<style scoped></style>