Merge remote-tracking branch 'origin/release' into release

master
liuweiwen 5 years ago
commit 2cf7b7471f

@ -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;

@ -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();
@ -136,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
@ -178,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'],
@ -205,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
@ -235,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);
@ -277,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
@ -309,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);
@ -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'];

@ -186,76 +186,18 @@ $(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 = '<option value="" selected>会长账号</option>';
if (data.length > 0) {
for (let i = 0;i < data.length;i++) {
html += '<option value="' + data[i]['id'] + '">' + data[i]['account'] + '(' + data[i]['real_name'] + ')' + '</option>';
}
}
$('#promote_id').html(html);
$('#promote_id').select2();
getPromoteGameRatio();
},
error: function (result) {
console.log(result);
}
});
});
$('#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);
$('#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 {
// $('#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('');
}
}
});
$('#pay_way').removeAttr('disabled');
$("#pay_way option[value='4']").prop('disabled', true);
$('#pay_way').val('').select2()
}
})
$('#submit').click(function (e) {
var target = $('form').get(0).action;
@ -293,123 +235,6 @@ $(function(){
}
});
});
$('.iconfont-btn-add').click(function (e) {
var delBtn = $('.iconfont-btn-del');
var html = '';
html += '<div class="li-ratio">';
html += '<label class="instanceof_text">月流水:</label>';
html += '<select name="instanceof[]" style="width: 50px;margin-right: 10px;">';
html += '<option value="1"></option>';
html += '<option value="2">></option>';
html += '</select>';
html += '<div class="turnover">';
html += '<input type="text" class="txt" name="turnover[]" value="" placeholder="请输入金额" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 100px;margin-right: 10px;">';
html += '<span></span>';
html += '</div>';
html += '<label>分成比例:</label>';
html += '<div class="turnover-ratio">';
html += '<input type="text" class="txt" name="turnover_ratio[]" value="" placeholder="请输入比例" onKeyUp="value=value.replace(/[^\\w\\.\\/]/ig, \'\')" style="width: 60px;">';
html += '<span class="form_unit" style="margin-right: 10px;">%</span>';
html += '<span class="error-message"></span>';
html += '</div>';
html += '</div>';
$('.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');
}
}
});
});
</script>
</block>

@ -17,6 +17,7 @@ class PresidentDepositService
1 => '银行转账',
2 => '支付宝转账',
3 => '微信转账',
4 => '分成款扣除',
];
public static $payTypes = [

@ -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 '部门/小组';
Loading…
Cancel
Save