You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
522 lines
15 KiB
HTML
522 lines
15 KiB
HTML
3 years ago
|
<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: 16px;
|
||
|
}
|
||
|
.normal_table td {
|
||
|
padding: 5px;
|
||
|
text-align: center;
|
||
|
}
|
||
|
.normal_table td select {
|
||
|
width: 100%;
|
||
|
}
|
||
|
.normal_table td button {
|
||
|
width: 50px;
|
||
|
height: 24px;
|
||
|
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;
|
||
|
background: #409eff;
|
||
|
color: #fff;
|
||
|
border: none;
|
||
|
border-radius: 4px;
|
||
|
cursor: pointer;
|
||
|
display: inline-block;
|
||
|
padding: 0px;
|
||
|
}
|
||
|
.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: auto;
|
||
|
height: 25px;
|
||
|
display: block;
|
||
|
background: #E5E5E5;
|
||
|
color: #535875;
|
||
|
border: none;
|
||
|
border-radius: 3px;
|
||
|
cursor: pointer;
|
||
|
display: inline-block;
|
||
|
margin-left: 10px;
|
||
|
padding: 0px 10px;
|
||
|
}
|
||
|
.info-row button.bind-btn {
|
||
|
background: #409eff;
|
||
|
color: #fff;
|
||
|
}
|
||
|
.form-group {
|
||
|
display: inline-block;
|
||
|
margin-bottom: 10px;
|
||
|
}
|
||
|
.form-group .form-item {
|
||
|
display: inline-block;
|
||
|
}
|
||
|
.form-group label {
|
||
|
display: inline-block;
|
||
|
width: 80px;
|
||
|
text-align: right;
|
||
|
margin-right: 10px;
|
||
|
font-weight: bold;
|
||
|
}
|
||
|
.form-group input {
|
||
|
padding: 5px;
|
||
|
border: 1px solid #E5E5E5;
|
||
|
border-radius: 4px;
|
||
|
height: 24px;
|
||
|
}
|
||
|
.clearfix:after {
|
||
|
content: "\20";
|
||
|
display: block;
|
||
|
height: 0;
|
||
|
clear: both;
|
||
|
}
|
||
|
.clearfix {
|
||
|
*zoom: 1;
|
||
|
}
|
||
|
.select2-container--open {
|
||
|
z-index: 1001;
|
||
|
}
|
||
|
.search-role-info {
|
||
|
position: absolute;
|
||
|
top: 0px;
|
||
|
right: 0px;
|
||
|
border: solid 1px #b6cad2;
|
||
|
padding: 15px 5px;
|
||
|
}
|
||
|
.search-role-info .item-name {
|
||
|
font-weight: bold;
|
||
|
margin-left: 10px;
|
||
|
width: 85px;
|
||
|
text-align: right;
|
||
|
display: inline-block;
|
||
|
font-size: 12px;
|
||
|
line-height: 35px;
|
||
|
}
|
||
|
.search-role-info .item-value {
|
||
|
font-size: 12px;
|
||
|
display: inline-block;
|
||
|
width: 150px;
|
||
|
line-height: 35px;
|
||
|
}
|
||
|
.data_list table th {
|
||
|
height: 30px;
|
||
|
line-height: 30px;
|
||
|
}
|
||
|
.data_list table td {
|
||
|
line-height: 30px;
|
||
|
}
|
||
|
</style>
|
||
|
<div class="page-search normal_list promoteCoin-record-search" style="padding: 10px;">
|
||
|
<div class="trunk-content article">
|
||
|
<div class="trunk-search clearfix" style="margin-bottom: 10px; position: relative;">
|
||
|
<form method="post" class="clearfix">
|
||
|
<div class="clearfix">
|
||
|
<div class="form-group">
|
||
|
<label>游戏名称</label>
|
||
|
<div class="form-item">
|
||
|
<select id="game-select" name="base_game_id" class="select_gallery" style="width:220px;">
|
||
|
<option value="0">游戏名称</option>
|
||
|
<?php foreach($baseGames as $baseGame):?>
|
||
|
<option value="<?=$baseGame['id']?>"><?=$baseGame['name']?></option>
|
||
|
<?php endforeach;?>
|
||
|
</select>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearfix">
|
||
|
<div class="form-group">
|
||
|
<label>日期</label>
|
||
|
<div class="form-item">
|
||
|
<input id="date-input" type="text" class="form-input time-select" name="role_id" style="width:208px" value="" autocomplete="off" placeholder="请输入单日累充返利日期">
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearfix">
|
||
|
<div class="form-group">
|
||
|
<label>角色ID</label>
|
||
|
<div class="form-item">
|
||
|
<input id="role-input" type="text" class="form-input" name="role_id" style="width:208px" value="" placeholder="请输入角色ID">
|
||
|
<button id="search-role" class="add-row" type="button">查询</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="clearfix">
|
||
|
<div class="form-group">
|
||
|
<label>道具选择</label>
|
||
|
<div class="form-item">
|
||
|
<select id="prop-list-select" name="prop_id" style="width:220px" class="select_gallery">
|
||
|
<option value="0" data-value="0">请选择道具</option>
|
||
|
</select>
|
||
|
<button id="add-row" class="add-row" type="button">增加</button>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
</form>
|
||
|
<div id="search-role-info" class="search-role-info" style="display: none;">
|
||
|
<div class="row">
|
||
|
<span class="item-name">角色名:</span><span class="item-value value-role-name"></span>
|
||
|
<span class="item-name">所属区服:</span><span class="item-value value-server-name"></span>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<span class="item-name">单日累充金额:</span><span class="item-value value-pay-amount"></span>
|
||
|
<span class="item-name">单日模拟累充:</span><span class="item-value value-simulate-amount"></span>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<span class="item-name">返利倍数:</span><span class="item-value value-max-times"></span>
|
||
|
<span class="item-name">总额度:</span><span class="item-value value-total-quota"></span>
|
||
|
</div>
|
||
|
<div class="row">
|
||
|
<span class="item-name">已申请额度:</span><span class="item-value value-applied-quota"></span>
|
||
|
<span class="item-name">剩余额度:</span><span class="item-value value-remain-quota"></span>
|
||
|
</div>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="trunk-list list_normal data_list" style="margin-top: 10px">
|
||
|
<div class="table-wrapper" style="height: 430px;">
|
||
|
<table id="prop-table" class="table normal_table ">
|
||
|
<thead>
|
||
|
<tr class="table-header">
|
||
|
<th width="150">道具</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>
|
||
|
</block>
|
||
|
<block name="script">
|
||
|
<script type="text/javascript" src="__JS__/20170831/select2.min.js"></script>
|
||
|
<script src="__STATIC__/laydate/laydate.js"></script>
|
||
|
<script type="text/javascript">
|
||
|
var roleInfo
|
||
|
var rowCount = 0
|
||
|
var beforeItem = {
|
||
|
base_game_id: 0,
|
||
|
role_id: '',
|
||
|
date: '',
|
||
|
}
|
||
|
$(".select_gallery").select2();
|
||
|
$('#game-select').on({
|
||
|
change: function () {
|
||
|
$('#search-role-info').hide()
|
||
|
$('#prop-table tbody').html('')
|
||
|
rowCount = 0
|
||
|
|
||
|
var baseGameId = $(this).val()
|
||
|
if (baseGameId == 0) {
|
||
|
$('#prop-list-select').html('<option value="0">请选择道具</option>')
|
||
|
$(".select_gallery").select2();
|
||
|
return
|
||
|
}
|
||
|
$.ajax({
|
||
|
url: "{:U('getRebateProps')}",
|
||
|
type: "get",
|
||
|
data: { base_game_id: baseGameId },
|
||
|
dataType: 'json',
|
||
|
success: function (result) {
|
||
|
var html = '<option value="0" data-value="0">请选择道具</option>'
|
||
|
for (var i in result.data.props) {
|
||
|
var prop = result.data.props[i]
|
||
|
html += '<option value="' + prop.id + '" data-value="' + prop.value + '">' + prop.name + '</option>'
|
||
|
}
|
||
|
$('#prop-list-select').html(html)
|
||
|
$(".select_gallery").select2();
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
|
||
|
$('.time-select').each(function(){
|
||
|
laydate.render({
|
||
|
elem: this,
|
||
|
type: 'date'
|
||
|
});
|
||
|
});
|
||
|
|
||
|
$('#add-row').click(function () {
|
||
|
if (rowCount >= 10) {
|
||
|
return layer.msg('最多同时只能添加10条')
|
||
|
}
|
||
|
var id = $('#prop-list-select').val()
|
||
|
if (id == 0) {
|
||
|
return layer.msg('请选择道具')
|
||
|
}
|
||
|
addRow()
|
||
|
})
|
||
|
|
||
|
function isFloat(num){
|
||
|
if(!num) {
|
||
|
return false
|
||
|
}
|
||
|
var strPreg = /^\d+(\.\d+)?$/;
|
||
|
if(!strPreg.test(num)) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
try{
|
||
|
if(parseFloat(num) != num) {
|
||
|
return false
|
||
|
}
|
||
|
} catch(ex) {
|
||
|
return false
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
function isNumber(num){
|
||
|
if(!num) {
|
||
|
return false
|
||
|
}
|
||
|
var strPreg = /^\d+$/
|
||
|
if(!strPreg.test(num)) {
|
||
|
return false
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
function checkIsInputChange() {
|
||
|
var date = $('#date-input').val()
|
||
|
var gameId = $('#game-select').val()
|
||
|
var roleId = $('#role-input').val()
|
||
|
if (beforeItem.date == date && beforeItem.base_game_id == gameId && beforeItem.role_id == roleId) {
|
||
|
return false
|
||
|
}
|
||
|
return true
|
||
|
}
|
||
|
|
||
|
function addRow() {
|
||
|
if (checkIsInputChange()) {
|
||
|
return layer.msg('请先查询角色')
|
||
|
}
|
||
|
var id = $('#prop-list-select').val()
|
||
|
var propName = $('#prop-list-select option:selected').html()
|
||
|
var value = $('#prop-list-select option:selected').attr('data-value')
|
||
|
|
||
|
var html = '<tr class="normal-row" data-id="' + id + '" >' +
|
||
|
'<td>' + propName + '</td>' +
|
||
|
'<td class="value">' + value + '</td>' +
|
||
|
'<td class="num"><input name="num" type="text" value="1"></td>' +
|
||
|
'<td><button class="delete-row" type="button" class="danger-btn">删除</button></td>' +
|
||
|
'</tr>';
|
||
|
|
||
|
$('#prop-table tbody').append(html)
|
||
|
rowCount ++
|
||
|
$(".select_gallery").select2()
|
||
|
statQuota()
|
||
|
}
|
||
|
|
||
|
$('#prop-table').on('click', '.delete-row', function () {
|
||
|
var tr = $(this).parents('tr').eq(0)
|
||
|
rowCount --
|
||
|
tr.remove()
|
||
|
statQuota()
|
||
|
})
|
||
|
$('#prop-table').on('blur', 'input[name=num]', function() {
|
||
|
if($(this).val() == '') {
|
||
|
return layer.msg('请输入道具数量')
|
||
|
} else {
|
||
|
statQuota()
|
||
|
}
|
||
|
})
|
||
|
|
||
|
function getCurrentQuota() {
|
||
|
var appliedQuota = roleInfo.applied_quota
|
||
|
var remainQuota = roleInfo.remain_quota
|
||
|
$('#prop-table').find('.normal-row').each(function (index, ele) {
|
||
|
var quota = $(ele).find('.value').html() * $(ele).find('.num').children('input').val()
|
||
|
appliedQuota += quota
|
||
|
remainQuota -= quota
|
||
|
})
|
||
|
return {
|
||
|
remain_quota: remainQuota,
|
||
|
applied_quota: appliedQuota
|
||
|
}
|
||
|
}
|
||
|
function statQuota() {
|
||
|
var currentQuota = getCurrentQuota()
|
||
|
if (currentQuota.remain_quota < 0) {
|
||
|
layer.msg('额度不足')
|
||
|
}
|
||
|
$('#search-role-info').find('.value-applied-quota').html(currentQuota.applied_quota)
|
||
|
$('#search-role-info').find('.value-remain-quota').html(currentQuota.remain_quota)
|
||
|
}
|
||
|
|
||
|
$('#search-role').on({
|
||
|
click: function () {
|
||
|
searchUserRole()
|
||
|
}
|
||
|
})
|
||
|
/* $('#date-input').on({
|
||
|
blur: function () {
|
||
|
searchUserRole()
|
||
|
}
|
||
|
}) */
|
||
|
function searchUserRole() {
|
||
|
var date = $('#date-input').val()
|
||
|
var gameId = $('#game-select').val()
|
||
|
var roleId = $('#role-input').val()
|
||
|
if (gameId == 0) {
|
||
|
return layer.msg('请选择游戏')
|
||
|
}
|
||
|
if (roleId == '') {
|
||
|
return layer.msg('请输入角色ID')
|
||
|
}
|
||
|
if (date == '') {
|
||
|
return layer.msg('请输入日期')
|
||
|
}
|
||
|
$.ajax({
|
||
|
url: "{:U('searchRoleInfo')}",
|
||
|
type: "post",
|
||
|
data: { role_id: roleId, base_game_id: gameId, date: date },
|
||
|
dataType: 'json',
|
||
|
success: function(result){
|
||
|
if (result.status == 1) {
|
||
|
roleInfo = result.data
|
||
|
|
||
|
beforeItem.role_id = roleId
|
||
|
beforeItem.base_game_id = gameId
|
||
|
beforeItem.date = date
|
||
|
|
||
|
$('#search-role-info').show()
|
||
|
$('#search-role-info').find('.value-role-name').html(result.data.role_name)
|
||
|
$('#search-role-info').find('.value-server-name').html(result.data.server_name)
|
||
|
$('#search-role-info').find('.value-pay-amount').html(result.data.pay_amount)
|
||
|
$('#search-role-info').find('.value-total-quota').html(result.data.total_quota)
|
||
|
$('#search-role-info').find('.value-applied-quota').html(result.data.applied_quota)
|
||
|
$('#search-role-info').find('.value-remain-quota').html(result.data.remain_quota)
|
||
|
$('#search-role-info').find('.value-max-times').html(result.data.max_times)
|
||
|
$('#search-role-info').find('.value-simulate-amount').html(result.data.simulate_amount)
|
||
|
|
||
|
} else {
|
||
|
$('#search-role-info').hide()
|
||
|
layer.msg(result.message)
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
function getProps() {
|
||
|
var records = []
|
||
|
$('#prop-table tbody tr').each(function (index, tr) {
|
||
|
var num = $(tr).find('input[name=num]').val()
|
||
|
var id = $(tr).attr('data-id')
|
||
|
records.push({
|
||
|
id: id,
|
||
|
num: num
|
||
|
})
|
||
|
})
|
||
|
return records
|
||
|
}
|
||
|
|
||
|
$('#submit-btn').on({
|
||
|
click: function () {
|
||
|
var props = getProps()
|
||
|
|
||
|
if (props.length == 0) {
|
||
|
return layer.msg('至少添加一项道具申请')
|
||
|
}
|
||
|
|
||
|
for (var i in props) {
|
||
|
if (props[i].num == '') {
|
||
|
return layer.msg('请输入道具数量')
|
||
|
}
|
||
|
}
|
||
|
|
||
|
var gameId = $('#game-select').val()
|
||
|
var roleId = $('#role-input').val()
|
||
|
var date = $('#date-input').val()
|
||
|
|
||
|
if (gameId == 0) {
|
||
|
return layer.msg('请选择游戏')
|
||
|
}
|
||
|
if (roleId == '') {
|
||
|
return layer.msg('请输入角色ID')
|
||
|
}
|
||
|
if (date == '') {
|
||
|
return layer.msg('请输入日期')
|
||
|
}
|
||
|
|
||
|
var currentQuota = getCurrentQuota()
|
||
|
if (currentQuota.remain_quota < 0) {
|
||
|
return layer.msg('额度不足')
|
||
|
}
|
||
|
|
||
|
$.ajax({
|
||
|
url: "{:U('doPropsApply')}",
|
||
|
type: "post",
|
||
|
data: { props: props, base_game_id: gameId, role_id: roleId, date: date},
|
||
|
dataType: 'json',
|
||
|
success: function(result){
|
||
|
if (result.status == 1) {
|
||
|
layer.msg(result.message, function(){
|
||
|
parent.window.location.href = parent.window.location.href
|
||
|
})
|
||
|
} else {
|
||
|
layer.msg(result.message)
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
})
|
||
|
$('#close-btn').on({
|
||
|
click: function () {
|
||
|
var index = parent.layer.getFrameIndex(window.name)
|
||
|
parent.layer.close(index)
|
||
|
}
|
||
|
})
|
||
|
</script>
|
||
|
</block>
|