master
elf 11 months ago
parent 1437980c72
commit 4fa034d309

@ -192,6 +192,185 @@ class SpendController extends ThinkController
$this->display();
}
public function lists1()
{
$startDate = empty($_REQUEST['timestart']) ? date('Y-m-d', strtotime('-6 day', time())) : $_REQUEST['timestart'];
$endDate = empty($_REQUEST['timeend']) ? date('Y-m-d') : $_REQUEST['timeend'];
$payStatus = isset($_REQUEST['pay_status']) ? $_REQUEST['pay_status'] : 1;
$startTime = strtotime($startDate);
$endTime = strtotime($endDate) + 86399;
if($payStatus > 0){
$map['pay_time'] = array('BETWEEN', array($startTime, $endTime));
}else{
$map['spend_time'] = array('BETWEEN', array($startTime, $endTime));
}
$map['pay_status'] = $payStatus;
unset($_REQUEST['timestart']);
unset($_REQUEST['timeend']);
if (isset($_REQUEST['is_check'])) {
$map['is_check'] = (int)($_REQUEST['is_check']);
}
if (isset($_REQUEST['is_refund'])) {
$map['is_refund'] = (int)($_REQUEST['is_refund']);
}
if (isset($_REQUEST['user_account'])) {
$map['user_account'] = array('like', trim($_REQUEST['user_account']));
unset($_REQUEST['user_account']);
}
if (isset($_REQUEST['spend_ip'])) {
$map['spend_ip'] = array('like', trim($_REQUEST['spend_ip']) . '%');
unset($_REQUEST['spend_ip']);
}
if (isset($_REQUEST['game_name'])) {
if ($_REQUEST['game_name'] == '全部') {
unset($_REQUEST['game_name']);
} else {
$map['game_id'] = ['in', array_column(getGameByName($_REQUEST['game_name'], $_REQUEST['game_type']), 'id')];
unset($_REQUEST['game_name']);
}
}
if (isset($_REQUEST['game_type']) && $_REQUEST['game_type']) {
$map['sdk_version'] = $_REQUEST['game_type'];
}
if (isset($_REQUEST['server_id'])) {
$map['server_id'] = $_REQUEST['server_id'];
unset($_REQUEST['server_id']);
}
if (isset($_REQUEST['pay_order_number'])) {
$map['pay_order_number'] = array('like', trim($_REQUEST['pay_order_number']));
unset($_REQUEST['pay_order_number']);
}
if (isset($_REQUEST['extend'])) {
$map['extend'] = array('like', trim($_REQUEST['extend']));
unset($_REQUEST['extend']);
}
if (isset($_REQUEST['pay_way'])) {
if ($_REQUEST['pay_way'] == 2) {
$map['pay_way'] = ['in', '2,3,4'];
} else {
$map['pay_way'] = $_REQUEST['pay_way'];
}
unset($_REQUEST['pay_way']);
}
if (isset($_REQUEST['pay_game_status'])) {
$map['pay_game_status'] = $_REQUEST['pay_game_status'];
unset($_REQUEST['pay_game_status']);
}
if ($_REQUEST['merchant_id']) {
$map['merchant_id'] = $_REQUEST['merchant_id'];
unset($_REQUEST['merchant_id']);
}
if (isset($_REQUEST['promote_id'])) {
$promoteId = intval($_REQUEST['promote_id']);
if ($promoteId == 0) {
$map['promote_id'] = 0;
} else {
$promoteMap['chain'] = ['like', "%/$promoteId/%"];
$promoteIds = M('Promote', 'tab_')->where($promoteMap)->getField('id', true);
$promoteIds[] = $promoteId;
$map['promote_id'] = ['in', $promoteIds];
}
}
$isMarketAdmin = isMarketAdmin();
$isMarketLeader = isMarketLeader();
$marketAdminIds = getSearchAdminIds('market_admin_id');
if (is_array($marketAdminIds)) {
$map['market_admin_id'] = ['in', $marketAdminIds];
}
setPowerPromoteIds($map,'promote_id');
if ($_REQUEST['data_order'] != '') {
$data_order = reset(explode(',', $_REQUEST['data_order']));
$data_order_type = end(explode(',', $_REQUEST['data_order']));
$this->assign('userarpu_order', $data_order);
$this->assign('userarpu_order_type', $data_order_type);
$sort = $data_order == 3 ? 'desc' : 'asc';
$order = $data_order_type . ' ' . $sort;
} else {
$order = ' pay_time desc ';
}
if (I('platform_type', 0) != 0) {
$sy = I('platform_type', 0) == 1 ? '=' : '<>';
$game_id = M("Game","tab_")->where('unique_code ' . $sy . ' ""')->getField("id",true);
$map['game_id'] = ['in',$game_id];
}
// if (intval(($endTime + 1) - $startTime) / (24 * 3600) <= 31) {
// $map1 = $map;
// $map1['pay_status'] = 1;
// } else {
// $map = '1 = 2';
// $map1 = $map;
// }
$this->checkListOrCountAuthRestMap($map,["extend", "pay_order_number", "user_account"]);
D("Spend")->addSubsiteWhere($map);
if ($payStatus > 0) {
$map1 = $map;
$map1['pay_status'] = 1;
$total = null_to_0(M(self::model_name, "tab_")->where($map1)->sum('pay_amount'));
}
$total=$total?$total:0;
$this->assign('total', $total);
$this->meta_title = $this->m_title = '游戏充值';
$this->assign('commonset', M('Kuaijieicon')->where(['url' => 'Spend/lists', 'status' => 1])->find());
$data = D(self::model_name)->lists($_GET["p"], $map, $order);
// dd($data);
if (!empty($data['data'])) {
$adminIds = array_column($data['data'], 'market_admin_id');
$adminUsernameList = getAdminUsernameList($adminIds);
$adminDepartments = getAdminDepartmentList($adminIds);
foreach ($data['data'] as $key=>&$value) {
($value['promote_account']=='官方渠道')?($value['promote_account']=C('OFFICIEL_CHANNEL')):'';
$value['market_admin_username'] = $adminUsernameList[$value['market_admin_id']] ?? '无';
$value['admin_department'] = $adminDepartments[$value['market_admin_id']] ?? '无';
$value['is_check_str'] = D(self::model_name)::IsCheckStr[$value['is_check']];
$value['is_refund_str'] = D(self::model_name)::IsRefundStr[$value['is_refund']];
//拆分游戏名称和设备类型
$game_arr = explode("(", rtrim($value['game_name'], ")"));
$value['game_name'] = $game_arr[0];
$value['sdk_version_name'] = $game_arr[1];
if(!$value['pay_time']) $value['pay_time'] = $value['spend_time'];
}
}
$departments = M('department', 'sys_')->select();
$this->assign('departments', $departments);
$this->assign('isMarketLeader', $isMarketLeader);
$this->assign('showMarketAdmin', session('user_auth')['show_market_admin']);
$this->assign('showPromote', session('user_auth')['show_promote']);
$this->assign('isMarketAdmin', $isMarketAdmin);
$this->assign('marketAdmins', getMarketAdmins());
$this->assign('startDate', $startDate);
$this->assign('endDate', $endDate);
$this->assign('payStatus', $payStatus);
$this->assign('list_data', $data['data']);
$this->assign('_page', $data['page']);
$show_data_power = (is_administrator()|| session('user_auth')['show_data']);
$this->assign('show_data_power', $show_data_power);
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth());
$this->display();
}
protected function menuAuth()
{
$mentBtn = [

@ -0,0 +1,889 @@
<extend name="Public/base"/>
<block name="body">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css"/>
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
.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;}
tr td:nth-child(3){
max-width: 200px;
word-wrap:break-word;
line-height: 1.5;
padding:5px;
}
.search_list{
margin-bottom: 15px;
}
.butnbox {padding:10px 0 10px;}
.butnbox .butnlist {overflow:hidden;clear:both;}
.butnbox .butnlist .butn,.butnbox .butnlist .butn:hover {text-decoration:none;border:none;}
.butnbox .butnlist .butn {display:inline-block;width:120px;height:28px;line-height:28px;text-align:center;color:#FFF;background:#3C95C8;border-radius:3px;}
.butnbox .butnlist .butn.last {background:#009900;}
.butnbox .butnlist .butn~.butn {margin-left:20px;}
.data_list table tbody tr a.disabled,.data_list table tbody tr a.disabled:hover {color:#999;cursor:default;}
.layui-layer-title {
text-align: center;
height: 80px;
line-height: 80px;
font-weight: 600;
font-size: 18px;
}
.data_list table td{
line-height: 2;
}
.layui-layer-title {
text-align: center;
height: 42px;
line-height: 42px;
font-weight: 400;
font-size: 14px;
}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">游戏充值</h3>
<p class="description_text">说明游戏充值全部订单全部订单包含游戏SDK内所有支付的订单包含SDK现金支付、平台币支付、绑币支付</p>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list">
<input type="text" name="{$model['search_key']|default='user_account'}" placeholder="玩家账号" class=""
value="{:I('user_account')}">
</div>
<div class="input-list">
<input type="text" name="pay_order_number" class="" value="{:I('pay_order_number')}" placeholder="支付订单号">
</div>
<div class="input-list">
<input type="text" name="extend" class="" value="{:I('extend')}" placeholder="CP订单号">
</div>
<div class="input-list">
<input type="text" readonly id="time-start" name="timestart" class="" value="{$startDate}"
placeholder="充值开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="time-end" name="timeend" class="" value="{$endDate}"
placeholder="充值结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
<option value="">游戏名称</option>
<volist name=":getAllGame()" id="vo">
<option value="{$vo.game_name}" <?php echo $vo.relation_game_name == I('game_name') ? 'selected':''; ?> >{$vo.game_name}</option>
</volist>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_type" name="game_type" class="select_gallery" >
<option value="">设备类型</option>
<option value="1" <?php echo I('game_type') == 1 ? "selected" : ''?>>安卓</option>
<option value="2" <?php echo I('game_type') == 2 ? "selected" : ''?>>苹果</option>
</select>
</div>
<div class="input-list input-list-server search_label_rehab">
<select id="server_id" name="server_id" class="select_gallery" style="width:120px;">
<option value="">区服名称</option>
</select>
</div>
<div class="input-list input-list-spend search_label_rehab">
<select id="pay_way_id" name="pay_way" class="select_gallery" style="width:120px;">
<option value="">充值方式</option>
<volist name=":all_pay_way_other(1)" id="vo">
<option value="{$vo.key}">{$vo.value}</option>
</volist>
</select>
</div>
<div class="input-list search_item input-list-orderstatus">
<select name="pay_status" style="color:#444" class="select_gallery" id="sel_order">
<!-- <option value="">订单状态</option> -->
<option value="1" <?php echo $payStatus == 1 ? "selected" : ''?>>充值成功</option>
<option value="0" <?php echo $payStatus == 0 ? "selected" : ''?>>下单未付款</option>
</select>
</div>
<div class="input-list">
<input type="text" name="spend_ip" class="" value="{:I('spend_ip')}" placeholder="充值ip">
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="pay_game_status" style="color:#444" class="select_gallery" id="pay_game_status">
<option value="">游戏通知状态</option>
<option value="1">通知成功</option>
<option value="0">通知失败</option>
<option value="2">已退款</option>
</select>
</div>
<br>
<?php if($showPromote == 1):?>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_level" style="color:#444" class="select_gallery" id="promote_level">
<option value="">请选择推广员等级</option>
<option value="1" <?php if ($_POST['promote_level'] == 1):?>selected<?php endif;?>>会长</option>
<option value="2" <?php if ($_POST['promote_level'] == 2):?>selected<?php endif;?>>部门长</option>
<option value="3" <?php if ($_POST['promote_level'] == 3):?>selected<?php endif;?>>组长</option>
<option value="4" <?php if ($_POST['promote_level'] == 4):?>selected<?php endif;?>>组员</option>
</select>
-
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="promote_id" style="color:#444" class="select_gallery" id="promote_id">
<option value="">请选择推广员</option>
</select>
</div>
<?php endif;?>
<?php if(!$isMarketAdmin && !$isMarketLeader):?>
<div class="input-list input-list-server search_label_rehab">
<select id="department_id" name="department_id" class="select_gallery" style="width:120px;">
<option value="">请选择市场部</option>
<?php foreach($departments as $department):?>
<option value="<?=$department['id']?>" <?php if($department['id'] == I('department_id')):?>selected<?php endif;?>><?=$department['name']?></option>
<?php endforeach;?>
</select>
</div>
<?php endif;?>
<?php if(!$isMarketAdmin && $showMarketAdmin == 1):?>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="market_admin_id" style="color:#444" class="select_gallery" id="market_admin_id">
<option value="0">所属市场专员</option>
<?php foreach($marketAdmins as $marketAdmin):?>
<option value="<?=$marketAdmin['id']?>" <?php if ($_POST['market_admin_id'] == $marketAdmin['id']):?>selected<?php endif;?>><?=$marketAdmin['username']?></option>
<?php endforeach;?>
</select>
</div>
<?php endif;?>
<div class="input-list search_item input-list-gamenoticestatus">
<select name="platform_type" style="color:#444" class="select_gallery" id="platform_type">
<option value="0">游戏平台</option>
<option value="1">联运平台</option>
<option value="2">聚合平台</option>
</select>
</div>
<if condition="!IS_SUBSITE">
<div class="input-list search_item input-list-gamenoticestatus">
<select id="merchant_id" name="merchant_id" class="select_gallery">
<option value="0">请选择商户</option>
<volist name=":getMerchantList()" id="vo">
<option value="{$vo.id}" <if condition="$_GET['merchant_id'] eq $vo['id']">selected</if>>{$vo.name}</option>
</volist>
</select>
</div>
</if>
<div class="input-list search_item input-list-gamenoticestatus">
<select id="is_check" name="is_check" class="select_gallery">
<option value="">是否参与结算</option>
<option value="1"></option>
<option value="2"></option>
</select>
</div>
<div class="input-list search_item input-list-gamenoticestatus">
<select id="is_refund" name="is_refund" class="select_gallery">
<option value="">退款状态</option>
<option value="1">已退款</option>
<option value="0">--</option>
</select>
</div>
<input type="hidden" name="" value="" class="sortBy">
<div class="input-list search_item">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('Spend/lists','model='.$model['name'] . '&row='.I('row'),false)}">搜索</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<foreach name="menubtn" item="vo" >
{$vo}
</foreach>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list zdata_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<th><input class="check-all" type="checkbox"></th>
<th>支付订单号</th>
<th style="max-width: 100px;">CP订单号</th>
<th><a class="paixu" data-order='pay_time'>
充值时间
</a></th>
<th>支付时间</th>
<th>玩家账号</th>
<th>游戏名称</th>
<th>设备类型</th>
<?php if($showPromote == 1):?>
<th>所属推广员</th>
<?php endif;?>
<th>所属市场部</th>
<?php if($showMarketAdmin == 1):?>
<th>所属市场专员</th>
<?php endif;?>
<th>所属商户</th>
<th>充值ip</th>
<th>区服ID</th>
<th>游戏区服</th>
<th>角色ID</th>
<th>角色名称</th>
<th>订单金额</th>
<th>折扣</th>
<th><a class="paixu" data-order='pay_amount'>
实付金额
</a></th>
<th>充值方式</th>
<th>订单状态</th>
<th>退款状态</th>
<th>游戏通知状态</th>
<th>是否参与结算</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name="list_data">
<td colspan="22" class="text-center">aOh! 暂时还没有内容!</td>
<else/>
<volist name="list_data" id="data">
<tr>
<td ><input class="ids" type="checkbox" data-ischeck="{$data.is_check}" data-isrefund="{$data.is_refund}" value="{$data['id']}" name="ids[]"></td>
<td>
<if condition="$show_data_power eq true ">
{$data.pay_order_number}
<else />
{$data.pay_order_number|encryptStr}
</if>
</td>
<td>
<if condition="$show_data_power eq true ">
{$data.extend}
<else />
{$data.extend|encryptStr}
</if>
</td>
<td>{:set_show_time($data['pay_time'])}</td>
<td>
<if condition="$data['pay_status'] eq 1">
{:set_show_time($data['payed_time'])}
<else />
------
</if>
</td>
<td>
<if condition="$show_data_power eq true ">
{$data.user_account}
<else />
{$data.user_account|encryptStr}
</if>
<gt name="data.small_id" value="0"><neq name="data.small_id" value="$data.user_id">{$data.small_account}</neq></gt></td>
<td>{$data.game_name}</td>
<td>{$data.sdk_version_name}</td>
<?php if($showPromote == 1):?>
<td>
<eq name="data.promote_id" value="-1">C('OFFICIEL_CHANNEL')<else/>
<!-- <if condition="$is_admin eq true ">
{:get_promote_account($data['promote_id'])}
<else />
{:encryptStr(get_promote_account($data['promote_id']))}
</if>-->
{$data['promote_account']}
<!-- {:get_promote_account($data['promote_id'])}-->
</eq>
</td>
<?php endif;?>
<td >{$data.admin_department}</td>
<?php if($showMarketAdmin == 1):?>
<td >{$data.market_admin_username}</td>
<?php endif;?>
<td >{:getMerchantName($data['merchant_id'])}</td>
<td>{$data.spend_ip}</td>
<empty name='data.server_name'>
<td>— —</td>
<td>— —</td>
<else/>
<td>{$data.server_id}</td>
<td>{$data.server_name}</td>
</empty>
<empty name='data.game_player_name'>
<td>— —</td>
<td>— —</td>
<else/>
<td>{$data.game_player_id}</td>
<td>{$data.game_player_name}</td>
</empty>
<td>{$data.cost|default=0.00}</td>
<td>{$data.discount_amount|default=0.00}</td>
<td><span>{$data.pay_amount}</span></td>
<td>{:get_pay_way($data['pay_way'])}</td>
<td>
<if condition="$data['pay_status'] eq 1"><span class="order_status_color">{:get_info_status($data['pay_status'],9)}</span>
<else/>
{:get_info_status($data['pay_status'],9)}
</if>
</td>
<td>{$data.is_refund_str}</td>
<td>
<if condition="$data['pay_status'] eq 1"><span class="game_notice_status_color">{:get_info_status($data['pay_game_status'],14)}</span>
<elseif condition="$data.pay_status eq 0"/>
— —
<else/>
{:get_info_status($data['pay_game_status'],14)}
</if>
</td>
<td>{$data.is_check_str}</td>
<td style="text-indent:0;">
<?php
if (!(substr($data['pay_order_number'], 0, 3) == "PF_" &&
substr($data['pay_order_number'], -2) == '_1')) {
?>
<if condition="($data['pay_game_status'] eq 0 or $data['pay_game_status'] eq 2) and $data['pay_status'] eq 1 and $data['is_refund'] eq 0">
<a class=" budan" href="javascript:void(0);"
href-data="{$data.pay_order_number}" href-hhh="{:U('Repair/repairEdit')}" style="width:100%;">补单</a>
</if>
<?php }?>
<br />
<if condition="($data['pay_game_status'] eq 0 or $data['pay_game_status'] eq 2) and ($data['pay_status'] eq 0 or $data['pay_status'] eq 2) and $data['is_refund'] eq 0">
<a class="pay_repair" href="javascript:void(0);"
href-data="{$data.pay_order_number}" href-hhh="{:U('Repair/noticePayed')}" style="width:100%;">通知到账</a>
</if>
</td>
</tr>
</volist>
</empty>
<if condition="$rule_count_check">
<tr class="data_summary">
<td colspan="2">汇总</td>
<td colspan="99">
当页充值:{:null_to_0(array_sum(array_column(array_status2value('pay_status','',$list_data),'pay_amount')))}
累计充值:{$total}(此处只汇总充值成功的订单)
</td>
</tr>
</if>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<a class="sch-btn" href="{:U('Export/expUser',array_merge(array('id'=>7,'xlsname'=>'游戏订单_游戏充值','timestart'=>$startDate,'timeend'=>$endDate),I('get.')))}">导出</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="Spend/lists">
</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>
</block>
<block name="script">
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script>
<volist name = ":I('get.')" id = "vo">
Think.setValue('{$key}', "{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('Spend/lists')}');
$(function () {
//搜索功能
$("#search").click(function () {
var sdate = Date.parse($('#time-start').val()) / 1000;
var edate = Date.parse($('#time-end').val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
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;
});
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
$order_type = '{$userarpu_order}';
if ($order_type == '' || $order_type == '4') {
$(".sortBy").attr('name', 'data_order');
val = '3,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
} else if ($order_type == '3') {
$(".sortBy").attr('name', 'data_order');
val = '4,' + $data_order;
$(".sortBy").attr('value', val);
$("#search").click();
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
showMeridian:true,
pickDate:true,
minView: 2,
autoclose: true,
pickTime:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var end = new Date($.trim($('#time-end').val())).getTime();
if (val>end) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$("#time-end").datetimepicker({
format:"yyyy-mm-dd",
language: "zh-CN",
showMeridian:true,
minView:2,
autoclose:true,
todayBtn:true,
}).on('change',function(ev){
var val = new Date($.trim($(this).val())).getTime();
var start = new Date($.trim($('#time-start').val())).getTime();
if (val<start) {
layer.msg('开始时间大于结束时间!');$(this).val('');
}
return false;
});
$(".budan").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
$.ajax({
type: 'post',
url: url,
data: {orderNo: data},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
if (e.msg) {
var tip_msg = e.msg;
} else {
var tip_msg = e.info ? e.info : "补单失败";
}
layer.msg(tip_msg, {icon: 2});
}
},
});
});
$(".budan2").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
$.ajax({
type: 'post',
url: url,
data: {orderNo: data},
success: function (e) {
if (e.status == 1) {
if (e.msg.length > 30) {
window.open(e.msg);
} else {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
}
} else {
layer.msg(e.msg, {icon: 2});
}
},
});
});
// 充值补单
$(".pay_repair").click(function () {
url = $(this).attr('href-hhh');
data = $(this).attr('href-data');
var pwd2 = prompt("请输入二级密码");
if (!pwd2) {
alert("二级密码不能为空");
return ;
}
$.ajax({
type: 'post',
url: url,
data: {orderNo: data, second: pwd2, type: 'spend'},
success: function (e) {
if (e.status == 1) {
layer.msg(e.msg, {icon: 1});
setTimeout(function () {
location.reload();
}, 1500);
} else {
if (e.msg) {
var tip_msg = e.msg;
} else {
var tip_msg = e.info ? e.info : "补单失败";
}
layer.msg(tip_msg, {icon: 2});
}
},
});
});
$(".d_list").find(".drop-down11").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down11 .nav-list li").find("a").each(function () {
var that = $(".drop-down11");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down12").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down12 .nav-list li").find("a").each(function () {
var that = $(".drop-down12");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
$(".d_list").find(".drop-down13").hover(function () {
$(this).find(".nav-list").removeClass("hidden");
}, function () {
$(this).find(".nav-list").addClass("hidden");
});
$(".drop-down13 .nav-list li").find("a").each(function () {
var that = $(".drop-down13");
$(this).click(function () {
var text = $(this).text(), val = $(this).attr("value");
that.find(".sort-txt").text(text).attr("data", val);
that.find(".nav-list").addClass("hidden");
that.siblings('.hiddenvalue').val(val);
})
});
//下拉内容框
$(".drop-down2").on('click', function (event) {
var navlist = $(this).find('.i_list_li');
if (navlist.hasClass('hidden')) {
navlist.removeClass('hidden');
$('#i_list_id').focus().val('');
} else {
navlist.addClass('hidden');
}
$(document).one("click", function () {
navlist.addClass('hidden');
});
event.stopPropagation();
});
$('#i_list_id').on('keyup', function (event) {
var val = $.trim($(this).val()).toLowerCase();
$('#i_list_idh').val(val);
});
$("#i_list_li").find("a").each(function () {
$(this).click(function () {
var text = $.trim($(this).text()).toLowerCase();
$("#i_list_id").val(text);
$('#i_list_idh').val(text);
})
});
var adminId = "{:I('market_admin_id')}";
var departmentId = "{:I('department_id')}";
function getAdminsByDepartmentId() {
var departmentId = $("#department_id option:selected").val();
if(!departmentId){
departmentId = -1;
}
$.ajax({
url: "{:U('Ajax/getAdminsByDepartment')}",
type: "get",
data: { department_id: departmentId},
dataType: 'json',
success: function (response) {
str = '<option value="">请选择市场专员</option>';
admins = response.data.admins;
for (var i in admins) {
str += "<option value='" + admins[i].uid + "' " + (adminId && admins[i].uid == adminId ? 'selected' : '') + ">" + admins[i].nickname + "</option>"
}
$("#market_admin_id").empty();
$("#market_admin_id").append(str);
$("#market_admin_id").select2();
}
})
}
getAdminsByDepartmentId();
$("#market_admin_id").change(function(){
adminId = $("#admin_id option:selected").val();
})
$("#department_id").change(function(){
getAdminsByDepartmentId();
})
})
var promote_id = "{:I('promote_id')}";
$("#promote_level").change(function(){
$.ajax({
url:"{:U('Ajax/getPromotersByLevelOther')}",
type:"get",
data:{level:$("#promote_level option:selected").val()},
dataType:'json',
success:function(response){
str = '<option value="">请选择推广员</option>' +
// '<option value="0"'+(promote_id && 0 == promote_id?'selected':'')+'>官方渠道</option>' +
'';
data = response.data;
for (var i in data){
str += "<option value='"+data[i].id+"' "+(promote_id && data[i].id == promote_id?'selected':'')+">"+data[i].nickname+"</option>"
}
$("#promote_id").empty();
$("#promote_id").append(str);
$("#promote_id").select2();
}
})
});
$("#promote_level").change();
var game_server = "{:I('server_id')}";
$("#game_type").change(function(){
$.ajax({
url:"{:U('Ajax/getGmeServer')}",
type:"post",
data:{sdk_version:$("#game_type option:selected").val(), game_name:$("#game_name option:selected").val()},
dataType:'json',
success:function(data){
str = "<option value=''>请选择区服</option>";
for (var i in data){
str += "<option value='"+data[i].server_id+"' "+(game_server && data[i].server_id == game_server?'selected':'')+">"+data[i].server_name+"</option>"
}
$("#server_id").empty();
$("#server_id").append(str);
$("#server_id").select2();
}
})
});
$("#game_name").change(function(){
$("#game_type").change();
});
$("#game_name").change();
$("#addStatement,#removeStatement").on("click",function(){
var id = $(this).attr("id");
if(id == "addStatement"){
var opname = "参与结算";
var opurl = "{:U('addStatement')}";
var opst ="[不参与结算]";
var status = [2];
}else if(id=="removeStatement"){
var opname = "移出结算";
var opurl = "{:U('removeStatement')}";
var opst ="[参与结算]";
var status = [1];
}
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
const ischeck = $(elem).data("ischeck");
if($.inArray(ischeck,status) > -1){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要'+opname+'的操作,仅'+opst+'状态可以进行'+opname+"</font>");
return;
}
text = text.join(",");
layer.confirm('【提示】'+opname+'操作后,相应的结算单需要进行重算后生效', {
btn: ['确认','取消'],
title:false
}, function(index){
layer.close(index);
layer.load(2);
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: true,
data: {ids:text},
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
})
$("#addRefund,#removeRefund").on("click",function(){
var id = $(this).attr("id");
if(id == "addRefund"){
var opname = "登记退款";
var opurl = "{:U('addRefund')}";
var opst ="[未退款]";
var status = [0];
}else if(id=="removeRefund"){
var opname = "取消退款";
var opurl = "{:U('removeRefund')}";
var opst ="[已退款]";
var status = [1];
}
var flag = false;
var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) {
const isrefund = $(elem).data("isrefund");
if($.inArray(isrefund,status) > -1){
return $(elem).val();
}
}).get();
if(text.length < 1){
layer.msg("<font style='color:white'>" + '无需要'+opname+'的操作,仅'+opst+'状态可以进行'+opname+"</font>");
return;
}
text = text.join(",");
layer.confirm('【提示】'+opname+'退款功能仅用于登记相关数据,未引入结算', {
btn: ['确认','取消'],
title:false
}, function(index){
layer.close(index);
layer.load(2);
$.ajax({
type: "POST",
url: opurl,
dataType: 'json',
async: true,
data: {ids:text},
success:function(data){
layer.closeAll('loading');
if(data.status==1){
layer.msg("<font style='color:white'>" + data.info + "</font>");
setTimeout(function(){
window.location.reload();
},1500);
}else{
layer.msg("<font style='color:white'>" + data.info + "</font>");
return false;
}
}
});
});
})
/**
* 初始化select2单选默认带搜索功能。
*/
//初始化页面加载
$(document).ready(function () {
});
</script>
</block>
Loading…
Cancel
Save