From 0513f0fa5e794a8c03cd3be38e4f769f985c78ae Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Thu, 20 Feb 2020 10:03:10 +0800 Subject: [PATCH 1/4] fix bug --- .../Admin/Controller/SettlementController.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Application/Admin/Controller/SettlementController.class.php b/Application/Admin/Controller/SettlementController.class.php index d7af2cfbf..c12cf0f89 100644 --- a/Application/Admin/Controller/SettlementController.class.php +++ b/Application/Admin/Controller/SettlementController.class.php @@ -22,11 +22,12 @@ class SettlementController extends ThinkController if (I('all_status')) { $map['all_status'] = I('all_status'); } + $map['_string'] = "1 = 1"; if (I('create_time_start')) { - $map['_string'] = "create_time >= ".strtotime(I('create_time_start')); + $map['_string'] .= " and create_time >= ".strtotime(I('create_time_start')); } if (I('create_time_end')) { - $map['_string'] = "create_time <= ".strtotime(I('create_time_end')) + 86400; + $map['_string'] .= " and create_time <= ".(strtotime(I('create_time_end')) + 86400); } $login_uid = is_login(); $list = M('settlement_sheet', 'tab_')->where($map)->page($p, $row)->order("if (audit_user ={$login_uid}, 0,1 ) and status = 3, all_status desc, create_time desc")->select(); @@ -434,7 +435,7 @@ class SettlementController extends ThinkController } else if ($arr_index + 1 == sizeof($info['audit_users']) && $info['status'] != 3) { return $this->error('该结算单已经审核完毕', true, true); } - $is_last = ($info['step'] + 1 >= sizeof($info['audit_users'])); + $is_last = ($info['step'] >= sizeof($info['audit_users'])); $update['remark'] = $remark; $update['status'] = $audit_type == 1 ? ($is_last ? 1 : 3) : 2; $update['step'] = ($audit_type == 1 && !$is_last) ? $info['step'] + 1 : $info['step']; From dad83c8d38264826dca291755c9b1416b5e0a8ea Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 20 Feb 2020 10:22:44 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E6=8A=BC=E9=87=91=E4=BB=98=E6=AC=BE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E6=B7=BB=E5=8A=A0=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/PresidentDepositController.class.php | 4 ++-- Application/Admin/View/PresidentDeposit/form.html | 12 ++++++++++++ .../Base/Service/PresidentDepositService.class.php | 1 + Data/update.sql | 4 ++++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php index bfb56c637..396b32df6 100644 --- a/Application/Admin/Controller/PresidentDepositController.class.php +++ b/Application/Admin/Controller/PresidentDepositController.class.php @@ -205,7 +205,7 @@ class PresidentDepositController extends ThinkController if ($payType == 0) { return $this->error('请选择押金付款方式'); } - if ($payWay == 0) { + if ($payType != 2 && $payWay == 0) { return $this->error('请选择付款方式'); } if ($amount !== '') { @@ -221,7 +221,7 @@ class PresidentDepositController extends ThinkController } $data = []; - $data['pay_way'] = $payWay; + $data['pay_way'] = $payType == 2 ? 4 : $payWay; $data['pay_type'] = $payType; $data['promote_id'] = $promoteId; $data['pay_account'] = $payAccount; diff --git a/Application/Admin/View/PresidentDeposit/form.html b/Application/Admin/View/PresidentDeposit/form.html index 80a517f1d..04ea3d80a 100644 --- a/Application/Admin/View/PresidentDeposit/form.html +++ b/Application/Admin/View/PresidentDeposit/form.html @@ -216,6 +216,18 @@ $(function(){ }); }); + $('#pay_type').change(function() { + var val = $(this).val() + if (val == 2) { + $("#pay_way option[value='4']").removeProp('disabled'); + $('#pay_way').val('4').select2() + $('#pay_way').attr('disabled', 'disabled') + } else { + $('#pay_way').removeAttr('disabled'); + $("#pay_way option[value='4']").prop('disabled', true); + $('#pay_way').val('').select2() + } + }) $('#ratio, #begin_time, #end_time, #remark').change(function () { var val = $(this).val(); var elementIdName = $(this).attr('id'); diff --git a/Application/Base/Service/PresidentDepositService.class.php b/Application/Base/Service/PresidentDepositService.class.php index 8d6299baa..2dcd8db0c 100644 --- a/Application/Base/Service/PresidentDepositService.class.php +++ b/Application/Base/Service/PresidentDepositService.class.php @@ -17,6 +17,7 @@ class PresidentDepositService 1 => '银行转账', 2 => '支付宝转账', 3 => '微信转账', + 4 => '分成款扣除', ]; public static $payTypes = [ diff --git a/Data/update.sql b/Data/update.sql index 2998e4fa1..7b3859fe9 100644 --- a/Data/update.sql +++ b/Data/update.sql @@ -1347,3 +1347,7 @@ CREATE TABLE `tab_financial_summary` ( KEY `count_year` (`count_year`) USING BTREE, KEY `key_name` (`key_name`) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COMMENT='财务分类汇总统计'; + +-- 推广员部门/小组 liaojinling +ALTER TABLE tab_promote +ADD COLUMN `group_remark` varchar(50) NOT NULL DEFAULT '' COMMENT '部门/小组'; \ No newline at end of file From 5dde3ef96ed322e5221cbfb96fbc39c28f0efc3e Mon Sep 17 00:00:00 2001 From: yulingwei <2436953959@qq.com> Date: Thu, 20 Feb 2020 10:36:26 +0800 Subject: [PATCH 3/4] upt --- .../Admin/Controller/SettlementController.class.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Application/Admin/Controller/SettlementController.class.php b/Application/Admin/Controller/SettlementController.class.php index c12cf0f89..900410962 100644 --- a/Application/Admin/Controller/SettlementController.class.php +++ b/Application/Admin/Controller/SettlementController.class.php @@ -137,7 +137,7 @@ class SettlementController extends ThinkController } $result = M('spend', 'tab_')->query(" SELECT - sum(s.pay_amount) as amount, g.relation_game_id, g.relation_game_name, p.partner, p.id as p_id, p.channel_rate, p.invoice_rate, g.id as game_id + TRUNCATE(sum(s.pay_amount), 2) as amount, g.relation_game_id, g.relation_game_name, p.partner, p.id as p_id, p.channel_rate, p.invoice_rate, g.id as game_id FROM tab_spend as s INNER JOIN tab_game g on s.game_id = g.id @@ -179,7 +179,7 @@ class SettlementController extends ThinkController $data['relation_game_name'] = $item['relation_game_name']; $data['amount'] = $item['amount']; $data['self_game_ratio'] = 100 - $data['game_ratio']; - $data['parter_settlement'] = $item['amount'] * $data['game_ratio']/100 - ($item['amount']*$item['channel_rate'] ) + $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine']; + $data['parter_settlement'] = floor(($item['amount'] * ($data['game_ratio']/100) - ($item['amount']*$item['channel_rate'] ) + $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'])*100)/100; $list[$item['p_id']]['channels'][] = array_merge($data, [ 'company_id'=>$item['p_id'], 'company_name'=>$item['partner'], @@ -206,7 +206,7 @@ class SettlementController extends ThinkController foreach ($result as $key => $item) { $res = M()->query(" select - g.relation_game_name, g.relation_game_id, sum(s.pay_amount) as amount + g.relation_game_name, g.relation_game_id, TRUNCATE(sum(s.pay_amount), 2) as amount from tab_spend s inner join tab_promote p on (p.chain like '/{$item['id']}/%' or p.id = {$item['id']}) and s.promote_id = p.id @@ -236,7 +236,7 @@ class SettlementController extends ThinkController 'time_start' => date('Y-m-d', $time_start), 'time_end' => date('Y-m-d', $time_end) ]; - $list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine']; + $list[$item['p_id']]['total_amount'] = floor(($list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'])*100)/100; } foreach ($res as $k => $val) { $gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true); @@ -278,7 +278,7 @@ class SettlementController extends ThinkController foreach ($result as $key => $item) { $res = M()->query(" select - g.relation_game_name, g.relation_game_id, sum(s.pay_amount) as amount + g.relation_game_name, g.relation_game_id, TRUNCATE(sum(s.pay_amount), 2) as amount from tab_spend s inner join tab_promote p on (p.chain like '/{$item['id']}/%' or p.id = {$item['id']}) and s.promote_id = p.id @@ -310,7 +310,7 @@ class SettlementController extends ThinkController 'time_start' => date('Y-m-d', $time_start), 'time_end' => date('Y-m-d', $time_end) ]; - $list[$item['p_id']]['total_amount'] = $list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine']; + $list[$item['p_id']]['total_amount'] = floor(($list[$item['p_id']]['bonuses'] - $list[$item['p_id']]['fine'])*100)/100; } foreach ($res as $k => $val) { $gameRatio = getPromoteGameRatio($item['id'], $val['relation_game_id'], $val['amount'], $time_start, $time_end, true); From 7cd28cc7ce0a40485be042b919bf5e51bd349c99 Mon Sep 17 00:00:00 2001 From: ELF <360197197@qq.com> Date: Thu, 20 Feb 2020 10:43:59 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=9A=E4=BD=99?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin/View/PresidentDeposit/form.html | 187 ------------------ 1 file changed, 187 deletions(-) diff --git a/Application/Admin/View/PresidentDeposit/form.html b/Application/Admin/View/PresidentDeposit/form.html index 04ea3d80a..b97f932d3 100644 --- a/Application/Admin/View/PresidentDeposit/form.html +++ b/Application/Admin/View/PresidentDeposit/form.html @@ -186,36 +186,6 @@ $(function(){ }); showTab(); - var promoteGameRatioData = {}; - promoteGameRatioData.ratio = '0.00'; - promoteGameRatioData.begin_time = ''; - promoteGameRatioData.end_time = ''; - promoteGameRatioData.remark = ''; - - $('#company_id').change(function (e) { - var companyId = parseInt($(this).val()); - $.ajax({ - type: 'post', - url: "{:U('getPromotes')}", - dataType: 'json', - data: {'company_id': companyId}, - success: function (data) { - var html = ''; - if (data.length > 0) { - for (let i = 0;i < data.length;i++) { - html += ''; - } - } - $('#promote_id').html(html); - $('#promote_id').select2(); - getPromoteGameRatio(); - }, - error: function (result) { - console.log(result); - } - }); - }); - $('#pay_type').change(function() { var val = $(this).val() if (val == 2) { @@ -228,46 +198,6 @@ $(function(){ $('#pay_way').val('').select2() } }) - $('#ratio, #begin_time, #end_time, #remark').change(function () { - var val = $(this).val(); - var elementIdName = $(this).attr('id'); - promoteGameRatioData[elementIdName] = val; - }); - - $('#promote_id, #game_id').change(function () { - getPromoteGameRatio(); - }); - - function getPromoteGameRatio() - { - var promoteId = parseInt($('#promote_id').val()); - var gameId = parseInt($('#game_id').val()); - - $.ajax({ - type: 'post', - url: "{:U('getPromoteGameRatio')}", - dataType: 'json', - data: {'promote_id': promoteId, 'game_id': gameId}, - success: function (data) { - var record = data.record; - if (data.status == 2) { - $('#ratio').val(record.ratio); - $('#last_ratio').text(record.last_ratio); - $('#begin_time').val(record.begin_time); - $('#end_time').val(record.end_time); - $('#remark').val(record.remark); - $('#id').val(record.id); - } else { - // $('#ratio').val(promoteGameRatioData.ratio); - $('#last_ratio').text(record.last_ratio); - // $('#begin_time').val(promoteGameRatioData.begin_time); - // $('#end_time').val(promoteGameRatioData.end_time); - // $('#remark').val(promoteGameRatioData.remark); - $('#id').val(''); - } - } - }); - } $('#submit').click(function (e) { var target = $('form').get(0).action; @@ -305,123 +235,6 @@ $(function(){ } }); }); - - $('.iconfont-btn-add').click(function (e) { - var delBtn = $('.iconfont-btn-del'); - var html = ''; - html += '
'; - html += ''; - html += ''; - html += '
'; - html += ''; - html += ''; - html += '
'; - html += ''; - html += '
'; - html += ''; - html += '%'; - html += ''; - html += '
'; - html += '
'; - - $('.list-ratio').append(html); - - if ($('.list-ratio').children().length > 1 && delBtn.children('i').hasClass('iconfont-unselected')) { - delBtn.children('i').removeClass('iconfont-unselected'); - delBtn.children('i').addClass('iconfont-selected'); - } - - $('.list-ratio').children(':last-child').children('.turnover').children('input').change(function (e) { - turnoverChangeHandle(); - }); - - $('.list-ratio').children(':last-child').children('.turnover-ratio').children('input').change(function (e) { - turnoverRatioChangeHandle(); - }); - }); - - $('.list-ratio').children('.li-ratio').children('.turnover').children('input').change(function (e) { - turnoverChangeHandle(); - }); - - $('.list-ratio').children('.li-ratio').children('.turnover-ratio').children('input').change(function (e) { - turnoverRatioChangeHandle(); - }); - - function turnoverChangeHandle() - { - $('.list-ratio').children('.li-ratio').children('.turnover').children('input').each(function () { - var that = $(this); - var thatLiRatio = that.parent().parent(); - var thatLiRatioIndex = thatLiRatio.index(); - var prevTurnover = 0; - var prev = thatLiRatio.prev().children().children('input'); - var thatTurnover = parseFloat(that.val()); - - if (thatLiRatioIndex > 0) { - prevTurnover = parseFloat(prev.val()); - prevTurnoverHandle(thatTurnover, prevTurnover, that); - } - }); - } - - function turnoverRatioChangeHandle() { - var ratio = parseFloat($('#ratio').val()); - $('.list-ratio').children('.li-ratio').children('.turnover-ratio').children('input').each(function () { - var that = $(this); - var thatLiRatio = that.parent().parent(); - var thatLiRatioIndex = thatLiRatio.index(); - var thatTurnoverRatio = parseFloat(that.val()); - - if (thatLiRatioIndex === 0) { - console.log(111) - prevTurnoverRatio = ratio; - prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that, true); - } else { - var prev = thatLiRatio.prev().children('.turnover-ratio').children('input'); - var prevTurnoverRatio = parseFloat(prev.val()); - prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that); - } - }); - } - - function prevTurnoverHandle(thatTurnover, prevTurnover, that) - { - if (thatTurnover <= prevTurnover) { - that.parent().children('span').text('月流水必须大于上一个月流水'); - that.parent().children('span').show(); - } else { - that.parent().children('span').hide(); - } - return true; - } - - function prevTurnoverRatioHandle(thatTurnoverRatio, prevTurnoverRatio, that, isDefault = false) - { - if (thatTurnoverRatio <= prevTurnoverRatio) { - var msg = isDefault ? '月流水分成比例必须大于默认分成比例' : '月流水分成比例必须大于上一个月流水分成比例'; - that.parent().children('.error-message').text(msg); - that.parent().children('.error-message').show(); - } else { - that.parent().children('.error-message').hide(); - } - return true; - } - - $('.iconfont-btn-del').click(function (e) { - var that = $(this); - - if ($('.list-ratio').children().length > 1) { - $('.list-ratio').children(':last-child').remove(); - if ($('.list-ratio').children().length === 1) { - that.children('i').removeClass('iconfont-selected'); - that.children('i').addClass('iconfont-unselected'); - } - } - }); }); \ No newline at end of file