From a18df8c6fb9646ccf42de1b8363036418514f5b7 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 24 Aug 2020 15:32:43 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=8B=E6=B8=B8?= =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E5=A4=9A=E6=AF=94=E4=BE=8B=E7=BB=93=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementSetController.class.php | 135 ++++++++++++++---- 1 file changed, 107 insertions(+), 28 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementSetController.class.php b/Application/Admin/Controller/CompanyStatementSetController.class.php index 3773c5c1c..ddd0b5e3b 100644 --- a/Application/Admin/Controller/CompanyStatementSetController.class.php +++ b/Application/Admin/Controller/CompanyStatementSetController.class.php @@ -644,7 +644,7 @@ class CompanyStatementSetController extends Controller { $tratio =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); $tratio += $company_ratio; }elseif($type == 0){ - $tratio = $t_game_ratio['ratio']; + $tratio = $tmp_game_ratio['ratio']; }else{ //补点 $tratio1 =$this->getTurnoverRatio($game_all_payment,$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); @@ -878,6 +878,8 @@ class CompanyStatementSetController extends Controller { $game[$v['relation_game_id']]['pay_amount'] = $v['pay_amount']; } } + $pcList[$company_id]['game_ids'] = implode(",",array_keys($game)); + foreach($list as $k=>$v){ try { $res[$company_id]["pay_amount"] += $v['pay_amount']; @@ -1075,40 +1077,88 @@ class CompanyStatementSetController extends Controller { $v['statement_money'] -= $v['server_fee']; } } - + $promoteCompanyGameRatio = D("CompanyGameRatio")->getPromoteCompanyGameRatio($v['id'],$v['game_ids'],$begintime,$endtime,$company_belong); foreach($v['list'] as $ke=>$va){ $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; + + $ratioCount = count($promoteCompanyGameRatio[$p_info['relation_game_id']]); + $isMoreRatio = $ratioCount > 1 ? true : false; + + if(!$isMoreRatio){ + $tmp_game_ratio = $promoteCompanyGameRatio[$p_info['relation_game_id']][0]; + if($type == 1){ + $tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); + $tratio += $company_ratio; + }elseif($type == 0){ + $tratio = $tmp_game_ratio['ratio']; + }else{ + //补点 + $tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); + $tratio2 =$tmp_game_ratio['ratio']; + $tratio = $tratio1-$tratio2+$company_ratio; + if($tratio <= 0){ continue;} } - } - if($type == 2){ - $p_info['increment_ratio']=$tratio; + $tratio -= 0; + if($type == 2){ + $p_info['increment_ratio']=$tratio; + }else{ + $p_info['ratio']=$tratio; + } + + $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; }else{ - $p_info['ratio']=$tratio; + for ($i=0; $i < $ratioCount; $i++) { + $temp_game = []; + $tmp_game_ratio = $promoteCompanyGameRatio[$p_info['relation_game_id']][$i]; + if($type == 1){ + $tratio =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); + $tratio += $company_ratio; + }elseif($type == 0){ + $tratio = $tmp_game_ratio['ratio']; + }else{ + //补点 + $tratio1 =$this->getTurnoverRatio($p_info['all_pay_amount'],$tmp_game_ratio['ratio'],$tmp_game_ratio['turnover_ratio']); + $tratio2 =$tmp_game_ratio['ratio']; + $tratio = $tratio1-$tratio2+$company_ratio; + if($tratio <= 0){ continue;} + } + $tratio -= 0; + if($type == 2){ + $temp_game['increment_ratio']=$tratio; + }else{ + $temp_game['ratio']=$tratio; + } + $temp_game['pay_amount'] = $this->getRelationGameIdPromoteSpend($p_info["p_id"],$p_info['relation_game_id'],$tmp_game_ratio['begintime'],$tmp_game_ratio['endtime']); + $temp_game['pay_amount'] -=0; + + $v['platform_amount'] += $temp_game['pay_amount']; + $temp_game['sum_money']=round($temp_game['pay_amount']*$tratio/100,2); //个人等于 结算金额*比例 + $v['pay_amount'] += $temp_game['sum_money']; + $v['statement_money'] += $temp_game['sum_money']; + + $temp_game['fax_ratio']=$fax_ratio-0; + $temp_game['statement_begin_time']=date("Y.m.d",$tmp_game_ratio['begintime']); + $temp_game['statement_end_time']=date("Y.m.d",$tmp_game_ratio['endtime']); + $temp_game['statement_type']=0; + + $temp_game['relation_game_id']=$p_info["relation_game_id"]; + $temp_game['game_name']=$p_info["game_name"]; + $temp_game['game_type_name']=$p_info["game_type_name"]; + $temp_game['all_pay_amount']=$p_info["all_pay_amount"]; + + $va['game_list'][] = $temp_game; + } } - $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; } $v['statement_info'][] = $va; } @@ -1383,6 +1433,35 @@ class CompanyStatementSetController extends Controller { $pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find(); return $pay_amount['pay_amount'] ?? 0; } + + protected function getRelationGameIdPromoteSpend($promote_id,$relation_game_id,$begintime,$endtime) + { + $res = []; + //获取推广员 + $Promote = M("Promote","tab_"); + $Spend = M("Spend","tab_"); + $spenMap = [ + "s.pay_status"=>1, + "s.payed_time"=>['between', [$begintime,$endtime]], + ]; + + $Pmap = [ + "chain"=>["LIKE","%/{$promote_id}/%"], + "_logic"=>"OR", + "id"=>$promote_id + ]; + $pres = $Promote->field("group_concat(id) ids,count(id) count")->where($Pmap)->group("company_id")->find(); + if($pres['count'] ==0 ){return 0;} + $spenMap['s.promote_id']=["in",$pres['ids']]; + //游戏 + + $game_id = D("Game")->changeRelationGameidToGameid($relation_game_id); + // dd($game_id); + $spenMap['s.game_id'] =['in',$game_id]; + //获取支付记录 + $pay_amount = $Spend->alias('s')->field('sum(s.pay_amount) pay_amount')->where($spenMap)->find(); + return $pay_amount['pay_amount'] ?? 0; + } /** * 重算接口 From 36d72848bbef5503ab4c11aff0d93c640f73db7c Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 24 Aug 2020 15:34:01 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=82=E5=9C=BA?= =?UTF-8?q?=E4=B8=93=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Application/Admin/View/CompanyStatementPool/viewPuPool.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Application/Admin/View/CompanyStatementPool/viewPuPool.html b/Application/Admin/View/CompanyStatementPool/viewPuPool.html index 1b6a6c127..749557685 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPuPool.html +++ b/Application/Admin/View/CompanyStatementPool/viewPuPool.html @@ -103,7 +103,7 @@ 下游名称 会长账号 下游类型 - 市场员 + 市场专员 下游性质 产品 产品类型 From 79468aa6f297ec2b59f1efc6e6fd772b72c124b6 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 24 Aug 2020 17:28:00 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BB=93=E7=AE=97?= =?UTF-8?q?=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementController.class.php | 16 +++++++++++++--- .../Admin/View/CompanyStatement/lists.html | 8 +++++++- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 5288057f2..e157ef131 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -306,6 +306,16 @@ class CompanyStatementController extends ThinkController } } } + public function delStatement(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete(); + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"删除成功" + )); + } + //审批通过 public function adminAgree(){ $this->setVerifyStatus(0,1,"admin"); @@ -729,9 +739,9 @@ class CompanyStatementController extends ThinkController } } //新增结算 - //获取要结算的公司及日期 public function getNewStatement() { + //获取要结算的公司及日期 $senddata = [ "up_company_id"=>[], "dowm_company_id"=>[], @@ -745,8 +755,7 @@ class CompanyStatementController extends ThinkController }else{ $dowm_company_id[]= $v['company_id']; } - } - ; + }; //获取上游 if(empty($up_company_id)){ $upwhere = "1=1"; @@ -895,6 +904,7 @@ class CompanyStatementController extends ThinkController "export"=>"批量导出", "updateNewStatement"=>"新增结算", "launch"=>"对外发起", + "delStatement"=>"批量删除" ]; $resarr = []; foreach ($mentBtn as $k => $v) { diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html index 1fc8d3483..44518f378 100644 --- a/Application/Admin/View/CompanyStatement/lists.html +++ b/Application/Admin/View/CompanyStatement/lists.html @@ -443,7 +443,7 @@ }); }); - $("#adminAgree,#adminRefuse,#verifyAgree,#verifyRefuse,#pool,#updateStatement").on("click",function(){ + $("#adminAgree,#adminRefuse,#verifyAgree,#verifyRefuse,#pool,#updateStatement,#delStatement").on("click",function(){ var id = $(this).attr("id"); if(id == "adminAgree"){ var opname = "管理员审批通过"; @@ -466,6 +466,12 @@ var opst ="[汇总撤销,管理员审批拒绝,未进行审批,管理员审批通过]"; var status = [-3,-2,-1,0,1]; var confirm = true; + }else if(id=="delStatement"){ + var opname = "批量删除"; + var opurl = "{:U('delStatement')}"; + var opst ="[未进行审批]"; + var status = [0]; + var confirm = true; } var confirm = confirm ? confirm :false; var flag = false; From b35d0a0e958578fe994f9be0bbfa92f9e1dc12ad Mon Sep 17 00:00:00 2001 From: chenzhi Date: Mon, 24 Aug 2020 17:30:58 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/Controller/CompanyStatementController.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index e157ef131..6b31b7964 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -310,6 +310,7 @@ class CompanyStatementController extends ThinkController if(!isset($_REQUEST['ids'])) $this->error("参数错误"); $ids = $_REQUEST['ids']; $dbres = $this->DBModel->where("id in ({$ids}) and verify_status = 0")->delete(); + addOperationLog(['op_type'=>2,'key'=>$ids,"op_name"=>"删除结算单",'url'=>U('lists')]); $this->ajaxReturn(array( 'status' => 1, "info"=>"删除成功" From e2d179acd80d284f59b84c6635a1a6aa18462c77 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 25 Aug 2020 09:20:22 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E6=89=93=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ompanyStatementOfflineController.class.php | 158 +++++++ .../CompanyStatementPoolController.class.php | 1 + .../View/CompanyStatementOffline/lists.html | 407 ++++++++++++++++++ 3 files changed, 566 insertions(+) create mode 100644 Application/Admin/Controller/CompanyStatementOfflineController.class.php create mode 100644 Application/Admin/View/CompanyStatementOffline/lists.html diff --git a/Application/Admin/Controller/CompanyStatementOfflineController.class.php b/Application/Admin/Controller/CompanyStatementOfflineController.class.php new file mode 100644 index 000000000..25893f7f5 --- /dev/null +++ b/Application/Admin/Controller/CompanyStatementOfflineController.class.php @@ -0,0 +1,158 @@ +"下游公司", + "2"=>"下游个人", + "3"=>"上游公司" + ]; + public $IsPayment = [ + "1"=>"是", + "2"=>"否" + ]; + public $PayStatus=[ + "-1"=>"打款失败", + "0"=>"未打款", + "1"=>"打款成功" + ]; + public $VerifyStatus=[ + "-1"=>"审批拒绝", + "0"=>"未审批", + "1"=>"审批通过", + ]; + public function lists() { + $params = I('get.'); + $page = $params['p'] ? intval($params['p']) : 1; + $row = $params['row'] ? intval($params['row']) : 10; + //权限分配 + if(!IS_ROOT){ + $this->OpAuthList= getModuleControllerAuth(); + } + $this->assign('menubtn',$this->menuAuth()); + + $map = [ + "c.verify_status"=>2 + ]; + if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { + $time_start = strtotime($_REQUEST['time_start']); + $time_end = strtotime($_REQUEST['time_end'])+ 86399; + $map["_string"] = "(c.statement_begin_time BETWEEN {$time_start} AND {$time_end}) OR (c.statement_end_time BETWEEN {$time_start} AND {$time_end}) OR (c.statement_begin_time <= {$time_end} AND c.statement_end_time >= {$time_end})"; + } elseif (isset($_REQUEST['time_start'])) { + $time_start = strtotime($_REQUEST['time_start']); + $map["_string"] = "(c.statement_begin_time >= {$time_start} ) OR (c.statement_end_time >= {$time_start})"; + } elseif (isset($_REQUEST['time_end'])) { + $time_end = strtotime($_REQUEST['time_end'])+ 86399; + $map["_string"] = "(c.statement_begin_time <= {$time_end} ) OR (c.statement_end_time <= {$time_end})"; + } + + //其他 + if(isset($_REQUEST['company_type'])){ + $map['c.company_type'] = $_REQUEST['company_type']; + } + if(isset($_REQUEST['company_name'])){ + $map['c.company_name'] =["LIKE","%{$_REQUEST['company_name']}%"]; + } + // if(isset($_REQUEST['statement_pool_num'])){ + // $map['statement_pool_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"]; + // } + // if(isset($_REQUEST['is_payment'])){ + // $map['is_payment'] = $_REQUEST['is_payment']; + // } + + // $this->checkListOrCountAuthRestMap($map);//导出权限 + + //条件end + $data = M("company_statement_info","tab_") + ->alias("c") + ->field("c.*,p.statement_num,p.verify_status") + ->where($map) + + ->join("left join tab_company_statement_pool as p ON c.pool_id = p.id") + + ->page($page,$row) + ->order("id desc") + ->select(); + + foreach($data as $k => &$v) { + + $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']); + $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']); + $v['company_type_str'] = $this->CompanyType[$v['company_type']]; + $v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}"; + $v["pay_status_str"] = $this->PayStatus[$v["pay_status"]]; + if($v["verify_status"] < 0){ + $v["verify_status"] = -1; + } + if($v["verify_status"] > 0){ + $v["verify_status"] = 1; + } + $v["verify_status_str"] = $this->VerifyStatus[$v["verify_status"]]; + + + $v['oplist'] = $this->OpAuth($v); + } + + $count = M("company_statement_info","tab_")->alias("c")->field("count(id) count,sum(statement_money) statement_money")->where($map)->find(); + // dd($count); + $params['p'] = $page; + $params['row'] = $row; + $page = set_pagination($count['count'], $row, $params); + if ($page) { + $this->assign('_page', $page); + } + // dd($data); + $this->assign('data',$data); + $this->assign('count',$count); + $this->assign('CompanyType',$this->CompanyType); + $this->display(); + + } + + public function OpAuth($info) + { + $id = $info['id']; + $type = $info['company_type']; + //原始列表 + $opBtn = [ + "viewStatement"=>"查看", + ]; + //操作对应菜单 + $optist = ["viewStatement"]; + $resarr = []; + foreach ($optist as $k => $v) { + if(IS_ROOT){ + $resarr[] = $opBtn[$v]; + }else{ + if(in_array($v,$this->OpAuthList)){ + $resarr[] = $opBtn[$v]; + } + } + } + return $resarr; + } + public function menuAuth() + { + $mentBtn = [ + "pool"=>"发起汇总", + "export"=>"批量导出" + ]; + $resarr = []; + foreach ($mentBtn as $k => $v) { + if(IS_ROOT){ + $resarr[] = $v; + }else{ + if(in_array($k,$this->OpAuthList)){ + $resarr[] = $v; + } + } + } + return $resarr; + } + +} diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index a86ca4153..ccf4b5520 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -293,6 +293,7 @@ class CompanyStatementPoolController extends ThinkController $count["platform_amount"] = "=SUM(J2:J".$line.")"; $count["sum_money"] = "=SUM(P2:P".$line.")"; } + // dd($infolist); $this->assign("data",$infolist); $this->assign("count",$count); $this->assign("is_export",$is_export); diff --git a/Application/Admin/View/CompanyStatementOffline/lists.html b/Application/Admin/View/CompanyStatementOffline/lists.html new file mode 100644 index 000000000..c461dcf05 --- /dev/null +++ b/Application/Admin/View/CompanyStatementOffline/lists.html @@ -0,0 +1,407 @@ + + + + + + + + + + + + + + + + + +
+ +
+ +
+ +
+ +
+   +
+ +
+   +
+ +
+ +  -  +
+ + +
+
+ + + +
+ 搜索 +
+ +
+
+ +
+
+ + {$vo} + +
+
+ + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
合作公司公司类型结算时间结算金额结算流水汇总单状态打款状态汇总单号汇总单号操作
aOh! 暂时还没有内容!
{$data.company_name}{$data.company_type_str}{$data.valid}{$data.statement_money}{$data.platform_amount}{$data.verify_status_str}{$data.pay_status_str}{$data.statement_num} + + {$vo} + +
合计结算总金额: {$count.statement_money}
+
+ +
+
+ + + + {$_page|default=''} +
+
+ + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + + + + From 69cf42e895270a7fe6818b4d4ee0da94a6d8893f Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 25 Aug 2020 11:16:24 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E7=A1=AE=E8=AE=A4=E6=89=93=E6=AC=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ompanyStatementOfflineController.class.php | 88 ++++++++++++++----- .../CompanyStatementPoolController.class.php | 12 +-- .../View/CompanyStatementOffline/lists.html | 21 ++--- 3 files changed, 75 insertions(+), 46 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementOfflineController.class.php b/Application/Admin/Controller/CompanyStatementOfflineController.class.php index 25893f7f5..795822b43 100644 --- a/Application/Admin/Controller/CompanyStatementOfflineController.class.php +++ b/Application/Admin/Controller/CompanyStatementOfflineController.class.php @@ -21,11 +21,7 @@ class CompanyStatementOfflineController extends ThinkController "0"=>"未打款", "1"=>"打款成功" ]; - public $VerifyStatus=[ - "-1"=>"审批拒绝", - "0"=>"未审批", - "1"=>"审批通过", - ]; + public function lists() { $params = I('get.'); $page = $params['p'] ? intval($params['p']) : 1; @@ -37,7 +33,8 @@ class CompanyStatementOfflineController extends ThinkController $this->assign('menubtn',$this->menuAuth()); $map = [ - "c.verify_status"=>2 + "c.verify_status"=>2, + "p.verify_status"=>["GT",1] ]; if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) { $time_start = strtotime($_REQUEST['time_start']); @@ -58,14 +55,6 @@ class CompanyStatementOfflineController extends ThinkController if(isset($_REQUEST['company_name'])){ $map['c.company_name'] =["LIKE","%{$_REQUEST['company_name']}%"]; } - // if(isset($_REQUEST['statement_pool_num'])){ - // $map['statement_pool_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"]; - // } - // if(isset($_REQUEST['is_payment'])){ - // $map['is_payment'] = $_REQUEST['is_payment']; - // } - - // $this->checkListOrCountAuthRestMap($map);//导出权限 //条件end $data = M("company_statement_info","tab_") @@ -73,7 +62,7 @@ class CompanyStatementOfflineController extends ThinkController ->field("c.*,p.statement_num,p.verify_status") ->where($map) - ->join("left join tab_company_statement_pool as p ON c.pool_id = p.id") + ->join("tab_company_statement_pool as p ON c.pool_id = p.id") ->page($page,$row) ->order("id desc") @@ -86,19 +75,18 @@ class CompanyStatementOfflineController extends ThinkController $v['company_type_str'] = $this->CompanyType[$v['company_type']]; $v["valid"] = "{$v['statement_begin_time']}-{$v['statement_end_time']}"; $v["pay_status_str"] = $this->PayStatus[$v["pay_status"]]; - if($v["verify_status"] < 0){ - $v["verify_status"] = -1; - } - if($v["verify_status"] > 0){ - $v["verify_status"] = 1; + + $v["pay_info"] = json_decode($v['pay_info'], true); + if(isset($v['pay_info']['payment_user'])){ + $v["payment"]= "{$v['pay_status_str']}({$v['verify_log']['payment_user']})
{$v['verify_log']['payment_time']}"; + }else{ + $v["payment"] = $v["pay_status_str"]; } - $v["verify_status_str"] = $this->VerifyStatus[$v["verify_status"]]; - $v['oplist'] = $this->OpAuth($v); } - $count = M("company_statement_info","tab_")->alias("c")->field("count(id) count,sum(statement_money) statement_money")->where($map)->find(); + $count = M("company_statement_info","tab_")->alias("c")->field("count(c.id) count,sum(c.statement_money) statement_money")->join("tab_company_statement_pool as p ON c.pool_id = p.id")->where($map)->find(); // dd($count); $params['p'] = $page; $params['row'] = $row; @@ -113,6 +101,58 @@ class CompanyStatementOfflineController extends ThinkController $this->display(); } + public function doPayment() + { + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + //获取所有的母单id + $companyStatementInfo = M("company_statement_info","tab_"); + $statementPool = $companyStatementInfo->where("id in ($ids) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select(); + $poolInfo = []; + foreach ($statementPool as $k => $v) { + $poolInfo[$v['pool_id']] = $v['count']; + } + unset($statementPool); + + //修改info + $saveData = [ + "pay_type"=>3, + "pay_status"=>1, + "pay_info"=>json_encode(["payment_user"=>$_SESSION['onethink_admin']['user_auth']["username"],"payment_time"=>date("Y-m-d H:i:s")]) + ]; + $ires = $companyStatementInfo->where("id in ($ids)")->save($saveData); + + //获取母单未支付完成订单 + $poolIds = implode(",",array_keys($poolInfo)); + $poolInfo = $companyStatementInfo->where("pool_id in ($poolIds) and pay_status <> 1")->field("pool_id,count(id) count")->group("pool_id")->select(); + + //全部就打款成功,否则打款中 + $companyStatementPool = M("company_statement_pool","tab_"); + foreach ($poolInfo as $k => $v) { + if($v['count'] == $poolInfo[$v['pool_id']]){ + //打款成功 + $this->setOneVerifyStatus(4,"payment",$v['pool_id']); + }else{ + //打款中 + $this->setOneVerifyStatus(3,"payment",$v['pool_id']); + } + } + + $this->ajaxReturn(array( + 'status' =>1, + "info"=>"打款确认成功" + )); + } + protected function setOneVerifyStatus($change_status,$op_pre,$id) + { + $dbres = M("company_statement_pool","tab_")->field("id,verify_status,verify_log")->where("id = {$id}")->find(); + $dbres['verify_log'] = json_decode($dbres['verify_log'],true); + $dbres['verify_log'][$op_pre.'_user']=$_SESSION['onethink_admin']['user_auth']["username"]; + $dbres['verify_log'][$op_pre.'_time']=date("Y-m-d H:i:s"); + $dbres['verify_log'] = json_encode($dbres['verify_log']); + $dbres['verify_status']=$change_status; + M("company_statement_pool","tab_")->save($dbres); + } public function OpAuth($info) { @@ -139,7 +179,7 @@ class CompanyStatementOfflineController extends ThinkController public function menuAuth() { $mentBtn = [ - "pool"=>"发起汇总", + "doPayment"=>"打款确认", "export"=>"批量导出" ]; $resarr = []; diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index ccf4b5520..ad6a3bf0f 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -151,24 +151,16 @@ class CompanyStatementPoolController extends ThinkController if(isset($v['verify_log']['payment_user'])){ if($v['verify_status'] == -2){ $ts = "拒绝打款"; - $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; }elseif($v['verify_status'] == 2){ $ts = "待打款"; - $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; }elseif($v['verify_status'] == 3){ $ts = "打款中"; - $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; }elseif($v['verify_status'] == 4){ - if($v['is_payment']==1){ - $ts="线上打款成功"; - }else{ - $ts="线下打款成功"; - } - $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; + $ts="打款成功"; }elseif($v['verify_status'] == 5){ $ts="无需打款"; - $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; } + $v["payment"]= "{$ts}({$v['verify_log']['payment_user']}){$symbol} {$v['verify_log']['payment_time']}"; }else{ $v["payment"] = '--'; } diff --git a/Application/Admin/View/CompanyStatementOffline/lists.html b/Application/Admin/View/CompanyStatementOffline/lists.html index c461dcf05..97e8017e6 100644 --- a/Application/Admin/View/CompanyStatementOffline/lists.html +++ b/Application/Admin/View/CompanyStatementOffline/lists.html @@ -162,7 +162,6 @@ 结算金额 结算流水 - 汇总单状态 打款状态 汇总单号汇总单号 @@ -180,13 +179,12 @@ - + {$data.company_name} {$data.company_type_str} {$data.valid} {$data.statement_money} {$data.platform_amount} - {$data.verify_status_str} {$data.pay_status_str} {$data.statement_num} @@ -279,24 +277,23 @@ }); }); - $("#pool").on("click",function(){ + $("#doPayment").on("click",function(){ var id = $(this).attr("id"); var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - return $(elem).val(); + if($(elem).data("paystatus") == 0){ + return $(elem).val(); + } }).get(); - if(text.length > 40){ - layer.msg("" + '为保证效率暂不支持超过40条的批量操作' + ""); - return; - } if(text.length < 1){ - layer.msg("" + '无需要汇总的操作'+""); + layer.msg("无需要进行确认打款确认操作的数据"); return; } + text = text.join(","); if(confirm){ - layer.confirm('【警告】汇总后将不可回退,如需继续请点击确认', { + layer.confirm('【警告】确认打款后将不可回退,如需继续请点击确认', { btn: ['确认','取消'], title:false }, function(){ @@ -310,7 +307,7 @@ //执行 $.ajax({ type: "POST", - url: "{:U('pool')}", + url: "{:U('doPayment')}", dataType: 'json', async: false, data: {ids:text}, From 4a98c587fa1a80c9705883cf14dfd1f8310af68f Mon Sep 17 00:00:00 2001 From: chenzhi Date: Tue, 25 Aug 2020 14:46:57 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BA=BF=E4=B8=8B?= =?UTF-8?q?=E6=89=93=E6=AC=BE=E7=A1=AE=E8=AE=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ompanyStatementOfflineController.class.php | 58 ++++++++++++++++++- .../CompanyStatementPoolController.class.php | 11 +++- .../View/CompanyStatementOffline/lists.html | 38 ++++++------ .../View/CompanyStatementPool/lists.html | 4 +- .../CompanyStatementPool/viewPayment.html | 25 ++++++-- 5 files changed, 105 insertions(+), 31 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementOfflineController.class.php b/Application/Admin/Controller/CompanyStatementOfflineController.class.php index 795822b43..c9b44d4f3 100644 --- a/Application/Admin/Controller/CompanyStatementOfflineController.class.php +++ b/Application/Admin/Controller/CompanyStatementOfflineController.class.php @@ -56,6 +56,12 @@ class CompanyStatementOfflineController extends ThinkController $map['c.company_name'] =["LIKE","%{$_REQUEST['company_name']}%"]; } + if(isset($_REQUEST['statement_pool_num'])){ + $map['p.statement_num'] =["LIKE","%{$_REQUEST['statement_pool_num']}%"]; + } + + + //条件end $data = M("company_statement_info","tab_") ->alias("c") @@ -78,7 +84,7 @@ class CompanyStatementOfflineController extends ThinkController $v["pay_info"] = json_decode($v['pay_info'], true); if(isset($v['pay_info']['payment_user'])){ - $v["payment"]= "{$v['pay_status_str']}({$v['verify_log']['payment_user']})
{$v['verify_log']['payment_time']}"; + $v["payment"]= "{$v['pay_status_str']}({$v['pay_info']['payment_user']})
{$v['pay_info']['payment_time']}"; }else{ $v["payment"] = $v["pay_status_str"]; } @@ -143,6 +149,56 @@ class CompanyStatementOfflineController extends ThinkController "info"=>"打款确认成功" )); } + public function viewStatement() + { + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $is_export= false; + if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ + $is_export = true; + } + //获取基本信息 + $dbres = M("company_statement_info","tab_")->where("id='{$id}'")->select(); + $title = $dbres[0]['company_name']; + $this->assign("title",$title); + + if($dbres[0]['company_type'] == 3){ + //上游 + A("CompanyStatementPool")->viewCpPool($dbres,$is_export); + }elseif($dbres[0]['company_type'] == 1){ + //下游公司 + A("CompanyStatementPool")->viewPcPool($dbres,$is_export); + }else{ + A("CompanyStatementPool")->viewPuPool($dbres,$is_export); + } + } + + public function export(){ + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = M("company_statement_info","tab_")->where("id in ({$ids})")->select(); + + $is_export= false; + if (isset($_REQUEST['export']) && $_REQUEST['export']==1){ + $is_export = true; + } + + if($dbres[0]['company_type'] == 3){ + //上游 + $this->assign("title","上游公司线下打款"); + A("CompanyStatementPool")->viewCpPool($dbres,$is_export); + }elseif($dbres[0]['company_type'] == 1){ + //下游公司 + $this->assign("title","下游公司线下打款"); + A("CompanyStatementPool")->viewPcPool($dbres,$is_export); + }else{ + $this->assign("title","下游个人线下打款"); + A("CompanyStatementPool")->viewPuPool($dbres,$is_export); + } + } + protected function setOneVerifyStatus($change_status,$op_pre,$id) { $dbres = M("company_statement_pool","tab_")->field("id,verify_status,verify_log")->where("id = {$id}")->find(); diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index ad6a3bf0f..08214598f 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -578,11 +578,16 @@ class CompanyStatementPoolController extends ThinkController $v['company_info'] = json_decode($v['company_info'],true); $v['company_info']['ali_user'] ?? ''; $v['company_info']['ali_account'] ?? ''; - $v['verify_status_str'] = $this->InfoVerifyStatus[ $v['verify_status']]; + + if($v['verify_status'] == 2){ + $v['is_payment'] = 2; + }else{ + $v['is_payment'] = 1; + } + + $v['verify_status_str'] = $this->PayStatus[$v['pay_status']]; if($v['verify_status'] == 1){ - - $v['verify_status_str'] = $this->PayStatus[$v['pay_status']]; if($v['pay_status'] == 1){ $v['pay_type'] = $v['pay_type'] == 1 ? "提现" :"线上打款"; $v['verify_status_str'] .= ("/". $v['pay_type']); diff --git a/Application/Admin/View/CompanyStatementOffline/lists.html b/Application/Admin/View/CompanyStatementOffline/lists.html index 97e8017e6..935c60ec7 100644 --- a/Application/Admin/View/CompanyStatementOffline/lists.html +++ b/Application/Admin/View/CompanyStatementOffline/lists.html @@ -44,9 +44,9 @@ font-weight: 600; font-size: 18px; } - /* .data_list table td{ + .data_list table td{ line-height: 2; - } */ + } .layui-layer-title { text-align: center; @@ -179,13 +179,13 @@ - + {$data.company_name} {$data.company_type_str} {$data.valid} {$data.statement_money} {$data.platform_amount} - {$data.pay_status_str} + {$data.payment} {$data.statement_num} @@ -327,24 +327,22 @@ }) $("#export").click(function () { + var company = []; var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - return $(elem).val(); - }).get(); - - if(text.length > 20){ - layer.msg("" + '暂不支持超过20条的批量导出' + ""); - return; - } - if(text.length < 1){ - layer.msg("" + '请先选择要导出的结算单' + ""); - return; - } - for (var index = 0; index < text.length; index++) { - var id = text[index]; - var url ="{:U('viewStatement')}"+"&id="+id+"&export=1"; - var iframeExcel = ""//添加下载的地址到iframe,这里是公司信息,我用**表示了。 + var cid = $(elem).data("companytype"); + try { + company[cid].push($(elem).val()); + } catch (error) { + company[cid] = []; + company[cid].push($(elem).val()); + } + }); + company.forEach(function(e){ + var ids = e.join(","); + var url ="{:U('export')}"+"&ids="+ids+"&export=1"; + var iframeExcel = ""; $("body").append(iframeExcel) - } + }); }) diff --git a/Application/Admin/View/CompanyStatementPool/lists.html b/Application/Admin/View/CompanyStatementPool/lists.html index 831d04102..3f5ef3ef7 100644 --- a/Application/Admin/View/CompanyStatementPool/lists.html +++ b/Application/Admin/View/CompanyStatementPool/lists.html @@ -430,7 +430,7 @@ title: "海南万盟天下科技有限公司", shadeClose: true, shade: 0.8, - area: ['80%', '80%'], + area: ['100%', '100%'], content: url }); }) @@ -442,7 +442,7 @@ title: "海南万盟天下科技有限公司", shadeClose: true, shade: 0.8, - area: ['70%', '80%'], + area: ['100%', '100%'], content: url }); }) diff --git a/Application/Admin/View/CompanyStatementPool/viewPayment.html b/Application/Admin/View/CompanyStatementPool/viewPayment.html index 3c2edbee7..4f1dfca5a 100644 --- a/Application/Admin/View/CompanyStatementPool/viewPayment.html +++ b/Application/Admin/View/CompanyStatementPool/viewPayment.html @@ -105,8 +105,12 @@ 序号 合作公司 - 支付宝真实名称 - 支付宝账号 + + 是否支付宝打款 + 户名 + 帐号 + 开户行 + 关联结算汇总单订单号 金额(元) 备注 @@ -119,8 +123,19 @@ {$key-0+1} {$vo.company_name} - {$vo.company_info.ali_user} - {$vo.company_info.ali_account} + + + 是 + {$vo.company_info.ali_user} + {$vo.company_info.ali_account} + + + 否 + {$vo.company_info.payee_name} + {$vo.company_info.bank_account} + {$vo.company_info.opening_bank} + + {$vo.statement_num} {$vo.statement_money} {$vo.remark} @@ -130,7 +145,7 @@ 合计: - 打款总金额:{$CompanyInfo[0]['all_money']} + 打款总金额:{$CompanyInfo[0]['all_money']}