From 2a303cf0f59eaf185cb44e46897ceae973a3dcd0 Mon Sep 17 00:00:00 2001 From: chenzhi Date: Sat, 25 Jul 2020 20:59:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AE=A1=E6=A0=B8=E6=B5=81?= =?UTF-8?q?=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CompanyStatementController.class.php | 91 ++++++++++---- .../Admin/View/CompanyStatement/lists.html | 111 ++++++++++++++---- Data/update.sql | 43 +++++++ 3 files changed, 201 insertions(+), 44 deletions(-) diff --git a/Application/Admin/Controller/CompanyStatementController.class.php b/Application/Admin/Controller/CompanyStatementController.class.php index 4bfb3d8b8..a1fbdf569 100644 --- a/Application/Admin/Controller/CompanyStatementController.class.php +++ b/Application/Admin/Controller/CompanyStatementController.class.php @@ -19,13 +19,18 @@ class CompanyStatementController extends ThinkController "9"=>"上游" ]; public $VerifyStatus=[ - "-2"=>"汇总撤销", - "-1"=>"审批拒绝", + "-3"=>"汇总撤销", + "-2"=>"审核拒绝", + "-1"=>"管理员审批拒绝", "0"=>"未审批", - "1"=>"审核通过", - "2"=>"对外发起", - "3"=>"合作确认", - "4"=>"已汇总" + "1"=>"管理员审核通过", + "2"=>"审核通过", + "3"=>"已汇总" + ]; + public $ConfirmStatus=[ + "0"=>"未发起", + "1"=>"已发起", + "2"=>"已确认" ]; public $admininfo; public $DBModel; @@ -112,12 +117,15 @@ class CompanyStatementController extends ThinkController if(isset($_REQUEST['verify_status'])){ $map['verify_status'] = $_REQUEST['verify_status']; } + if(isset($_REQUEST['confirm_status'])){ + $map['confirm_status'] = $_REQUEST['confirm_status']; + } // $this->checkListOrCountAuthRestMap($map);//导出权限 //条件end $data = M("company_statement","tab_") - ->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,op_time,remark") + ->field("id,withdraw_type,company_name,company_belong,statement_begin_time,statement_end_time,statement_money,platform_amount,verify_status,verify_log,confirm_status,confirm_log,op_time,remark") ->where($map) - ->order("FIELD(verify_status,0,1,-1,2,3,-2,4,5),id desc")->page($page,$row)->select(); + ->order("FIELD(verify_status,0,1,-1,2,3,-2,-3),id desc")->page($page,$row)->select(); foreach($data as $k => &$v) { $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']); @@ -132,14 +140,26 @@ class CompanyStatementController extends ThinkController $v['withdraw_type_2'] = ($v['withdraw_type'] == 2 ? "补点" :"正常结算"); $v['verify_log'] = json_decode($v['verify_log'], true); + $v['confirm_log'] = json_decode($v['confirm_log'], true); if (isset($params['export'])) { $symbol = "\n"; } else { $symbol = "
"; } $v["create"]= "{$v['verify_log']['create_user']} {$symbol} {$v['verify_log']['create_time']}"; - if(isset($v['verify_log']['verify_user'])){ + if(isset($v['verify_log']['admin_user'])){ if($v['verify_status'] == -1){ + $ts = "管理员审核拒绝"; + }else{ + $ts = "管理员审核通过"; + } + $v["admin"]= "{$ts}({$v['verify_log']['admin_user']}) {$symbol} {$v['verify_log']['admin_time']}"; + }else{ + $v["admin"] = '--'; + } + + if(isset($v['verify_log']['verify_user'])){ + if($v['verify_status'] == -2){ $ts = "审核拒绝"; }else{ $ts = "审核通过"; @@ -149,21 +169,21 @@ class CompanyStatementController extends ThinkController $v["verify"] = '--'; } - if(isset($v['verify_log']['launch_user'])){ + if(isset($v['confirm_log']['launch_user'])){ $ts = "已发起"; - $v["launch"]= "{$ts}({$v['verify_log']['launch_user']}) {$symbol} {$v['verify_log']['launch_time']}"; + $v["launch"]= "{$ts}({$v['confirm_log']['launch_user']}) {$symbol} {$v['confirm_log']['launch_time']}"; }else{ $v["launch"] = '--'; } - if(isset($v['verify_log']['confirm_user'])){ + if(isset($v['confirm_log']['confirm_user'])){ $ts = "已确认"; - $v["confirm"]= "{$ts}({$v['verify_log']['confirm_user']}) {$symbol} {$v['verify_log']['confirm_time']}"; + $v["confirm"]= "{$ts}({$v['confirm_log']['confirm_user']}) {$symbol} {$v['confirm_log']['confirm_time']}"; }else{ $v["confirm"] = '--'; } if(isset($v['verify_log']['pool_user'])){ - if($v['verify_status'] == -2){ + if($v['verify_status'] == -3){ $ts = "撤销汇总"; $v["pool"]= "{$ts}({$v['verify_log']['pool_user']}){$symbol} {$v['verify_log']['pool_time']}"; }else{ @@ -190,6 +210,7 @@ class CompanyStatementController extends ThinkController $this->assign('CompanyType',$this->CompanyType); $this->assign('CompanyBelong',$this->CompanyBelong); $this->assign('VerifyStatus',$this->VerifyStatus); + $this->assign('ConfirmStatus',$this->ConfirmStatus); $this->display(); } @@ -296,15 +317,40 @@ class CompanyStatementController extends ThinkController } } //审批通过 + public function adminAgree(){ + $this->setVerifyStatus(0,1,"admin"); + } + public function adminRefuse(){ + $this->setVerifyStatus(0,-1,"admin"); + } public function verifyAgree(){ - $this->setVerifyStatus(0,1,"verify"); + $this->setVerifyStatus(1,2,"verify"); } public function verifyRefuse(){ - $this->setVerifyStatus(0,-1,"verify"); + $this->setVerifyStatus(1,-2,"verify"); } + public function launch(){ - $this->setVerifyStatus(1,2,"launch"); + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + $dbres = $this->DBModel->field("id,confirm_status,confirm_log")->where("id in ({$ids})")->select(); + foreach($dbres as $k=>&$v){ + if($v['confirm_status'] != 0) continue; + $v['confirm_log'] = json_decode($v['confirm_log'],true); + $v['confirm_log']['launch_user']=$this->admininfo["username"]; + $v['confirm_log']['launch_time']=date("Y-m-d H:i:s"); + $v['confirm_log'] = json_encode($v['confirm_log']); + $v['confirm_status']=1; + // $v['op_time'] = time(); + $this->DBModel->save($v); + addOperationLog(['op_type'=>1,'key'=>$v['id'],"op_name"=>"发起确认",'url'=>U('lists')]); + } + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"对外发起成功" + )); } + protected function setVerifyStatus($old_status,$change_status,$op_pre) { if(!isset($_REQUEST['ids'])) $this->error("参数错误"); @@ -457,7 +503,7 @@ class CompanyStatementController extends ThinkController } foreach ($dbres as $k=>$v) { - if($v['verify_status'] != 3) continue; + if($v['verify_status'] != 2) continue; if($v['company_belong'] == 9){ //上游 if($v['is_payment'] == 1){ @@ -516,7 +562,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'],3,4,"pool",$v['statement_num']); + $this->updatePoolVerifyStatus($v['statement_ids'],2,3,"pool",$v['statement_num']); } $this->ajaxReturn(array( 'status' => 1, @@ -843,9 +889,6 @@ class CompanyStatementController extends ThinkController case '3': $optist = ["viewStatement","addRemark","viewRemark","editRemark"]; break; - case '4': - $optist = ["viewStatement","addRemark","viewRemark","editRemark"]; - break; default: break; } @@ -871,13 +914,15 @@ class CompanyStatementController extends ThinkController public function menuAuth() { $mentBtn = [ + "adminAgree"=>"管理员审核通过", + "adminRefuse"=>"管理员审核拒绝", "verifyAgree"=>"审批通过", "verifyRefuse"=>"审核拒绝", - "launch"=>"对外发起", "pool"=>"发起汇总", "updateStatement"=>"重算金额", "export"=>"批量导出", "updateNewStatement"=>"新增结算", + "launch"=>"对外发起", ]; $resarr = []; foreach ($mentBtn as $k => $v) { diff --git a/Application/Admin/View/CompanyStatement/lists.html b/Application/Admin/View/CompanyStatement/lists.html index 1aaafbdae..f4972427c 100644 --- a/Application/Admin/View/CompanyStatement/lists.html +++ b/Application/Admin/View/CompanyStatement/lists.html @@ -146,6 +146,15 @@ +
+ +
+
 -  @@ -186,10 +195,11 @@ 结算金额 结算流水 创建记录 + 管理员审核 审批状态 + 汇总状态 对外发起 合作确认 - 汇总状态 操作 @@ -204,7 +214,7 @@ - + {$data.company_name} {$data.company_belong} {$data.valid} @@ -215,6 +225,17 @@ {$data.create} +
+ {$data.admin} +
+ +
+ {$data.admin} +
+
+ + +
{$data.verify}
@@ -224,10 +245,8 @@
- {$data.launch} - {$data.confirm} - +
{$data.pool}
@@ -237,6 +256,8 @@
+ {$data.launch} + {$data.confirm} {$vo} @@ -244,7 +265,7 @@ - 合计结算总金额: {$count.statement_money}     结算总流水: {$count['platform_amount']} (补点不重复统计在内) + 合计结算总金额: {$count.statement_money}     结算总流水: {$count['platform_amount']} (补点不重复统计在内) @@ -386,7 +407,7 @@ //设置对账网址 var order_url = window.location.protocol+"//"+window.location.host+"/admin.php?s=/Public/cp_login.html"; - $("#order_url").html("流程说明:结算自动生成对账单--->财务审核对账单--->发起对外对账--->合作方进行确认--->进入报销流程【合作方确认地址:"+order_url+"】"); + $("#order_url").html("流程说明:结算自动生成对账单--->管理员审核--->财务审核对账单--->发起汇总 / 确认流程: 发起对外对账--->合作方进行确认【合作方确认地址:"+order_url+"】"); $("#updateNewStatement").on("click",function(){ layer.confirm("新增结算需要花费2分钟左右时间,并且只计算一个月内的新增结算,请勿在中途关闭页面,无需新增结算请取消",{title:false}, function(index){ @@ -428,33 +449,38 @@ }); }); - $("#verifyAgree,#verifyRefuse,#launch,#pool,#updateStatement").on("click",function(){ + $("#adminAgree,#adminRefuse,#verifyAgree,#verifyRefuse,#pool,#updateStatement").on("click",function(){ var id = $(this).attr("id"); - if(id == "verifyAgree"){ - var opname = "审批通过"; - var opurl = "{:U('verifyAgree')}"; + if(id == "adminAgree"){ + var opname = "管理员审批通过"; + var opurl = "{:U('adminAgree')}"; + var opst ="[未进行审批]"; + var status = [0]; + }else if(id=="adminRefuse"){ + var opname = "管理员审批拒绝"; + 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 = [0]; - }else if(id=="launch"){ - var opname = "对外发起"; - var opurl = "{:U('launch')}"; - var opst ="[审批通过]"; + var opst ="[管理员审批通过]"; var status = [1]; }else if(id=="pool"){ var opname = "发起汇总"; var opurl = "{:U('pool')}"; - var opst ="[合作方确认]"; - var status = [3]; + var opst ="[审批通过]"; + var status = [2]; }else if(id=="updateStatement"){ var opname = "重算金额"; var opurl = "{:U('updateStatement')}"; - var opst ="[汇总撤销,审批拒绝,未进行审批,审批通过,对外发起]"; - var status = [-2,-1,0,1,2]; + var opst ="[汇总撤销,管理员审批拒绝,审批拒绝,未进行审批,管理员审批通过,审批通过]"; + var status = [-3,-2,-1,0,1,2]; var confirm = true; } var confirm = confirm ? confirm :false; @@ -521,6 +547,49 @@ }); } }) + $("#launch").on("click",function(){ + var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + if($(elem).data("confirm") == 0){ + return $(elem).val(); + } + }).get(); + if(text.length < 1){ + layer.msg("" + '无需要进行[对外发起]的申请,仅[未发起]状态可以进行[对外发起]操作'); + return; + } + text = text.join(","); + layer.confirm('【警告】[对外发起]将不可回退,如需继续请点击确认', { + btn: ['确认','取消'], + title:false + }, function(index){ + layer.close(index); + _doAgreeApply(); + }); + function _doAgreeApply(){ + //执行 + layer.load(2); + $.ajax({ + type: "POST", + url: "{:U('launch')}", + dataType: 'json', + async: true, + data: {ids:text}, + success:function(data){ + layer.closeAll('loading'); + if(data.status==1){ + layer.msg("" + data.info + ""); + setTimeout(function(){ + window.location.reload(); + },1500); + }else{ + layer.msg("" + data.info + ""); + return false; + } + } + }); + } + + }) $("#export").click(function () { var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { diff --git a/Data/update.sql b/Data/update.sql index 9784407ca..b5a5cedf9 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2241,4 +2241,47 @@ INSERT INTO `tab_payment_member` (`id`, `real_name`, `mobile`, `last_login_time` ALTER TABLE `tab_game` ADD COLUMN `select_package_name` tinyint(2) NOT NULL DEFAULT 0 COMMENT '结算包名 0:原包名 1:现包名' AFTER `original_package_name`; +--chenzhi 新增结算发起 +CREATE TABLE `tab_company_statement` ( + `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '自增主键', + `withdraw_type` tinyint(2) DEFAULT '0' COMMENT '对账类型(0-周结 1月结 2补点)', + `company_id` int(11) DEFAULT '0' COMMENT '对账公司id', + `company_name` varchar(60) NOT NULL DEFAULT '' COMMENT '对账公司名称', + `company_belong` tinyint(1) NOT NULL DEFAULT '0' COMMENT '工会归属:0-下游内团;1-下游外团 2-下游分发联盟 3 下游无,9:上游', + `company_type` tinyint(3) NOT NULL DEFAULT '1' COMMENT '公司性质:1-公司 2-个人', + `is_payment` tinyint(3) NOT NULL DEFAULT '1' COMMENT '是否需要打款:1-是 2-否(线下)', + + `statement_begin_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账开始时间', + `statement_end_time` int(11) NOT NULL DEFAULT '0' COMMENT '对账截止时间', + + `statement_money` decimal(10,2) DEFAULT '0.00' COMMENT '对账金额', + `pay_amount` decimal(10,2) DEFAULT '0.00' COMMENT '总计', + `platform_amount` decimal(10,2) DEFAULT '0.00' COMMENT '平台流水金额', + + `verify_status` tinyint(2) NOT NULL DEFAULT '0' COMMENT '审核状态 -2:汇总驳回 -1审批拒绝 0:系统生成 1:审核通过 2:对外发起 3:合作确认 4:汇总', + `verify_log` text NOT NULL COMMENT '审批相关信息json', + `pay_type` tinyint(2) DEFAULT '0' COMMENT '1甲方收款;2乙方收款', + `first_party_info` text NOT NULL COMMENT '甲方相关信息json', + `second_party_info` text NOT NULL COMMENT '乙方相关信息json', + `statement_info` text NOT NULL COMMENT '订单相关信息json', + `op_time` int(11) NOT NULL DEFAULT '0' COMMENT '操作时间', + `remark` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '' COMMENT '备注', + PRIMARY KEY (`id`), + KEY `withdraw_type` (`withdraw_type`) USING BTREE, + KEY `company_id` (`company_id`) USING BTREE, + KEY `statement_begin_time` (`statement_begin_time`) USING BTREE, + KEY `statement_end_time` (`statement_end_time`) USING BTREE, + KEY `verify_status` (`verify_status`) USING BTREE, + KEY `op_time` (`op_time`) USING BTREE +) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='聚合上游联运上下游对账单'; + + + +ALTER TABLE `tab_company_statement` +ADD COLUMN `confirm_status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '确认状态 0:未处理 1:发起 2审核' AFTER `verify_log`; + +ALTER TABLE `tab_company_statement` +ADD COLUMN `confirm_log` text COMMENT '确认信息' AFTER `confirm_status`; +ALTER TABLE `tab_company_statement` +MODIFY COLUMN `verify_status` tinyint(2) NOT NULL DEFAULT 0 COMMENT '审核状态 -3:汇总驳回 -2:审核拒绝 -1管理员审批拒绝 0:系统生成 1:管理员审核通过 2:审核通过 3:汇总' AFTER `platform_amount`; \ No newline at end of file