From 90b2cb4d9bf78ecb7408192e26fefe3914d65119 Mon Sep 17 00:00:00 2001 From: chenzhi <chenzhi063@qq.com> Date: Fri, 2 Jul 2021 17:56:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=B8=82=E5=9C=BA=E6=AF=9B?= =?UTF-8?q?=E5=88=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MarketPercentageController.class.php | 58 ++-- .../Controller/TimingController.class.php | 4 + .../Admin/View/MarketPercentage/index.html | 286 ++++++------------ .../MarketPercentage/marketstaffsettle.html | 11 +- 4 files changed, 141 insertions(+), 218 deletions(-) diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index 3d5f54ea1..b34b5a9e7 100644 --- a/Application/Admin/Controller/MarketPercentageController.class.php +++ b/Application/Admin/Controller/MarketPercentageController.class.php @@ -122,9 +122,10 @@ class MarketPercentageController extends ThinkController // var_dump($map);die(); $data = SM("settleup_marketorder", "tab_") - ->field("pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name, + ->field("id,pay_time,promote_account,company_name,company_belong,real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount, - sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit"); + sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit, + other_amount,refund_amount"); if ($_REQUEST['export']) { $data = $data->where($map) @@ -142,7 +143,8 @@ class MarketPercentageController extends ThinkController $sum = SM("settleup_marketorder", "tab_") ->field("pay_time,promote_account,company_belong,real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(cp_amount) cp_amount,sum(promote_amount) promote_amount, - sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit") + sum(channel_amount) channel_amount, sum(company_tax) company_tax,sum(company_profit) company_profit, + sum(other_amount) other_amount,sum(refund_amount) refund_amount") ->where($map) ->find(); @@ -181,9 +183,11 @@ class MarketPercentageController extends ThinkController 'develop_type' => '类型', 'game_name' => '游戏名称', 'pay_amount' => '总流水', - 'cp_amount' => '上游结算流水', - 'promote_amount' => '下游结算流水', + 'cp_amount' => '上游结算额', + 'promote_amount' => '下游结算额', 'channel_amount' => '支付渠道费用', + 'refund_amount'=>'退款金额', + 'other_amount'=>'返点及其他', 'company_tax' => '公司税费', 'company_profit' => '税后毛利额']; @@ -221,6 +225,22 @@ class MarketPercentageController extends ThinkController $this->display(); } + public function otherAmountEdit() + { + if(!array_key_exists('id',$_REQUEST) || !array_key_exists('other_amount',$_REQUEST)){ + $this->ajaxReturn(['status'=>0,'msg'=>'参数错误']); + } + $id = I("id"); + $other_amount = I("other_amount"); + $dbres = M("settleup_marketorder","tab_")->where("id = {$id}")->find(); + $save = [ + 'id'=>$id, + 'company_profit'=>$dbres['company_profit']-($other_amount-$dbres['other_amount']), + 'other_amount'=>$other_amount + ]; + M("settleup_marketorder","tab_")->save($save); + $this->ajaxReturn(['status'=>1,'msg'=>'其他扣款添加成功']); + } public function indexuncaculate($row = 10, $p = 1) { @@ -1266,19 +1286,23 @@ class MarketPercentageController extends ThinkController public function reCaculateBonus() { - - $pay_time = $_REQUEST['pay_time']; - - if (!$pay_time) { - $pay_time = "all"; -// $pay_time = date("Y-m",strtotime('-1 month')); + $type = $_REQUEST['type']; + if(empty($type)){ + die('参数错误'); + } + if($type == 1){ + $action = "caculateMarketStream/time"; + }else{ + $action = "createMarketBonus/pay_time"; + } + $pay_time = date( 'Y-m', strtotime( 'last day of -1 months' ) ); + $params = "php ".SUBSITE_INDEX." Timing/{$action}/{$pay_time}"; + $r = D("CmdTasks")->addTask("MarketPerformanceSet",$params); + if($r){ + $this->ajaxReturn(["status"=>"1",'msg'=>"任务添加成功,大约需等待5分钟后生成"]); + }else{ + $this->ajaxReturn(["status"=>"0","msg"=>'任务添加失败']); } - -// var_dump("cd ".ROOTTT.";php admin.php timing/caculateMarketStream/time/{$pay_time} > /dev/null &");die(); - - exec("source /etc/profile;cd " . ROOTTT . ";php " . SUBSITE_INDEX . " timing/caculateMarketStream/time/{$pay_time} > /dev/null &"); - - $this->ajaxReturn(['status' => 1]); } public function showBonusList($row = 10, $p = 1) diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 6d40c92a0..d08526f0d 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -844,6 +844,7 @@ class TimingController extends AdminController { $count_date = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); } A("MarketPerformanceSet")->setFreeMonth($count_date); + $this->createMarketBonus($_REQUEST['time']); die(); echo date("Y-m-d H:i:s")."----------------------市场结算管理计算----------------------\n"; @@ -1357,6 +1358,7 @@ class TimingController extends AdminController { ->field("id,admin_id,pay_time,promote_account,company_belong,tab_settleup_marketorder.real_name,develop_type,game_name, sum(pay_amount) pay_amount,sum(company_profit) company_profit, sum(if((develop_type = 1 or develop_type = 2), pay_amount, 0)) performance_revenue,sum(if(develop_type = 3, pay_amount, 0)) appraisal_bonuses, + sum(if((develop_type = 1 or develop_type = 2), refund_amount, 0)) performance_refund_amount,sum(if(develop_type = 3, refund_amount, 0)) appraisal_refund_amount, sum(company_tax) company_tax, sum(cp_amount) cp_amount,sum(promote_amount) promote_amount") ->where($map) ->where(["admin_id"=>['in',array_keys($accessData)]]) @@ -1368,6 +1370,8 @@ class TimingController extends AdminController { if(isset($accessData[$admin_id])){ $value = array_merge($value,$accessData[$admin_id]); } + $value['performance_revenue'] -= $value['performance_refund_amount']; + $value['appraisal_bonuses'] -= $value['appraisal_refund_amount']; $sum_amount = $value['performance_revenue'] + $value['appraisal_bonuses']; diff --git a/Application/Admin/View/MarketPercentage/index.html b/Application/Admin/View/MarketPercentage/index.html index 02c2d0628..8dae70017 100644 --- a/Application/Admin/View/MarketPercentage/index.html +++ b/Application/Admin/View/MarketPercentage/index.html @@ -43,7 +43,7 @@ <div class="tools"> <if condition="$caculate_check eq true"> <empty name="show_status"> - <a class="recaculate" url="{:U('reCaculateBonus?pay_time='.$_GET['pay_time'])}" style="width: 60px;text-align: center;padding-right: 0;margin-right: 0;">重算</a> + <a class="recaculate" url="{:U('reCaculateBonus')}" style="width: 60px;text-align: center;padding-right: 0;margin-right: 0;">重算</a> </empty> </if> </div> @@ -125,11 +125,14 @@ <th>类型</th> <th >游戏名称</th> <th >总流水</th> - <th>上游结算流水</th> - <th>下游结算流水</th> + <th>上游结算额</th> + <th>下游结算额</th> <th>支付渠道费用</th> + <th>退款金额</th> + <th>返点及其他</th> <th><a href="{:U('editTaxRatio')}" style="text-decoration:none;">公司税费</a></th> <th>税后毛利额</th> + <th>操作</th> </tr> </thead> @@ -154,8 +157,11 @@ <td>{$data['cp_amount']}</td> <td>{$data['promote_amount']}</td> <td>{$data['channel_amount']}</td> + <td>{$data['refund_amount']}</td> + <td>{$data['other_amount']}</td> <td>{$data['company_tax']}</td> <td>{$data['company_profit']}</td> + <td><a class="edit_oter_amout" data-id="{$data.id}" data-amount="{$data['other_amount']}">编辑</a></td> </tr> </volist> <tr> @@ -170,8 +176,11 @@ <td>{$sum['cp_amount']}</td> <td>{$sum['promote_amount']}</td> <td>{$sum['channel_amount']}</td> + <td>{$sum['refund_amount']}</td> + <td>{$sum['other_amount']}</td> <td>{$sum['company_tax']}</td> <td>{$sum['company_profit']}</td> + <td></td> </tr> </notemtpy> </tbody> @@ -187,6 +196,24 @@ </if> {$_page|default=''} </div> + <script type="text/html" id="changeTpl"> + <div style="padding:10px 40px 30px;"> + <spend style="font-size:14px;color:#666;"> + + </spend> + <table border="0" cellspacing="0" cellpadding="0" style="margin:0px;"> + <tr style="line-height: 4;"> + <td class="l noticeinfo" style="width:80px;">返点及其他:</td> + <td class="r table_radio"> + <input type="text" id="other_amount" placeholder="其他扣款" /> + </td> + </tr> + </table> + <button class="submit_btn mlspacing" id="changeMargin" type="submit" style="margin-top:30px;"> + 保存 + </button> + </div> + </script> </block> @@ -206,6 +233,63 @@ //导航高亮 highlight_subnav('{:U('MarketPercentage/index')}'); $(function(){ + $(".edit_oter_amout").on("click",function(){ + var data = $(this).data(); + layer.open({ + type: 1, + title: '编辑', + maxWidth:720, + closeBtn: 1, + shadeClose: false, + content: $("#changeTpl").html(), + success:function(){ + env(data); + } + }); + + }); + function env(data) { + $("#other_amount").val(data.amount); + $("#changeMargin").off("click"); + $("#changeMargin").on("click",function(){ + let other_amount = $("#other_amount").val(); + var reg = /^(\-|\+)?\d+(\.\d*)?$/; + if( !reg.test(other_amount)){ + layer.msg("返点扣款金额格式错误"); + return ; + } + if(other_amount == data.amount){ + layer.msg("无修改请直接关闭窗口"); + return ; + } + //成功 + let send = { + id:data.id, + other_amount:other_amount, + } + $.ajax({ + type: "POST", + url: "{:U('otherAmountEdit')}", + dataType: 'json', + data: send, + success: function (data) { + if (data.status == 1) { + layer.msg(data.msg); + setTimeout(function () { + window.location.reload(); + }, 1500); + } else { + layer.msg(data.msg); + return false; + } + } + }); + }); + + } + + + //搜索功能 $("#search").click(function(){ var url = $(this).attr('url'); @@ -230,54 +314,12 @@ window.location.href = url; }); - $(".paixu").click(function(){ - var that=$(this); - $data_order=that.attr('data-order'); - $order_type='{$userarpu_order}'; - if($order_type==''||$order_type=='4'){ - $(".sortBy").attr('name','data_order'); - val='3,'+$data_order; - $(".sortBy").attr('value',val); - $("#search").click(); - }else if($order_type=='3'){ - $(".sortBy").attr('name','data_order'); - val='4,'+$data_order; - $(".sortBy").attr('value',val); - $("#search").click(); - } - }); //回车自动提交 $('.jssearch').find('input').keyup(function(event){ if(event.keyCode===13){ $("#search").click(); } }); - $("#admin").on('click',function(event) { - var navlist = $(this).find('.i_list_li'); - if (navlist.hasClass('hidden')) { - navlist.removeClass('hidden'); - $(this).find('#i_list_id').focus().val(''); - } else { - navlist.addClass('hidden'); - } - $(document).one("click", function(){ - navlist.addClass('hidden'); - }); - event.stopPropagation(); - }); - - $('#admin #i_list_id').on('keyup',function(event) { - var val = $.trim($(this).val()).toLowerCase(); - $(this).closest('.drop-down').find('#i_list_idh').val(val); - }); - - $("#admin #i_list_li").find("a").each(function(){ - $(this).click(function(){ - var text = $.trim($(this).text()).toLowerCase(); - $(this).closest('.drop-down').find("#i_list_id").val(text); - $(this).closest('.drop-down').find('#i_list_idh').val(text); - }) - }); $('#time_start').datetimepicker({ format: 'yyyy-mm', @@ -321,35 +363,6 @@ }); event.stopPropagation(); }); - /* 状态搜索子菜单 */ - /*渠道删除*/ - $('.delete').click(function(){ - var id = $(this).attr('data-id'); - layer.confirm('渠道删除后,下级渠道同时被删除,所属数据归属于自然渠道!', { - title:'确定要删除该渠道?', - icon:0, - btn: ['删除','取消'] //按钮 - }, function(){ - $.ajax({ - type: "POST", - url: "{:U('del_promote')}", - dataType: 'json', - async: false, - data: {id:id}, - success:function(data){ - if(data.status==1){ - layer.msg(data.msg); - setTimeout(function(){ - window.location.reload(); - },1500); - } - } - }); - }, function(){ - layer.close(); - }); - - }) $('.recaculate').click(function(){ var url = $(this).attr('url'); @@ -361,16 +374,17 @@ $.ajax({ type: "POST", url: url, + data:{type:1}, dataType: 'json', async: false, success:function(data){ if(data.status == 1) { - layer.msg("重新计算需要时间,请等待10分钟后再查看"); + layer.msg(data.msg); setTimeout(function(){ window.location.reload(); },1500); } else { - layer.msg(data.info); + layer.msg(data.msg); } }, }); @@ -384,124 +398,4 @@ </script> - <script type="text/javascript"> - - //点击字母按照条件按钮筛选 - $(".pro_promot_select_list_con").click(function(){ - //选中高亮样式 - $(this).addClass('active'); - $(this).siblings().removeClass('active'); - - var that = $(this); - var index = $(this).attr("data-index"); - - $("#game_list li").each(function(index,ele){ - var short = $(this).attr('data-short'); - $(this).show(); - if(that.attr('data-index')){ - if(that.attr('data-index')!=short.charAt(0)){ - $(this).hide(); - } - } - }) - }); - - //打开弹窗 - $(".ajax-view").click(function(){ - //获取游戏列表 - var url = "{:U('Promote/getPromoteGame')}"; - var id = $(this).attr('data-id'); - var checked = 'checked'; - - - - $.post(url,{id:id},function(res){ - if(res.code==1){ - - $(".pro_promot_select_list a").eq(0).addClass('active'); - $(".pro_promot_select_list a").eq(0).siblings().removeClass('active'); - - var game_list = res.data.game_list; - var promote_info = res.data.promote_info; - var lis = []; - - $.each(game_list,function(index,ele){ - if(ele.game_name.length>6){ - ele.game_name = ele.game_name .substring(0,6)+"..." - } - lis.push('<li class="fl pro_promot_game_con" data-short="'+ele.short+'">'); - - - if(promote_info['game_ids']==''){ - lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />'); - }else{ - if(promote_info['game_ids'].indexOf(ele.id)>-1){ - lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" checked="checked" id="gameCheck'+index+'" />'); - }else{ - $(".jsgamecheckall").attr('checked',false); - lis.push('<input type="checkbox" value="'+ele.id+'" name="game_ids[]" class="fl pro_promot_game_check jsgameid" id="gameCheck'+index+'" />'); - checked = ''; - } - } - - lis.push('<label for="gameCheck'+index+'" class="fl"></label>'); - lis.push('<span class="fl pro_promot_game_name">'+ele.game_name+'</span>'); - lis.push('</li>'); - }); - - $(".jsgamecheckall").attr('checked',checked); - - $("#game_list").html(lis.join('')); - $(".pro_promot_number").text(res.data.promote_info.account); - $("#se_promote_id").val(res.data.promote_info.id); - $(".pro_promot").css("display","block"); - - jsgameid(); - - }else{ - var tip_msg = res.info ? res.info : '操作失败'; - layer.msg(tip_msg); - } - }); - }); - - //保存修改 - $(".pro_promot_btn_confirm").click(function(){ - $("#ajaxForm").ajaxSubmit(function(res){ - layer.msg(res.msg); - $(".pro_promot").hide(); - }); - return false; - }); - - //关闭弹窗 - $(".pro_promot_close").click(function(){ - $(".pro_promot").css("display","none"); - }); - //取消修改 - $(".pro_promot_btn_cancel").click(function(){ - $(".pro_promot").css("display","none"); - layer.msg('修改已取消'); - }); - - $(".jsgamecheckall").click(function(){ - $(this).closest('.jsgamecheckallbox').siblings("#game_list").find(".jsgameid").prop("checked", this.checked); - }); - - //可申请游戏 全选及全选反选 功能 @author zwm date 20180604 - function jsgameid(){ - $(".jsgameid").click(function(){ - var option = $(this).closest('ul').find(".jsgameid"), - checkall = $(this).closest('ul').siblings('.jsgamecheckallbox').find('.jsgamecheckall'); - option.each(function(i){ - if(!this.checked){ - checkall.prop("checked", false); - return false; - }else{ - checkall.prop("checked", true); - } - }); - }); - } - </script> </block> diff --git a/Application/Admin/View/MarketPercentage/marketstaffsettle.html b/Application/Admin/View/MarketPercentage/marketstaffsettle.html index 2c575d913..0b197a5b3 100644 --- a/Application/Admin/View/MarketPercentage/marketstaffsettle.html +++ b/Application/Admin/View/MarketPercentage/marketstaffsettle.html @@ -113,7 +113,7 @@ <div class="tools"> <if condition="$caculate_check eq true"> <empty name="show_status"> - <a class="recaculate" url="{:U('reCaculateBonus?pay_time='.$_GET['pay_time'])}" style="width: 60px;text-align: center;padding-right: 0;margin-right: 0;">重算</a> + <a class="recaculate" url="{:U('reCaculateBonus')}" style="width: 60px;text-align: center;padding-right: 0;margin-right: 0;">重算</a> </empty> </if> </div> @@ -196,8 +196,8 @@ <th>市场专员</th> <th>离职时间</th> <th>级别</th> - <th><div class="tooltip">开发总流水<span class="tooltiptext"><span style="margin-left: -10px">当月自主开发下渠道游戏内充值总和</span></span></div></th> - <th><div class="tooltip">维护总流水<span class="tooltiptext"><span style="margin-left: -10px">当月只维护下渠道游戏内充值总和</span></span></div></th> + <th><div class="tooltip">开发总流水<span class="tooltiptext"><span style="margin-left: -10px">当月自主开发下渠道游戏内充值总和(已减去退款)</span></span></div></th> + <th><div class="tooltip">维护总流水<span class="tooltiptext"><span style="margin-left: -10px">当月只维护下渠道游戏内充值总和(已减去退款)</span></span></div></th> <th >业绩提成</th> <th ><div class="tooltip">绩效考核奖金<span class="tooltiptext"><span style="margin-left: -10px">当月开发税后毛利奖金与维护税后毛利奖金之和</span></span></div></th> <th >绩效系数</th> @@ -584,16 +584,17 @@ $.ajax({ type: "POST", url: url, + data:{type:2}, dataType: 'json', async: false, success:function(data){ if(data.status == 1) { - layer.msg("重新计算需要时间,请等待10分钟后再查看"); + layer.msg(data.msg); setTimeout(function(){ window.location.reload(); },1500); } else { - layer.msg(data.info); + layer.msg(data.msg); } },