master
yulingwei 4 years ago
parent 877a53e892
commit 066610f236

@ -599,7 +599,64 @@ class StatementMangementController extends ThinkController
$this->assign('companyTypes', RewardModel::$companyTypes);
$this->display();
}
}
public function rewardManageDetail($id=0)
{
$games = M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select();
$this->assign('games', $games);
if ($id) {
if (I('delete')) {
$rewardRecordData = M('reward_record', 'tab_')->where(['id'=>$id])->find();
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->delete();
M('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$rewardRecordData['company_id']])->find();
addOperationLog(['op_type'=>2,'key'=>$companyName['partner'].'/'.(($rewardRecordData['reward_type']==1)?'奖励':'惩罚').'/'.$rewardRecordData['money'],'op_name'=>'删除奖惩记录','url'=>U('StatementMangement/rewardManageList'),'menu'=>'推广员-结算单管理-奖罚记录管理']);
return $upt ? $this->success('删除成功') : $this->error('删除失败');
} else {
$data = M('reward_record', 'tab_')->where(['id'=>$id])->find();
if (!$data) return $this->error("未找到该记录");
$data['confirm_time'] = $data['confirm_time'] ? date('Y-m-d H:i:s', $data['confirm_time']) : '';
$data['accounts'] = json_decode($data['accounts'], true) ?: [];
$data['settlement_info'] = json_decode($data['settlement_info'], true) ?: [];
//$this->assign('data', $data);
}
} else {
$data['reward_time'] = strtotime(date('Y-m-01'));
}
$details = M('reward_detail', 'tab_')->where(['record_id'=>$id])->select();
// 根据type 来合并
foreach ($details as $item) {
$item['info'] = $item;
if (empty($item['company_name']) && $item['company_id']) {
if ($item['company_type'] == RewardModel::COMPANY_TYPE_PARTNER) {
$item['company_name'] = M('partner', 'tab_')->where(['id'=>$item['company_id']])->getField('partner');
} else {
$item['company_name'] = M('promote_company', 'tab_')->where(['id'=>$item['company_id']])->getField('company_name');
}
}
$tmp[$item['type']][] = $item;
}
$data['rewardCount'] = sizeof($tmp[RewardModel::REWARD_TYPE_REWARD]);
$data['punishCount'] = sizeof($tmp[RewardModel::REWARD_TYPE_PUNISH]);
$data['rewardAmount'] = $data['rewardCount'] > 0 ? array_sum(array_column($tmp[RewardModel::REWARD_TYPE_REWARD], 'amount')) : 0;
$data['punishAmount'] = $data['punishCount'] > 0 ? array_sum(array_column($tmp[RewardModel::REWARD_TYPE_PUNISH], 'amount')) : 0;
$data['maxCount'] = $data['rewardCount'] > $data['punishCount'] ? $data['rewardCount'] : $data['punishCount'];
$this->assign('details', $tmp);
$this->assign('data', $data);
$this->assign('promoters', M('promote', 'tab_')->where(['level'=>1])->field('id, nickname')->select());
$this->assign('rewardTypes', RewardModel::$rewardTypes);
$this->assign('settlementTypes', RewardModel::$settlementTypes);
$this->assign('companyTypes', RewardModel::$companyTypes);
$this->display('rewardManagerDetail');
}
public function getCompanys($type=1)

@ -232,6 +232,7 @@
<td>{:get_admin_name($data['creater_id'])}</td>
<td>
<a href="{:U('StatementMangement/rewardManageDetail',array('id'=>$data['id']))}">查看 </a>
<a href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id']))}">编辑 </a>
<a class="confirm ajax-get" href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id'], 'delete'=>1))}">删除 </a>
</td>
@ -263,6 +264,7 @@
<td rowspan="{$data['maxCount']}">{:get_admin_name($data['creater_id'])}</td>
<td rowspan="{$data['maxCount']}">
<a href="{:U('StatementMangement/rewardManageDetail',array('id'=>$data['id']))}">查看 </a>
<a href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id']))}">编辑 </a>
<a class="confirm ajax-get" href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id'], 'delete'=>1))}">删除 </a>
</td>

@ -0,0 +1,321 @@
<extend name="Public/base" />
<block name="css">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
.bnt_add,.bnt_remove,.bnt_save, .settlement_bnt_add{
height: 30px;
width: 20px;
font-size: 20px;
line-height: 10px;
color: #3399ff;
background: none;
border: none;
margin-left: 20px;
cursor: pointer;
}
.bnt_remove{
color: #F70909;
}
.bnt_save{
color: #4DB361;
}
.data_list table td {
line-height:20px;
padding: 0px;
height: 30px;
text-indent: 0%;
}
</style>
<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;}
</style>
</block>
<!-- 管理员用户组新增和编辑页面 -->
<block name="body">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></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 type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<div class="tab-wrap" id='pop-form' hidden>
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="item-form" method="post" class="form-horizontal" style="margin-bottom: 40px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark">*</i>类型:</td>
<td class="r">
<select name="type" id='form-type' class="select_gallery">
<option value="1">奖励</option>
<option value="2">惩罚</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>公司类型:</td>
<td class="r">
<select name="company_type" id='form-company-type' class="select_gallery">
<?php foreach($companyTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>公司/部门:</td>
<td class="r">
<select name="company_id" id='form-company-id' class="select_gallery">
<option value="0">其他</option>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="text" name="company_name" id='form-company-name' autocomplete="off" placeholder="请填写公司/部门" />
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r">
<select name="promote_account" id="form-promote-account" class="select_gallery">
<option value="0">其他</option>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="text" name="promote_account_input" autocomplete="off" id='form-promote-account-input' placeholder="请填写会长账号" />
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算方式:</td>
<td class="r">
<select name="settlement_type" id='form-settlement-type' class="select_gallery">
<?php foreach($settlementTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>金额</td>
<td class="r">
<input type="text" name="amount" id='form-amount' autocomplete="off" value="0" />
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn mlspacing" id="add-item" type="button" target-form="form-horizontal" style="margin-top: 10px;">
新增
</button>
</div>
</form>
</div>
</div>
<form action="{:U('StatementMangement/rewardManageSave')}" enctype="application/x-www-form-urlencoded" method="POST"
class="form-horizontal form_info_ml" id="form">
<div class="formtitle"><span>查看</span></div>
<ul class="form_info ">
<input type="hidden" name="id" value="{$data.id}" />
<li>
<div class="data_list">
<div class="">
<table id="record-table" border="1px solid #ccc" >
<!-- 表头 -->
<thead>
<tr>
<th colspan='5'>奖励</th>
<th colspan='5'>惩罚</th>
</tr>
</thead>
<!-- 表头 -->
<thead>
<tr>
<th>公司类型</th>
<th>公司/部门</th>
<th>会长账号</th>
<th>结算方式</th>
<th>金额</th>
<th>公司类型</th>
<th>公司/部门</th>
<th>会长账号</th>
<th>结算方式</th>
<th>金额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="table-body">
<?php for($i=0; $i<$data['maxCount']; $i++):?>
<tr class="<?php if (!isset($details[1][$i])): php?>empty-reward<?php endif; php?> <?php if (!isset($details[2][$i])): php?>empty-punish<?php endif; php?>">
<!-- 奖励信息 -->
<td class="reward-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='<?=$details[1][$i]['info'] ? json_encode($details[1][$i]['info']) : ''?>' />
</td>
<td class="reward-td company-type"><?=$companyTypes[$details[1][$i]['company_type']] ?? '-'?></td>
<td class="reward-td company-name"><?=$details[1][$i]['company_name'] ?? '-'?></td>
<td class="reward-td promote-account"><?=$details[1][$i]['promote_account'] ?? '-'?></td>
<td class="reward-td settlement-type"><?=$settlementTypes[$details[1][$i]['settlement_type']] ?? '-'?></td>
<td class='reward-amount reward-td amount'><?=$details[1][$i]['amount'] ?? '-'?></td>
<!-- 惩罚信息 -->
<td class="punish-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='<?=$details[2][$i]['info'] ? json_encode($details[2][$i]['info']) : ''?>' />
</td>
<td class="punish-td company-type"><?=$companyTypes[$details[2][$i]['company_type']] ?? ''?></td>
<td class="punish-td company-name"><?=$details[2][$i]['company_name'] ?? ''?></td>
<td class="punish-td promote-account"><?=$details[2][$i]['promote_account'] ?? ''?></td>
<td class="punish-td settlement-type"><?=$settlementTypes[$details[2][$i]['settlement_type']] ?? ''?></td>
<td class='punish-amount punish-td amount'><?=$details[2][$i]['amount'] ?? ''?></td>
</tr>
<?php endfor;?>
<tr id='total-amount'>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td id='total-reward-amount'>{$data['rewardAmount']}</td>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td id='total-punish-amount'>{$data['punishAmount']}</td>
</tr>
</tbody>
</table>
</div>
</div>
</li>
<?php if ($data['accounts']):?>
<?php foreach ($data['accounts'] as $k => $account):?>
<?php if ($k == 0):?>
<li class="user-account">
<?php if ($k == 0):?>
<label>涉及账号</label>
<?php else:?>
<label>-</label>
<?php endif;?>
<select name="user_type[]" readonly class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1" <?php if ($account['user_type'] == 1):?>selected<?php endif;?>>推广员</option>
<option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option>
</select>
<input type="text" readonly class="txt table_text_input" name="account[]" value="{$account['account']}" placeholder="账号">
</li>
<?php else:?>
<li class="user-account">
<label>涉及账号</label>
<select disabled name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1" <?php if ($account['user_type'] == 1):?>selected<?php endif;?>>推广员</option>
<option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option>
</select>
<input readonly type="text" class="txt table_text_input" name="account[]" value="{$account['account']}" placeholder="账号">
</li>
<?php endif;?>
<?php endforeach;?>
<?php else:?>
<li class="user-account">
<label>涉及账号</label>
<select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1">推广员</option>
<option value="2">玩家</option>
</select>
<input type="text" class="txt table_text_input" name="account[]" value="" placeholder="账号">
</li>
<?php endif;?>
<li>
<label>游戏</label>
<select id="relation_game_id" disabled name="relation_game_id" class="select_gallery">
<option value="0">其他</option>
<?php foreach ($games as $game):?>
<option value="{$game['relation_game_id']}" <?php if ($game['relation_game_id'] == $data['relation_game_id']):?>selected<?php endif;?> >{$game['relation_game_name']}</option>
<?php endforeach;?>
</select>
</li>
<li>
<label>事件</label>
<textarea name="content" readonly class="" id='content' placeholder="事件" >{$data.content}</textarea>
</li>
<li>
<label>奖惩时间</label>
<input type="text"readonly class="" value="{:date('Y-m-d H:i:s',$data['reward_time'])}" placeholder="奖惩时间" />
</li>
<li>
<label>奖惩结算时间</label>
<input type="text" readonly class="" value="<?=$data['settlement_time'] ? date('Y-m-d H:i:s',$data['settlement_time']) : ''?>" placeholder="奖惩时间" />
</li>
<li>
<label>奖惩确认时间</label>
<input type="text" readonly class="" value="{$data['confirm_time']}" placeholder="奖惩确认时间" />
</li>
<li>
<label>备注</label>
<textarea name="remark" readonly class="" placeholder="备注" >{$data.remark}</textarea>
</li>
<li>
<label>&nbsp;</label>
<input type="button" value="返 回" target-form="form-horizontal" class="form_btn" onclick="javascript:void(window.history.go(-1))">
</li>
</ul>
</form>
<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="AuthManager/index">
</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">
<script type="text/javascript">
highlight_subnav('{:U('StatementMangement/rewardManageList')}');
</script>
</block>
Loading…
Cancel
Save