Merge branch 'feature/reward' of wmtx/platform into release

奖惩修改
master
廖金灵 4 years ago committed by Gogs
commit 7ddf61e536

@ -608,7 +608,7 @@ function arrayPromoteWithdrawStatus($status, $param, $array = array()) {
function getAllGame()
{
$list = M("game", 'tab_')->field('relation_game_name as game_name')->group('relation_game_name')->select();
$list = M("game", 'tab_')->field('relation_game_name as game_name, relation_game_id as game_id')->group('relation_game_name')->select();
return $list;
}
/**

@ -2,6 +2,7 @@
namespace Admin\Controller;
use Admin\Model\RewardModel;
use User\Api\UserApi as UserApi;
/**
@ -11,7 +12,6 @@ use User\Api\UserApi as UserApi;
class StatementMangementController extends ThinkController
{
public function lists() {
$map = [];
if (isset($_REQUEST['time_start']) && isset($_REQUEST['time_end'])) {
@ -94,7 +94,6 @@ class StatementMangementController extends ThinkController
}
$this->meta_title = '结算单管理';
$this->assign('data',$data);
$this->display();
}
@ -248,47 +247,173 @@ class StatementMangementController extends ThinkController
public function rewardManageList($row = 10, $p = 1)
{
$map = [];
if (!empty(I("game_name"))) {
$game_ids = array_column(getGameByName(I("game_name")), 'id');
if ($game_ids) {
$map['relation_game_id'] = ['in', $game_ids];
}
$companys[1] = array_column(M('partner', 'tab_')->field('id, partner as name')->select(), 'name', 'id');
$companys[2] = array_column(M('promote_company', 'tab_')->field('id, company_name as name')->select(), 'name', 'id');
$games = array_column(M('game', 'tab_')->field('relation_game_id, relation_game_name, partner_id')->group('relation_game_id')->select(), null, 'relation_game_id');
$map = ' 1=1 ';
$params = $_GET;
if (!empty(I('reward_type'))) {
$map .= " and reward_type = {$params['reward_type']}";
}
if (I('game_id', -1) !== '' && I('game_id', -1) >= 0) {
$map .= " and r.relation_game_id = {$params['game_id']}";
}
if (!empty(I('partner_id'))) {
$map['company_id'] = I('partner_id');
$gameIds = [];
foreach ($games as $item) {
if ($item['partner_id'] == I('partner_id')) {
$gameIds[] = $item['relation_game_id'];
}
}
if ($gameIds) {
$map .= " and r.relation_game_id in (".implode(',', $gameIds).")";
} else {
$map .= " and 1<>1 ";
}
}
if (!empty($params['settlement_type'])) {
$map .= " and rd.settlement_type = {$params['settlement_type']} ";
}
if (strlen(I('company_type'))) {
$map['company_type'] = I('company_type');
if (!empty($params['detail_reward_type'])) {
$map .= " and rd.type = {$params['detail_reward_type']} ";
}
if (!empty(I('account'))) {
$map['accounts'] = ['like', '%' . I('account') . '%'];
if (!empty($params['settlement_time_range'])) {
list($settlment_time_start, $settlment_time_end) = explode('~', $params['settlement_time_range']);
$map .= " and r.settlement_time between " . strtotime(trim($settlment_time_start)) . " and " . (strtotime(trim($settlment_time_end))+86400);
}
$list = M('reward_record', 'tab_')->where($map)->page($p, $row)->select();
if ($list) {
$companys[1] = array_column(M('partner', 'tab_')->field('id, partner as name')->select(), 'name', 'id');
$companys[2] = array_column(M('promote_company', 'tab_')->field('id, company_name as name')->select(), 'name', 'id');
$games = array_column(M('game', 'tab_')->field('relation_game_id, relation_game_name')->group('relation_game_id')->select(), 'relation_game_name', 'relation_game_id');
foreach ($list as &$item) {
$item['company_name'] = $companys[$item['company_type']][$item['company_id']];
$item['accounts'] = json_decode($item['accounts'], true) ?: [];
$item['reward_type_desc'] = $item['reward_type'] == 1 ? "奖励" : "惩罚";
$item['company_type_desc'] = $item['company_type'] == 1 ? "上游公司" : "下游公司";
$item['relation_game_name'] = $games[$item['relation_game_id']];
$item['reward_time'] = $item['reward_time'] ? date('Y-m-d H:i:s', $item['reward_time']) : '-';
// if ($item['company_type'] == 1) {
// } else {
// }
}
if (!empty($params['confirm_time_range'])) {
list($confirm_time_start, $confirm_time_end) = explode('~', $params['confirm_time_range']);
$map .= " and r.confirm_time between " . strtotime(trim($confirm_time_start)) . " and " . (strtotime(trim($confirm_time_end))+86400);
}
if (!empty($params['detail_company_type'])) {
$map .= " and rd.company_type = {$params['detail_company_type']} ";
}
$count = M('reward_record', 'tab_')->where($map)->count();
// 判断公司
if (I('detail_company_id', -1) >= 0) {
$map .= " and rd.company_id = {$params['detail_company_id']} ";
// if (!empty($params['detail_company_name'])) {
// $map .= " and rd.company_name = '{$params['detail_company_name']}' ";
// }
}
if (!empty($params['detail_settlement_type'])) {
$map .= " and rd.settlement_type = {$params['detail_settlement_type']} ";
}
if (!empty($params['detail_company_name'])) {
$map .= " and rd.company_name like '%{$params['detail_company_name']}%' ";
}
// 判断会长
if (I('detail_promote_account', -1) >= 0) {
$map .= " and rd.promote_account like ('%{$params['detail_promote_account']}%') ";
}
if (!empty($params['detail_promote_account_input'])) {
$map .= " and rd.promote_account like ('%{$params['detail_promote_account_input']}%') ";
}
$result = M('reward_record', 'tab_')->alias('r')
->field('r.id')
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')
->where($map)
->group('r.id')
->select();
if ($result) {
$map = [];
$allIds = array_column($result, 'id');
// 分页
$count = count($allIds);
$currentIds = I('is_export', false) ? $allIds : array_slice($allIds, ($p-1)*$row, $row);
$map['r.id'] = ['in', $currentIds];
} else {
$map = '1<>1';
}
$list = M('reward_record', 'tab_')->alias('r')
->field('
r.id, r.relation_game_id, r.settlement_time, r.confirm_time, r.content, r.reward_type, r.creater_id,
rd.id as rid, rd.type as detail_type, rd.company_type as detail_company_type, rd.company_id as detail_company_id , rd.company_name as detail_company_name, rd.settlement_type as detail_settlement_type, rd.promote_account as detail_promote_account,rd.amount as detail_amount
')
->where($map)
->join('tab_reward_detail as rd on rd.record_id = r.id', 'LEFT')->select();
if ($list) {
$record = [];
foreach ($list as $item) {
if (!isset($record[$item['id']]))
{
$record[$item['id']] = [
'id' => $item['id'],
'relation_game_name' => $games[$item['relation_game_id']]['relation_game_name'] ?? '其他',
'relation_game_partner' => $companys[1][$games[$item['relation_game_id']]['partner_id']] ?? '无',
'settlement_time' => $item['settlement_time'] ? date('Y年m月', $item['settlement_time']) : '-',
'confirm_time' => $item['confirm_time'] ? date('Y-m-d', $item['confirm_time']) : '-',
'content' => $item['content'],
'reward_type_text' => RewardModel::$rewardTypes[$item['reward_type']],
'maxCount' => 0,
'creater_id' => $item['creater_id'],
'totalReward' => 0,
'totalPunish' => 0
];
}
if (!empty($item['rid'])) {
$record[$item['id']]['detail'][$item['detail_type']][] = [
'company_type_text' => RewardModel::$companyTypes[$item['detail_company_type']] ?? '-',
'settlement_type_text' => RewardModel::$settlementTypes[$item['detail_settlement_type']] ?? '-',
'company_name' => empty($item['detail_company_name']) && !empty($item['detail_company_id']) ? ($companys[$item['detail_company_type']][$item['detail_company_id']] ?? '无') : ($item['detail_company_name'] ?? '无'),
'amount' => $item['detail_type'] == RewardModel::REWARD_TYPE_PUNISH ? -$item['detail_amount'] : $item['detail_amount'],
'promote_account' => $item['detail_promote_account'] ?? '无',
];
if ($item['detail_type'] == RewardModel::REWARD_TYPE_REWARD) {
$record[$item['id']]['totalReward'] += $item['detail_amount'];
} else {
$record[$item['id']]['totalPunish'] += $item['detail_amount'];
}
}
// 获取最大行数
if (sizeof($record[$item['id']]['detail'][$item['detail_type']]) > $record[$item['id']]['maxCount']) {
$record[$item['id']]['maxCount'] = sizeof($record[$item['id']]['detail'][$item['detail_type']]);
}
}
}
$count = sizeof($result);
$page = set_pagination($count, $row);
if ($page) {
$this->assign('_page', $page);
}
$this->assign('list', $list);
ksort($record);
$this->assign('list', $record);
$this->assign('promoters', array_column(M('promote', 'tab_')->where(['level'=>1])->field('id, nickname, account')->select(), null, 'id'));
$this->checkListOrCountAuthRestMap($map,[]);
if(I('is_export', false)){
$getData = $_GET;
unset($getData['export']);
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出推广公司','url'=>U('PromoteCompany/lists'),'menu'=>'推广员-推广员管理-推广公司管理-导出推广公司']);
//导出
$this->display("rewardExport");
die();
}
$this->display();
}
@ -303,11 +428,58 @@ class StatementMangementController extends ThinkController
'money' => I('money'),
'content' => I('content'),
'remark' => I('remark'),
'reward_time' => strtotime(I('reward_time'))
'promote_id' => I('promote_id'),
//'settlement_info' => json_encode(I('settlement_info') ? array_values(I('settlement_info')) : []),
'reward_time' => strtotime(I('reward_time')),
'confirm_time' => strtotime(I('confirm_time')),
'settlement_time' => strtotime(I('settlement_time')),
];
$settlment_info = I('settlement_info');
$accounts = I('account');
$user_types = I('user_type');
// 处理结算信息
if ($settlment_info) {
$tmp = [];
foreach($settlment_info as &$item) {
if (empty($item)) {
unset($item);
continue;
}
// if (!is_numeric($item['price']) || empty($item['price'])) {
// return $this->error('请填写正确的奖惩金额');
// }
$item = json_decode($item, true);
if (!empty($id) && empty($item['id'])) {
$item['record_id'] = $id;
//$item['id'] = null;
}
if (!empty($item['company_id']))
{
$item['company_name'] = '';
}
$item['confirm_time'] = $data['settlement_time'];
//$item['settlement_flag'] = sprintf('%s-%s-%s', $item['company_type'], $item['company_name'], $item[''])
// 归类奖罚数组
$tmp[$item['type']][] = $item;
}
if (empty($tmp)) {
return $this->error('请填写结算信息');
}
$settlment_info = $tmp;
// $promoterIds = array_column($settlment_info, 'promote_id');
// if (in_array(0, $promoterIds)) {
// return $this->error('请选择合作方后再提交');
// }
// if (sizeof(array_unique($promoterIds)) != sizeof($promoterIds)) {
// return $this->error('含有重复的结算方,请确认!');
// }
} else {
return $this->error('请填写结算信息');
}
if ($accounts) {
foreach ($accounts as $index => $account) {
@ -325,27 +497,52 @@ class StatementMangementController extends ThinkController
$data['accounts']=a_array_unique($data['accounts']);
// dump($data['accounts']);die();
$data['accounts'] = json_encode($data['accounts']);
if (!is_numeric(I('money'))) {
return $this->error('请输入正确的金额');
}
// if (!is_numeric(I('money'))) {
// return $this->error('请输入正确的金额');
// }
if (empty(I('content'))) {
return $this->error('请填写事件内容');
}
//dd($settlment_info);
// 更新结算信息
if ($id) {
M('reward_detail', 'tab_')->where(['record_id'=>$id])->delete();
}
if (!empty($settlment_info[RewardModel::REWARD_TYPE_REWARD]) && !empty($settlment_info[RewardModel::REWARD_TYPE_PUNISH])) {
$data['reward_type'] = RewardModel::REWARD_TYPE_ALL;
} else if (!empty($settlment_info[RewardModel::REWARD_TYPE_REWARD])) {
$data['reward_type'] = RewardModel::REWARD_TYPE_REWARD;
} else if (!empty($settlment_info[RewardModel::REWARD_TYPE_PUNISH])) {
$data['reward_type'] = RewardModel::REWARD_TYPE_PUNISH;
}
$settlmentSet = array_merge($settlment_info[RewardModel::REWARD_TYPE_REWARD] ?? [], $settlment_info[RewardModel::REWARD_TYPE_PUNISH] ?? []);
if ($id) {
$upt = M('reward_record', 'tab_')->where(['id'=>$id])->save($data);
if ($upt === false) {
$this->error('保存失败');
} else {
foreach ($settlmentSet as $item) {
M('reward_detail', 'tab_')->add($item);
}
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$data['company_id']])->find();
addOperationLog(['op_type'=>1,'key'=>$companyName['partner'].'/'.(($data['reward_type']==1)?'奖励':'惩罚').'/'.$data['money'],'op_name'=>'修改奖惩记录','url'=>U('Query/settlement'),'menu'=>'推广员-结算单管理-奖罚记录管理-修改奖惩记录']);
$this->success('保存成功', U('StatementMangement/rewardManageList'));
}
} else {
$data['create_time'] = time();
$data['creater_id'] = is_login();
$ins = M('reward_record', 'tab_')->add($data);
$record_id = M('reward_record', 'tab_')->getLastInsID();
foreach ($settlmentSet as $item) {
$item['record_id'] = $record_id;
M('reward_detail', 'tab_')->add($item);
}
$companyName = M('partner','tab_')->field('partner')->where(['id'=>$data['company_id']])->find();
addOperationLog(['op_type'=>0,'key'=>$companyName['partner'].'/'.(($data['reward_type']==1)?'奖励':'惩罚').'/'.$data['money'],'op_name'=>'新增奖惩记录','url'=>U('Query/settlement'),'menu'=>'推广员-结算单管理-奖罚记录管理-新增奖惩记录']);
@ -361,6 +558,8 @@ class StatementMangementController extends ThinkController
$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'=>'推广员-结算单管理-奖罚记录管理']);
@ -369,16 +568,100 @@ class StatementMangementController extends ThinkController
} 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) ?: [];
$this->assign('data', $data);
$data['settlement_info'] = json_decode($data['settlement_info'], true) ?: [];
//$this->assign('data', $data);
}
} else {
$data['reward_time'] = strtotime(date('Y-m-01'));
$this->assign('data', $data);
}
$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();
}
}
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)

@ -0,0 +1,56 @@
<?php
// +----------------------------------------------------------------------
// | OneThink [ WE CAN DO IT JUST THINK IT ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013 http://www.onethink.cn All rights reserved.
// +----------------------------------------------------------------------
// | Author: huajie <banhuajie@163.com>
// +----------------------------------------------------------------------
namespace Admin\Model;
use Common\Api\GameApi;
use Org\WeixinSDK\Weixin;
use Think\Model;
/**
* 文档基础模型
*/
class RewardModel extends Model
{
const REWARD_TYPE_REWARD = 1;
const REWARD_TYPE_PUNISH = 2;
const REWARD_TYPE_ALL = 3;
public static $rewardTypes = [
self::REWARD_TYPE_REWARD => '奖励',
self::REWARD_TYPE_PUNISH => '惩罚',
self::REWARD_TYPE_ALL => '双向'
];
const GAME_RELATION_OTHER = 0;
const SETTLEMENT_TYPE_ONLINE = 2;
const SETTLMENT_TYPE_OFFLINE = 1;
public static $settlementTypes = [
self::SETTLEMENT_TYPE_ONLINE => '线上结算',
self::SETTLMENT_TYPE_OFFLINE => '线下结算'
];
const COMPANY_TYPE_PARTNER = 1;
const COMPANY_TYPE_COMPANY = 2;
const COMPANY_TYPE_INSIDE = 3;
public static $companyTypes = [
self::COMPANY_TYPE_PARTNER => '上游公司',
self::COMPANY_TYPE_COMPANY => '下游公司',
self::COMPANY_TYPE_INSIDE => '内部'
];
public function __construct($name = '', $tablePrefix = '', $connection = '')
{
$this->tablePrefix = 'tab_';
parent::__construct($name, $tablePrefix, $connection);
}
}

@ -0,0 +1,178 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8">
<title>游戏登陆列表|----软件管理平台</title>
<link href="http://admin.vlcms.com/Public/icon.ico" type="image/x-icon" rel="shortcut icon">
<link rel="stylesheet" type="text/css" href="__CSS__/base.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/common.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/module.css">
<link rel="stylesheet" type="text/css" href="__CSS__/style.css" media="all">
<link rel="stylesheet" type="text/css" href="__CSS__/default_color.css" media="all">
<script type="text/javascript" src="__STATIC__/jquery-2.0.3.min.js"></script>
<script src="__STATIC__/table2excel.js"></script>
</head>
<style>
html {
min-width:100%;
}
body {
padding: 0px;
}
</style>
<body>
<div style="margin:auto;font-size: 20px;color: red;line-height: 3;padding: 20px;">
导出进行中。。。<br/>
如果导出成功你也可以手动关闭此页面
</div>
<!-- 数据列表 -->
<table border="1" id="exporttable" style="opacity: 0;">
<!-- 表头 -->
<thead>
<tr>
<th>游戏名</th>
<th>游戏合作方</th>
<th>结算时间</th>
<th>奖惩确认时间</th>
<th>事件说明</th>
<th>奖惩性质</th>
<!-- 惩罚方 -->
<th>奖惩类型</th>
<th>结算公司类型</th>
<th>结算方</th>
<th>会长账号</th>
<th>奖惩金额</th>
<th>结算方式</th>
<!-- 奖励方 -->
<th>奖惩类型</th>
<th>结算公司类型</th>
<th>结算方</th>
<th>会长账号</th>
<th>奖惩金额</th>
<th>结算方式</th>
<th>添加人</th>
</tr>
</thead>
<!-- 列表 -->
<tbody>
<if condition = "empty($list)">
<tr>
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "list">
<volist name="list" id="data">
<!-- 如果没有子级 -->
<?php if(!$data['maxCount']):?>
<tr>
<td>{$data['relation_game_name']}</td>
<td>{$data['relation_game_partner']}</td>
<td>{$data['settlement_time']}</td>
<td>{$data['confirm_time']}</td>
<td>{$data['content']}</td>
<td>{$data['reward_type_text']}</td>
<td>惩罚方</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>奖励方</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{:get_admin_name($data['creater_id'])}</td>
</tr>
<!-- 如果有子级 -->
<?php else:?>
<?php for($i=0; $i<$data['maxCount']; $i++):?>
<?php if($i == 0):?>
<tr>
<td rowspan="{$data['maxCount']}">{$data['relation_game_name']}</td>
<td rowspan="{$data['maxCount']}">{$data['relation_game_partner']}</td>
<td rowspan="{$data['maxCount']}">{$data['settlement_time']}</td>
<td rowspan="{$data['maxCount']}">{$data['confirm_time']}</td>
<td rowspan="{$data['maxCount']}">{$data['content']}</td>
<td rowspan="{$data['maxCount']}">{$data['reward_type_text']}</td>
<td rowspan="{$data['maxCount']}">惩罚方</td>
<td><?=$data['detail'][2][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['settlement_type_text'] ?? '无'?></td>
<td rowspan="{$data['maxCount']}">奖励方</td>
<td><?=$data['detail'][1][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['settlement_type_text'] ?? '无'?></td>
<td rowspan="{$data['maxCount']}">{:get_admin_name($data['creater_id'])}</td>
</tr>
<?php else:?>
<tr>
<td><?=$data['detail'][2][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['settlement_type_text'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['settlement_type_text'] ?? '无'?></td>
</tr>
<?php endif;?>
<?php endfor;?>
<?php endif;?>
</volist>
</notemtpy>
<tr>
<td colspan="10" class="text-center">合计</td>
<td class="text-center" id="total_reward">-{:array_sum(array_column($list, 'totalPunish'))}</td>
<td colspan="5" class="text-center">合计</td>
<td class="text-center" id="total_punish">{:array_sum(array_column($list, 'totalReward'))}</td>
<td colspan="2" class="text-center"></td>
</tr>
</tbody>
</table>
<script>
$(function(){
$("#exporttable").table2excel({
filename: "奖惩列表.xls", // do include extension
preserveColors: false // set to true if you want background colors and font colors preserved
});
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&" + $('.jssearch').find('select').serialize();
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if ( url.indexOf('?')>0 ){
url += '&' + query;
} else {
url += '?' + query;
}
window.parent.reloadIframe(url);
parent.document.getElementsByTagName('iframe').src = url;
});
});
</script>
</body>
</html>

@ -8,6 +8,7 @@
<script type="text/javascript" src="__JS__/bootstrap.min.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<script type="text/javascript" src="__STATIC__/layer3/layer.js"></script>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<style>
.select2-container--default .select2-selection--single {
@ -45,31 +46,31 @@
font-weight: 600;
font-size: 18px;
}
.data_list table td {
line-height:20px;
padding: 0.5px;
height: 30px;
text-indent: 0%;
}
</style>
<div class="cf main-place top_nav_list navtab_list">
<h3 class="page_title">奖罚记录管理</h3>
<p class="description_text">上下游奖罚记录管理</p>
<h3 class="page_title">记录管理</h3>
<p class="description_text">上下游奖记录管理</p>
</div>
<div class="butnbox" >
<div class="butnlist jscheckbutn" style="margin-left: 2px">
<a class="butn" href="{:U('StatementMangement/rewardManageSave')}">添加</a>
</div>
</div>
<div class="cf top_nav_list">
<!-- 高级搜索 -->
<div class="jssearch fl cf search_list">
<!--公司类型搜索END-->
<div class="input-list input-list-server search_label_rehab">
<select id="company_type" name="company_type" class="select_gallery" style="width:120px;">
<option value="">请选择公司类型</option>
<option value="1" <if condition="'0' eq $_GET['company_type']">selected=selected</if>>上游公司</option>
<option value="2" <if condition="'1' eq $_GET['company_type']">selected=selected</if>>下游公司</option>
<select id="reward_type" name="reward_type" class="select_gallery" style="width:120px;">
<option value="">奖惩性质</option>
<option value="3" <if condition="'3' eq $_GET['reward_type']">selected=selected</if>>双向</option>
<option value="1" <if condition="'1' eq $_GET['reward_type']">selected=selected</if>>单向-奖励</option>
<option value="2" <if condition="'2' eq $_GET['reward_type']">selected=selected</if>>单向-惩罚</option>
</select>
</div>
<!--合作公司搜索END-->
@ -82,24 +83,79 @@
</select>
</div>
<div class="input-list input-list-game search_label_rehab">
<select id="game_name" name="game_name" class="select_gallery" >
<select id="game_id" name="game_id" class="select_gallery" >
<option value="">请选择游戏</option>
<option value="0">其他</option>
<volist name=":getAllGame()" id="vo">
<option value="{$vo.game_name}" <if condition="$vo.game_name eq I('game_name')">selected</if>
<option value="{$vo.game_id}" <if condition="$vo.game_id eq I('game_id')">selected</if>
>{$vo.game_name}</option>
</volist>
</select>
</div>
<div class="input-list search_label_rehab">
<input readonly type="text" name="settlement_time_range" style="width:180px;" id='settlement-time-select' value="{$_GET['settlement_time_range']}" placeholder="结算时间范围">
</div>
<div class="input-list">
<div class="input-list search_label_rehab">
<input readonly type="text" name="confirm_time_range" style="width:180px;" id='confirm-time-select' value="{$_GET['confirm_time_range']}" placeholder="确认时间范围">
</div>
<div class="input-list search_label_rehab">
<select id="detail_reward_type" name="detail_reward_type" class="select_gallery">
<option value="">结算奖惩类型</option>
<option value="1" <if condition="'1' eq $_GET['detail_reward_type']">selected=selected</if>>奖励</option>
<option value="2" <if condition="'2' eq $_GET['detail_reward_type']">selected=selected</if>>惩罚</option>
</select>
</div>
<div class="input-list search_label_rehab">
<select id="detail_company_type" name="detail_company_type" class="select_gallery">
<option value="">结算公司类型</option>
<option value="1" <if condition="'1' eq $_GET['detail_company_type']">selected=selected</if>>上游公司</option>
<option value="2" <if condition="'2' eq $_GET['detail_company_type']">selected=selected</if>>下游公司</option>
<option value="3" <if condition="'3' eq $_GET['detail_company_type']">selected=selected</if>>内部</option>
</select>
</div>
<input type="text" name="account" placeholder="账号" class="" value="{:I('account')}"/>&nbsp;
<div class="input-list search_label_rehab">
<select id="detail_company_id" name="detail_company_id" class="select_gallery">
<option value="-1">结算公司/部门</option>
<!-- <option value="0">其他</option> -->
</select>
</div>
<div class="input-list search_label_rehab">
<input type="text" id='detail_company_name' hidden disabled name="detail_company_name" value="{:I('detail_company_name')}" placeholder="请输入内部部门">
</div>
<div class="input-list search_label_rehab">
<select id="detail_promote_account" name="detail_promote_account" class="select_gallery">
<option value="-1">选择会长</option>
<!-- <option value="0">其他</option> -->
<volist name="promoters" id="vo">
<option value="{$vo.account}" <if condition="$vo.account eq I('detail_promote_account')">selected</if>
>{$vo.account}</option>
</volist>
</select>
</div>
<div class="input-list search_label_rehab">
<input type="text" id='detail_promote_account_input' name="detail_promote_account_input" value="{:I('detail_promote_account_input')}" placeholder="请输入会长账号">
</div>
<div class="input-list search_label_rehab">
<select id="detail_settlement_type" name="detail_settlement_type" class="select_gallery">
<option value="">结算方式</option>
<option value="2" <if condition="'2' eq $_GET['detail_settlement_type']">selected=selected</if>>线上结算</option>
<option value="1" <if condition="'1' eq $_GET['detail_settlement_type']">selected=selected</if>>线下结算</option>
</select>
</div>
<input type="hidden" name="from" value="{$_GET['from']}"/>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('StatementMangement/rewardManageList','model='.$model['name'].'&row='.I('row'),false)}"
style="width: 100px;border: #3C95C8 solid 1px;">搜索</a>
<a class="sch-btn" href="{:U('StatementMangement/rewardManageSave')}" style="width: 100px;border: #3C95C8 solid 1px;">新增</a>
<!-- <a class="sch-btn" href="javascript:history.go(-1)" style="background:#fff;color: #000;border: #000 solid 1px;width: 100px">返回</a>-->
</div>
@ -115,15 +171,28 @@
<!-- 表头 -->
<thead>
<tr>
<th>奖罚类型</th>
<th>公司类型</th>
<th>公司名称</th>
<th>涉及账号</th>
<th>游戏</th>
<th>事件</th>
<th>金额</th>
<th>备注</th>
<th>奖罚时间</th>
<th>游戏名</th>
<th>游戏合作方</th>
<th>结算时间</th>
<th>奖惩确认时间</th>
<th>事件说明</th>
<th>奖惩性质</th>
<!-- 惩罚方 -->
<th>奖惩类别</th>
<th>结算公司类型</th>
<th>结算方</th>
<th>会长账号</th>
<th>奖惩金额</th>
<th>结算方式</th>
<!-- 奖励方 -->
<th>奖惩类别</th>
<th>结算公司类型</th>
<th>结算方</th>
<th>会长账号</th>
<th>奖惩金额</th>
<th>结算方式</th>
<th>添加人</th>
<th>操作</th>
</tr>
@ -133,41 +202,108 @@
<tbody>
<if condition = "empty($list)">
<tr>
<td colspan="10" class="text-center">aOh! 暂时还没有内容!</td>
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
</tr>
</if>
<notemtpy name = "list">
<volist name="list" id="data">
<tr>
<td>{$data.reward_type_desc}</td>
<td>{$data.company_type_desc}</td>
<td>{$data.company_name}</td>
<td>
<?php foreach ($data['accounts'] as $account):?>
<div>
<?php if ($account['user_type'] == 1):?>推广员/<?php else:?>玩家/<?php endif;?>{$account['account']}
</div>
<?php endforeach;?>
</td>
<td>{$data.relation_game_name}</td>
<td>{$data.content}</td>
<td>{$data.money}</td>
<td>{$data.remark}</td>
<td>{$data['reward_time']}</td>
<td>{:get_admin_nickname($data['creater_id'])}</td>
<td>
<a href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id']))}">编辑 </a>
<a class="confirm ajax-get" href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id'], 'delete'=>1))}">删除 </a>
</td>
</tr>
<!-- 如果没有子级 -->
<?php if(!$data['maxCount']):?>
<tr>
<td>{$data['relation_game_name']}</td>
<td>{$data['relation_game_partner']}</td>
<td>{$data['settlement_time']}</td>
<td>{$data['confirm_time']}</td>
<td>{$data['content']}</td>
<td>{$data['reward_type_text']}</td>
<td>惩罚方</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>奖励方</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td>{:get_admin_name($data['creater_id'])}</td>
<td>
<a href="{:U('StatementMangement/rewardManageDetail',array('id'=>$data['id']))}">查看 </a>
<a href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id']))}">编辑 </a>
<a class="confirm ajax-get" href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id'], 'delete'=>1))}">删除 </a>
</td>
</tr>
<!-- 如果有子级 -->
<?php else:?>
<?php for($i=0; $i<$data['maxCount']; $i++):?>
<?php if($i == 0):?>
<tr>
<td rowspan="{$data['maxCount']}">{$data['relation_game_name']}</td>
<td rowspan="{$data['maxCount']}">{$data['relation_game_partner']}</td>
<td rowspan="{$data['maxCount']}">{$data['settlement_time']}</td>
<td rowspan="{$data['maxCount']}">{$data['confirm_time']}</td>
<td rowspan="{$data['maxCount']}">{$data['content']}</td>
<td rowspan="{$data['maxCount']}">{$data['reward_type_text']}</td>
<td rowspan="{$data['maxCount']}">惩罚方</td>
<td><?=$data['detail'][2][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['settlement_type_text'] ?? '无'?></td>
<td rowspan="{$data['maxCount']}">奖励方</td>
<td><?=$data['detail'][1][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['settlement_type_text'] ?? '无'?></td>
<td rowspan="{$data['maxCount']}">{:get_admin_name($data['creater_id'])}</td>
<td rowspan="{$data['maxCount']}">
<a href="{:U('StatementMangement/rewardManageDetail',array('id'=>$data['id']))}">查看 </a>
<a href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id']))}">编辑 </a>
<a class="confirm ajax-get" href="{:U('StatementMangement/rewardManageSave',array('id'=>$data['id'], 'delete'=>1))}">删除 </a>
</td>
</tr>
<?php else:?>
<tr>
<td><?=$data['detail'][2][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][2][$i]['settlement_type_text'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['company_type_text'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['company_name'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['promote_account'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['amount'] ?? '无'?></td>
<td><?=$data['detail'][1][$i]['settlement_type_text'] ?? '无'?></td>
</tr>
<?php endif;?>
<?php endfor;?>
<?php endif;?>
</volist>
</notemtpy>
<tr>
<td colspan="10" class="text-center">合计</td>
<td class="text-center" id="total_reward">-{:array_sum(array_column($list, 'totalPunish'))}</td>
<td colspan="5" class="text-center">合计</td>
<td class="text-center" id="total_punish">{:array_sum(array_column($list, 'totalReward'))}</td>
<td colspan="3" class="text-center"></td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="page">
<if condition="$role_export_check eq true ">
<a class="sch-btn" href="{:U('StatementMangement/rewardManageList',array_merge(['is_export'=>1], I('get.')))}">导出</a>
</if>
{$_page|default=''}
</div>
<div class="common_settings">
@ -201,73 +337,163 @@
$(".select_gallery").select2();
highlight_subnav("{:U('StatementMangement/rewardManageList')}");
function get_company_list()
{
var id = $('#partner_id').val();
var company_type = $("#company_type option:selected").val();
$.ajax({
url:"{:U('Ajax/getCompanyList')}",
type:"post",
data:{
company_type:company_type,
},
dataType:'json',
success:function(data){
var str = "<option value=''>请选择合作公司</option>";
for (var i in data){
str += "<option value='"+data[i].id+"'"+"data-type='"+data[i].type+"'"+(id && data[i].id == id?'selected':'')+">"+data[i].name+"</option>"
}
// console.log(str);
$("#partner_id").empty();
$("#partner_id").append(str);
$("#partner_id").select2();
laydate.render({
elem: '#settlement-time-select' //指定元素
,type: 'date'
,range: '~'
});
}
})
}
laydate.render({
elem: '#confirm-time-select' //指定元素
,type: 'date'
,range: '~'
});
// var partner_id = {:I('partner_id', 0)};
// function get_company_list()
// {
// var id = partner_id;
// var company_type = $("#company_type option:selected").val();
// if (company_type == '') {
// return false;
// }
// $.ajax({
// url:"{:U('Ajax/getCompanyList')}",
// type:"post",
// data:{
// company_type:company_type,
// },
// dataType:'json',
// success:function(data){
// var str = "<option value=''>请选择合作公司</option>";
// for (var i in data){
// str += "<option value='"+data[i].id+"'"+"data-type='"+data[i].type+"'"+(id && data[i].id == id?'selected':'')+">"+data[i].name+"</option>"
// }
// // console.log(str);
// $("#partner_id").empty();
// $("#partner_id").append(str);
// $("#partner_id").select2();
function get_game_list()
// }
// })
// }
// function get_game_list()
// {
// var game_name = $('#game_name').val();
// var partner_id = $("#partner_id option:selected").val();
// var sdk_type = $("#sdk_version1 option:selected").val();
// $.ajax({
// url:"{:U('Finance/getGameList')}",
// type:"post",
// data:{
// partner_id:partner_id,
// sdk_type:sdk_type
// },
// dataType:'json',
// success:function(data){
// var str = "<option value=''>请选择游戏</option>";
// for (var i in data){
// str += "<option value='"+data[i].game_name+"'"+(game_name && data[i].game_name == game_name?'selected':'')+">"+data[i].game_name+"</option>"
// }
// // console.log(str);
// $("#game_name").empty();
// $("#game_name").append(str);
// $("#game_name").select2();
// }
// })
// }
var defaultCompanyId = "{:I('detail_company_id', -1)}";
function companyTypeChange()
{
var game_name = $('#game_name').val();
var partner_id = $("#partner_id option:selected").val();
var sdk_type = $("#sdk_version1 option:selected").val();
$.ajax({
url:"{:U('Finance/getGameList')}",
type:"post",
data:{
partner_id:partner_id,
sdk_type:sdk_type
},
dataType:'json',
success:function(data){
var str = "<option value=''>请选择游戏</option>";
for (var i in data){
str += "<option value='"+data[i].game_name+"'"+(game_name && data[i].game_name == game_name?'selected':'')+">"+data[i].game_name+"</option>"
var companyId = $('#detail_company_id').val();
var companyType = $('#detail_company_type').val();
$('#detail_company_name').attr('disabled', true).hide();
//var companyType = $('#form-company-type').val();
// 如果公司类型为内部的时候,公司部门仅其他
if (companyType == 3) {
var companyData = "<option value='-1'>请选择公司/部门</option>";
$('#detail_company_id').html(companyData);
$('#detail_company_name').attr('disabled', false).show();
//$("#detail_company_name").attr("readonly",false)
$('#detail_company_id').change();
} else {
$.ajax({
url:"{:U('StatementMangement/getCompanys')}",
dataType:'JSON',
data: {'type':companyType},
success:function(response){
var companyData = "<option value='-1'>请选择公司/部门</option>";
$.each(response.info, function(index, item){
if (defaultCompanyId == item.id) {
companyData += "<option value='"+item.id+"' selected >"+item.name+"</option>";
} else {
companyData += "<option value='"+item.id+"' >"+item.name+"</option>";
}
});
$('#detail_company_id').html(companyData);
//$("#detail_company_name").attr("readonly",true)
$('#detail_company_id').change();
}
// console.log(str);
$("#game_name").empty();
$("#game_name").append(str);
$("#game_name").select2();
}
})
});
}
}
companyTypeChange()
$('#detail_company_type').on('change', function(){
companyTypeChange()
})
// $('#detail_company_id').on('change', function(){
// var companyId = $('#detail_company_id').val();
// if (companyId == 0) { // 其他
// $('#detail_company_name').attr("readonly",false)
// }else if (companyId != '-1') {
// $('#detail_company_name').attr("readonly",true).val('')
// }
// $('#detail_promote_account').change();
// });
// $('#detail_promote_account').on('change', function(){
// var promoteAccount = $('#detail_promote_account').val();
// if (promoteAccount == 0) { // 其他
// $('#detail_promote_account_input').attr("readonly",false)
// } else if (promoteAccount != '-1') {
// $('#detail_promote_account_input').attr("readonly",true).val('')
// }
// });
$(function(){
get_company_list();
$("#partner_id").change(function(){
get_game_list();
});
$("#company_type").change(function(){
get_company_list();
});
//
// $("#partner_id").change(function(){
// get_game_list();
// });
// if ($("#company_type").val() != '') {
// get_company_list();
// }
// $("#company_type").change(function(){
// if ($("#company_type").val() != '') {
// get_company_list();
// } else {
// $("#partner_id").empty();
// $("#partner_id").select2();
// }
// });
//搜索功能
$("#search").click(function(){
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
console.log(url);
query += "&" + $('.jssearch').find('select').serialize();
console.log(query);
query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
//query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g,'');
query = query.replace(/^&/g,'');
if( url.indexOf('?')>0 ){
url += '&' + query;

@ -5,7 +5,7 @@
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
.bnt_add,.bnt_remove,.bnt_save{
.bnt_add,.bnt_remove,.bnt_save, .settlement_bnt_add{
height: 30px;
width: 20px;
font-size: 20px;
@ -22,6 +22,13 @@
.bnt_save{
color: #4DB361;
}
.data_list table td {
line-height:20px;
padding: 0px;
height: 30px;
text-indent: 0%;
}
</style>
<style>
.select2-container--default .select2-selection--single {
@ -58,8 +65,96 @@
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"
charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<div class="tab-wrap" id='pop-form' hidden>
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="item-form" method="post" class="form-horizontal" style="margin-bottom: 40px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark">*</i>类型:</td>
<td class="r">
<select name="type" id='form-type' class="select_gallery">
<option value="1">奖励</option>
<option value="2">惩罚</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>公司类型:</td>
<td class="r">
<select name="company_type" id='form-company-type' class="select_gallery">
<?php foreach($companyTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>公司/部门:</td>
<td class="r">
<select name="company_id" id='form-company-id' class="select_gallery">
<option value="0">其他</option>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="text" name="company_name" id='form-company-name' autocomplete="off" placeholder="请填写公司/部门" />
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r">
<select name="promote_account" id="form-promote-account" class="select_gallery">
<option value="0">其他</option>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="text" name="promote_account_input" autocomplete="off" id='form-promote-account-input' placeholder="请填写会长账号" />
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算方式:</td>
<td class="r">
<select name="settlement_type" id='form-settlement-type' class="select_gallery">
<?php foreach($settlementTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>金额</td>
<td class="r">
<input type="text" name="amount" id='form-amount' autocomplete="off" value="0" />
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn mlspacing" id="add-item" type="button" target-form="form-horizontal" style="margin-top: 10px;">
新增
</button>
</div>
</form>
</div>
</div>
<form action="{:U('StatementMangement/rewardManageSave')}" enctype="application/x-www-form-urlencoded" method="POST"
class="form-horizontal form_info_ml" id="form">
@ -67,39 +162,96 @@
<ul class="form_info ">
<input type="hidden" name="id" value="{$data.id}" />
<li>
<label>奖惩类型</label>
<?php if ($_GET['id']):?>
<input type="hidden" name="reward_type" value="{$data['reward_type']}">
<?php endif;?>
<select id="reward_type" name="reward_type" class="select_gallery" <?php if ($_GET['id']):?> disabled<?php endif;?>>
<option value="1" <?php if ($data['reward_type'] == 1):?>selected<?php endif;?>>奖励</option>
<option value="2" <?php if ($data['reward_type'] == 2):?>selected<?php endif;?>>惩罚</option>
</select>
<a class="btn" onclick="openForm()">
添加奖惩信息
</a>
</li>
<li>
<label>公司类型</label>
<?php if ($_GET['id']):?>
<input type="hidden" name="company_type" value="{$data['company_type']}">
<?php endif;?>
<select id="company_type" name="company_type" class="select_gallery" onchange="companyTypeChange()" <?php if ($_GET['id']):?> disabled<?php endif;?>>
<option value="1" <?php if ($data['company_type'] == 1):?>selected<?php endif;?>>上游公司</option>
<option value="2" <?php if ($data['company_type'] == 2):?>selected<?php endif;?>>下游公司</option>
</select>
</li>
<li>
<label>公司名称</label>
<select id="company_id" name="company_id" class="select_gallery">
</select>
</li>
<li>
<label>奖罚时间</label>
<input type="text" id="reward_time" readonly name="reward_time" class="" value="{:date('Y-m-d H:i:s',$data['reward_time'])}" placeholder="奖罚时间" />
<div class="data_list">
<div class="">
<table id="record-table" border="1px solid #ccc" >
<!-- 表头 -->
<thead>
<tr>
<th colspan='6'>奖励</th>
<th colspan='6'>惩罚</th>
</tr>
</thead>
<!-- 表头 -->
<thead>
<tr>
<th>公司类型</th>
<th>公司/部门</th>
<th>会长账号</th>
<th>结算方式</th>
<th>金额</th>
<th>操作</th>
<th>公司类型</th>
<th>公司/部门</th>
<th>会长账号</th>
<th>结算方式</th>
<th>金额</th>
<th>操作</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="table-body">
<?php for($i=0; $i<$data['maxCount']; $i++):?>
<tr class="<?php if (!isset($details[1][$i])): php?>empty-reward<?php endif; php?> <?php if (!isset($details[2][$i])): php?>empty-punish<?php endif; php?>">
<!-- 奖励信息 -->
<td class="reward-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='<?=$details[1][$i]['info'] ? json_encode($details[1][$i]['info']) : ''?>' />
</td>
<td class="reward-td company-type"><?=$companyTypes[$details[1][$i]['company_type']] ?? '-'?></td>
<td class="reward-td company-name"><?=$details[1][$i]['company_name'] ?? '-'?></td>
<td class="reward-td promote-account"><?=$details[1][$i]['promote_account'] ?? '-'?></td>
<td class="reward-td settlement-type"><?=$settlementTypes[$details[1][$i]['settlement_type']] ?? '-'?></td>
<td class='reward-amount reward-td amount'><?=$details[1][$i]['amount'] ?? '-'?></td>
<td class='reward-opt reward-td opt'><?php if (isset($details[1][$i])): php?><a onclick="removeItem(this, 'reward')">删除</a><?php else: php?><a onclick="openForm()">添加</a><?php endif; php?></td>
<!-- 惩罚信息 -->
<td class="punish-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='<?=$details[2][$i]['info'] ? json_encode($details[2][$i]['info']) : ''?>' />
</td>
<td class="punish-td company-type"><?=$companyTypes[$details[2][$i]['company_type']] ?? ''?></td>
<td class="punish-td company-name"><?=$details[2][$i]['company_name'] ?? ''?></td>
<td class="punish-td promote-account"><?=$details[2][$i]['promote_account'] ?? ''?></td>
<td class="punish-td settlement-type"><?=$settlementTypes[$details[2][$i]['settlement_type']] ?? ''?></td>
<td class='punish-amount punish-td amount'><?=$details[2][$i]['amount'] ?? ''?></td>
<td class='punish-opt punish-td opt'><?php if (isset($details[2][$i])): php?><a onclick="removeItem(this, 'punish')">删除</a><?php else: php?><a onclick="openForm()">添加</a><?php endif; php?></td>
</tr>
<?php endfor;?>
<tr id='total-amount'>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td id='total-reward-amount'>{$data['rewardAmount']}</td>
<td><a onclick="openForm()">添加</a></td>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td id='total-punish-amount'>{$data['punishAmount']}</td>
<td><a onclick="openForm()">添加</a></td>
</tr>
</tbody>
</table>
</div>
</div>
</li>
<?php if ($data['accounts']):?>
<?php foreach ($data['accounts'] as $k => $account):?>
<?php if ($k == 0):?>
<li class="user-account">
<?php if ($k == 0):?>
<label>涉及账号</label>
<?php else:?>
<label>-</label>
<?php endif;?>
<select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1" <?php if ($account['user_type'] == 1):?>selected<?php endif;?>>推广员</option>
<option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option>
@ -133,6 +285,7 @@
<li>
<label>游戏</label>
<select id="relation_game_id" name="relation_game_id" class="select_gallery">
<option value="0">其他</option>
<?php foreach ($games as $game):?>
<option value="{$game['relation_game_id']}" <?php if ($game['relation_game_id'] == $data['relation_game_id']):?>selected<?php endif;?> >{$game['relation_game_name']}</option>
<?php endforeach;?>
@ -140,11 +293,19 @@
</li>
<li>
<label>事件</label>
<textarea name="content" class="" placeholder="事件" >{$data.content}</textarea>
<textarea name="content" class="" id='content' placeholder="事件" >{$data.content}</textarea>
</li>
<li>
<label>金额</label>
<input name="money" type="text" class="" placeholder="金额" value="{$data.money}" />
<label>奖惩时间</label>
<input type="text" id="reward_time" readonly name="reward_time" class="" value="{:date('Y-m-d H:i:s',$data['reward_time'])}" placeholder="奖惩时间" />
</li>
<li>
<label>奖惩结算时间</label>
<input type="text" id="settlement_time" readonly name="settlement_time" class="" value="<?=$data['settlement_time'] ? date('Y-m-d H:i:s',$data['settlement_time']) : ''?>" placeholder="奖惩时间" />
</li>
<li>
<label>奖惩确认时间</label>
<input type="text" id="confirm_time" readonly name="confirm_time" class="" value="{$data['confirm_time']}" placeholder="奖惩确认时间" />
</li>
<li>
<label>备注</label>
@ -152,7 +313,7 @@
</li>
<li>
<label>&nbsp;</label>
<button class="submit_btn ajax-post" id="submit" type="submit" target-form="form-horizontal">
<button class="submit_btn ajax-post" id="submit-btn" type="submit" target-form="form-horizontal">
确认保存
</button>
<input type="button" value="返 回" target-form="form-horizontal" class="form_btn" onclick="javascript:void(window.history.go(-1))">
@ -174,27 +335,50 @@
<script type="text/javascript">
highlight_subnav('{:U('StatementMangement/rewardManageList')}');
$(".bnt_add").bind("click",function(){
var a= '<li class="user-account"><label>涉及账号</label><select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)"><option value="1">推广员</option><option value="2">玩家</option></select><input type="text" class="txt table_text_input" name="account[]" value="" placeholder="账号"><button type="button" class="bnt_remove"></button>';
var a= '<li class="user-account"><label>-</label><select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)"><option value="1">推广员</option><option value="2">玩家</option></select><input type="text" class="txt table_text_input" name="account[]" value="" placeholder="账号"><button type="button" class="bnt_remove"></button>';
$(".user-account:last").after(a);
});
$(document).on('click', '.bnt_remove', function(){
$(this).parents('li').remove();
countAmount();
});
$(document).on('input propertychange', '#form-amount', function(){
if (!Number($(this).val())) {
s=$(this).val().substring(0,$(this).val().Length-1);
$(this).val(s);
layer.msg('请输入数字');
//countAmount();
return false;
}
//countAmount();
});
var date = new Date();
var monthStart = date.getFullYear()+'-0'+(date.getMonth()+1)+'-01';
$("#reward_time").datetimepicker({
format : "yyyy-mm-dd hh:ii",
autoclose : true,
todayBtn : true,
todayHighlight : true,
startDate : monthStart,
language : 'zh-CN',
startView : 2,//月视图
showMeridian : true,
pickerPosition : "bottom-left",
minuteStep : 5
$("#reward_time, #confirm_time, #settlement_time").each(function(){
laydate.render({
elem: this //指定元素
,type: 'datetime'
});
});
function openForm()
{
layer.open({
type : 1 ,
title:"新增",
area:['30%','60%'],
content: $('#pop-form'),
end : function(){
$('#item-form')[0].reset() // 重置数据
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
}
});
}
/* $('#reward_time').datetimepicker({
language:"zh-CN",
hour: 13,
@ -203,28 +387,212 @@
todayHighlight : true,
todayBtn:true
});*/
var company_id = '{$data["company_id"]}';
function companyTypeChange()
function removeItem(obj, type)
{
var companyType = $('#company_type').val();
$.ajax({
url:"{:U('StatementMangement/getCompanys')}",
dataType:'JSON',
data: {'type':companyType},
success:function(response){
var companyData = '';
$.each(response.info, function(index, item){
if (company_id == item.id) {
companyData += "<option value='"+item.id+"' selected >"+item.name+"</option>";
} else {
companyData += "<option value='"+item.id+"' >"+item.name+"</option>";
}
});
$('#company_id').html(companyData);
$(obj).parents('tr').children('.'+type+'-data-info').find('.info').val('');
$(obj).parents('tr').addClass('empty-'+type);
if ($(obj).parents('tr').hasClass('empty-reward') && $(obj).parents('tr').hasClass('empty-punish')) {
$(obj).parents('tr').remove();
} else {
$(obj).parents('tr').children('.'+type+'-td').each(function(index, item){
if (index < 6) {
$(item).html('');
} else {
$(item).html('<a onclick="openForm()">添加</a>')
}
});
}
countAmount();
}
$(document).on('click', '#add-item', function(){
var data = {
type : $("#form-type").val(),
company_type : $("#form-company-type").val(),
company_type_desc : $("#form-company-type option:selected").text(),
company_id : $("#form-company-id").val(),
company_name : $("#form-company-name").val(),
//promote_account : $("#form-promote-account").val() ?? $("#form-promote-account-input").val(),
settlement_type : $("#form-settlement-type").val(),
settlement_type_desc : $("#form-settlement-type option:selected").text(),
amount : $("#form-amount").val()
};
if ($("#form-promote-account").val() == 0) {
data['promote_account'] = $("#form-promote-account-input").val();
} else {
data['promote_account'] = $("#form-promote-account").val();
}
var type_dec = data['type'] == 1 ? 'reward' : 'punish';
// 找到空闲的节点,如果没有,则创建一行
var emptyNode = $('.table-body tr,.empty-'+type_dec+':first');
if (emptyNode.length == 0) {
console.log(emptyNode.length)
var newNodeHtml =
`<tr class="empty-reward empty-punish">
<!-- 奖励信息 -->
<td class="reward-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='' />
</td>
<td class="reward-td company-type"></td>
<td class="reward-td company-name"></td>
<td class="reward-td promote-account"></td>
<td class="reward-td settlement-type"></td>
<td class='reward-amount reward-td amount'></td>
<td class='reward-opt reward-td opt'><a onclick="openForm()">添加</a></td>
<!-- 惩罚信息 -->
<td class="punish-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='' />
</td>
<td class="punish-td company-type"></td>
<td class="punish-td company-name"></td>
<td class="punish-td promote-account"></td>
<td class="punish-td settlement-type"></td>
<td class='punish-amount punish-td amount'></td>
<td class='punish-opt punish-td opt'><a onclick="openForm()">添加</a></td>
</tr>`;
$('#total-amount').before(newNodeHtml);
emptyNode = $('.table-body tr,.empty-'+type_dec+':first');
}
$(emptyNode).children('.'+type_dec+'-data-info').find('.info').val(JSON.stringify(data));
$(emptyNode).children('.'+type_dec+'-td').each(function(index, item){
if ($(item).hasClass('company-type')) {
$(item).text(data['company_type_desc'])
} else if ($(item).hasClass('company-name')) {
$(item).text(data['company_name'])
} else if ($(item).hasClass('promote-account')) {
$(item).text(data['promote_account'])
} else if ($(item).hasClass('settlement-type')) {
$(item).text(data['settlement_type_desc'])
} else if ($(item).hasClass('amount')) {
$(item).text(data['amount'])
} else if ($(item).hasClass('opt')) {
$(item).html(`<a onclick="removeItem(this, '`+type_dec+`')">删除</a>`)
}
});
$(emptyNode).removeClass('empty-'+type_dec);
countAmount();
$('#item-form')[0].reset()
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
layer.closeAll();
});
// 全部总金额重算
function countAmount()
{
var reward_amount = punish_amount = 0;
$('.reward-amount').each(function(index, item){
if (Number($(item).text()) != null) {
reward_amount += Number($(item).text());
}
});
$('#total-reward-amount').text(reward_amount);
$('.punish-amount').each(function(index, item){
if (Number($(item).text())) {
punish_amount += Number($(item).text());
}
});
$('#total-punish-amount').text(punish_amount);
}
// 修改公司类型时候
$(document).on('change', '#form-company-type', function(){
companyTypeChange();
});
$(document).on('change', '#form-company-id', function(){
promoteChange();
});
$(document).on('change', '#form-promote-account', function(){
var promoteAccount = $('#form-promote-account').val();
if (promoteAccount == 0) {
$("#form-promote-account-input").attr("readonly",false)
$("#form-promote-account-input").val('');
} else {
$("#form-promote-account-input").attr("readonly",true).val($(this).val());
}
});
function promoteChange() {
var companyId = $('#form-company-id').val();
var companyType = $('#form-company-type').val();
// 如果选择为其他,则开放填写
if (companyId == 0) {
$("#form-company-name").attr("readonly",false)
$("#form-company-name").val('');
} else if (companyType == 1) { // 上游公司没有下级会长
var promoteData = "<option value='0' selected>其他</option>";
$('#form-promote-account').html(promoteData);
$("#form-promote-account-input").attr("readonly",false)
$("#form-company-name").attr("readonly",true)
$("#form-company-name").val($('#form-company-id option:selected').text());
} else {
$.ajax({
url:"{:U('Ajax/getPromotersByCompanyid')}",
dataType:'JSON',
data: {'company_id':companyId},
success:function(response){
var promoteData = "<option value='0'>其他</option>";
$.each(response.data, function(index, item){
promoteData += "<option value='"+item.account+"' >"+item.account+"</option>";
});
$('#form-promote-account').html(promoteData);
$("#form-promote-account-input").attr("readonly",false)
$("#form-company-name").attr("readonly",true)
$("#form-company-name").val($('#form-company-id option:selected').text());
}
});
}
}
// var company_id = '{$data["company_id"]}';
function companyTypeChange()
{
var companyType = $('#form-company-type').val();
// 如果公司类型为内部的时候,公司部门仅其他
if (companyType == 3) {
var companyData = "<option value='0' selected>其他</option>";
$('#form-company-id').html(companyData);
$("#form-company-name").attr("readonly",false)
} else {
$.ajax({
url:"{:U('StatementMangement/getCompanys')}",
dataType:'JSON',
data: {'type':companyType},
success:function(response){
var companyData = "<option value='0'>其他</option>";
$.each(response.info, function(index, item){
companyData += "<option value='"+item.id+"' >"+item.name+"</option>";
});
$('#form-company-id').html(companyData);
$("#form-company-name").attr("readonly",true)
//$('#company_id').html(companyData);
promoteChange();
}
});
}
}
companyTypeChange();
// $('#submit-btn').on('click', function(){
// var data = {
// relation_game_id : $('#relation_game_id').val(),
// content : $('#content').text(),
// reward_time : $('#reward_time').val(),
// settlement_time : $('#settlement_time').val(),
// confirm_time : $('#confirm_time').val(),
// remark : $('#remark').val()
// };
// return false;
// })
</script>
</block>

@ -0,0 +1,321 @@
<extend name="Public/base" />
<block name="css">
<link rel="stylesheet" type="text/css" href="__CSS__/admin_table.css" media="all">
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
#form .txt_area.download_url {width:400px;}
.tabcon1711 .table_radio2 .table_btn {width:215px;}
.bnt_add,.bnt_remove,.bnt_save, .settlement_bnt_add{
height: 30px;
width: 20px;
font-size: 20px;
line-height: 10px;
color: #3399ff;
background: none;
border: none;
margin-left: 20px;
cursor: pointer;
}
.bnt_remove{
color: #F70909;
}
.bnt_save{
color: #4DB361;
}
.data_list table td {
line-height:20px;
padding: 0px;
height: 30px;
text-indent: 0%;
}
</style>
<style>
.select2-container--default .select2-selection--single {
color: #000;
resize: none;
border-width: 1px;
border-style: solid;
border-color: #a7b5bc #ced9df #ced9df #a7b5bc;
box-shadow: 0px 3px 3px #F7F8F9 inset;height:35px;
height:28px;border-radius:3px;font-size:12px;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
line-height:35px;
line-height:28px;
}
.select2-container--default .select2-selection--single .select2-selection__arrow {
height:26px;
}
.select2-container--default .select2-search--dropdown .select2-search__field {
height:26px;line-height:26px;font-size:12px;
}
.select2-results__option[aria-selected] {font-size:12px;}
</style>
</block>
<!-- 管理员用户组新增和编辑页面 -->
<block name="body">
<script src="__STATIC__/layer/layer.js" type="text/javascript"></script>
<script src="__STATIC__/layer/extend/layer.ext.js" type="text/javascript"></script>
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<link href="__STATIC__/datetimepicker/css/datetimepicker.css" rel="stylesheet" type="text/css">
<php>if(C('COLOR_STYLE')=='blue_color') echo '
<link href="__STATIC__/datetimepicker/css/datetimepicker_blue.css" rel="stylesheet" type="text/css">
';
</php>
<link href="__STATIC__/datetimepicker/css/dropdown.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="__STATIC__/datetimepicker/js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="__STATIC__/datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js"charset="UTF-8"></script>
<script type="text/javascript" src="__STATIC__/laydate/laydate.js"></script>
<div class="tab-wrap" id='pop-form' hidden>
<div class="tab-content tabcon1711">
<!-- 表单 -->
<form id="item-form" method="post" class="form-horizontal" style="margin-bottom: 40px;">
<!-- 基础文档模型 -->
<div id="tab1" class="tab-pane in tab1">
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="l"><i class="mustmark">*</i>类型:</td>
<td class="r">
<select name="type" id='form-type' class="select_gallery">
<option value="1">奖励</option>
<option value="2">惩罚</option>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>公司类型:</td>
<td class="r">
<select name="company_type" id='form-company-type' class="select_gallery">
<?php foreach($companyTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>公司/部门:</td>
<td class="r">
<select name="company_id" id='form-company-id' class="select_gallery">
<option value="0">其他</option>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="text" name="company_name" id='form-company-name' autocomplete="off" placeholder="请填写公司/部门" />
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r">
<select name="promote_account" id="form-promote-account" class="select_gallery">
<option value="0">其他</option>
</select>
</td>
</tr>
<tr>
<td class="l"></td>
<td class="r">
<input type="text" name="promote_account_input" autocomplete="off" id='form-promote-account-input' placeholder="请填写会长账号" />
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>结算方式:</td>
<td class="r">
<select name="settlement_type" id='form-settlement-type' class="select_gallery">
<?php foreach($settlementTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
</select>
</td>
</tr>
<tr>
<td class="l"><i class="mustmark">*</i>金额</td>
<td class="r">
<input type="text" name="amount" id='form-amount' autocomplete="off" value="0" />
</td>
</tr>
</tbody>
</table>
</div>
<div class="form-item cf">
<button class="submit_btn mlspacing" id="add-item" type="button" target-form="form-horizontal" style="margin-top: 10px;">
新增
</button>
</div>
</form>
</div>
</div>
<form action="{:U('StatementMangement/rewardManageSave')}" enctype="application/x-www-form-urlencoded" method="POST"
class="form-horizontal form_info_ml" id="form">
<div class="formtitle"><span>查看</span></div>
<ul class="form_info ">
<input type="hidden" name="id" value="{$data.id}" />
<li>
<div class="data_list">
<div class="">
<table id="record-table" border="1px solid #ccc" >
<!-- 表头 -->
<thead>
<tr>
<th colspan='5'>奖励</th>
<th colspan='5'>惩罚</th>
</tr>
</thead>
<!-- 表头 -->
<thead>
<tr>
<th>公司类型</th>
<th>公司/部门</th>
<th>会长账号</th>
<th>结算方式</th>
<th>金额</th>
<th>公司类型</th>
<th>公司/部门</th>
<th>会长账号</th>
<th>结算方式</th>
<th>金额</th>
</tr>
</thead>
<!-- 列表 -->
<tbody id="table-body">
<?php for($i=0; $i<$data['maxCount']; $i++):?>
<tr class="<?php if (!isset($details[1][$i])): php?>empty-reward<?php endif; php?> <?php if (!isset($details[2][$i])): php?>empty-punish<?php endif; php?>">
<!-- 奖励信息 -->
<td class="reward-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='<?=$details[1][$i]['info'] ? json_encode($details[1][$i]['info']) : ''?>' />
</td>
<td class="reward-td company-type"><?=$companyTypes[$details[1][$i]['company_type']] ?? '-'?></td>
<td class="reward-td company-name"><?=$details[1][$i]['company_name'] ?? '-'?></td>
<td class="reward-td promote-account"><?=$details[1][$i]['promote_account'] ?? '-'?></td>
<td class="reward-td settlement-type"><?=$settlementTypes[$details[1][$i]['settlement_type']] ?? '-'?></td>
<td class='reward-amount reward-td amount'><?=$details[1][$i]['amount'] ?? '-'?></td>
<!-- 惩罚信息 -->
<td class="punish-data-info" hidden>
<input class="info" name="settlement_info[]" hidden value='<?=$details[2][$i]['info'] ? json_encode($details[2][$i]['info']) : ''?>' />
</td>
<td class="punish-td company-type"><?=$companyTypes[$details[2][$i]['company_type']] ?? ''?></td>
<td class="punish-td company-name"><?=$details[2][$i]['company_name'] ?? ''?></td>
<td class="punish-td promote-account"><?=$details[2][$i]['promote_account'] ?? ''?></td>
<td class="punish-td settlement-type"><?=$settlementTypes[$details[2][$i]['settlement_type']] ?? ''?></td>
<td class='punish-amount punish-td amount'><?=$details[2][$i]['amount'] ?? ''?></td>
</tr>
<?php endfor;?>
<tr id='total-amount'>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td id='total-reward-amount'>{$data['rewardAmount']}</td>
<td></td>
<td></td>
<td></td>
<td>合计</td>
<td id='total-punish-amount'>{$data['punishAmount']}</td>
</tr>
</tbody>
</table>
</div>
</div>
</li>
<?php if ($data['accounts']):?>
<?php foreach ($data['accounts'] as $k => $account):?>
<?php if ($k == 0):?>
<li class="user-account">
<?php if ($k == 0):?>
<label>涉及账号</label>
<?php else:?>
<label>-</label>
<?php endif;?>
<select name="user_type[]" readonly class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1" <?php if ($account['user_type'] == 1):?>selected<?php endif;?>>推广员</option>
<option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option>
</select>
<input type="text" readonly class="txt table_text_input" name="account[]" value="{$account['account']}" placeholder="账号">
</li>
<?php else:?>
<li class="user-account">
<label>涉及账号</label>
<select disabled name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1" <?php if ($account['user_type'] == 1):?>selected<?php endif;?>>推广员</option>
<option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option>
</select>
<input readonly type="text" class="txt table_text_input" name="account[]" value="{$account['account']}" placeholder="账号">
</li>
<?php endif;?>
<?php endforeach;?>
<?php else:?>
<li class="user-account">
<label>涉及账号</label>
<select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<option value="1">推广员</option>
<option value="2">玩家</option>
</select>
<input type="text" class="txt table_text_input" name="account[]" value="" placeholder="账号">
</li>
<?php endif;?>
<li>
<label>游戏</label>
<select id="relation_game_id" disabled name="relation_game_id" class="select_gallery">
<option value="0">其他</option>
<?php foreach ($games as $game):?>
<option value="{$game['relation_game_id']}" <?php if ($game['relation_game_id'] == $data['relation_game_id']):?>selected<?php endif;?> >{$game['relation_game_name']}</option>
<?php endforeach;?>
</select>
</li>
<li>
<label>事件</label>
<textarea name="content" readonly class="" id='content' placeholder="事件" >{$data.content}</textarea>
</li>
<li>
<label>奖惩时间</label>
<input type="text"readonly class="" value="{:date('Y-m-d H:i:s',$data['reward_time'])}" placeholder="奖惩时间" />
</li>
<li>
<label>奖惩结算时间</label>
<input type="text" readonly class="" value="<?=$data['settlement_time'] ? date('Y-m-d H:i:s',$data['settlement_time']) : ''?>" placeholder="奖惩时间" />
</li>
<li>
<label>奖惩确认时间</label>
<input type="text" readonly class="" value="{$data['confirm_time']}" placeholder="奖惩确认时间" />
</li>
<li>
<label>备注</label>
<textarea name="remark" readonly class="" placeholder="备注" >{$data.remark}</textarea>
</li>
<li>
<label>&nbsp;</label>
<input type="button" value="返 回" target-form="form-horizontal" class="form_btn" onclick="javascript:void(window.history.go(-1))">
</li>
</ul>
</form>
<div class="common_settings">
<span class="plus_icon"><span><img src="__IMG__/zwmimages/icon_jia.png"></span></span>
<form class="addShortcutIcon">
<input type="hidden" name="title" value="{$m_title}">
<input type="hidden" name="url" value="AuthManager/index">
</form>
<a class="ajax-post add-butn <notempty name='commonset'>addSIsetted</notempty>" href="javascript:;" target-form="addShortcutIcon" url="{:U('Think/addShortcutIcon')}"><img src="__IMG__/zwmimages/icon_jia.png"><span><notempty name='commonset'>已添加<else />添加至常用设置</notempty></span></a>
</div>
</block>
<block name="script">
<script type="text/javascript">
highlight_subnav('{:U('StatementMangement/rewardManageList')}');
</script>
</block>

@ -2237,6 +2237,37 @@ CREATE TABLE `tab_payment_member` (
INSERT INTO `tab_payment_member` (`id`, `real_name`, `mobile`, `last_login_time`) VALUES ('1', '胡歌', '18959188422', '0')
--20200710 ylw
ALTER TABLE `tab_reward_record`
ADD COLUMN `promote_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会长id' AFTER `company_id`,
ADD COLUMN `settlement_info` json NOT NULL AFTER `accounts`,
ADD COLUMN `confirm_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '确认时间' AFTER `remark`;
CREATE TABLE `tab_reward_detail` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`company_type` tinyint(1) unsigned NOT NULL DEFAULT '3' COMMENT '公司类型 1上游 2下游 3内部',
`company_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '公司id',
`company_name` varchar(64) NOT NULL DEFAULT '' COMMENT '公司/部门名称',
`promote_account` varchar(64) NOT NULL DEFAULT '' COMMENT '会长账号',
`settlement_type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '结算方式 1线下结算 2线上结算 ',
`amount` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '奖罚额度',
`record_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '记录id',
`type` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '1奖励 2惩罚',
`confirm_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '结算时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
ALTER TABLE `tab_reward_record`
DROP COLUMN `company_type`,
DROP COLUMN `company_id`,
DROP COLUMN `promote_id`,
DROP COLUMN `settlement_info`,
DROP COLUMN `money`,
MODIFY COLUMN `reward_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 COMMENT '奖罚类型 1奖励 2惩罚 3双向' AFTER `id`,
MODIFY COLUMN `relation_game_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '游戏id 0其他' AFTER `accounts`
---- 2020-7-20 ylw
ALTER TABLE `tab_promote`
ADD COLUMN `alipay_real_name` varchar(30) NOT NULL DEFAULT '' COMMENT '支付宝真实姓名' AFTER `alipay_account`;

Loading…
Cancel
Save