|
|
|
|
<extend name="Public/basic"/>
|
|
|
|
|
<block name="body">
|
|
|
|
|
<style>
|
|
|
|
|
.trunk-search .form-group {
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
.normal_table input {
|
|
|
|
|
position: relative;
|
|
|
|
|
padding: 5px;
|
|
|
|
|
border: 1px solid #E5E5E5;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
height: 25px;
|
|
|
|
|
}
|
|
|
|
|
.normal_table td {
|
|
|
|
|
padding: 5px;
|
|
|
|
|
}
|
|
|
|
|
.normal_table td select {
|
|
|
|
|
width: 100%;
|
|
|
|
|
}
|
|
|
|
|
.normal_table td button {
|
|
|
|
|
width: 70px;
|
|
|
|
|
height: 35px;
|
|
|
|
|
display: block;
|
|
|
|
|
background: #409eff;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.normal_table td button.delete-row {
|
|
|
|
|
background-color: rgb(249,104,104);
|
|
|
|
|
}
|
|
|
|
|
.btn-row {
|
|
|
|
|
position: relative;
|
|
|
|
|
font-size: 11px;
|
|
|
|
|
margin-top: 28px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.btn-row button {
|
|
|
|
|
width: 70px;
|
|
|
|
|
height: 35px;
|
|
|
|
|
display: block;
|
|
|
|
|
background: #409eff;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
.btn-row button.close-btn {
|
|
|
|
|
background: #E5E5E5;
|
|
|
|
|
color: #535875;
|
|
|
|
|
}
|
|
|
|
|
.form-group .static-input {
|
|
|
|
|
line-height: 32px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
.trunk-search button {
|
|
|
|
|
width: 70px;
|
|
|
|
|
height: 35px;
|
|
|
|
|
display: block;
|
|
|
|
|
background: #409eff;
|
|
|
|
|
color: #fff;
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
}
|
|
|
|
|
.info-row {
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
}
|
|
|
|
|
.info-row button {
|
|
|
|
|
width: 120px;
|
|
|
|
|
height: 25px;
|
|
|
|
|
display: block;
|
|
|
|
|
background: #E5E5E5;
|
|
|
|
|
color: #535875;
|
|
|
|
|
border: none;
|
|
|
|
|
border-radius: 4px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
}
|
|
|
|
|
</style>
|
|
|
|
|
<div class="page-search normal_list promoteCoin-record-search" style="padding: 20px;">
|
|
|
|
|
<div class="trunk-content article">
|
|
|
|
|
<div class="trunk-search clearfix" style="margin-bottom: 10px;">
|
|
|
|
|
<form method="post" class="clearfix">
|
|
|
|
|
<div class="clearfix">
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<select id="game-select" name="" class="select_gallery" style="width:150px">
|
|
|
|
|
<option value="0">请选择游戏</option>
|
|
|
|
|
<?php foreach($games as $game):?>
|
|
|
|
|
<option value="<?=$game['id']?>"><?=$game['game_name']?></option>
|
|
|
|
|
<?php endforeach;?>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<select id="server-select" class="select_gallery" style="width:150px">
|
|
|
|
|
<option value="0">请选择区服</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<input id="test_account" type="text" name="account" class="txt normal_txt" id="uid" placeholder="请输入测试资源账号" value="{:I('account')}">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<select id="role-select" name="role_id" class="select_gallery" style="width:150px">
|
|
|
|
|
<option value="0">请选择角色</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="info-row">
|
|
|
|
|
<button id="bind-btn" type="button">绑定玩家账号</button>
|
|
|
|
|
<div class="" style="display:inline-block; margin-left: 10px;">当前可用额度:1364 待审核额度:0</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="clearfix" style="margin-top: 10px;">
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<select id="resource-type-select" name="resource_type_id" style="width:150px" class="select_gallery">
|
|
|
|
|
<option value="">请选择资源类型</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<select id="resource-select" name="resource_id" style="width:150px" class="select_gallery">
|
|
|
|
|
<option value="">请选择资源内容</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<p id="resource-amount" class="static-input">资源价值: --</p>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<input id="num-input" type="text" name="num" class="txt normal_txt" id="uid" placeholder="请输入资源数量" value="">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<input id="remark-input" type="text" name="remark" class="txt normal_txt" id="uid" placeholder="请输入备注" value="">
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group fl">
|
|
|
|
|
<button id="add-row" class="add-row" type="button">增加</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="trunk-list list_normal">
|
|
|
|
|
<div class="table-wrapper" style="height: 280px;">
|
|
|
|
|
<table id="resource-table" class="table normal_table">
|
|
|
|
|
<thead>
|
|
|
|
|
<tr class="table-header">
|
|
|
|
|
<th width="150">资源类型</th>
|
|
|
|
|
<th width="150">资源内容</th>
|
|
|
|
|
<th>资源价值</th>
|
|
|
|
|
<th>资源数量</th>
|
|
|
|
|
<th>备注</th>
|
|
|
|
|
<th>操作</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="btn-row clearfix">
|
|
|
|
|
<button id="submit-btn" class="submit-btn" type="button">提交</button>
|
|
|
|
|
<button id="close-btn" class="close-btn" type="button">关闭</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div id="bind-box" class="layer-box" style="display: none;">
|
|
|
|
|
<form method="post" enctype="multipart/form-data">
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>玩家账号</label>
|
|
|
|
|
<div class="form-item" style="width: 250px">
|
|
|
|
|
<input name="account" type="text" class="form-input" style="width: 100%;">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label>玩家角色</label>
|
|
|
|
|
<div class="form-item" style="width: 250px">
|
|
|
|
|
<select id="role-select" name="role_id" style="width:270px" class="select_gallery">
|
|
|
|
|
<option value="">请选择</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="form-group">
|
|
|
|
|
<label></label>
|
|
|
|
|
<a id="add-submit" href="javascript:;" class="add-submit btn">确定</a>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</block>
|
|
|
|
|
<block name="script">
|
|
|
|
|
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
|
|
|
|
|
<script type="text/javascript">
|
|
|
|
|
$(".select_gallery").select2()
|
|
|
|
|
var globalGameId = 0
|
|
|
|
|
$('#game-select').on({
|
|
|
|
|
change: function () {
|
|
|
|
|
var gameId = $(this).val()
|
|
|
|
|
globalGameId = gameId
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{:U('getServers')}",
|
|
|
|
|
type: "post",
|
|
|
|
|
data: { game_id: gameId },
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(result){
|
|
|
|
|
if (result.status == 1) {
|
|
|
|
|
var servers = result.data.servers
|
|
|
|
|
var html = "<option value='0'>请选择区服</option>";
|
|
|
|
|
for (var i in servers){
|
|
|
|
|
html += "<option value='"+servers[i].id+"'>"+servers[i].server_name+"</option>"
|
|
|
|
|
}
|
|
|
|
|
$("#server-select").html(html);
|
|
|
|
|
$("#server-select").select2();
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
initTable(gameId)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
var resourceTypes = new Array()
|
|
|
|
|
var rowCount = 0
|
|
|
|
|
function initTable(gameId) {
|
|
|
|
|
var table = $('#resource-table');
|
|
|
|
|
table.find('.normal-row').remove()
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{:U('getResourceTypes')}",
|
|
|
|
|
type: "post",
|
|
|
|
|
data: { game_id: gameId },
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(result){
|
|
|
|
|
if (result.status == 1) {
|
|
|
|
|
rowCount = 0
|
|
|
|
|
resourceTypes = result.data.resourceTypes
|
|
|
|
|
var selector = $('#resource-type-select')
|
|
|
|
|
var html = getResourceTypesHtml()
|
|
|
|
|
selector.html(html)
|
|
|
|
|
selector.select2();
|
|
|
|
|
|
|
|
|
|
var resourceSelector = $('#resource-select')
|
|
|
|
|
resourceSelector.html(getResourcesHtml([]))
|
|
|
|
|
resourceSelector.select2();
|
|
|
|
|
|
|
|
|
|
$('#resource-amount').html('资源价值:--')
|
|
|
|
|
$('#resource-table tbody').html('')
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
function getResourceTypesHtml() {
|
|
|
|
|
var html = "<option value=''>请选择资源类型</option>";
|
|
|
|
|
for (var i in resourceTypes) {
|
|
|
|
|
html += "<option value='"+resourceTypes[i].id+"'>"+resourceTypes[i].name+"</option>"
|
|
|
|
|
}
|
|
|
|
|
return html
|
|
|
|
|
}
|
|
|
|
|
$('#resource-type-select').change(function () {
|
|
|
|
|
var that = this
|
|
|
|
|
var typeId = $(this).val()
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{:U('getResources')}",
|
|
|
|
|
type: "post",
|
|
|
|
|
data: { type_id: typeId },
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(result){
|
|
|
|
|
if (result.status == 1) {
|
|
|
|
|
var resources = result.data.resources
|
|
|
|
|
var html = getResourcesHtml(resources)
|
|
|
|
|
var rowSelect = $('#resource-select')
|
|
|
|
|
rowSelect.html(html);
|
|
|
|
|
rowSelect.select2();
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
function getResourcesHtml(resources) {
|
|
|
|
|
var html = "<option value=''>请选择资源内容</option>";
|
|
|
|
|
for (var i in resources){
|
|
|
|
|
html += "<option value='"+resources[i].ref_id+"' data-amount="+resources[i].amount+">"+resources[i].name+"</option>"
|
|
|
|
|
}
|
|
|
|
|
return html
|
|
|
|
|
}
|
|
|
|
|
$('#resource-select').change(function () {
|
|
|
|
|
var amount = $(this).find('option:selected').attr('data-amount')
|
|
|
|
|
amount = amount == undefined ? '--' : amount
|
|
|
|
|
$('#resource-amount').html('资源价值:' + amount)
|
|
|
|
|
})
|
|
|
|
|
$('#add-row').click(function () {
|
|
|
|
|
if (rowCount >= 5) {
|
|
|
|
|
return layer.msg('最多同时只能添加5条')
|
|
|
|
|
}
|
|
|
|
|
var resourceTypeId = $('#resource-type-select').val()
|
|
|
|
|
var resourceId = $('#resource-select').val()
|
|
|
|
|
var resourceTypeName = $('#resource-type-select option:selected').html()
|
|
|
|
|
var resourceName = $('#resource-select option:selected').html()
|
|
|
|
|
var amount = $('#resource-select option:selected').attr('data-amount')
|
|
|
|
|
amount = amount == undefined ? '--' : amount
|
|
|
|
|
var num = $('#num-input').val()
|
|
|
|
|
var remark = $('#remark-input').val()
|
|
|
|
|
|
|
|
|
|
if (resourceTypeId == '') {
|
|
|
|
|
return layer.msg('请选择资源类型')
|
|
|
|
|
}
|
|
|
|
|
if (resourceId == '') {
|
|
|
|
|
return layer.msg('请选择资源内容')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var html = '<tr class="normal-row" data-resource-id="' + resourceId + '" data-resource-type-id="' + resourceTypeId + '" >' +
|
|
|
|
|
'<td>' + resourceTypeName + '</td>' +
|
|
|
|
|
'<td>' + resourceName + '</td>' +
|
|
|
|
|
'<td class="amount">' + amount + '</td>' +
|
|
|
|
|
'<td class="num"><input name="num" type="text" value="' + num + '"></td>' +
|
|
|
|
|
'<td class="remark"><input name="remark" type="text" value="' + remark + '"></td>' +
|
|
|
|
|
'<td><button class="delete-row" type="button" class="danger-btn">删除</button></td>' +
|
|
|
|
|
'</tr>';
|
|
|
|
|
|
|
|
|
|
$('#resource-table tbody').append(html)
|
|
|
|
|
rowCount ++
|
|
|
|
|
$(".select_gallery").select2()
|
|
|
|
|
})
|
|
|
|
|
$('#resource-table').on('click', '.delete-row', function () {
|
|
|
|
|
var tr = $(this).parents('tr').eq(0)
|
|
|
|
|
rowCount --
|
|
|
|
|
tr.remove()
|
|
|
|
|
})
|
|
|
|
|
$('#test_account').on({
|
|
|
|
|
blur: function() {
|
|
|
|
|
var gameId = $('#game-select').val()
|
|
|
|
|
if (gameId == 0) {
|
|
|
|
|
return layer.msg('请选择游戏')
|
|
|
|
|
}
|
|
|
|
|
var serverId = $('#server-select').val()
|
|
|
|
|
if (serverId == 0) {
|
|
|
|
|
return layer.msg('请选择区服')
|
|
|
|
|
}
|
|
|
|
|
if (userAccount == '') {
|
|
|
|
|
return layer.msg('请输入测试资源账号')
|
|
|
|
|
}
|
|
|
|
|
var userAccount = $('#test_account').val()
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{:U('getUserRoles')}",
|
|
|
|
|
type: "post",
|
|
|
|
|
data: { user_account: userAccount, game_id: gameId, server_id: serverId },
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(result){
|
|
|
|
|
if (result.status == 1) {
|
|
|
|
|
var roles = result.data.roles
|
|
|
|
|
if (roles.length == 0) {
|
|
|
|
|
return layer.msg('当前账号不属于该区服')
|
|
|
|
|
}
|
|
|
|
|
var html = "<option value='0'>请选择角色</option>";
|
|
|
|
|
for (var i in roles){
|
|
|
|
|
html += "<option value='"+roles[i].id+"'>"+roles[i].role_name+"</option>"
|
|
|
|
|
}
|
|
|
|
|
$("#role-select").html(html);
|
|
|
|
|
$("#role-select").select2();
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg(result.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function getRecords() {
|
|
|
|
|
var records = []
|
|
|
|
|
$('#resource-table tbody tr').each(function (index, tr) {
|
|
|
|
|
var num = $(tr).find('input[name=num]').val()
|
|
|
|
|
var remark = $(tr).find('input[name=remark]').val()
|
|
|
|
|
var resourceId = $(tr).attr('data-resource-id')
|
|
|
|
|
var resourceTypeId = $(tr).attr('data-resource-type-id')
|
|
|
|
|
records.push({
|
|
|
|
|
resource_id: resourceId,
|
|
|
|
|
resource_type_id: resourceTypeId,
|
|
|
|
|
num: num,
|
|
|
|
|
remark: remark,
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
return records
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$('#bind-btn').click(function () {
|
|
|
|
|
var box = $('#bind-box')
|
|
|
|
|
layer.open({
|
|
|
|
|
title: '绑定玩家账号',
|
|
|
|
|
type: 1,
|
|
|
|
|
content: box,
|
|
|
|
|
area: ['500px', '250px'],
|
|
|
|
|
zIndex: 250,
|
|
|
|
|
scrollbar: false
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
$('#submit-btn').on({
|
|
|
|
|
click: function () {
|
|
|
|
|
var records = getRecords()
|
|
|
|
|
|
|
|
|
|
if (records.length == 0) {
|
|
|
|
|
return layer.msg('至少添加一项资源申请')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
for (var i in records) {
|
|
|
|
|
if (records[i].num == '') {
|
|
|
|
|
return layer.msg('请输入资源数量')
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var gameId = $('#game-select').val()
|
|
|
|
|
var serverId = $('#server-select').val()
|
|
|
|
|
var userAccount = $('#test_account').val()
|
|
|
|
|
var roleId = $('#role-select').val()
|
|
|
|
|
|
|
|
|
|
if (gameId == 0) {
|
|
|
|
|
return layer.msg('请选择游戏')
|
|
|
|
|
}
|
|
|
|
|
if (serverId == 0) {
|
|
|
|
|
return layer.msg('请选择区服')
|
|
|
|
|
}
|
|
|
|
|
if (userAccount == '') {
|
|
|
|
|
return layer.msg('请输入测试资源账号')
|
|
|
|
|
}
|
|
|
|
|
if (roleId == 0) {
|
|
|
|
|
return layer.msg('请选择角色')
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "{:U('doApply')}",
|
|
|
|
|
type: "post",
|
|
|
|
|
data: { records: records, game_id: gameId, server_id: serverId, user_account: userAccount, role_id: roleId},
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
success: function(result){
|
|
|
|
|
if (result.status == 1) {
|
|
|
|
|
var servers = result.data.servers
|
|
|
|
|
var html = "<option value=''>请选择区服</option>";
|
|
|
|
|
for (var i in servers) {
|
|
|
|
|
html += "<option value='"+servers[i].server_id+"'>"+servers[i].server_name+"</option>"
|
|
|
|
|
}
|
|
|
|
|
$("#server-select").html(html);
|
|
|
|
|
$("#server-select").select2();
|
|
|
|
|
} else {
|
|
|
|
|
layer.msg(result.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
$('#close-btn').on({
|
|
|
|
|
click: function () {
|
|
|
|
|
var index = parent.layer.getFrameIndex(window.name)
|
|
|
|
|
parent.layer.close(index)
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
</script>
|
|
|
|
|
</block>
|