diff --git a/Application/Admin/Controller/CompanyStatementPoolController.class.php b/Application/Admin/Controller/CompanyStatementPoolController.class.php index 83f736809..0cb2f2dca 100644 --- a/Application/Admin/Controller/CompanyStatementPoolController.class.php +++ b/Application/Admin/Controller/CompanyStatementPoolController.class.php @@ -1264,6 +1264,13 @@ class CompanyStatementPoolController extends ThinkController $v['company_info'] = json_decode($v['company_info'],true); $v['statement_begin_time'] = date('Y.m.d',$v['statement_begin_time']); $v['statement_end_time'] = date('Y.m.d',$v['statement_end_time']); + + if($is_export){ + $v['remark'] = str_replace(";","\n",$v['remark']); + }else{ + $v['remark'] = str_replace(";","
",$v['remark']); + } + if( isset($v['verify_status'])){ if( $v['verify_status'] ==2 ){ $v['is_payment'] = 2; //不打款 diff --git a/Application/Admin/Controller/MarketPercentageController.class.php b/Application/Admin/Controller/MarketPercentageController.class.php index c6494cc60..61245096f 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) { @@ -1275,19 +1295,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/MarketPerformanceSetController.class.php b/Application/Admin/Controller/MarketPerformanceSetController.class.php new file mode 100644 index 000000000..d5772eea2 --- /dev/null +++ b/Application/Admin/Controller/MarketPerformanceSetController.class.php @@ -0,0 +1,475 @@ +adddata = [];//置空否者会脚本进来会重复计算 + $this->date = $month; + $tarry = explode('-',$month); + $this->year= $tarry[0]; + if(strlen($tarry[1]) < 2) $tarry[1]="0".$tarry[1]; + + $this->month= $tarry[1]; + $this->beginThismonth=mktime(0,0,0,$tarry[1],1,$tarry[0]); + $this->endThismonth=mktime(0,0,0,$tarry[1]-0+1,1,$tarry[0])-1; + $this->settleupMarketorderModel=SM("settleup_marketorder","tab_"); + $this->reCount(); + $this->setSettleupMarketorder(); + } + /** + * 强制重新聚合 + */ + private function reCount() + { + // $this->settleupMarketorderModel->where(['pay_time'=>$this->date])->delete(); + echo "旧数据清理成功".PHP_EOL; + } + /** + * 计算公司毛利 + */ + private function setSettleupMarketorder() + { + $this->setIsTipData(); + $this->getInsideCompanyid(); + $this->getChannelRatio(); + $this->getTaxRatio(); + $this->getAllDownFlowSpend(); + $this->getAllGameInfo(); + $this->getCompanyOtherInfo(); + $this->getPuStatement(); + $this->getPuSpecialStatement(); + $this->performanceSet(); + $this->settleupMarketorderDbSave(); + echo "{$this->year}-{$this->month}生成成功".PHP_EOL; + } + /** + * 获取是否标红提示数据,旧数据比对 + */ + private function setIsTipData() + { + $dbres = $this->settleupMarketorderModel->where(['pay_time'=>$this->date])->select(); + + if($dbres){ + foreach ($dbres as $key => $v) { + $this->oldMarketPerformance[$v['company_id']][$v['game_name']]['company_profit'] = $v['company_profit']; + } + }else{ + $this->oldMarketPerformance = false; + } + //取消所有提示 + $this->settleupMarketorderModel->where("1=1")->save(["is_tip"=>0]); + } + + + + /** + * 获取公司内部公司id + */ + private function getInsideCompanyid() + { + $res = M("PromoteCompany","tab_")->where("is_inside = 1")->field("id")->select(); + if($res){ + $res = array_column($res,"id"); + $res[] = 0; + }else{ + $res = [0]; + } + $this->inSideCompanyIds = implode(",",$res); + } + /** + * 支付服务商渠道费 + * TODO:当前默认除了绑定币其他渠道都1% + */ + private function getChannelRatio() + { + $res = M("payment_merchant","tab_")->getField("id,config",true); + foreach ($res as $k => $v) { + $res[$k] = 1; + //------begin------注释的部分表示按实际配置收取 + // $config = json_decode($v,true); + // if(array_key_exists("channel_rate",$config) && $config['channel_rate'] > 0){ + // $res[$k] = $config['channel_rate']; + // }else{ + // $res[$k] = 0; + // } + //----------end------ + } + $res[0] = 1;//平台币 + $res[-1] = 0;//绑定币 + $this->channelRatio = $res; + unset($res); + } + /** + * 获取公司税率 + */ + private function getTaxRatio() + { + $where = [ + "time"=>['ELT',$this->beginThismonth] + ]; + $tax_data = M("tax_radio","tab_") + ->field("tax_radio") + ->order("time desc") + ->where($where) + ->find(); + if($tax_data){ + $this->taxRatio = $tax_data['tax_radio']; + }else{ + $this->taxRatio = 0; + } + } + + /** + * 获取所有下游公司支付信息 + */ + private function getAllDownFlowSpend() + { + $where = [ + "pay_status"=>1, + "s.is_check"=>1, + "payed_time"=>["between",[$this->beginThismonth,$this->endThismonth]], + "p.company_id"=>["NOT IN",$this->inSideCompanyIds], + "p.company_belong"=>['GT',0] + ]; + $dbres = M("Spend","tab_") + ->alias("s") + ->field("substring_index(game_name, '(', 1) relation_game_name, + SUM(pay_amount) pay_amount, + IFNULL(SUM(CASE WHEN is_refund = 1 THEN pay_amount ELSE 0 END),0) as refund_amount, + p.company_id,p.company_belong,merchant_id") + ->join("tab_promote as p on s.promote_id = p.id") + ->where($where) + ->group("relation_game_name,company_id,merchant_id") + ->order("pay_amount desc")->select(); + foreach ($dbres as $v) { + if(!array_key_exists($v['relation_game_name'],$this->downFlowData[$v['company_id']])){ + $this->downFlowData[$v['company_id']][$v['relation_game_name']] = [ + "cp_pay_amount"=>0, + "promote_pay_amount"=>0, + "pay_amount"=>0, + "channel_amount"=>0, + "refund_amount"=>0, + "special_amount"=>0, + "ratio"=>0 + ]; + } + $channel_amount = round($v['pay_amount']*$this->channelRatio[$v['merchant_id']]/100,2); + $cp_amount = $v['pay_amount']-$v['refund_amount']; + $promote_amount = $v['pay_amount']-$v['refund_amount']; + $this->downFlowData[$v['company_id']][$v['relation_game_name']]['channel_amount'] += $channel_amount; + $this->downFlowData[$v['company_id']][$v['relation_game_name']]['cp_pay_amount'] += $cp_amount; + $this->downFlowData[$v['company_id']][$v['relation_game_name']]['promote_pay_amount'] += $promote_amount; + $this->downFlowData[$v['company_id']][$v['relation_game_name']]['pay_amount'] += $v['pay_amount']; + $this->downFlowData[$v['company_id']][$v['relation_game_name']]['refund_amount'] += $v['refund_amount']; + } + unset($dbres); + } + /** + * 获取游戏信息及cp结算比例 + */ + private function getAllGameInfo() + { + $games=[]; + foreach ( $this->downFlowData as $key => $value) { + $games = array_merge(array_keys($value),$games); + } + $games = array_unique($games); + //获取游戏信息 + $gameRes = M("Game","tab_")->where(['relation_game_name'=>['in',$games]])->getField("relation_game_name,relation_game_id",TRUE); + foreach ($gameRes as $k => $v) { + $this->gameInfo[$k]['relation_game_id'] = $v; + $this->gameInfo[$k]['cp_ratio'] = 0; + } + $this->getCpStatement(); + } + /** + * 获取公司信息及推广员账号,市场员信息 + */ + private function getCompanyOtherInfo() + { + $companyIds = array_unique(array_keys($this->downFlowData)); + $companyRes = M("promote_company","tab_")->alias("pc") + ->join("tab_promote as p on p.company_id = pc.id") + ->join("sys_member as m on p.admin_id = m.uid") + ->where(['pc.id'=>['in',$companyIds],'p.level'=>1]) + ->group("pc.id") + ->getField("pc.id company_id,pc.company_name,pc.company_belong,pc.develop_type,p.id promote_id,p.account promote_account,p.admin_id,m.real_name",TRUE); + $this->companyInfo = $companyRes; + } + + /** + * 获取下游结算比例,以最后一周的结算比例为最终比例 + */ + private function getPuStatement() + { + //1.获取下游周结结算单 + $where = [ + "_string"=>"statement_begin_time between {$this->beginThismonth} and {$this->endThismonth} OR statement_end_time between {$this->beginThismonth} and {$this->endThismonth}", + "company_type"=>2, + "withdraw_type"=>0 + ]; + $statement_pool = M("company_statement_pool","tab_")->where($where)->order("statement_begin_time desc")->select(); + //获取结算分段 + $date_arr = []; + foreach ($statement_pool as $k => $v) { + $tem = [ + "statement_begin_time"=>$v['statement_begin_time'], + "statement_end_time"=>$v['statement_end_time'], + "begin_time"=>date("Y.m.d",$v['statement_begin_time']), + "end_time"=>date("Y.m.d",$v['statement_end_time']), + "withdraw_type"=>0 + ]; + if($v['statement_begin_time'] < $this->beginThismonth){ + $tem['statement_begin_time'] = $this->beginThismonth; + $tem['begin_time'] = date("Y.m.d",$this->beginThismonth); + } + if($v['statement_end_time'] > $this->endThismonth){ + $tem['statement_end_time'] = $this->endThismonth; + $tem['end_time'] = date("Y.m.d",$this->endThismonth); + } + $this->getPuAllStatement($tem,$v); + $this->getPuCompanyStatement($tem);//对公周结 + $date_arr[] = $tem; + } + //2.获取对公的下游 + $tem = [ + "statement_begin_time"=>$this->beginThismonth, + "statement_end_time"=>$this->endThismonth, + "begin_time"=>date("Y.m.d",$this->beginThismonth), + "end_time"=>date("Y.m.d",$this->endThismonth), + "withdraw_type"=>1 + ]; + $this->getPuCompanyStatement($tem); + + } + /** + * 获取所有个人周结 + */ + private function getPuAllStatement($time,$pool){ + $id = $pool['id']; + //获取基本信息 + $infolist = M("company_statement_info","tab_")->where("pool_id = '{$id}'")->select(); + //获取母单 + if(!empty($pool['create_lack_ids'])){ + $l_ids = $pool['create_lack_ids']; + $lack_info = M("company_lack_statement_info","tab_")->where("id in ({$l_ids})")->select(); + $infolist =array_merge($infolist,$lack_info); + } + foreach ($infolist as $v) { + $sinfo = json_decode($v['statement_info'],true); + foreach ($sinfo as $va) { + foreach ($va["game_list"] as $val) { + + //奖罚不算 + if( !array_key_exists($val['game_name'],$this->gameInfo) ){ + continue; + } + //其他计算日期不算 + if( ($val['statement_begin_time'] != $time['begin_time']) && ($val['statement_end_time'] != $time['end_time']) ){ + continue; + } + if(!array_key_exists($val['game_name'],$this->downFlowData[$v['company_id']])){ + continue; + } + if($this->downFlowData[$v['company_id']][$val['game_name']]["ratio"] == 0){ + $this->downFlowData[$v['company_id']][$val['game_name']]["ratio"] = $val['ratio']; + } + } + } + } + } + + /** + * 对公的下游结算 + */ + private function getPuCompanyStatement($time) + { + $where = [ + "company_belong"=>["NOT IN",[0,9]], + "withdraw_type"=>$time['withdraw_type'] + ]; + if($time['recount']){ + $where['_string'] = "statement_begin_time = {$time['statement_begin_time']} OR statement_end_time = {$time['statement_end_time']}"; + }else{ + $where['statement_begin_time'] = $time['statement_begin_time']; + $where['statement_end_time'] = $time['statement_end_time']; + } + $res = M("company_statement","tab_")->where($where)->select(); + if($res){ + foreach ($res as $v) { + $sinfo = json_decode($v['statement_info'],true); + foreach ($sinfo as $val) { + //奖罚不算 + if( !array_key_exists($val['game_name'],$this->gameInfo) ){ + continue; + } + //其他计算日期不算 + if( ($val['statement_begin_time'] != $time['begin_time']) && ($val['statement_end_time'] != $time['end_time']) ){ + continue; + } + if(!array_key_exists($val['game_name'],$this->downFlowData[$v['company_id']])){ + continue; + } + if($this->downFlowData[$v['company_id']][$val['game_name']]["ratio"] == 0){ + $this->downFlowData[$v['company_id']][$val['game_name']]["ratio"] = $val['ratio']; + } + } + } + } + } + /** + * 特殊补点 + */ + private function getPuSpecialStatement() + { + $where = [ + "company_belong"=>["NOT IN",[0,9]], + "withdraw_type"=>3, + "_string"=>"statement_begin_time >= {$this->beginThismonth} and statement_end_time <= {$this->endThismonth}" + ]; + $res = M("company_statement","tab_")->where($where)->select(); + if($res){ + foreach ($res as $v) { + $sinfo = json_decode($v['statement_info'],true); + foreach ($sinfo as $va) { + foreach ($va["game_list"] as $val) { + //奖罚不算 + if( !array_key_exists($val['game_name'],$this->gameInfo) ){ + continue; + } + $this->downFlowData[$v['company_id']][$val['game_name']]["special_amount"] += $val['sum_money']; + } + } + } + } + } + //获取cp结算单 + private function getCpStatement() + { + $where = [ + "company_belong"=>9, + "withdraw_type"=>1, + "statement_begin_time"=>$this->beginThismonth, + "statement_end_time"=>$this->endThismonth + ]; + $res = M("company_statement","tab_")->where($where)->select(); + if($res){ + foreach ($res as $v) { + $sinfo = json_decode($v['statement_info'],true); + foreach ($sinfo as $val) { + //获取真实游戏名 + $games = $this->cpOPName2GName($val['game_name'],$v['company_id']); + foreach ($games as $game) { + if( !array_key_exists($game,$this->gameInfo) ){ + continue; + } + if($v['pay_type'] == 1){ + $ratio = $val['first_ratio']; + }else{ + $ratio = $val['second_ratio']; + } + $this->gameInfo[$game]['cp_ratio'] = $ratio; + } + } + } + } + } + //结算包名还原游戏名 + private function cpOPName2GName($OPName,$company_id) + { + $where = [ + "partner_id"=>$company_id, + "_string"=>"original_package_name = '{$OPName}' OR relation_game_name = '{$OPName}'" + ]; + $game = M("Game","tab_")->field("relation_game_name")->where($where)->group("relation_game_name")->select(); + if($game){ + return array_column($game,"relation_game_name"); + }else{ + return [$OPName]; + } + } + /** + * 计算相应数据 + */ + private function performanceSet() + { + foreach ($this->downFlowData as $company_id => $games) { + $baseArr = $this->companyInfo[$company_id]; + $baseArr['pay_time'] = $this->date; + $baseArr['is_settlement'] = 1; + foreach ($games as $k => $v) { + // if($company_id == 452){ + // dd($v); + // } + $game = $this->gameInfo[$k]; + $cp_ratio = $game['cp_ratio']; + $tempArr = $baseArr; + $tempArr['game_id'] = $game['relation_game_id']; + $tempArr['relation_game_id'] = $game['relation_game_id']; + $tempArr['game_name'] = $k; + $tempArr['pay_amount'] = $v['pay_amount']; + $tempArr['cp_amount'] = round($v['cp_pay_amount']*$cp_ratio/100,2); + $tempArr['promote_amount'] = round($v['promote_pay_amount']*$v['ratio']/100+$v['special_amount'],2); + $tempArr['channel_amount'] = $v['channel_amount']; + $tempArr['refund_amount'] = $v['refund_amount']; + $tempArr['company_tax'] = round( ($v['pay_amount']-$tempArr['cp_amount']-$tempArr['promote_amount']) * ($this->taxRatio / 100),2 ); + $tempArr['company_profit'] = $tempArr['pay_amount']-$tempArr['cp_amount']-$tempArr['promote_amount']-$tempArr['channel_amount']-$tempArr['company_tax']; + $tempArr['is_tip'] = 0; + if($this->oldMarketPerformance){ + if(!array_key_exists($company_id,$this->oldMarketPerformance) || !array_key_exists($k,$this->oldMarketPerformance[$company_id])){ + $tempArr['is_tip'] = 1; + }else{ + if($this->oldMarketPerformance[$company_id][$k]['company_profit'] != $tempArr['company_profit'].''){ + $tempArr['is_tip'] = 1; + } + } + } + if($tempArr['promote_amount'] != 0){ + $this->adddata[]= $tempArr; + } + + } + } + } + /** + * 毛利数据库操作 + */ + private function settleupMarketorderDbSave() + { + //删除旧数据 + $this->settleupMarketorderModel->where(['pay_time'=>$this->date])->delete(); + $this->settleupMarketorderModel->addAll($this->adddata); + } + +} diff --git a/Application/Admin/Controller/TimingController.class.php b/Application/Admin/Controller/TimingController.class.php index 8e3771422..b4252f5d8 100644 --- a/Application/Admin/Controller/TimingController.class.php +++ b/Application/Admin/Controller/TimingController.class.php @@ -836,9 +836,17 @@ class TimingController extends AdminController { return $spend; } - //计算市场专员业绩公式 参数 time 2020-10 public function caculateMarketStream () { + if ($_REQUEST['time']) { + $count_date = $_REQUEST['time']; + }else{ + $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"; $map['pay_time'] = date('Y-m',strtotime(date('Y',time()).'-'.(date('m',time())-1).'-01')); @@ -846,6 +854,7 @@ class TimingController extends AdminController { if ($_REQUEST['time']) { $map['pay_time'] = $_REQUEST['time']; } + $spend_map = []; $time_start = 0; $time_end = 0; @@ -1349,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)]]) @@ -1360,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 @@
- 重算 + 重算
@@ -125,11 +125,14 @@ 类型 游戏名称 总流水 - 上游结算流水 - 下游结算流水 + 上游结算额 + 下游结算额 支付渠道费用 + 退款金额 + 返点及其他 公司税费 税后毛利额 + 操作 @@ -154,8 +157,11 @@ {$data['cp_amount']} {$data['promote_amount']} {$data['channel_amount']} + {$data['refund_amount']} + {$data['other_amount']} {$data['company_tax']} {$data['company_profit']} + 编辑 @@ -170,8 +176,11 @@ {$sum['cp_amount']} {$sum['promote_amount']} {$sum['channel_amount']} + {$sum['refund_amount']} + {$sum['other_amount']} {$sum['company_tax']} {$sum['company_profit']} + @@ -187,6 +196,24 @@ {$_page|default=''} + @@ -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 @@ - diff --git a/Application/Admin/View/MarketPercentage/marketstaffsettle.html b/Application/Admin/View/MarketPercentage/marketstaffsettle.html index f5fd381e9..9e019d33f 100644 --- a/Application/Admin/View/MarketPercentage/marketstaffsettle.html +++ b/Application/Admin/View/MarketPercentage/marketstaffsettle.html @@ -113,7 +113,7 @@
- 重算 + 重算
@@ -199,8 +199,8 @@ 市场专员 离职时间 级别 -
开发总流水当月自主开发下渠道游戏内充值总和
-
维护总流水当月只维护下渠道游戏内充值总和
+
开发总流水当月自主开发下渠道游戏内充值总和(已减去退款)
+
维护总流水当月只维护下渠道游戏内充值总和(已减去退款)
业绩提成
绩效考核奖金当月开发税后毛利奖金与维护税后毛利奖金之和
绩效系数 @@ -282,6 +282,7 @@ + @@ -635,16 +636,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); } },