diff --git a/Application/Admin/Controller/StatementMangementController.class.php b/Application/Admin/Controller/StatementMangementController.class.php index 1251f842e..b838257a9 100644 --- a/Application/Admin/Controller/StatementMangementController.class.php +++ b/Application/Admin/Controller/StatementMangementController.class.php @@ -599,7 +599,64 @@ class StatementMangementController extends ThinkController $this->assign('companyTypes', RewardModel::$companyTypes); $this->display(); } - + } + + public function rewardManageDetail($id=0) + { + $games = M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select(); + $this->assign('games', $games); + if ($id) { + if (I('delete')) { + + $rewardRecordData = M('reward_record', 'tab_')->where(['id'=>$id])->find(); + + $upt = M('reward_record', 'tab_')->where(['id'=>$id])->delete(); + + M('reward_detail', 'tab_')->where(['record_id'=>$id])->delete(); + + $companyName = M('partner','tab_')->field('partner')->where(['id'=>$rewardRecordData['company_id']])->find(); + + addOperationLog(['op_type'=>2,'key'=>$companyName['partner'].'/'.(($rewardRecordData['reward_type']==1)?'奖励':'惩罚').'/'.$rewardRecordData['money'],'op_name'=>'删除奖惩记录','url'=>U('StatementMangement/rewardManageList'),'menu'=>'推广员-结算单管理-奖罚记录管理']); + + return $upt ? $this->success('删除成功') : $this->error('删除失败'); + } else { + $data = M('reward_record', 'tab_')->where(['id'=>$id])->find(); + if (!$data) return $this->error("未找到该记录"); + $data['confirm_time'] = $data['confirm_time'] ? date('Y-m-d H:i:s', $data['confirm_time']) : ''; + $data['accounts'] = json_decode($data['accounts'], true) ?: []; + $data['settlement_info'] = json_decode($data['settlement_info'], true) ?: []; + //$this->assign('data', $data); + } + } else { + $data['reward_time'] = strtotime(date('Y-m-01')); + + } + $details = M('reward_detail', 'tab_')->where(['record_id'=>$id])->select(); + // 根据type 来合并 + foreach ($details as $item) { + $item['info'] = $item; + if (empty($item['company_name']) && $item['company_id']) { + if ($item['company_type'] == RewardModel::COMPANY_TYPE_PARTNER) { + $item['company_name'] = M('partner', 'tab_')->where(['id'=>$item['company_id']])->getField('partner'); + } else { + $item['company_name'] = M('promote_company', 'tab_')->where(['id'=>$item['company_id']])->getField('company_name'); + } + } + $tmp[$item['type']][] = $item; + } + $data['rewardCount'] = sizeof($tmp[RewardModel::REWARD_TYPE_REWARD]); + $data['punishCount'] = sizeof($tmp[RewardModel::REWARD_TYPE_PUNISH]); + $data['rewardAmount'] = $data['rewardCount'] > 0 ? array_sum(array_column($tmp[RewardModel::REWARD_TYPE_REWARD], 'amount')) : 0; + $data['punishAmount'] = $data['punishCount'] > 0 ? array_sum(array_column($tmp[RewardModel::REWARD_TYPE_PUNISH], 'amount')) : 0; + $data['maxCount'] = $data['rewardCount'] > $data['punishCount'] ? $data['rewardCount'] : $data['punishCount']; + + $this->assign('details', $tmp); + $this->assign('data', $data); + $this->assign('promoters', M('promote', 'tab_')->where(['level'=>1])->field('id, nickname')->select()); + $this->assign('rewardTypes', RewardModel::$rewardTypes); + $this->assign('settlementTypes', RewardModel::$settlementTypes); + $this->assign('companyTypes', RewardModel::$companyTypes); + $this->display('rewardManagerDetail'); } public function getCompanys($type=1) diff --git a/Application/Admin/View/StatementMangement/rewardManageList.html b/Application/Admin/View/StatementMangement/rewardManageList.html index 5f28986b2..52785a868 100644 --- a/Application/Admin/View/StatementMangement/rewardManageList.html +++ b/Application/Admin/View/StatementMangement/rewardManageList.html @@ -232,6 +232,7 @@ {:get_admin_name($data['creater_id'])} + 查看 编辑 删除 @@ -263,6 +264,7 @@ {:get_admin_name($data['creater_id'])} + 查看 编辑 删除 diff --git a/Application/Admin/View/StatementMangement/rewardManagerDetail.html b/Application/Admin/View/StatementMangement/rewardManagerDetail.html new file mode 100644 index 000000000..3def4ff61 --- /dev/null +++ b/Application/Admin/View/StatementMangement/rewardManagerDetail.html @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + if(C('COLOR_STYLE')=='blue_color') echo ' + + '; + + + + + + + +
+
查看
+
    + +
  • +
    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    奖励惩罚
    公司类型公司/部门会长账号结算方式金额公司类型公司/部门会长账号结算方式金额
    合计{$data['rewardAmount']}合计{$data['punishAmount']}
    +
    +
    +
  • + + + $account):?> + + + + + + + + + +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
  • + + +
  • +
+
+ + + +
+ + + \ No newline at end of file