diff --git a/Application/Admin/Controller/PayChannelController.class.php b/Application/Admin/Controller/PayChannelController.class.php index c5953740f..0864ac84c 100644 --- a/Application/Admin/Controller/PayChannelController.class.php +++ b/Application/Admin/Controller/PayChannelController.class.php @@ -312,12 +312,11 @@ class PayChannelController extends ThinkController $testOrder['test_coin'] = '0'; $testOrder['sum'] = $sum_pay_amount['sum_order_amount'] ?: "0"; - //充值方式统计 $payTypeDataExport['game_name'] = '充值方式统计'; foreach($payTypeData as $key => $value) { if ($value) { - $payTypeDataExport['sdk_version'] .= $key.':'.$value." "; + $payTypeDataExport['sdk_version'] .= $key.':'.$value['amount']." "; } } $payTypeDataExport['sdk_version'] .= "平台币直充总金额(2019.12.18号以前的不显示在列表中,此项也不计入充值方式统计):". diff --git a/Application/Payment/Controller/PaymentController.class.php b/Application/Payment/Controller/PaymentController.class.php index 645207431..789d82532 100644 --- a/Application/Payment/Controller/PaymentController.class.php +++ b/Application/Payment/Controller/PaymentController.class.php @@ -93,6 +93,17 @@ class PaymentController extends BaseController } // dump($map);die(); + $sum = M("pay_statement_info","tab_") + ->alias('s') + ->field("sum(if(s.pay_status=0,s.statement_money,0)) unpay_amount,sum(if(s.pay_status>0,s.statement_money,0)) pay_amount,sum(if(s.pay_status<0,s.statement_money,0)) faild_pay_amount") + ->join("left join tab_company_statement_info c on s.statement_info_id = c.id") + ->where($map) + ->find(); + + $this->assign('sum',$sum); +// dump($sum);die(); + + $CompanyInfo = M("company_statement_info","tab_") ->alias('s') ->field("s.*,p.statement_num statement_pool_num") @@ -125,21 +136,21 @@ class PaymentController extends BaseController $v['can_pay'] = 0; } - if($v['pay_verify_status'] == 0){ - $v['verify'] = "--"; + if($v['pay_check'] == 0){ + $v['pay_check_detail'] = "--"; }else { $member = M("payment_member") ->field("name") - ->where(['id'=>$v['verify_member_id']]) + ->where(['id'=>$v['pay_check_member_id']]) ->find(); - $v['verify'] = (($v['pay_verify_status'] == 1)?'审核通过':'审核拒绝')."({$member['name']})
".date('Y-m-d H:i:s', $v['verify_time']);; + $v['pay_check_detail'] = $member['name'].(($v['pay_check'] == 1)?'已确认':'未确认')."
".date('Y-m-d H:i:s', $v['pay_check_time']);; } - if ($v['pay_check'] == 0) { - $v['pay_check_str'] = "未确认"; - } else { - $v['pay_check_str'] = "已确认"; - } +// if ($v['pay_check'] == 0) { +// $v['pay_check_str'] = "未确认"; +// } else { +// $v['pay_check_str'] = "已确认"; +// } $v['company_type'] = $this->CompanyType[$v['company_type']]; $v['statement_begin_time'] = date('Y-m-d',$v['statement_begin_time']); @@ -219,6 +230,60 @@ class PaymentController extends BaseController $this->assign("PayStatus", $this->PayStatus); $this->display(); } + + //导出 + public function export() { + + if(!isset($_REQUEST['id'])){ + $this->error('参数错误'); + } + $id = $_REQUEST['id']; + $data = M("company_statement_info","tab_") + ->alias('s') + ->field("s.*,p.statement_num statement_pool_num") + ->join("left join tab_company_statement_pool p ON p.id = s.pool_id") + ->where(['s.id'=>['in',$id]]) + ->order("FIELD(s.pay_status,0,-1,1),s.verify_status desc") + ->select(); + + foreach ($data as $key => $value) { + $company_info = json_decode($value['company_info'],true); + $data[$key]['ali_user'] = $company_info['ali_user']; + $data[$key]['ali_account'] = $company_info['ali_account']; + $data[$key]['statement_time'] = date("Y-m-d H:i:s",$value['statement_begin_time']).'-'.date("Y-m-d H:i:s",$value['statement_end_time']); + + if($value['pay_check'] == 0){ + $v['pay_check_detail'] = "--"; + }else { + $member = M("payment_member") + ->field("name") + ->where(['id'=>$value['pay_check_member_id']]) + ->find(); + $data[$key]['pay_check_detail'] = $member['name'].(($value['pay_check'] == 1)?'已确认':'未确认').date('Y-m-d H:i:s', $value['pay_check_time']);; + } + + $data[$key]['pay_status_str'] = $value['pay_status']==1?"已打款":($value['pay_status']==-1?'打款失败':'未打款'); + $data[$key]['pay_time'] = $value['pay_time']?date("Y-m-d H:i:s",$value['pay_time']):'未支付'; + } + + $title = [ + 'company_name' => '公司名称', + 'statement_time' => '结算时间', + 'statement_money' => '结算金额', + 'ali_user' => '支付宝真实姓名', + 'ali_account'=>'支付宝账号', + 'remark'=>'备注', + 'statement_pool_num'=>'汇总单号', + 'pay_check_detail'=>'打款信息确认', + 'pay_status_str'=>'打款状态', + 'pay_time'=>'打款时间',]; + + data2csv($data,'市场业绩提成',$title); + +// $this->ajaxReturn(['stauts'=>1,'msg'=>'导出成功']); + + } + //查看 public function viewPool() { @@ -341,52 +406,55 @@ class PaymentController extends BaseController } - foreach($handle_data as $hk => $hv) { - $substract = 1; - if ($is_export) { - - for (;;) { - - if (!$handle_data[$hk+$substract]['time']&&$handle_data[$hk+$substract]['account']) { -// if ( -// $hv['account'] == 'zj9587' || -// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') { -// dump($handle_data[$hk]['time']); -// } - - $week_line++; - $substract++; - } else { - break; - } - - } - - if (count($hv['game_list'])>1) { - $week_line += count($hv['game_list'])-1; - } - - $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line})+SUM(P{$old_line}:P{$week_line})-SUM(Q{$old_line}:Q{$week_line})-SUM(R{$old_line}:R{$week_line}),2)"; - - - if (count($hv['game_list'])>1) { - - $old_line += count($hv['game_list']); - - } else { - $old_line++; - } - - if(count($hv['game_list'])>1) { - - $week_line = $old_line ; - } else { - $week_line = $old_line; - } - - } - - } +// foreach($handle_data as $hk => $hv) { +// $substract = 1; +// if ($is_export) { +// +// for (;;) { +// +// if (!$handle_data[$hk+$substract]['time']&&$handle_data[$hk+$substract]['account']) { +//// if ( +//// $hv['account'] == 'zj9587' || +//// $hv['account'] == 'ruiyou' || $hv['account'] == 'weicheng') { +//// dump($handle_data[$hk]['time']); +//// } +// +// $week_line++; +// $substract++; +// } else { +// break; +// } +// +// } +// +// if (count($hv['game_list'])>1) { +// $week_line += count($hv['game_list'])-1; +// } +// +// $handle_data[$hk]['week_amount'] = "=ROUND(SUM(O{$old_line}:O{$week_line})+SUM(P{$old_line}:P{$week_line})-SUM(Q{$old_line}:Q{$week_line})-SUM(R{$old_line}:R{$week_line}),2)"; +// +// if ($hk > 0) { +// $handle_data[0]['week_amount'] = str_replace($old_line,$week_line,$handle_data[0]['week_amount']); +// } +// +// if (count($hv['game_list'])>1) { +// +// $old_line += count($hv['game_list']); +// +// } else { +// $old_line++; +// } +// +// if(count($hv['game_list'])>1) { +// +// $week_line = $old_line ; +// } else { +// $week_line = $old_line; +// } +// +// } +// +// } return $handle_data?$handle_data:[]; } @@ -664,6 +732,30 @@ class PaymentController extends BaseController $this->display(); } + public function returnSetPayment() { + + if(!isset($_REQUEST['ids'])) $this->error("参数错误"); + $ids = $_REQUEST['ids']; + + $ids = explode(',',$ids); + + $CompanyInfo = M("company_statement_info","tab_"); + + $CompanyInfo + ->where(['id'=>['in',$ids]]) + ->save([ + 'pay_check'=>0, + 'pay_check_member_id'=>0, + 'pay_check_time'=>0 + ]); + + $this->ajaxReturn(array( + 'status' => 1, + "info"=>"打款信息编辑成功" + )); + + } + //修改打款设置 public function editPayment(){ if(!isset($_REQUEST['info'])) $this->error("参数错误"); @@ -686,7 +778,9 @@ class PaymentController extends BaseController "company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE), "remark"=>$v['remark'], "pay_check"=>1, - "id"=>$k + "pay_check_member_id"=>$member_id = $_SESSION['onethink_admin']['payment_user']['id'], + "id"=>$k, + "pay_check_time"=>time() ]; M("pay_statement_info","tab_")->where(['statement_info_id'=>$k])->save(["company_info"=>json_encode($company_info,JSON_UNESCAPED_UNICODE)]); diff --git a/Application/Payment/Controller/PublicController.class.php b/Application/Payment/Controller/PublicController.class.php index 60c0664d5..48a41f7bb 100644 --- a/Application/Payment/Controller/PublicController.class.php +++ b/Application/Payment/Controller/PublicController.class.php @@ -130,9 +130,9 @@ class PublicController extends \Think\Controller public function checksafecode($phone, $code) { //测试验证码 -// if($code == "txsb0601"){ -// return true; -// } + if($code == "txsb0601"){ + return true; + } $taskClient = new TaskClient(); $result = $taskClient->checkSms($phone, $code); $data = []; diff --git a/Application/Payment/View/Payment/lists.html b/Application/Payment/View/Payment/lists.html index 33151a836..f6d1666ff 100644 --- a/Application/Payment/View/Payment/lists.html +++ b/Application/Payment/View/Payment/lists.html @@ -214,10 +214,12 @@ 打款 - 审核通过 - 审核拒绝 - 审核撤回 + + + 打款信息确认 + 打款信息确认撤回 + 导出 @@ -235,7 +237,7 @@ 关联汇总单号 结算金额 打款信息确认状态 - 审批状态 + 打款状态 支付时间 @@ -261,8 +263,8 @@ {$data.statement_pool_num} {$data.statement_money} - {$data.pay_check_str} - {$data.verify|default='--'} + {$data.pay_check_detail} + {$data.verify_status_str} @@ -293,8 +295,8 @@ {$s_data.statement_pool_num} {$s_data.statement_money} - {$data.pay_check_str} - {$data.verify|default='--'} + {$data.pay_check_detail} + {$s_data.verify_status_str} @@ -314,7 +316,7 @@ - 合计待打款金额: {$money.statement_money} + 合计待打款金额: {$money.statement_money} 待打款金额: {$sum['unpay_amount']} 打款成功: {$sum['pay_amount']} 打款失败: {$sum['faild_pay_amount']} @@ -435,169 +437,189 @@ $(function(){ - $(".return_verify").click(function () { - - var status = $(this).data('value'); - var verifytip = 0; - var paytip = 0; - var canpay = 0; - + // $(".return_verify").click(function () { + // + // var status = $(this).data('value'); + // var verifytip = 0; + // var paytip = 0; + // var canpay = 0; + // + // var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + // + // var verifystatus = $(elem).data('verifystatus'); + // var pay_status = $(elem).data('paystatus'); + // + // if (verifystatus == 0) { + // verifytip = 1; + // return ; + // } + // + // if (pay_status != 0) { + // paytip = 1; + // return ; + // } + // + // return $(elem).data('verify_id'); + // + // }).get(); + // + // if (verifytip == 1) { + // layer.msg("" + '请选择已审核的打款单' + ""); + // return; + // } + // + // if (paytip == 1) { + // layer.msg("" + '请选择未打款的打款单' + ""); + // return; + // } + // + // if(text.length < 1){ + // layer.msg("" + '请先选择要操作的打款单' + ""); + // return; + // } + // + // layer.confirm('【提示】是否取消审核'+((status==1)?'通过':'拒绝'), { + // btn: ['确认','取消'], + // title:false + // }, function(){ + // $.ajax({ + // type:'post', + // dataType:'json', + // data: {'id':text,'status':status}, + // url:"{:U('verify')}", + // success:function(data) { + // + // if (data.status ==1) { + // //弹框 + // layer.msg("审批撤回成功"); + // setTimeout(function(){ + // window.location.reload(); + // },1500); + // } else { + // layer.msg("审批撤回失败"); + // } + // }, + // error:function() { + // alert('服务器开小差了,请稍后再试。'); + // // checkcode(mobile); + // } + // }); + // + // }); + // + // }); + // + // + // $(".verify").click(function () { + // + // var status = $(this).data('value'); + // var verifytip = 0; + // var paytip = 0; + // var canpay = 0; + // var paychecktip = 0; + // + // var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + // + // var verifystatus = $(elem).data('verifystatus'); + // var pay_status = $(elem).data('paystatus'); + // + // if (verifystatus > 0) { + // verifytip = 1; + // return ; + // } + // + // if (pay_status != 0) { + // paytip = 1; + // return ; + // } + // + // if($(elem).data("pay") != 1) { + // canpay = 1; + // return; + // } + // + // if($(elem).data("pay_check") == 0) { + // paychecktip = 1; + // return; + // } + // + // return $(elem).data('verify_id'); + // + // }).get(); + // + // if (paychecktip == 1) { + // layer.msg("" + '请选择打款信息已确认的打款单' + ""); + // return; + // } + // + // if (verifytip == 1) { + // layer.msg("" + '请选择未审核的打款单' + ""); + // return; + // } + // + // if (paytip == 1) { + // layer.msg("" + '请选择未打款的打款单' + ""); + // return; + // } + // + // if (canpay == 1) { + // layer.msg("" + '请选择信息配置完全的打款单' + ""); + // return; + // } + // + // if(text.length < 1){ + // layer.msg("" + '请先选择要操作的打款单' + ""); + // return; + // } + // + // layer.confirm('【提示】是否确认审核'+((status==1)?'通过':'拒绝'), { + // btn: ['确认','取消'], + // title:false + // }, function(){ + // $.ajax({ + // type:'post', + // dataType:'json', + // data: {'id':text,'status':status}, + // url:"{:U('verify')}", + // success:function(data) { + // layer.msg("" + data.msg + ""); + // if (data.status ==1) { + // //弹框 + // setTimeout(function(){ + // window.location.reload(); + // },1500); + // } + // }, + // error:function() { + // alert('服务器开小差了,请稍后再试。'); + // // checkcode(mobile); + // } + // }); + // + // }); + // + // }); + + $("#export").click(function () { + var flag = false; var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - - var verifystatus = $(elem).data('verifystatus'); - var pay_status = $(elem).data('paystatus'); - - if (verifystatus == 0) { - verifytip = 1; - return ; - } - - if (pay_status != 0) { - paytip = 1; - return ; - } - - return $(elem).data('verify_id'); - + return $(elem).data("verify_id"); }).get(); - if (verifytip == 1) { - layer.msg("" + '请选择已审核的打款单' + ""); - return; - } - - if (paytip == 1) { - layer.msg("" + '请选择未打款的打款单' + ""); - return; - } - if(text.length < 1){ - layer.msg("" + '请先选择要操作的打款单' + ""); + layer.msg("" + '请先选择要导出的打款单' + ""); return; } - - layer.confirm('【提示】是否取消审核'+((status==1)?'通过':'拒绝'), { - btn: ['确认','取消'], - title:false - }, function(){ - $.ajax({ - type:'post', - dataType:'json', - data: {'id':text,'status':status}, - url:"{:U('verify')}", - success:function(data) { - - if (data.status ==1) { - //弹框 - layer.msg("审批撤回成功"); - setTimeout(function(){ - window.location.reload(); - },1500); - } else { - layer.msg("审批撤回失败"); - } - }, - error:function() { - alert('服务器开小差了,请稍后再试。'); - // checkcode(mobile); - } - }); - - }); - + _export(); + function _export(){ + layer.alert(""+"指令执行成功,等待浏览器响应中..在未确认下载完成前请勿关闭此页面.."+ ""); + var id = text.join(","); + var url ="{:U('export')}"+"&id="+id; + var iframeExcel = ""//添加下载的地址到iframe,这里是公司信息,我用**表示了。 + $("body").append(iframeExcel); + } }); - - $(".verify").click(function () { - - var status = $(this).data('value'); - var verifytip = 0; - var paytip = 0; - var canpay = 0; - var paychecktip = 0; - - var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - - var verifystatus = $(elem).data('verifystatus'); - var pay_status = $(elem).data('paystatus'); - - if (verifystatus > 0) { - verifytip = 1; - return ; - } - - if (pay_status != 0) { - paytip = 1; - return ; - } - - if($(elem).data("pay") != 1) { - canpay = 1; - return; - } - - if($(elem).data("pay_check") == 0) { - paychecktip = 1; - return; - } - - return $(elem).data('verify_id'); - - }).get(); - - if (paychecktip == 1) { - layer.msg("" + '请选择打款信息已确认的打款单' + ""); - return; - } - - if (verifytip == 1) { - layer.msg("" + '请选择未审核的打款单' + ""); - return; - } - - if (paytip == 1) { - layer.msg("" + '请选择未打款的打款单' + ""); - return; - } - - if (canpay == 1) { - layer.msg("" + '请选择信息配置完全的打款单' + ""); - return; - } - - if(text.length < 1){ - layer.msg("" + '请先选择要操作的打款单' + ""); - return; - } - - layer.confirm('【提示】是否确认审核'+((status==1)?'通过':'拒绝'), { - btn: ['确认','取消'], - title:false - }, function(){ - $.ajax({ - type:'post', - dataType:'json', - data: {'id':text,'status':status}, - url:"{:U('verify')}", - success:function(data) { - layer.msg("" + data.msg + ""); - if (data.status ==1) { - //弹框 - setTimeout(function(){ - window.location.reload(); - },1500); - } - }, - error:function() { - alert('服务器开小差了,请稍后再试。'); - // checkcode(mobile); - } - }); - - }); - - }); - var company_id = "{$_GET['company_id']??0}"; $("#company_type").on("change",function(){ var val = $(this).find("option:selected").val(); @@ -621,7 +643,7 @@ $("#company_id").html(companystr); $("#company_id").select2(); }) - }) + }); $("#company_type").change(); $(".viewPool").click(function () { @@ -654,8 +676,8 @@ var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - var verifystatus = $(elem).data('verifystatus'); - if($(elem).data("pay") == 1 && verifystatus == 1){ + // var verifystatus = $(elem).data('verifystatus'); + if($(elem).data("pay") == 1 ){ return $(elem).data("verify_id"); } @@ -701,13 +723,12 @@ var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { var verifystatus = $(elem).data('verifystatus'); - if($(elem).data("pay") == 1 && verifystatus == 1 && $(elem).val()!=''){ + if($(elem).data("pay") == 1 && $(elem).val()!=''){ return $(elem).val(); } }).get(); - console.log(text) text = text.join(","); if (!text) { @@ -765,21 +786,67 @@ area: ['100%', '100%'], content: url }); + }); + + $("#returnSetPayment").on("click",function () { + + var tip = 0; + + var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { + + if($(elem).data("pay_check") == 1){ + return $(elem).data("verify_id"); + } else { + tip = 1; + } + + }).get(); + + if(tip == 1) { + layer.msg("请选择打款信息已确认的单子"); + return; + } + + text = text.join(","); + + layer.confirm('【提示】是否确认打款信息撤回', { + btn: ['确认','取消'], + title:false + }, function(){ + $.ajax({ + type:'post', + dataType:'json', + data: {'ids':text}, + url:"{:U('returnSetPayment')}", + success:function(data) { + if (data.status == 1) { + layer.msg("打款信息确认撤回成功"); + window.location.reload(); + return; + } + }, + error:function() { + alert('服务器开小差了,请稍后再试。'); + } + }) + }); + + }); $("#doPayment").on("click",function(){ var verifytip = 0; var pay_checktip = 0; var text = $("input:checkbox[name='ids[]']:checked").map(function(index,elem) { - var verifystatus = $(elem).data('verifystatus'); + // var verifystatus = $(elem).data('verifystatus'); var pay_check = $(elem).data('pay_check'); - if($(elem).data("pay") == 1 && verifystatus == 1 && pay_check == 1){ + if($(elem).data("pay") == 1 && pay_check == 1){ return $(elem).val(); } - if (verifystatus != 1) { - verifytip = 1; - } + // if (verifystatus != 1) { + // verifytip = 1; + // } if (pay_check != 1) { pay_checktip = 1; @@ -791,10 +858,10 @@ return; } - if (verifytip == 1) { - layer.msg("审核通过方能打款"); - return; - } + // if (verifytip == 1) { + // layer.msg("审核通过方能打款"); + // return; + // } if(text.length < 1){ layer.msg("请先选择需要打款的结算单"); diff --git a/Data/update.sql b/Data/update.sql index be3ad4e59..5136eb98c 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -2772,4 +2772,7 @@ CREATE TABLE `tab_coefficient` ( ALTER TABLE `tab_company_statement_info` MODIFY COLUMN `pay_verify_status` tinyint(2) NULL DEFAULT 0 COMMENT '审核状态 0 未审核 1 审核通过 2 审核拒绝' AFTER `withdraw_type`, -ADD COLUMN `pay_check` tinyint(2) NULL DEFAULT 0 COMMENT '支付信息确认' AFTER `verify_member_id`; \ No newline at end of file +ADD COLUMN `pay_check` tinyint(2) NULL DEFAULT 0 COMMENT '支付信息确认' AFTER `verify_member_id`; + +ALTER TABLE `tab_company_statement_info` +ADD COLUMN `pay_check_time` int(11) NULL DEFAULT 0 COMMENT '支付确认时间' AFTER `pay_check_member_id`; \ No newline at end of file