搬迁代码【第九版】

This commit is contained in:
liaozetao
2023-09-26 10:15:07 +08:00
parent d3e34cee0f
commit 31ac17f150
52 changed files with 21289 additions and 0 deletions

View File

@@ -0,0 +1,518 @@
<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 -->
<section class="content">
<div class="row">
<form class="form-horizontal col-sm-6" id="infoForm">
<div class="form-group">
<label for="ernos" class="col-sm-2 control-label">平台ID多个ID用换行分隔:</label>
<div class="col-sm-10">
<textarea class="form-control" name="ernos" id="ernos" style="height:150px;"></textarea>
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">备注:</label>
<div class="col-sm-10">
<input type="text" name="remark" id="remark" class="form-control" maxlength="100"
placeholder="非必填">
</div>
</div>
<div class="form-group">
<label for="busType" class="col-sm-2 control-label">分类:</label>
<div class="col-sm-10">
<select id="busType" name="busType" class="form-control validate[required]">
<option value="">请选择...</option>
</select>
</div>
</div>
</form>
<form class="form-horizontal col-sm-6" id="goldForm">
<div class="form-group">
<label for="num" class="col-sm-2 control-label">数量:</label>
<div class="col-sm-10">
<input type="text" class="form-control validate[required]" name="num" id="num"
value="1">
</div>
</div>
<div class="form-group">
<label for="type" class="col-sm-2 control-label">活动类型:</label>
<div class="col-sm-10">
<select name="type" id="type" class="form-control" ata-btn-class="btn-warning"
onchange="selectOnchang(this)">
<option value="OFFICAL_DIAMOND">官方赠送钻石</option>
<option value="OFFICAL_RADISH">官方赠送水晶</option>
<option value="ACTIVITY_GOLD">活动奖励钻石</option>
<option value="COMPANY_ACCOUNT_DIAMOND">公款充值钻石</option>
<option value="OFFICAL_REDUCE_DIAMONDS">官方钻石消除</option>
<option value="OFFICAL_GOLD">官方赠送金币</option>
<option value="CLEAR_USER_GOLD">用户金币清除</option>
<!-- <option value="OFFICAL_RADISH">官方赠送萝卜</option>
<option value="ACTIVITY_RADISH">活动奖励萝卜</option> -->
</select>
</div>
</div>
<div class="form-group hidden" id="actualAmountDiv">
<label for="type" class="col-sm-2 control-label">实际充值金额:</label>
<div class="col-sm-10">
<input type="text" name="actualAmount" id="actualAmount" class="form-control"
placeholder="必填">
</div>
</div>
<div class="form-group">
<label class="col-sm-2 control-label"></label>
<div class="col-sm-10">
<button type="button" class="btn btn-primary" id="btnScan">查看用户</button>
<button type="button" class="btn btn-primary" id="btnGive">确认</button>
<button type="button" class="btn btn-primary" id="btnGoldRecord">查看记录</button>
<!-- <button type="button" class="btn btn-primary" id="btnRadishRecord">查看萝卜记录</button> -->
</div>
</div>
</form>
</div><!-- ./row -->
</section>
</div>
</div>
<div class="box box-primary">
<div class="box-body">
<table class="table table-bordered" id="table">
<!--<thead><tr>
<th style="width: 50px">头像</th>
<th style="width:200px;">耳伴号</th>
<th style="width:300px;">昵称</th>
<th>钻石</th>
</tr></thead>
<tbody id="tbody">
</tbody>-->
</table>
</div>
</div>
<!--查看钻石赠送记录-->
</section>
<!-- .content -->
</template>
<script>
import TableHelper from '@/utils/bootstrap-table-helper';
export default {
name: "OfficicalGoldView",
setup() {
function selectOnchang(obj) {
var type = $('#type').val();
if (type == 'COMPANY_ACCOUNT_DIAMOND') {
$('#actualAmountDiv').removeClass("hidden");
} else {
$('#actualAmountDiv').addClass("hidden");
}
$.get('/admin/goldcoin/busType/listByQuery', { status: 1, activityTypeEnum: $('#type').val() }, function (res) {
if (res && res.code == 200) {
var data = res.data;
$('#busType').empty();
$('#busType').append('<option value="">请选择...</option>');
for (var i = 0; i < data.length; i++) {
var item = data[i];
$('#busType').append('<option value="' + item.id + '">' + item.busName + '</option>');
}
}
});
}
window.selectOnchang = selectOnchang;
return {
selectOnchang
};
},
created() {
this.$nextTick(function () {
this.initData();
});
},
methods: {
initData() {
$(function () {
var isGiveBol = false;
$("#goldForm").validationEngine();
$.get('/admin/goldcoin/busType/listByQuery', { status: 1, activityTypeEnum: $('#type').val() }, function (res) {
if (res && res.code == 200) {
var data = res.data;
if (data.length > 0) {
$('#busType').empty();
$('#busType').append('<option value="">请选择...</option>');
for (var i = 0; i < data.length; i++) {
var item = data[i];
$('#busType').append('<option value="' + item.id + '">' + item.busName + '</option>');
}
}
}
});
$('#btnScan').click(function () {
console.log("star===>>" + $("#ernos").text() + ", " + $("#ernos").val());
if (!$('#ernos').val()) {
$("#tipMsg").text("请输入耳伴号");
$("#tipModal").modal('show');
return;
}
$('#table').bootstrapTable('destroy');
initUserInfoTable();
});
$("#btnGoldRecord").click(function () {
if (!$('#ernos').val()) {
$("#tipMsg").text("请输入兔兔号");
$("#tipModal").modal('show');
return;
}
$("#table").bootstrapTable('destroy');
initGoldRecordTable();
})
$("#btnRadishRecord").click(function () {
if (!$('#ernos').val()) {
$("#tipMsg").text("请输入兔兔号");
$("#tipModal").modal('show');
return;
}
$("#table").bootstrapTable('destroy');
initRadishRecordTable();
})
$("#btnGive").click(function () {
//校验
check();
//参数
var type = $('#type').val();
var erBanNos = $("#ernos").val();
var num = $('#num').val();
var actualAmount = $('#actualAmount').val();
var reg = actualAmount.match(/^[0-9]+(.[0-9]{1,3})?$/);
var remark = $('#remark').val();
var busType = $('#busType').val();
var data = {
'ernos': erBanNos,
'type': type,
'num': num,
'actualAmount': actualAmount,
'remark': remark,
'busType': busType
};
if (type == 'CLEAR_USER_GOLD') {
clearUserGold(data);
} else {
give(data);
}
});
function give(data) {
isGiveBol = true;
if (confirm('确认吗?')) {
$("#tipMsg").text("处理中,请稍后...");
$("#tipModal").modal('show');
$.ajax({
type: "post",
url: "/admin/goldcoin/give.action",
data: data,
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("处理成功");
$('#btnScan').click();
} else {
$("#tipMsg").text("处理出错errorCode: " + json.message);
}
isGiveBol = false;
},
error: function (json) {
$("#tipMsg").text("处理出错,网络出错");
isGiveBol = false;
}
});
}
}
function check() {
if (isGiveBol) {
return;
}
var type = $('#type').val();
var erBanNos = $("#ernos").val();
var actualAmount = $('#actualAmount').val();
var num = $('#num').val();
var busType = $('#busType').val();
if (!erBanNos) {
$("#tipMsg").text("请输入平台ID");
$("#tipModal").modal('show');
return;
}
if (type == 'COMPANY_ACCOUNT_DIAMOND') {
if (!actualAmount) {
$("#tipMsg").text("请输入实际充值金额数");
$("#tipModal").modal('show');
return;
}
var reg = actualAmount.match(/^[0-9]+(.[0-9]{1,3})?$/);
if (reg == null) {
$("#tipMsg").text("请输入合理的充值金额数");
$("#tipModal").modal('show');
return;
}
var minGold = parseInt(actualAmount * 800);
var maxGold = parseInt(actualAmount * 1200);
var actualGold = parseInt(num);
if (actualGold < minGold || actualGold > maxGold) {
$("#tipMsg").text("赠送钻石与充值金额兑换比例不正确!");
$("#tipModal").modal('show');
return;
}
if (actualGold != parseInt(actualAmount * 1000)) {
$("#tipMsg").text("赠送钻石与充值金额兑换比例不正确!");
$("#tipModal").modal('show');
return;
}
}
if (type != 'CLEAR_USER_GOLD') {
if (busType == null || busType.trim() == '') {
$("#tipMsg").text("请填写分类");
$("#tipModal").modal('show');
return;
}
}
}
function clearUserGold(data) {
isGiveBol = true;
if (confirm('确认吗?')) {
$("#tipMsg").text("处理中,请稍后...");
$("#tipModal").modal('show');
$.ajax({
type: "post",
url: "/admin/goldcoin/clearUserGold?erBanNos=" + data.ernos + "&num=" + data.num,
dataType: "json",
success: function (json) {
if (json.code == 200) {
$("#tipMsg").text("处理成功");
$('#btnScan').click();
} else {
$("#tipMsg").text("处理出错errorCode: " + json.message);
}
isGiveBol = false;
},
error: function (json) {
$("#tipMsg").text("处理出错,网络出错");
isGiveBol = false;
}
});
}
}
});
}
},
};
function initUserInfoTable() {
$('#table').bootstrapTable({
columns: [
{
field: 'avatar',
title: '头像',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val != null && (val.indexOf("http") == 0 || val.indexOf("https") == 0)) {
return "<img src='" + val + "' height='106'>";
} else {
return "-";
}
}
},
{ field: 'erbanNo', title: '耳伴号', align: 'center', width: '5%', valign: 'middle' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%', valign: 'middle' },
{ field: 'goldNum', title: '金币', align: 'center', width: '5%', valign: 'middle' },
{ field: 'radishNum', title: '水晶', align: 'center', width: '5%', valign: 'middle' },
{ field: 'diamondsNum', title: '钻石', align: 'center', width: '5%', valign: 'middle' }
],
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,
"ernos": $("#ernos").val(),
};
return param;
},
toolbar: '#toolbar',
url: '/admin/goldcoin/userinfo.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
//初始化查看记录表格
function initGoldRecordTable() {
$('#table').bootstrapTable({
columns: [
{
field: 'avatar',
title: '头像',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val != null && val.indexOf("https") == 0) {
return "<img src='" + val + "' height='106'>";
} else {
return "-";
}
}
},
{ field: 'erbanNo', title: '兔兔号', align: 'center', width: '5%', valign: 'middle' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%', valign: 'middle' },
{ field: 'money', title: '余额', align: 'center', width: '5%', valign: 'middle' },
{ field: 'goldNum', title: '赠送数量', align: 'center', width: '5%', valign: 'middle' },
{ field: 'typeCn', title: '赠送类型', align: 'center', width: '5%', valign: 'middle' },
{ field: 'busName', title: '赠送分类', align: 'center', width: '5%', valign: 'middle' },
{ field: 'remark', title: '备注', align: 'center', width: '10%', valign: 'middle' },
{
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:ss");
} else {
return '-';
}
}
},
{ field: 'operatorName', title: '操作人', align: 'center', width: '5%', valign: 'middle' }
],
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 type = $('#type').val();
console.log('type: ' + type);
var param = {
page: params.pageNumber,
pageSize: params.pageSize,
ernos: $("#ernos").val(),
};
return param;
},
toolbar: '#toolbar',
url: '/admin/goldcoin/record.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
//初始化查看记录表格
function initRadishRecordTable() {
$('#table').bootstrapTable({
columns: [
{
field: 'avatar',
title: '头像',
align: 'center',
width: '5%',
valign: 'middle',
formatter: function (val, row, index) {
if (val != null && val.indexOf("https") == 0) {
return "<img src='" + val + "' height='106'>";
} else {
return "-";
}
}
},
{ field: 'erbanNo', title: '平台号', align: 'center', width: '5%', valign: 'middle' },
{ field: 'nick', title: '昵称', align: 'center', width: '5%', valign: 'middle' },
{ field: 'radish', title: '萝卜余额', align: 'center', width: '5%', valign: 'middle' },
{ field: 'goldNum', title: '赠送萝卜数量', align: 'center', width: '5%', valign: 'middle' },
{ field: 'typeCn', title: '赠送类型', align: 'center', width: '5%', valign: 'middle' },
{ field: 'remark', title: '备注', align: 'center', width: '10%', valign: 'middle' },
{
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:ss");
} else {
return '-';
}
}
},
{ field: 'operatorName', title: '操作人', align: 'center', width: '5%', valign: 'middle' }
],
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 = {
currencyType: 1,
page: params.pageNumber,
pageSize: params.pageSize,
"ernos": $("#ernos").val(),
};
return param;
},
toolbar: '#toolbar',
url: '/admin/goldcoin/record.action',
onLoadSuccess: function () { //加载成功时执行
console.log("load success");
},
onLoadError: function () { //加载失败时执行
console.log("load fail");
}
})
}
</script>
<style scoped></style>