master
yulingwei 5 years ago
parent dfe52865bd
commit 47d01e0aff

@ -7,30 +7,117 @@ namespace Admin\Controller;
class SettlementController extends ThinkController
{
// 汇总结算单列表
public function getSettlementSheetList()
public function sheetList($row = 10, $p = 1)
{
$map = [];
if (I('settlement_type')) {
$map['settlement_type'] = I('settlement_type');
}
if (I('settlement_time_type')) {
$map['settlement_time_type'] = I('settlement_time_type');
}
if (I('creater_id')) {
$map['creater_id'] = I('creater_id');
}
if (I('create_time_start')) {
$map['_string'] = "create_time >= ".strtotime(I('create_time_start'));
}
if (I('create_time_end')) {
$map['_string'] = "create_time <= ".strtotime(I('create_time_end'));
}
$list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->select();
$count = M('settlement_sheet', 'tab_')->where($map)->count();
if (!empty($list)) {
foreach ($list as &$item) {
switch ($item['settlement_type']) {
case '1':
$item['settlement_type_name'] = '上游结算单';
break;
case '2':
$item['settlement_type_name'] = '下游-内团结算单';
break;
case '3':
$item['settlement_type_name'] = '下游-外团结算单';
break;
case '4':
$item['settlement_type_name'] = '下游-个人结算单';
break;
}
switch ($item['settlement_time_type']) {
case '1':
$item['settlement_time_type_name'] = '周结';
break;
case '2':
$item['settlement_time_type_name'] = '月结';
break;
}
switch ($item['status']) {
case '1':
$item['status_name'] = '审核通过';
break;
case '2':
$item['status_name'] = '审核未通过';
break;
case '3':
$item['status_name'] = '待审核';
break;
}
$item['audit_users'] = json_decode($item['audit_users'], true);
}
}
$this->assign('admin_users', M('member')->field('uid, nickname')->select());
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('list_data', $list);
$this->display();
}
// 生成结算单 月结算补点 周结不算
public function generateSettlementSheet($settlement_type = 0, $settlement_time_type = 0, $time_start=0, $time_end = 0)
public function generateSettlementSheet($settlement_type = 0, $settlement_time_type = 0, $time_start=0, $time_end = 0, $delete=0, $id=0, $action='')
{
$this->meta_title = '结算单管理';
$this->assign(I(''));
$this->assign('action', $action);
if ($delete) {
$res = M('settlement_sheet', 'tab_'->where(['id'=>$id]))->delete();
return $res ? $this->success('删除成功', true, true) : $this->success('删除失败', true, true);
}
$this->meta_title = '结算单管理';
if (empty($settlement_type)) {
$msg = '请选择汇总结算单类型';
}
if (empty($settlement_time_type)) {
$msg = '请选择结算方式';
}
$settlement_time = I('settlement_time', '');
if ($settlement_time_type == 1) {
$settlement_time = explode(' 至 ', $settlement_time);
if (count($settlement_time) != 2) {
$msg = '请选择正确的时间区间';
} else {
$time_start = strtotime($settlement_time[0]);
$time_end = strtotime($settlement_time[1]) + 3600 * 24 - 1;
}
} else {
$time_start = strtotime($settlement_time);
$time_end = strtotime('+1 month', $time_start) - 1;
}
if (empty($time_start) || empty($time_end)) {
$msg = '请选择正确的时间区间';
}
if (IS_GET) {
$msg = '';
if (empty($settlement_type)) {
$msg = '请选择汇总结算单类型';
}
if (empty($settlement_time_type)) {
$msg = '请选择结算方式';
}
if (empty($time_start) || empty($time_end)) {
$msg = '请选择正确的时间区间';
}
// 判断结算时间是否冲突
// 生成结算单数据
$generate = false;
if (!$msg) {
$generate = true;
if ($settlement_type == 1) {
if ($settlement_time_type == 1) {
$map = " and p.settlement_type = 1";
@ -114,30 +201,29 @@ class SettlementController extends ThinkController
where s.pay_status = 1 and s.pay_time BETWEEN {$time_start} and {$time_end}
group by g.relation_game_id
");
if (!isset($list[$item['p_id']])) {
// 奖罚金额
$reward = M('reward_record', 'tab_')
->field('sum(money) as money, reward_type')
->where("company_type = 2 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
->group('reward_type')
->select();
if (!empty($reward)) {
$reward = array_column($reward, 'money', 'reward_type');
}
$list[$item['p_id']] = [
'company_id'=>$item['p_id'],
'company_name'=>$item['company_name'],
'fax_ratio' => $item['fax_ratio'],
'bonuses'=>isset($reward[1]) ? $reward[1] : 0,
'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
'settlement_contact' => $item['settlement_contact'],
'create_time' => time()
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
}
if ($res) {
if (!isset($list[$item['p_id']])) {
// 奖罚金额
$reward = M('reward_record', 'tab_')
->field('sum(money) as money, reward_type')
->where("company_type = 2 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
->group('reward_type')
->select();
if (!empty($reward)) {
$reward = array_column($reward, 'money', 'reward_type');
}
$list[$item['p_id']] = [
'company_id'=>$item['p_id'],
'company_name'=>$item['company_name'],
'fax_ratio' => $item['fax_ratio'],
'bonuses'=>isset($reward[1]) ? $reward[1] : 0,
'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
'settlement_contact' => $item['settlement_contact'],
'create_time' => time()
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
}
foreach ($res as $k => $val) {
$gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true);
if ($settlement_time_type == 2) {
@ -186,31 +272,30 @@ class SettlementController extends ThinkController
where s.pay_status = 1 and s.pay_time BETWEEN {$time_start} and {$time_end}
group by g.relation_game_id
");
if (!isset($list[$item['p_id']])) {
// 奖罚金额
$reward = M('reward_record', 'tab_')
->field('sum(money) as money, reward_type')
->where("company_type = 2 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
->group('reward_type')
->select();
if (!empty($reward)) {
$reward = array_column($reward, 'money', 'reward_type');
}
$list[$item['p_id']] = [
'company_id'=>$item['p_id'],
'company_name'=>$item['company_name'],
'bonuses'=>isset($reward[1]) ? $reward[1] : 0,
'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
'settlement_contact' => $item['settlement_contact'],
'bank_card' => $item['bank_card'],
'bank_address' => $item['bank_address'],
'create_time' => time()
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
}
if ($res) {
if (!isset($list[$item['p_id']])) {
// 奖罚金额
$reward = M('reward_record', 'tab_')
->field('sum(money) as money, reward_type')
->where("company_type = 2 and company_id = {$item['p_id']} and reward_time between {$time_start} and {$time_end}")
->group('reward_type')
->select();
if (!empty($reward)) {
$reward = array_column($reward, 'money', 'reward_type');
}
$list[$item['p_id']] = [
'company_id'=>$item['p_id'],
'company_name'=>$item['company_name'],
'bonuses'=>isset($reward[1]) ? $reward[1] : 0,
'fine'=>isset($reward[2]) ? $reward[2] : 0 ,
'settlement_contact' => $item['settlement_contact'],
'bank_card' => $item['bank_card'],
'bank_address' => $item['bank_address'],
'create_time' => time()
];
$list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'];
}
foreach ($res as $k => $val) {
$gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true);
if ($settlement_time_type == 2) {
@ -238,9 +323,12 @@ class SettlementController extends ThinkController
}
}
} else {
$generate = false;
$msg = "请选择正确的结算单类型";
}
}
$this->assign("generate", $generate);
$this->assign('admin_users', M('member')->where(['status'=>1])->field('uid, nickname')->select());
$this->assign('listData', array_values($list));
$this->assign('msg', $msg);
$this->assign('settlement_type', $settlement_type);
@ -248,11 +336,84 @@ class SettlementController extends ThinkController
$this->display();
} else {
// 判断结算时间是否冲突
if ($msg) {
return $this->error($msg, true, true);
}
if ($id) {
$info = M('settlement_sheet', 'tab_')->where(['id'=>$id])->find();
if (!$info) {
return $this->error('未找到该记录');
}
} else {
if (\sizeof($_POST['settlement_sheet']) == 0) {
return $this->error('无法生成无记录的结算单', true, true);
}
$isExsist = M('settlement_sheet', 'tab_')->where(['settlement_type'=>$settlement_type, 'time_start'=>$time_start, 'time_end'=>$time_end, 'settlement_time_type'=>$settlement_time_type])->find();
if ($isExsist) {
return $this->error('已存在此类型结算单', true, true);
}
$data['creater_id'] = is_login();
$data['create_time'] = time();
$data['orderid'] = $settlement_type.$settlement_time_type.date('YmdHis').$data['creater_id'].rand(1000, 9999);
$data['settlement_type'] = $settlement_type;
$data['settlement_time_type'] = $settlement_time_type;
$data['time_start'] = $time_start;
$data['time_end'] = $time_end;
$data['audit_users'] = json_encode($_POST['audit_users']);
$data['settlement_sheet'] = json_encode($_POST['settlement_sheet']);
$res = M('settlement_sheet', 'tab_')->add($data);
return $res ? $this->success('生成成功', true, true) : $this->error('生成失败', true, true);
}
}
}
public function settlementSheetDetail($id=0)
public function sheetDetail($id=0)
{
$info = M('settlement_sheet', 'tab_')->where(['id'=>$id])->find();
if (!$info) {
return $this->error('未找到该记录');
}
$info['listData'] = json_decode($info['settlement_sheet'], true);
$info['audit_users'] = json_decode($info['audit_users']);
$login_uid = is_login();
$arr_index = array_search($login_uid, $info['audit_users']);
$audit_auth = true;
if ($arr_index === false) {
$audit_auth = false;
} else if ($arr_index + 1 != $info['step']) {
$audit_auth = false;
} else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) {
$audit_auth = false;
} else if ($info['status'] != 3) {
$audit_auth = false;
}
$this->assign(['audit_auth'=>$audit_auth]);
$this->assign($info);
$this->meta_title = '结算单管理';
$this->display();
}
public function auditSheet($id=0, $audit_type = 2, $remark = '' )
{
$info = M('settlement_sheet', 'tab_')->where(['id'=>$id])->find();
if (!$info) {
return $this->error('未找到该记录', true, true);
}
$info['audit_users'] = json_decode($info['audit_users']);
$login_uid = is_login();
$arr_index = array_search($login_uid, $info['audit_users']);
if ($arr_index === false) {
return $this->error('无权审核改结算单', true, true);
} else if ($arr_index + 1 != $info['step']) {
return $this->error('您已审核过此结算单', true, true);
} else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) {
return $this->error('该结算单已经审核完毕', true, true);
}
$update['remark'] = $remark;
$update['status'] = $audit_type == 1 ? 3 : 2;
$update['step'] = $audit_type == 1 ? $info['step'] + 1 : $info['step'];
$upt = M('settlement_sheet', 'tab_')->where(['id'=>$id])->save($update);
return $upt ? $this->success('审核成功', true, true) : $this->error('审核失败', true, true);
}
}

@ -34,6 +34,50 @@
padding: 3px;
}
</style>
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
.bnt_add,.bnt_remove,.bnt_save{
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;
}
</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>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
@ -47,89 +91,39 @@
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list">
<input style="width: 200px;" type="text" name="company_name" class="search-input" value="{:I('company_name')}" placeholder="请输入公司名称搜索">&nbsp;
</div>
<div class="input-list input-list-promote search_label_rehab">
<select id="promote_id" name="promote_id" class="select_gallery" style="width: 200px;">
<option value="">推广员账号</option>
<volist name="promoteList" id="vo">
<option promote-id="{$vo.id}" value="{$vo.id}">{$vo.account}({$vo.real_name})</option>
</volist>
<div class="input-list input-list-game search_label_rehab">
<select id="settlement_type" name="settlement_type" class="select_gallery" <?php echo $generate ? 'disabled="disabled"' : ""?></select>>
<option value="">请选择结算单类型</option>
<option value="1" <?php echo $settlement_type === 1 ? "selected" : ''?>>上游-汇总结算单</option>
<option value="2" <?php echo $settlement_type === 2 ? "selected" : ''?>>下游-内团汇总结算单</option>
<option value="3" <?php echo $settlement_type === 3 ? "selected" : ''?>>下游-外团汇总结算单</option>
<option value="4" <?php echo $settlement_type === 4 ? "selected" : ''?>>下游-个人汇总结算单</option>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="company_type" name="company_type" class="select_gallery">
<option value="">请选择公司性质</option>
<option value="1" <?php echo I('company_type') === 1 ? "selected" : ''?>>公司</option>
<option value="2" <?php echo I('company_type') == 2 ? "selected" : ''?>>个人</option>
<select id="settlement_time_type" name="settlement_time_type" class="select_gallery" <?php echo $generate ? 'disabled="disabled"' : ""?>>
<option value="">结算方式</option>
<option value="1" <?php $settlement_time_type === 1 ? "selected" : ''?>>周结</option>
<option value="2" <?php $settlement_time_type == 2 ? "selected" : ''?>>月结</option>
</select>
</div>
<div class="input-list" id="pay_time">
<input type="text" class="txt range-date" id="time" name="settlement_time" placeholder="结算时间" value="{$settlement_time}" <?php echo $generate ? 'disabled="disabled"' : ""?> style="width: 180px;" readonly="readonly">
</div>
<?php if (!$generate) :?>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PromoteCompany/lists','model='.$model['name'].'&row='.I('row'),false)}">生成</a>
<a class="sch-btn" href="javascript:;" id="search" url="/admin.php?s=/settlement/generateSettlementSheet">生成</a>
</div>
<?php endif;?>
</div>
</div>
</div>
<?php if ($msg):?>
{$msg}
<div class="data_list data_game_list">
<div class="">
<table border="1">
<!-- 表头 -->
<thead>
<tr>
<th style="width:10%;min-width:150px;">平台</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>
<tr>
<td rowspan="3"></td>
<td></td>
<td></td>
<td></td>
<td rowspan="3"></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
</div>
<?php elseif ($settlement_type == 1):?>
<span style="color: red;">上游-汇总结算单</span>
<div class="data_list data_game_list">
@ -158,7 +152,7 @@
<empty name ="listData">
<td colspan="99" class="text-center">aOh! 暂时还没有可结算内容!</td>
<else />
<?php foreach ($listData as $item): ?>
<?php foreach ($listData as $index => $item): ?>
<?php foreach ($item['channels'] as $k => $channel): ?>
<?php if ($k == 0) :?>
<tr>
@ -173,7 +167,7 @@
<td>{$channel['parter_settlement']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['fine']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['bonuses']}</td>
<td rowspan="{:sizeof($item['channels'])}">备注</td>
<td rowspan="{:sizeof($item['channels'])}"><textarea class="remark-txt" style="height: 100%;width: 100%;" oninput="updateDataRemark({$index}, this)"></textarea></td>
</tr>
<?php else :?>
<tr>
@ -341,21 +335,46 @@
</div>
</div>
<?php endif;?>
<div >
<label>请选择审核人</label>
</div>
<br>
<?php if ($generate):?>
<span>请选择审核人:</span>
<div>
<span class="audit_user">
<select class="first_audit">
<?php foreach ($admin_users as $admin):?>
<option value="{$admin['uid']}" >{$admin['nickname']}</option>
<?php endforeach;?>
</select>
<button type="button" class="bnt_save"></button>
</span>
<button type="button" class="bnt_add"></button>
<button type="button" class="bnt_remove"></button>
</div>
<div>
<button class="submit_btn" id="submit" type="submit" target-form="form-horizontal">
确认保存
</button>
<button class="submit_btn" onclick="javascript:history.back(-1)">
返回
</button>
</div>
<?php endif;?>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.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>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<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>
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
@ -376,6 +395,7 @@
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
var data = {:json_encode($listData)};
$(function(){
//搜索功能
$("#search").click(function(){
@ -394,6 +414,126 @@
window.location.href = url;
});
// 提交
$('#submit').on('click', function(){
var first_audit_arr = [];
var first_audits = $('.first_audit');
if (first_audits.size() <= 0) {
layer.msg("请选择至少一名一级审核人")
return false;
} else {
$.each(first_audits, function(index, item){
first_audit_arr.push($(item).val());
});
}
$.ajax({
url:"{:U('settlement/generateSettlementSheet')}",
method:'POST',
dataType:'JSON',
data:{
settlement_sheet:data,
audit_users:first_audit_arr,
settlement_type : $('#settlement_type').val(),
settlement_time_type : $('#settlement_time_type').val(),
settlement_time : $('#time').val()
},
success:function(response){
layer.msg(response.info);
if (response.status != 0) {
window.location.href = "{:U('settlement/sheetList')}";
}
}
});
});
$(".bnt_add").bind("click",function(){
console.log(1)
var a = $(this).parent('div').children('.audit_user:last').clone();
//$(".user-account:last").after(a);
$(this).before(a);
});
$(document).on('click', '.bnt_remove', function(){
if ($(this).parent('div').find('.audit_user').size() == 1) {
return false;
}
$(this).parent('div').find('.audit_user:last').remove();
});
function setTimeByWeek() {
var defaultDate = $('#time').val()
defaultDate = defaultDate == '' ? [] : defaultDate.split(' 至 ')
$('#time').flatpickr({
mode: 'range',
locale: 'zh',
dateFormat: "Y-m-d",
defaultDate: defaultDate,
onChange: function (selectedDates, dateStr, instance) {
if (dateStr.indexOf('至') === -1) {
var thisDate = new Date(Date.parse(dateStr));
if (thisDate.getDay() !== 1) {
layer.msg('请选择周一到周日');
return false;
}
} else {
var thisDate = dateStr.split(' 至 ');
var startDate = new Date(Date.parse(thisDate[0]));
if (startDate.getDay() !== 1 || Date.parse(thisDate[1]) / 1000 - Date.parse(thisDate[0]) / 1000 !== 518400) {
layer.msg('请选择周一到周日');
$('#time').val('');
return false;
}
}
}
});
}
function setTimeByMonth() {
$('#time').datetimepicker({
format: 'yyyy-mm',
language: "zh-CN",
autoclose: true,
scrollMonth: false,
scrollTime: false,
scrollInput: false,
startView: 'year',
minView:'year',
maxView:'year',
});
}
function resetTime() {
$('#time').remove();
var html = '<input type="text" class="txt range-date" id="time" name="settlement_time" placeholder="结算时间" value="" style="width: 180px;" readonly="readonly">';
$('#pay_time').html(html);
}
switch (parseInt("{:(I('settlement_time_type', 0))}")) {
case 1:
setTimeByWeek();
break;
case 2:
setTimeByMonth();
break;
}
$('#settlement_time_type').change(function () {
var settlementType = parseInt($(this).val());
switch (settlementType) {
case 1:
resetTime();
setTimeByWeek();
break;
case 2:
case 3:
resetTime();
setTimeByMonth();
break;
default:
break;
}
});
//回车自动提交
$('.jssearch').find('input').keyup(function(event){
if(event.keyCode===13){
@ -401,5 +541,9 @@
}
});
});
function updateDataRemark(index, obj)
{
data[index].remark = $(obj).val();
}
</script>
</block>

@ -0,0 +1,406 @@
<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;}
.data_list table td{
text-indent:0;
}
.data_game_list table td{
line-height:1;
padding: 3px;
}
</style>
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
.bnt_add,.bnt_remove,.bnt_save{
height: 30px;
width: 20px;
font-size: 20px;
line-height: 10px;
color: #3399ff;
background: none;
border: none;
cursor: pointer;
}
.bnt_remove{
color: #F70909;
}
.bnt_save{
color: #4DB361;
}
</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>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">{$meta_title}</h3>
<p class="description_text">说明:该功能是用于录入工会所属的推广公司名称</p>
</div>
<div class="jssearch search_list fl cf">
<a class="sch-btn" href="javascript:history.back(-1)" >返回</a>
<?php if ($msg):?>
{$msg}
<?php elseif ($settlement_type == 1):?>
<div class="data_list data_game_list">
<span style="color: red;">上游-汇总结算单</span>
<div class="">
<table border="1">
<!-- 表头 -->
<thead>
<tr>
<th style="width:10%;min-width:150px;">平台</th>
<th>时间</th>
<th>游戏名称</th>
<th>平台流水</th>
<th>分成比例</th>
<th>我方比例</th>
<th>渠道费率</th>
<th>税费费率</th>
<th>合作方结算分成</th>
<th>违规罚款</th>
<th>奖励</th>
<th style="width:20%;min-width:150px;">备注</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="listData">
<td colspan="99" class="text-center">aOh! 暂时还没有可结算内容!</td>
<else />
<?php foreach ($listData as $index => $item): ?>
<?php foreach ($item['channels'] as $k => $channel): ?>
<?php if ($k == 0) :?>
<tr>
<td rowspan="{:sizeof($item['channels'])}">{$item.company_name}</td>
<td>123</td>
<td>{$channel['relation_game_name']}</td>
<td>{$channel['amount']}</td>
<td>{$channel['game_ratio']}%</td>
<td>{$channel['self_game_ratio']}%</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['channel_rate']*100}%</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['invoice_rate']*100}%</td>
<td>{$channel['parter_settlement']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['fine']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['bonuses']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['remark']}</td>
</tr>
<?php else :?>
<tr>
<td>123</td>
<td>{$channel['relation_game_name']}</td>
<td>{$channel['amount']}</td>
<td>{$channel['game_ratio']}%</td>
<td>{$channel['self_game_ratio']}%</td>
<td>{$channel['parter_settlement']}</td>
</tr>
<?php endif;?>
<?php endforeach;?>
<?php endforeach;?>
</empty>
</tbody>
</table>
</div>
</div>
<?php elseif (in_array($settlement_type, [2, 3])):?>
<!-- 下游-内团/外团汇总结算单 -->
<span style="color: red;">下游-<?php echo $settlement_type == 2 ? "内团" : "外团"?>汇总结算单</span>
<div class="data_list data_game_list">
<div class="">
<table border="1">
<!-- 表头 -->
<thead>
<tr>
<th>排序</th>
<th style="width:10%;">平台</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 style="width:20%;min-width:150px;">备注</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<empty name ="listData">
<td colspan="99" class="text-center">aOh! 暂时还没有可结算内容!</td>
<else />
<?php foreach ($listData as $index => $item): ?>
<?php foreach ($item['channels'] as $k => $channel): ?>
<?php if ($k == 0) :?>
<tr>
<td rowspan="{:sizeof($item['channels'])}">{$index+1}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item.company_name}</td>
<td>{$channel['account']}</td>
<td>{$channel['relation_game_name']}</td>
<td>{$channel['amount']}</td>
<td>{$channel['game_ratio']}%</td>
<td>{$channel['game_ratio_max']}%</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['fax_ratio']*100}%</td>
<td>{$channel['price']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['fine']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['bonuses']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['total_amount']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['settlement_contact']}</td>
<td>时间</td>
<td rowspan="{:sizeof($item['channels'])}">备注</td>
</tr>
<?php else :?>
<tr>
<td>{$channel['account']}</td>
<td>{$channel['relation_game_name']}</td>
<td>{$channel['amount']}</td>
<td>{$channel['game_ratio']}%</td>
<td>{$channel['game_ratio_max']}%</td>
<td>{$channel['price']}</td>
<td>时间</td>
</tr>
<?php endif;?>
<?php endforeach;?>
<?php endforeach;?>
</empty>
</tbody>
</table>
</div>
</div>
<?php elseif ($settlement_type == 4):?>
<span style="color: red;">下游-个人汇总结算单</span>
<div class="data_list data_game_list">
<div class="">
<table border="1">
<!-- 表头 -->
<thead>
<tr>
<th>排序</th>
<th style="width:10%;min-width:150px;">公司名称</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 ="listData">
<td colspan="99" class="text-center">aOh! 暂时还没有可结算内容!</td>
<else />
<?php foreach ($listData as $index => $item): ?>
<?php foreach ($item['channels'] as $k => $channel): ?>
<?php if ($k == 0) :?>
<tr>
<td rowspan="{:sizeof($item['channels'])}">{$index+1}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item.company_name}</td>
<td>{$channel['account']}</td>
<td>{$channel['admin_name']}</td>
<td>{$channel['company_relation_name']}</td>
<td>{$channel['type_name']}</td>
<td>{$channel['relation_game_name']}</td>
<td >结算时间</td>
<td>{$channel['amount']}</td>
<td>{$channel['game_ratio']}%</td>
<td>{$channel['game_ratio_max']}%</td>
<td>{$channel['price']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['bonuses']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['fine']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['total_amount']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['settlement_contact']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['bank_card']}</td>
<td rowspan="{:sizeof($item['channels'])}">{$item['bank_address']}</td>
</tr>
<?php else :?>
<tr>
<td>{$channel['account']}</td>
<td>{$channel['admin_name']}</td>
<td>{$channel['company_relation_name']}</td>
<td>{$channel['type_name']}</td>
<td>{$channel['relation_game_name']}</td>
<td >结算时间</td>
<td>{$channel['amount']}</td>
<td>{$channel['game_ratio']}%</td>
<td>{$channel['game_ratio_max']}%</td>
<td>{$channel['price']}</td>
</tr>
<?php endif;?>
<?php endforeach;?>
<?php endforeach;?>
</empty>
</tbody>
</table>
</div>
</div>
<?php endif;?>
<br>
<?php if ($generate):?>
<span>请选择审核人:</span>
<div>
<span class="audit_user">
<select class="first_audit">
<?php foreach ($admin_users as $admin):?>
<option value="{$admin['uid']}" >{$admin['nickname']}</option>
<?php endforeach;?>
</select>
<button type="button" class="bnt_save"></button>
</span>
<button type="button" class="bnt_add"></button>
<button type="button" class="bnt_remove"></button>
</div>
<?php endif;?>
<div>
<h3>审核人:</h3>
<div>
<?php foreach ($audit_users as $index => $user_id):?>
<span>
{:get_admin_nickname($user_id)}
<?php if ($index + 1 < $step):?>
通过
<?php elseif ($index + 1 == $step) :?>
<?php echo $status == 1 ? "通过" : ($status == 2 ? "未通过" : "待审核")?>
<?php else:?>
待审核
<?php endif;?>
<?php if ($index < sizeof($audit_users) - 1):?><button type="button" class="bnt_save"></button><?php endif;?>
</span>
<?php endforeach;?>
</div>
<div style="margin-top:30px;">
<label>备注:</label>
<?php if ($audit_auth):?>
<textarea style="width: 400px;height: 200px;" id="remark">{$remark}</textarea>
<?php else :?>
<textarea style="width: 400px;height: 200px;" id="remark" disabled>{$remark}</textarea>
<?php endif;?>
</div>
<?php if ($audit_auth):?>
<div style="margin-top: 30px;">
<button class="submit_btn" id="submit" type="submit" target-form="form-horizontal" onclick="auditSettlement({$id}, 1)">
审核通过
</button>
<button class="submit_btn" target-form="form-horizontal" onclick="auditSettlement({$id}, 2)">
审核未通过
</button>
</div>
<?php endif;?>
</div>
</block>
<block name="script">
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.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>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<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>
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
.layui-layer-demo .layui-layer-content table{width:100%;border:0;border-spacing:0;padding:0;}
.layui-layer-demo .layui-layer-content td {height:42px;padding-left:20px;}
.layui-layer-demo .layui-layer-content tr:hover {background:#F0F5F7;}
.layui-layer-demo .layui-layer-content tr~tr {border-top:1px solid #ccc;}
.layui-layer-demo .layui-layer-content td~td {border-left:1px solid #ccc;}
.layui-layer-demo .layui-layer-content tr:last-child td {}
</style>
<script>
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
$(".select_gallery").select2();
</script>
<script type="text/javascript">
//导航高亮
highlight_subnav("{:U('lists')}");
function auditSettlement(id, audit_type)
{
$.ajax({
url : "{:U('settlement/auditSheet')}",
dataType:"JSON",
method:"POST",
data : {id:id, audit_type:audit_type, remark:$('#remark').val()},
success:function(response){
layer.msg(response.info);
if (response.status != 0) {
location.reload()
}
}
});
}
</script>
</block>

@ -0,0 +1,254 @@
<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;}
.layui-layer-dialog .layui-layer-content{color:red}
.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;
}
</style>
<!-- 标题栏 -->
<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">
<a class="confirm ajax-post" id="dtnn" target-form="ids" url="{:U('Member/delprovide')}"><span class="button_icon button_icon2 "></span>批量删除</a>
</div> -->
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="settlement_type" name="settlement_type" class="select_gallery">
<option value="">选择汇总结算单类型</option>
<option value="1" <?php echo I('settlement_type') == 1 ? "selected" : "" ?> >上游结算单</option>
<option value="2" <?php echo I('settlement_type') == 2 ? "selected" : "" ?> >下游-内团结算单</option>
<option value="3" <?php echo I('settlement_type') == 3 ? "selected" : "" ?>>下游-外团结算单</option>
<option value="4" <?php echo I('settlement_type') == 4 ? "selected" : "" ?>>下游-个人结算单</option>
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="settlement_time_type" name="settlement_time_type" class="select_gallery">
<option value="">选择汇总结算单类型</option>
<option value="1" <?php echo I('settlement_time_type') == 1 ? "selected" : "" ?> >周结</option>
<option value="2" <?php echo I('settlement_time_type') == 2 ? "selected" : "" ?> >月结</option>
</select>
</div>
<div class="input-list">
<input type="text" readonly id="create-time-start" name="create_time_start" class="" value="{:I('create_time_start')}"
placeholder="申请开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly id="create-time-end" name="create_time_end" class="" value="{:I('create_time_end')}"
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="creater_id" name="creater_id" class="select_gallery" >
<option value="">选择申请人</option>
<?php foreach ($admin_users as $user):?>
<option value="{$user['uid']}" <?php if ($user['uid'] == I('creater_id')):?>selected<?php endif;?> >{$user['nickname']}</option>
<?php endforeach;?>
</select>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search"
url="{:U('settlement/sheetList','model='.$model['name'],false)}">
搜索
</a>
</div>
</div>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class="butn" href="{:U('settlement/generateSettlementSheet')}">
生成报销单
</a>
</div>
</div>
<!-- 数据列表 -->
<div class="data_list">
<div class="">
<table>
<!-- 表头 -->
<thead>
<tr>
<!-- <th class="">
<input class="check-all" type="checkbox">
</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="list_data">
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
<else/>
<volist name="list_data" id="data">
<tr>
<!-- <td><input class="ids" type="checkbox" value="{$data['id']}" name="ids"></td> -->
<td>{$data.orderid}</td>
<td>{$data.settlement_type_name}</td>
<td >{:date('Y-m-d', $data['time_start'])} - {:date('Y-m-d', $data['time_end'])}</td>
<td>{$data.settlement_time_type_name}</td>
<td>{$data.create_time|date='Y-m-d H:i:s',###}</td>
<td>{:get_admin_nickname($data['creater_id'])}</td>
<td>{$data.status_name}</td>
<td>{:get_admin_nickname($data['audit_users'][$data['step']-1])}</td>
<td>{$data.remark}</td>
<td>
<a href="{:U('settlement/sheetDetail',array('id'=>$data['id']))}">查看 </a>
<a class="ajax-get" href="{:U('Member/save_device_bans',array('id'=>$data['id']))}">解除 </a>
</td>
</tr>
</volist>
</empty>
</tbody>
</table>
</div>
</div>
<div class="page">
{$_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="settlement/sheetList">
</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 src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/layer/extend/layer.ext.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>
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/layer/extend/layer.ext.js" ></script>
<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>
<link rel="stylesheet" href="__STATIC__/flatpickr/flatpickr.min.css">
<script src="__STATIC__/flatpickr/flatpickr.min.js"></script>
<script src="__STATIC__/flatpickr/l10n/zh.js"></script>
<style>
.layui-layer-demo .layui-layer-title {background:#F0F5F7;font-weight:bold;}
.layui-layer-demo .layui-layer-content {}
.layui-layer-demo .layui-layer-content table{width:100%;border:0;border-spacing:0;padding:0;}
.layui-layer-demo .layui-layer-content td {height:42px;padding-left:20px;}
.layui-layer-demo .layui-layer-content tr:hover {background:#F0F5F7;}
.layui-layer-demo .layui-layer-content tr~tr {border-top:1px solid #ccc;}
.layui-layer-demo .layui-layer-content td~td {border-left:1px solid #ccc;}
.layui-layer-demo .layui-layer-content tr:last-child td {}
</style>
<script type="text/javascript">
//导航高亮
highlight_subnav('{:U('settlement/sheetList')}');
$(function () {
$(".select_gallery").select2();
//搜索功能
$("#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;
});
//回车自动提交
$('.jssearch').find('input').keyup(function (event) {
if (event.keyCode === 13) {
$("#search").click();
}
});
$('#create-time-start').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true
});
$('#datetimepicker').datetimepicker({
format: 'yyyy-mm-dd',
language: "zh-CN",
minView: 2,
autoclose: true,
pickerPosition: 'bottom-left'
})
})
</script>
</block>
Loading…
Cancel
Save