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.

516 lines
22 KiB
HTML

<extend name="Public/base"/>
<block name="css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
<script src="__STATIC__/laydate/laydate.js"></script>
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
.select2-container--open {
z-index: 1001;
}
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
.textarea-style {
width: 200px;
height: 80px;
border-radius: 5px;
padding: 5px;
}
.mustmark {
color: #FF0000;
font-style: normal;
margin: 0 3px;
}
.clearfix:after {
content: "\20";
display: block;
height: 0;
clear: both;
}
.clearfix {
*zoom: 1;
}
#other_quota_remark {
width:250px;
height:130px;
padding: 0 10px;
}
</style>
</block>
<block name="body">
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__JS__/jquery.form.js"></script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script src="__STATIC__/md5.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript" src="__STATIC__/webuploader/webuploader.js"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js"></script>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">测试账号角色</h3>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="fl button_list">
<div class="tools">
<empty name="show_status">
<a class="fr" id="apply" href="javascript:;"><span class="button_icon button_icon9"></span>批量申请后续</a>
<a class="fr" id="add-test-user" href="javascript:;"><span class="button_icon button_icon1"></span>新增测试账号</a>
<!-- <a class="fr" id="batch_freeze"><span class="button_icon button_icon5 "></span>批量锁定</a>-->
</empty>
</div>
</div>
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="game_id" name="game_id" class="select_gallery" style="width:120px;">
<option value="0">请选游戏</option>
<?php foreach($games as $game):?>
<option game-id="<?=$game['id']?>" value="<?=$game['id']?>"><?=$game['game_name']?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
<option value="">请选择区服</option>
<?php foreach($servers as $server):?>
<option server-id="<?=$server['server_id']?>" value="<?=$server['server_id']?>">
<?=$server['server_name']?>
</option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<input type="text" name="account" placeholder="测试账号" class="" value="" style="width: 150px">
</div>
<div class="input-list">
<input type="text" name="role_name" placeholder="角色名称" class="" value="" style="width: 150px">
</div>
<div class="input-list input-list-promote search_label_rehab">
<input type="text" readonly name="create_time_start" class="time-select" value="{:I('create_time_start')}"
placeholder="创建开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly name="create_time_end" class="time-select" value="{:I('create_time_end')}"
placeholder="创建结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<select name="status" class="select_gallery" style="width:120px;">
<option value="0">请选择账号状态</option>
<?php foreach($statusList as $key => $value):?>
<option value="<?=$key?>"><?=$value?></option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('TestingResource/roles')}">搜索</a>
</div>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th>
选择
</th>
<th>游戏名称</th>
<th>区服名称</th>
<th>测试账号</th>
<th>手机号</th>
<th>角色名称</th>
<th>绑定账号</th>
<th>绑定角色</th>
<th>初始额度</th>
<th>额外额度</th>
<th>累计额度</th>
<th>待审核金额</th>
<th>累计发放资源</th>
<th>今日发放金额</th>
<th>申请总金额</th>
<th>状态</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="records">
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="records" id="record">
<tr data-id="<?=$record['id']?>" data-binding-id="{$record.binding_id}" data-other-quota="{$record.other_quota}" data-other-quota-remark="{$record.other_quota_remark}">
<td>
<input class="ids" type="radio" value="{$record['id']}" name="role_id">
</td>
<td>{$record.game_name}</td>
<td>{$record.server_name}</td>
<td>{$record.user_account}</td>
<td>{$record.user_phone}</td>
<td>{$record.role_name}</td>
<td>{$record.bind_user_account}</td>
<td>
{$record.bind_role_name}
</td>
<td class="base_quota">{$record.base_quota}</td>
<td class="other_quota">{$record.other_quota}</td>
<td class="quota">{$record.quota}</td>
<td>{$record.verify_amount}</td>
<td class="provide_amount">{$record.provide_amount}</td>
<td>{$record.today_amount}</td>
<td>{$record.apply_amount}</td>
<td>{$record.status}</td>
<td>
<?=substr($record['create_time'], 0, 10)?>
<br>
<?=substr($record['create_time'], 10)?>
</td>
<td>
<a href="javascript:;" class="set-quota-btn">设置额外额度</a>
<?php if($record['binding_id'] > 0):?>
<a href="javascript:;" style="color: #f56c6c" class="unbind-btn">解绑角色</a>
<?php endif;?>
</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<a class="sch-btn export-btn"
href="{:U(CONTROLLER_NAME.'/'.ACTION_NAME,array_merge(['export'=>1],I('get.')))}" target="_blank">导出</a>
</if>
{$_page|default=''}
</div>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="Query/withdraw">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
<div id="add-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: 400px;">
<textarea name="accounts" placeholder="用户账号以英文逗号(,)隔开" class="form-input" id="" cols="50" rows="10"></textarea>
</div>
</div>
<div class="form-group">
<label></label>
<a id="add-submit" href="javascript:;" class="add-submit btn">确定</a>
</div>
</form>
</div>
<div id="other-quota-box" class="layer-box" style="display: none;">
<form method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="">
<div class="form-group">
<label>额外额度</label>
<div class="form-item" style="width: 280px;">
<input type="text" class="form-input" name="other_quota" value="" style="width:250px">
</div>
</div>
<div class="form-group">
<label>备注信息:</label>
<div class="form-item" style="width: 280px;">
<textarea name="other_quota_remark"id="other_quota_remark" class="form-input" placeholder="100字以内" value="" maxlength="100"></textarea>
</div>
</div>
<div class="form-group">
<label></label>
<a id="quota-submit" href="javascript:;" class="add-submit btn">确定</a>
</div>
</form>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<script src="__STATIC__/jquery.cookie.js" charset="utf-8"></script>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('TestingResource/roles')}");
$(function(){
// 全局变量声明
var base_quota = 0;
var quota = 0;
var provide_amount = 0;
// 添加全部选项
if ('all' == "{:I('row', 0)}") {
$("#pagechange").prepend("<option value='all' selected>全部</option>");
} else {
$("#pagechange").prepend("<option value='all'>全部</option>");
}
$('.time-select').each(function(){
laydate.render({
elem: this,
type: 'date'
});
});
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();
//query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;
}else{
url += '?' + query;
}
window.location.href = url;
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
$("#search").click();
}
});
function getIds() {
var ids = [];
$('.ids:checked').each(function() {
ids.push($(this).val());
})
return ids;
}
$('#add-test-user').click(function () {
var box = $('#add-box')
layer.open({
title: '新增',
type: 1,
content: box,
area: ['700px', '380px'],
zIndex: 250,
})
})
function isNumber(num){
if(!num) {
return false
}
var strPreg = /^-?[1-9]\d*$/
if(!strPreg.test(num)) {
return false
}
return true
}
$('.set-quota-btn').click(function () {
var _this = $(this).parent().parent();
var base_quota = _this.find(".base_quota").text();
var quota = _this.find(".quota").text();
var provide_amount = _this.find(".provide_amount").text();
var box = $('#other-quota-box')
var tr = $(this).parents('tr').eq(0)
var id = tr.attr('data-id')
var otherQuota = tr.attr('data-other-quota')
var otherQuotaRemark = tr.attr('data-other-quota-remark')
console.log(tr)
box.find('[name=id]').val(id)
box.find('[name=other_quota]').val(otherQuota)
box.find('[name=other_quota_remark]').val(otherQuotaRemark)
layer.open({
title: '设置额外额度',
type: 1,
content: box,
area: ['500px', '400px'],
zIndex: 250,
})
quota_submit(base_quota,quota,provide_amount);
})
function quota_submit(base_quota,quota,provide_amount) {
$('#quota-submit').on({
click: function() {
var box = $('#other-quota-box')
var id = box.find('[name=id]').val()
var otherQuota = box.find('[name=other_quota]').val()
var otherQuotaRemark = box.find('[name=other_quota_remark]').val()
if (!(parseInt(otherQuota, 10) == otherQuota)){
return layer.msg('额外额度只能为整数')
}
// 初始金额+奖金(累计金额)+额外额度-累计已发放
base_quota = parseInt(base_quota,10) //初始金额
quota = parseInt(quota,10) //奖金=累计额度
otherQuota = parseInt(otherQuota,10) //额外额度
provide_amount = parseInt(provide_amount,10) //累计已发放
console.log(base_quota)
console.log(quota)
console.log(otherQuota)
console.log(provide_amount)
if ((base_quota+quota+otherQuota-provide_amount) < 0){
return layer.msg('额度不足,请重新设置')
}
$.ajax({
url: "{:U('setOtherQuota')}",
type: "POST",
dataType: "json",
data: { id: id, other_quota: otherQuota,otherQuotaRemark: otherQuotaRemark },
success: function (result) {
if (result.status == 0) {
layer.msg(result.message);
} else {
layer.msg(result.message, function(){
window.location.href = window.location.href
})
}
},
error: function () {
}
})
}
})
}
$('.unbind-btn').click(function () {
var tr = $(this).parents('tr').eq(0)
var bindingId = tr.attr('data-binding-id')
layer.confirm('确定要解绑吗?', {
// closeBtn:0,
title: '解绑',
btn: ['确定'] //按钮
}, function(){
$.ajax({
async: false,
url: "{:U('unbindRole')}",
type: "POST",
dataType: "json",
data: { binding_id: bindingId },
success: function (result) {
if (result.status == 0) {
layer.msg(result.message);
} else {
layer.msg(result.message, function(){
window.location.href = window.location.href
})
}
}
})
})
})
$('#add-submit').on({
click: function () {
var box = $('#add-box')
var accounts = box.find('[name=accounts]').val()
console.log(accounts)
$.ajax({
async: false,
url: "{:U('addTestingUsers')}",
type: "POST",
dataType: "json",
data: { accounts: accounts },
success: function (result) {
if (result.status == 0) {
layer.msg(result.message);
} else {
var message = '成功' + result.data.successCount + '个, 失败' + result.data.errorCount + '个, 已存在' + result.data.existCount + '个。'
layer.confirm(message, {
btn: ['确定'] //按钮
}, function(){
location.reload();
})
}
},
error: function () {
}
})
}
})
$('#apply').click(function () {
var title = '添加测试资源申请'
var url = "{:U('TestingResource/apply', '', '')}"
var id = $('input[name=role_id]:checked').val()
id = id == undefined ? 0 : id;
if (id > 0) {
url += '/id/' + id
} else {
return layer.msg('请选择测试账号角色')
}
layer.open({
title: title,
type: 2,
content: [url , 'no'],
area: ['1000px', '600px'],
zIndex: 250,
scrollbar: false,
})
})
$("#game_id").change(function () {
$.ajax({
url: "{:U('getServers')}",
type: "post",
data: { game_id: $("#game_id option:selected").attr('game-id') },
dataType: 'json',
success: function (result ) {
if (result.status == 1) {
var servers = result.data.servers
var str = "<option value=''>请选择区服</option>"
for (var i in servers){
str += "<option value='"+servers[i].server_id+"'>"+servers[i].server_name+"</option>"
}
$("#server_id").empty()
$("#server_id").append(str)
$("#server_id").select2()
}
}
})
})
});
</script>
</block>