Merge branch 'feature/finance_statement_three' of wmtx/platform into release

master
陈志 4 years ago committed by Gogs
commit 15676c69b9

@ -0,0 +1,29 @@
<?php
namespace Admin\Controller;
use Think\Controller;
/**
* 系统任务接口
* @author cz
* TODO: 罚款的游戏没有流水不统计补点为0 无法重算
*/
class CmdTasksController extends Controller {
public function run()
{
$params = D("CmdTasks")->getTask();
if(!$params){
echo('暂无任务');
}
$taskid = $params['id'];
$cmd = $params['params'];
$cmd = str_replace('{$taskid}',$taskid,$cmd);
try {
system($cmd);
} catch (\Exception $e) {
D("CmdTasks")->updateTask(['id'=>$params['id'],'status' => 3, 'end_time' => time(), 'result' => $e->getMessage()]);
}
}
}

@ -19,13 +19,11 @@ class CompanyStatementController extends ThinkController
"9"=>"上游"
];
public $VerifyStatus=[
"-3"=>"撤销汇总",
"-2"=>"审核拒绝",
"-1"=>"管理员审批拒绝",
"-2"=>"撤销汇总",
"-1"=>"管理员审核拒绝",
"0"=>"未审批",
"1"=>"管理员审核通过",
"2"=>"审核通过",
"3"=>"已汇总"
"2"=>"已汇总"
];
public $ConfirmStatus=[
"0"=>"未发起",
@ -161,18 +159,6 @@ class CompanyStatementController extends ThinkController
}else{
$v["admin"] = '--';
}
if(isset($v['verify_log']['verify_user'])){
if($v['verify_status'] == -2){
$ts = "审核拒绝";
}else{
$ts = "审核通过";
}
$v["verify"]= "{$ts}({$v['verify_log']['verify_user']}) {$symbol} {$v['verify_log']['verify_time']}";
}else{
$v["verify"] = '--';
}
if(isset($v['confirm_log']['launch_user'])){
$ts = "已发起";
$v["launch"]= "{$ts}({$v['confirm_log']['launch_user']}) {$symbol} {$v['confirm_log']['launch_time']}";
@ -187,7 +173,7 @@ class CompanyStatementController extends ThinkController
$v["confirm"] = '--';
}
if(isset($v['verify_log']['pool_user'])){
if($v['verify_status'] == -3){
if($v['verify_status'] == -2){
$ts = "撤销汇总";
$v["pool"]= "{$ts}({$v['verify_log']['pool_user']}){$symbol} {$v['verify_log']['pool_time']}";
}else{
@ -327,12 +313,6 @@ class CompanyStatementController extends ThinkController
public function adminRefuse(){
$this->setVerifyStatus(0,-1,"admin");
}
public function verifyAgree(){
$this->setVerifyStatus(1,2,"verify");
}
public function verifyRefuse(){
$this->setVerifyStatus(1,-2,"verify");
}
public function launch(){
if(!isset($_REQUEST['ids'])) $this->error("参数错误");
@ -504,7 +484,7 @@ class CompanyStatementController extends ThinkController
}
foreach ($dbres as $k=>$v) {
if($v['verify_status'] != 2) continue;
if($v['verify_status'] != 1) continue;
if($v['company_belong'] == 9){
//上游
$this->setDf($datas['up'],$v);
@ -554,7 +534,7 @@ class CompanyStatementController extends ThinkController
M("company_lack_statement_info","tab_")->where("id in ({$v['del_lack_ids']})")->save(["is_pool"=>1]);
}
//修改结算单规则
$this->updatePoolVerifyStatus($v['statement_ids'],2,3,"pool",$v['statement_num']);
$this->updatePoolVerifyStatus($v['statement_ids'],1,2,"pool",$v['statement_num']);
}
$this->ajaxReturn(array(
'status' => 1,
@ -877,11 +857,10 @@ class CompanyStatementController extends ThinkController
case '-2':
case '-1':
case '0':
case '1':
case '2':
$optist = ["viewStatement","editStatement","addRemark","viewRemark","editRemark"];
break;
case '3':
case '1':
case '2':
$optist = ["viewStatement","addRemark","viewRemark","editRemark"];
break;
default:
@ -911,8 +890,6 @@ class CompanyStatementController extends ThinkController
$mentBtn = [
"adminAgree"=>"<a class='butn' id='adminAgree'>管理员审核通过</a>",
"adminRefuse"=>"<a class='butn' id='adminRefuse' style='background-color: red;'>管理员审核拒绝</a>",
"verifyAgree"=>"<a class='butn' id='verifyAgree'>审批通过</a>",
"verifyRefuse"=>"<a class='butn' id='verifyRefuse' style='background-color: red;'>审核拒绝</a>",
"pool"=>"<a class='butn' id='pool'>发起汇总</a>",
"updateStatement"=>"<a class='butn' id='updateStatement' style='background-color: green;'>重算金额</a>",
"export"=>"<a class='butn' id='export'>批量导出</a>",

@ -71,6 +71,7 @@ class CompanyStatementLackController extends ThinkController
->field("*")
->where($map)
->page($page,$row)
->order("id desc")
->select();
foreach($data as $k => &$v) {

@ -248,33 +248,50 @@ class CompanyStatementPoolController extends ThinkController
}
$cline = $line+1;
if($is_export){
$v['sum_money_exp'] = "=";
$v['statement_money'] = "=";
}
$row = 0;
foreach($v['statement_info'] as $ke=>&$va){
$line ++;
if(isset($va['ratio'])){
$va['increment_ratio'] = 0;
}else{
$va['ratio'] = 0;
}
if($is_export){
//J3*(K3+L3)+M3-N3
if($va['statement_type'] > 0){ //罚款服务器费用
$va['sum_money'] = "=J{$line}";
$va['row'] = count($va['game_list']);
$row += count($va['game_list']);
foreach($va['game_list'] as $key=>&$val){
$line ++;
if(isset($val['ratio'])){
$val['increment_ratio'] = 0;
}else{
$va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
$val['ratio'] = 0;
}
if($is_export){
$val['sum_money'] = "=J{$line}*(K{$line}+L{$line})";
$v['statement_money'] .= "M{$line}+";
}else{
$count['platform_amount'] += $val['pay_amount'];
$count['sum_money'] += $val['sum_money'];
}
}else{
$count['platform_amount'] += $va['pay_amount'];
$count['sum_money'] += $va['sum_money'];
}
// if($is_export){
// //J3*(K3+L3)+M3-N3
// if($va['statement_type'] > 0){ //罚款服务器费用
// $va['sum_money'] = "=J{$line}";
// }else{
// $va['sum_money'] = "=J{$line}*(K{$line}+L{$line})+M{$line}-N{$line}";
// }
// }else{
// $count['platform_amount'] += $va['pay_amount'];
// $count['sum_money'] += $va['sum_money'];
// }
}
$v['row'] = $row;
if($is_export){
$v['statement_money'] .="N{$cline}-O{$cline}";
}
$v['statement_count'] = count($v['statement_info']);
}
if($is_export){
$count["platform_amount"] = "=SUM(J2:J".$line.")";
$count["sum_money"] = "=SUM(O2:O".$line.")";
$count["sum_money"] = "=SUM(P2:P".$line.")";
}
$this->assign("data",$infolist);
$this->assign("count",$count);
@ -856,7 +873,7 @@ class CompanyStatementPoolController extends ThinkController
$v['verify_log']['pool_user']=$this->admininfo["username"];
$v['verify_log']['pool_time']=date("Y.m.d H:i:s");
$v['verify_log'] = json_encode($v['verify_log']);
$v['verify_status']=-3;
$v['verify_status']=-2;
$stres = M("company_statement","tab_")->save($v);
if($stres === false){
M()->rollback();

@ -785,13 +785,85 @@ class CompanyStatementSetController extends Controller {
$res[$company_id][$v['relation_game_id']]= $v;
}
}
}
}
foreach($res as $k=>$v){
$pcList[$k]["pay_amount"] = $v['pay_amount'];
unset($v['pay_amount']);
$pcList[$k]['list'] = $v;
}
}
//获取推广公司推广金额
protected function getPuPromoteSpend(&$pcList,$idarr,$begintime,$endtime){
$res = [];
//获取推广员
if(count($idarr) == 0){return $res;}
$Promote = M("Promote","tab_");
$Spend = M("Spend","tab_");
$spenMap = [
"s.pay_status"=>1,
"s.payed_time"=>['between', [$begintime,$endtime]],
];
for ($i=0; $i <count($idarr); $i++) {
$company_id = $idarr[$i];
$pres = $Promote->field("id,account")->where("company_id = '{$company_id}'")->select();
if(empty($pres)){continue;}
$spenMap['s.promote_id']=["in",array_column($pres,"id")];
$promote_a = [];
foreach($pres as $key=>$value){
$promote_a[$value['id']] = $value['account'];
}
unset($pres);
//获取支付记录
$list = $Spend
->alias('s')
->field("sum(s.pay_amount) pay_amount,s.game_id,g.relation_game_id,g.relation_game_name game_name,IFNULL(if(substring_index(substring_index(promote.`chain`,'/',2),'/',-1)='',s.promote_id,substring_index(substring_index(promote.`chain`,'/',2),'/',-1)),0) p_id")
->where($spenMap)
->group('p_id,game_id')
->join("tab_promote promote ON s.promote_id = promote.id","left")
->join("left join tab_game g on s.game_id = g.id")
->select();
if(empty($list)){continue;}
$game = [];
foreach($list as $k=>$v){
if(isset($game[$v['relation_game_id']])){
$game[$v['relation_game_id']]['pay_amount'] += $v['pay_amount'];
}else{
$game[$v['relation_game_id']]['pay_amount'] = $v['pay_amount'];
}
}
foreach($list as $k=>$v){
try {
$res[$company_id]["pay_amount"] += $v['pay_amount'];
} catch (\Throwable $th) {
$res[$company_id]["pay_amount"] = $v['pay_amount'];
}
$p_account = $promote_a[$v['p_id']];
if(isset($res[$company_id][$p_account][$v['relation_game_id']])){
//
$res[$company_id][$p_account][$v['relation_game_id']]['pay_amount'] += $v['pay_amount'];
}else{
unset($v['game_id']);
$res[$company_id][$p_account][$v['relation_game_id']]= $v;
$res[$company_id][$p_account][$v['relation_game_id']]['all_pay_amount']= $game[$v['relation_game_id']]['pay_amount'];
$res[$company_id][$p_account][$v['relation_game_id']]['game_type_name'] = $this->getGameTypeName($v['relation_game_id']);
}
}
}
foreach($res as $k=>$v){
$pcList[$k]["pay_amount"] = $v['pay_amount'];
unset($v['pay_amount']);
foreach($v as $ke=>$va){
$tmp = [
"account"=>$ke,
'game_list'=>$va
];
$pcList[$k]['list'][] = $tmp;
}
}
}
public function promoteUserPool($type,$stime,$recount = false){
$t = $this->setBeginAndEndTime($type,$stime);
@ -908,7 +980,9 @@ class CompanyStatementSetController extends Controller {
$pc[$v['id']]['is_payment']=$pcList[$v['id']]['is_payment'];
}
unset($tmpp);
$this->getPromoteCompanySpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
// $this->getPromoteCompanySpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
$this->getPuPromoteSpend($pc,array_unique(array_keys($pc)),$begintime,$endtime);
$StatementDb = M("CompanyStatement","tab_");
$statement_begin_time = date("Y.m.d",$begintime);
@ -930,8 +1004,15 @@ class CompanyStatementSetController extends Controller {
$countdata = &$user;
$v['statement_money'] = 0;
$v['pay_amount'] = 0;
$v['fine'] = 0;
$v['reward'] = 0;
if($type < 2 && $RewardRecordRes){
$v['fine'] = $RewardRecordRes['fine'];
$v['reward'] = $RewardRecordRes['reward'];
$v['statement_money'] -= $v['fine'];
$v['statement_money'] += $v['reward'];
}else{
$v['fine'] = 0;
$v['reward'] = 0;
}
$v['platform_amount'] = 0;
if(!isset($v['list'])){continue;}
$company_belong = $pc[$v['id']]['company_belong'];
@ -949,59 +1030,43 @@ class CompanyStatementSetController extends Controller {
$v['pay_amount'] -= $v['server_fee'];
$v['statement_money'] -= $v['server_fee'];
}
}
}
foreach($v['list'] as $ke=>$va){
$game =[];
$game['pay_amount'] =$va['pay_amount'];
$game['game_name'] =$va['game_name'];
//获取比例
$game['relation_game_id']=$va['relation_game_id'];
$game['game_type_name'] = $this->getGameTypeName($va['relation_game_id']);
if($type == 1){
$tratio = getGamePromoteCompanyRadio($v['id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = getGamePromoteCompanyRadio($v['id'],$va['relation_game_id'],$endtime,$va['pay_amount'],false,$company_belong);
}else{
//补点
$tratio1 = getGamePromoteCompanyRadio($v['id'],$va['relation_game_id'],$endtime,$va['pay_amount'],true,$company_belong);;
$tratio2 = getGamePromoteCompanyRadio($v['id'],$va['relation_game_id'],$endtime,$va['pay_amount'],false,$company_belong);
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){
continue;
$templist = $va['game_list'];
$va['game_list'] = [];
foreach($templist as $p_id => $p_info){
// dd($p_info);
if($type == 1){
$tratio = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],true,$company_belong);
$tratio += $company_ratio;
}elseif($type == 0){
$tratio = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],false,$company_belong);
}else{
//补点
$tratio1 = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],true,$company_belong);;
$tratio2 = getGamePromoteCompanyRadio($v['id'],$p_info['relation_game_id'],$endtime,$p_info['all_pay_amount'],false,$company_belong);
$tratio = $tratio1-$tratio2+$company_ratio;
if($tratio <= 0){
continue;
}
}
}
if($type == 2){
$game['increment_ratio']=$tratio;
}else{
$game['ratio']=$tratio;
}
$v['pay_amount'] += $va['pay_amount'];
$v['platform_amount'] += $va['pay_amount'];
//判断是否是个人
if($type < 2){
//非补点
if($RewardRecordRes){
$rrfres = $RewardRecordRes[$va['relation_game_id']];
if($type == 2){
$p_info['increment_ratio']=$tratio;
}else{
$rrfres = [
'reward_count'=>0,
'fine_count'=>0,
];
$p_info['ratio']=$tratio;
}
$game['reward'] = $rrfres['reward_count'];
$game['fine'] = $rrfres['fine_count'];
$v['platform_amount'] += $p_info['pay_amount'];
$p_info['sum_money']=round($p_info['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例
$v['pay_amount'] += $p_info['sum_money'];
$v['statement_money'] += $p_info['sum_money'];
$p_info['fax_ratio']=$fax_ratio;
$p_info['statement_begin_time']=$statement_begin_time;
$p_info['statement_end_time']=$statement_end_time;
$p_info['statement_type']=0;
$va['game_list'][] = $p_info;
}
$game['sum_money']=round($va['pay_amount']*$tratio/100,2)+$game['reward']-$game['fine']; //个人等于 结算金额*比例-罚款+奖励
$v['statement_money'] += $game['sum_money'];
$game['fax_ratio']=$fax_ratio;
$game['statement_begin_time']=$statement_begin_time;
$game['statement_end_time']=$statement_end_time;
$game['statement_type']=0;
$v['statement_info'][] = $game;
$v['statement_info'][] = $va;
}
$company_info = [
'account'=>$v['account'],
@ -1014,7 +1079,7 @@ class CompanyStatementSetController extends Controller {
"ali_user"=>$v['ali_user'],
"ali_account"=>$v['ali_account']
];
if($v['pay_amount'] < 300){
if($v['platform_amount'] < 300){
$lackcompany =[
"company_id"=>$k,
"company_type"=>2,
@ -1048,10 +1113,22 @@ class CompanyStatementSetController extends Controller {
$v['fine'] += $val['fine'];
$v['reward'] += $val['reward'];
$v['platform_amount'] += $val['platform_amount'];
$v['statement_info'] = array_merge($v['statement_info'],json_decode($val['statement_info'],true));
$last_names = array_column($v['statement_info'],'game_name');
array_multisort($last_names,SORT_DESC,SORT_STRING,$v['statement_info']);
$t_statement_info = json_decode($val['statement_info'],true);
$statement_info = [];
foreach($t_statement_info as $p=>$info){
$statement_info[$info['account']] = $info['game_list'];
}
foreach($v['statement_info'] as $p=>&$info){
if(isset($statement_info[$info['account']])){
$info['game_list'] = array_merge($statement_info[$info['account']],$info['game_list']);
unset($statement_info[$info['account']]);
}
}
if(!empty($statement_info)){
foreach($statement_info as $p=>$info){
$v['statement_info'][] = ["account"=>$p,"game_list"=>$info];
}
}
}
}
@ -1144,7 +1221,7 @@ class CompanyStatementSetController extends Controller {
{
$pl = M("promote_company","tab_")
->alias('pc')
->field("p.account,p.company_relation,IFNULL(s.nickname,'admin') nickname")
->field("p.account,p.company_relation,IFNULL(s.real_name,'-') nickname")
->join("left join (select company_id,account,company_relation,admin_id from tab_promote where level = 1 group by company_id ) p on p.company_id = pc.id")//获取会长
->join("left join sys_member s on s.uid = p.admin_id")
->where("pc.id = {$company_id}")
@ -1183,7 +1260,7 @@ class CompanyStatementSetController extends Controller {
return $ratio;
}
/**
* 获取公司比例加成
* 获取公司奖罚
* @param [type] $paymount 支付金额
* @param [type] $turnover_ratio 梯度
*/
@ -1199,22 +1276,15 @@ class CompanyStatementSetController extends Controller {
$rfres = M("RewardDetail","tab_")
->alias("d")
->field("
IFNULL(SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),0) as reward_count,
IFNULL(SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),0) as fine_count,
r.relation_game_id
")
IFNULL(SUM(CASE WHEN type = 1 THEN amount ELSE 0 END),0) as reward,
IFNULL(SUM(CASE WHEN type = 2 THEN amount ELSE 0 END),0) as fine")
->where($rrmap)
->join("tab_reward_record as r on d.record_id = r.id")
->group("record_id,company_id")
->select();
->group("company_id")
->find();
if(empty($rfres)){
return false;
}else{
$s = [];
foreach($rfres as $k=>$v){
$s[$v['relation_game_id']] = $v;
}
return $s;
$rfres;
}
}

@ -25,11 +25,32 @@ class FinancialSummaryController extends AdminController
if(!array_key_exists("year",$_REQUEST) || !array_key_exists("type",$_REQUEST)){
$this->redirect(ACTION_NAME, array('year' => date('Y',time()),"type"=>2));
}
if(!IS_ROOT){
$this->OpAuthList= getModuleControllerAuth();
}
$this->assign('menubtn',$this->menuAuth());
$lastRecount = D("CmdTasks")->getTypeLastTask("FinancialSummary");
if(!$lastRecount){
$lastRecount = "无";
}
$this->assign('lastRecount',$lastRecount);
$this->getYearList();
$this->getYearData();
$this->display();
}
public function updateStatement()
{
$temp = date('Y',time()).'-'.(date('m',time())-1);
$params = "cd ".ROOTTTTT.";php admin.php FinancialSummarySet/setMonthFinancialSummary/recount/1/count_date/{$temp}";
$r = D("CmdTasks")->addTask("FinancialSummary",$params);
if($r){
$this->ajaxReturn(["success"=>"ok"]);
}else{
$this->ajaxReturn(["error"=>"error"]);
}
}
//获取指定年份数据
public function getYearData()
{
@ -142,6 +163,23 @@ class FinancialSummaryController extends AdminController
}
$this->assign('YearList', $list);
}
public function menuAuth()
{
$mentBtn = [
"updateStatement"=>"<a class='butn' id='updateStatement' style='background-color: green;'>重算金额</a>"
];
$resarr = [];
foreach ($mentBtn as $k => $v) {
if(IS_ROOT){
$resarr[] = $v;
}else{
if(in_array($k,$this->OpAuthList)){
$resarr[] = $v;
}
}
}
return $resarr;
}

@ -14,6 +14,8 @@ class FinancialSummarySetController extends \Think\Controller
public $month;//月份
public $year;//年份
public $adddata;//要添加的数据
public $taskid=false;
public $result='';
//数据库
public $FinancialSummaryModel;
public function _initialize(){
@ -35,6 +37,11 @@ class FinancialSummarySetController extends \Think\Controller
$this->CoinPayOrderModel = M("CoinPayOrder",'tab_');//会长充值平台币表
$this->TestOrderModel = M("TestOrder",'tab_');//测试订单录入
$taskid = I("taskid");
if(!empty($taskid)){
$this->taskid = $taskid;
}
}
/**
* 更新某月数据
@ -56,6 +63,9 @@ class FinancialSummarySetController extends \Think\Controller
$this->reCount();
$this->setFinancialSummary();
if($this->taskid){
D("CmdTasks")->updateTask(['id'=>$this->taskid,'status'=>2,'end_time' => time(), 'result' =>$this->result]);
}
}
/**
* 强制重新聚合
@ -85,7 +95,11 @@ class FinancialSummarySetController extends \Think\Controller
//判断是否已经聚合
$countRes = $this->FinancialSummaryModel->field("IFNULL(COUNT(*),0) count")->where("count_year = '{$this->year}' and count_month= '{$this->month}'")->find()['count'];
if($countRes > 0){
die("error:Repeated statistics,msg:{$this->date}已经聚合过");
if($this->taskid){
throw new \Exception("error:Repeated statistics,msg:{$this->date}已经聚合过");
}else{
die("error:Repeated statistics,msg:{$this->date}已经聚合过");
}
}
echo "{$this->date}开始统计".PHP_EOL;
echo "--收入类型统计中".PHP_EOL;
@ -108,6 +122,10 @@ class FinancialSummarySetController extends \Think\Controller
$t2 = microtime(true);
echo ("success {$this->date}:ok runtime:".round($t2-$t1,3).'s'.PHP_EOL);
if($this->taskid){
$this->result = "success {$this->date}:ok runtime:".round($t2-$t1,3).'s';
}
}
/**
* 获取类型为1的数据,按收入类型

@ -0,0 +1,61 @@
<?php
//推广公司模型
namespace Admin\Model;
use Think\Model;
/**
* 文档基础模型
*/
class CmdTasksModel extends Model{
protected $tablePrefix = 'tab_';
//获取待执行任务
public function getTask()
{
//按顺序获取任务
$has_run = $this->where(['status'=>"1"])->count();
if($has_run > 0){
return false;
}
$task = $this->field("id,params")->where(['status'=>"0"])->order("id asc")->find();
if(empty($task)){
return false;
}else{
//修改状态为执行中
$this->save(['id'=>$task['id'],'status'=>"1","start_time"=>time()]);
return $task;
}
}
//更新
public function updateTask($params)
{
$this->save($params);
}
//获取同类型任务最后一次操作时间
public function getTypeLastTask($type)
{
$task = $this->field("end_time")->where(['status'=>"2",'type'=>$type])->order("id desc")->find();
if(empty($task)){
return false;
}else{
return date("Y-d-m H:i:s",$task['end_time']);
}
}
//插入任务
public function addTask($type,$params,$need_tasksid = true)
{
$task = $this->field("end_time")->where(['status'=>"1",'type'=>$type])->order("id desc")->find();
if(!empty($task)){
return false;
}
if($need_tasksid){
$params = rtrim($params,";").'/taskid/{$taskid};';
}
$save = [
"uid"=>$_SESSION['onethink_admin']['user_auth']['uid'],
"created_time"=>time(),
"params"=>$params,
"type"=>$type
];
return $this->add($save);
}
}

@ -202,7 +202,6 @@
<th>结算流水</th>
<th>创建记录</th>
<th>管理员审核</th>
<th>审批状态</th>
<th>汇总状态</th>
<th>对外发起</th>
<th>合作确认</th>
@ -242,17 +241,6 @@
</td>
<td>
<if condition="$data.verify_status eq -2 ">
<div style="line-height: 2;color: red;">
{$data.verify}
</div>
<else />
<div style="line-height: 2;">
{$data.verify}
</div>
</if>
</td>
<td>
<if condition="$data.verify_status eq -3 ">
<div style="line-height: 2;color: red;">
{$data.pool}
</div>
@ -467,26 +455,16 @@
var opurl = "{:U('adminRefuse')}";
var opst ="[未进行审批]";
var status = [0];
}else if(id == "verifyAgree"){
var opname = "审批通过";
var opurl = "{:U('verifyAgree')}";
var opst ="[管理员审批通过]";
var status = [1];
}else if(id=="verifyRefuse"){
var opname = "审批拒绝";
var opurl = "{:U('verifyRefuse')}";
var opst ="[管理员审批通过]";
var status = [1];
}else if(id=="pool"){
var opname = "发起汇总";
var opurl = "{:U('pool')}";
var opst ="[审批通过]";
var status = [2];
var status = [1];
}else if(id=="updateStatement"){
var opname = "重算金额";
var opurl = "{:U('updateStatement')}";
var opst ="[汇总撤销,管理员审批拒绝,审批拒绝,未进行审批,管理员审批通过,审批通过]";
var status = [-3,-2,-1,0,1,2];
var opst ="[汇总撤销,管理员审批拒绝,未进行审批,管理员审批通过]";
var status = [-3,-2,-1,0,1];
var confirm = true;
}
var confirm = confirm ? confirm :false;

@ -83,7 +83,10 @@
float: left;
margin: 0;
}
#statementShow td{
line-height: 1.5;
padding: 8px 0;
}
</style>
<body>
<!-- <div style="width: 100%;line-height: 100px;font-size: 25px;font-weight: 600;text-align: center;">
@ -108,6 +111,7 @@
<th>推广流水</th>
<th>分成比例</th>
<th>补点</th>
<th>分成结算金额</th>
<th>奖励</th>
<th>罚款</th>
<th>结算金额</th>
@ -119,100 +123,154 @@
<th>是否结算</th>
<th>备注</th>
<if condition="!$is_export">
<if condition="!$is_export">
<th>操作</th>
</if>
</tr>
</thead>
<tbody id="statementShow">
<foreach name="data" item="com">
<tr>
<td rowspan="{$com.statement_count}">{$key-0+1}</td>
<td rowspan="{$com.statement_count}">{$com.company_name}</td>
<td rowspan="{$com.row}">{$key-0+1}</td>
<td rowspan="{$com.row}">{$com.company_name}</td>
<td rowspan="{$com.statement_count}">{$com.company_info.account}</td>
<td rowspan="{$com.statement_count}">{$com.company_info.company_relation_str}</td>
<td rowspan="{$com.statement_count}">{$com.company_info.nickname}</td>
<td rowspan="{$com.statement_count}">{$com.company_info.company_type_str}</td>
<!-- <td rowspan="{$com.statement_count}">{$com.company_info.account}</td> -->
<td>{$com['statement_info'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_type_name']}</td>
<td>{$com['statement_info'][0]['statement_begin_time']}-{$com['statement_info'][0]['statement_end_time']}</td>
<td>{$com['statement_info'][0]['pay_amount']}</td>
<if condition="$com['statement_info'][0]['statement_type'] neq 0">
<td></td>
<td></td>
<notempty name="com['statement_info']">
<td rowspan="{$com['statement_info'][0]['row']}">{$com['statement_info'][0]['account']}</td>
<else />
<td>{$com['statement_info'][0]['ratio']|default=0}%</td>
<td>{$com['statement_info'][0]['increment_ratio']|default=0}%</td>
</if>
<td>-</td>
</notempty>
<td rowspan="{$com.row}">{$com.company_info.company_relation_str}</td>
<td rowspan="{$com.row}">{$com.company_info.nickname}</td>
<td rowspan="{$com.row}">{$com.company_info.company_type_str}</td>
<td>{$com['statement_info'][0]['reward']}</td>
<td>{$com['statement_info'][0]['fine']}</td>
<td>{$com['statement_info'][0]['sum_money']}</td>
<notempty name="com['statement_info'][0]['game_list']">
<td>{$com['statement_info'][0]['game_list'][0]['game_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['game_type_name']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['statement_begin_time']}-{$com['statement_info'][0]['game_list'][0]['statement_end_time']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['pay_amount']}</td>
<td>{$com['statement_info'][0]['game_list'][0]['ratio']|showNumPercent}</td>
<td>{$com['statement_info'][0]['game_list'][0]['increment_ratio']|showNumPercent}</td>
<td>{$com['statement_info'][0]['game_list'][0]['sum_money']}</td>
<td rowspan="{$com.row}">{$com['reward']}</td>
<td rowspan="{$com.row}">{$com['fine']}</td>
<td rowspan="{$com.row}">{$com['statement_money']}</td>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
<td rowspan="{$com.row}">-</td>
</notempty>
<if condition="$com['is_payment'] eq 2">
<td rowspan="{$com.statement_count}">{$com.company_info.payee_name}</td>
<td rowspan="{$com.statement_count}">&nbsp;{$com.company_info.bank_account}</td>
<td rowspan="{$com.statement_count}">{$com.company_info.opening_bank}</td>
<td rowspan="{$com.row}">{$com.company_info.payee_name}</td>
<td rowspan="{$com.row}">&nbsp;{$com.company_info.bank_account}</td>
<td rowspan="{$com.row}">{$com.company_info.opening_bank}</td>
</if>
<if condition="$com['is_payment'] eq 1">
<td rowspan="{$com.statement_count}">{$com.company_info.ali_user}</td>
<td rowspan="{$com.statement_count}">{$com.company_info.ali_account}</td>
<td rowspan="{$com.statement_count}"></td>
<td rowspan="{$com.row}">{$com.company_info.ali_user}</td>
<td rowspan="{$com.row}">{$com.company_info.ali_account}</td>
<td rowspan="{$com.row}"></td>
</if>
<td rowspan="{$com.row}"><if condition="$com['is_payment'] eq 1"><else /></if></td>
<td rowspan="{$com.row}"><if condition="$com['st'] eq 0"><else /></if></td>
<td rowspan="{$com.row}">{$com.remark}</td>
<td rowspan="{$com.statement_count}"><if condition="$com['is_payment'] eq 1"><else /></if></td>
<td rowspan="{$com.statement_count}"><if condition="$com['st'] eq 0"><else /></if></td>
<td rowspan="{$com.statement_count}">{$com.remark}</td>
<if condition="!$is_export">
<td rowspan="{$com.statement_count}">
<td rowspan="{$com.row}">
<if condition="($com['st'] eq 1 ) AND ($pool_status lt 1)">
<a data-id="{$com['id']}" class='butn no_statement' style="cursor:pointer">不结算</a>
</if>
</td>
</if>
</tr>
<foreach name="com.statement_info" item="it" key="k">
<if condition="$k neq 0">
<tr>
<td>{$it['game_name']}</td>
<td>{$it['game_type_name']}</td>
<td>{$it['statement_begin_time']}-{$it['statement_end_time']}</td>
<td>{$it['pay_amount']}</td>
<if condition="$com['statement_info'][0]['row'] gt 1">
<foreach name="com['statement_info'][0]['game_list']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>
<td>{$game['pay_amount']}</td>
<td>{$game['ratio']|showNumPercent}</td>
<td>{$game['increment_ratio']|showNumPercent}</td>
<td>{$game['sum_money']}</td>
</tr>
</if>
</foreach>
</if>
<notempty name="com['statement_info'][1]">
<foreach name="com['statement_info']" item="account" key="akey">
<if condition="$akey gt 0">
<tr>
<td rowspan="{$account['row']}">{$account['account']}</td>
<notempty name="account['game_list']">
<td>{$account['game_list'][0]['game_name']}</td>
<td>{$account['game_list'][0]['game_type_name']}</td>
<td>{$account['game_list'][0]['statement_begin_time']}-{$account['game_list'][0]['statement_end_time']}</td>
<td>{$account['game_list'][0]['pay_amount']}</td>
<td>{$account['game_list'][0]['ratio']|showNumPercent}</td>
<td>{$account['game_list'][0]['increment_ratio']|showNumPercent}</td>
<td>{$account['game_list'][0]['sum_money']}</td>
<else />
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
<td>-</td>
</notempty>
</tr>
<if condition="$it['statement_type'] neq 0">
<td></td>
<td></td>
<else />
<td>{$it['ratio']|default=0}%</td>
<td>{$it['increment_ratio']|default=0}%</td>
<if condition="$account['row'] gt 1">
<foreach name="account['game_list']" item="game" key="gamekey">
<if condition="$gamekey gt 0">
<tr>
<td>{$game['game_name']}</td>
<td>{$game['game_type_name']}</td>
<td>{$game['statement_begin_time']}-{$game['statement_end_time']}</td>
<td>{$game['pay_amount']}</td>
<td>{$game['ratio']|showNumPercent}</td>
<td>{$game['increment_ratio']|showNumPercent}</td>
<td>{$game['sum_money']}</td>
</tr>
</if>
</foreach>
</if>
<td>{$it['reward']}</td>
<td>{$it['fine']}</td>
<td>{$it['sum_money']}</td>
</if>
</foreach>
</tr>
</if>
</foreach>
</notempty>
</foreach>
<tr>
<td colspan=9 >合计:</td>
<td>{$count.platform_amount|default=0}</td>
<td>{$count.platform_amount}</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{$count.sum_money|default=0}</td>
<td>{$count.sum_money}</td>
<td></td>
<td></td>
<td></td>

@ -39,43 +39,12 @@
font-size: 12px;
}
.tooltip {
position: relative;
/* display: block; */
/* color: #056dae; */
}
.tooltip .tooltiptext {
display: none;
width: 100%;
background-color: #fff;
text-align: center;
border-radius: 6px;
padding: 5px 10px 5px 5px;
position: absolute;
z-index: 1;
bottom: 80%;
left: 0;
border: #000 solid 1px;
line-height: 20px;
}
.tooltip .tooltiptext::after {
content: "";
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: black transparent transparent transparent;
}
.tooltip:hover .tooltiptext {
color: #333;
display: block;
}
.butnbox {padding:10px 0 15px;}
.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;}
</style>
<!-- 标题栏 -->
<div class="cf main-place top_nav_list navtab_list">
@ -89,7 +58,7 @@
</style>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch search_list fl cf">
<div class="jssearch search_list fl cf" style="margin-bottom: 10px;">
<div class="input-list search-title-box">
<label>搜索:</label>
</div>
@ -119,7 +88,13 @@
</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">
@ -268,9 +243,7 @@
//导航高亮
highlight_subnav('{:U("FinancialSummary/index")}');
$(function () {
<volist name=":I('get.')" id="vo">
Think.setValue('{$key}',"{$vo}");
</volist>
});
</script>
<script type="text/javascript">
@ -311,6 +284,26 @@
}
window.location.href = url;
});
$("#updateStatement").on("click",function(){
layer.confirm("新增结算需要花费2分钟左右时间,并且只上个月统计信息,无需结算请取消,上次重算时间【{$lastRecount}】",{title:false}, function(index){
$.ajax({
type: 'post',
url: "{:U('updateStatement')}",
data:{},
success: function(data) {
if(data.success){
layer.alert('添加重算任务成功请2分钟后刷新查看');
}else{
layer.alert('添加任务失败,已有重算任务。请上个重算任务完成');
}
},
error:function(){
layer.alert("网络错误或超时");
return false;
}
});
});
})
$(".paixu").click(function () {
var that = $(this);
$data_order = that.attr('data-order');
@ -462,6 +455,9 @@
layer.close(index);
});
}
</script>
</block>
Loading…
Cancel
Save