@ -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;
@ -60,6 +60,7 @@
< 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 >
< form action = "{:U('StatementMangement/rewardManageSave')}" enctype = "application/x-www-form-urlencoded" method = "POST"
class="form-horizontal form_info_ml" id="form">
@ -91,15 +92,69 @@
< select id = "company_id" name = "company_id" class = "select_gallery" >
< / select >
< / li >
< li >
< label > 会长名称< / label >
< select id = "promote_id" name = "promote_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 = "奖罚时间" / >
< / li >
<?php if ($data['settlement_info']):?>
<?php foreach ($data['settlement_info'] as $k => $settlement):?>
< li class = "settlement-info" >
<?php if ($k == 0):?>
< label > 结算方< / label >
<?php else:?>
< label > -< / label >
<?php endif;?>
< select name = "settlement_info[{$k+1}][promote_id]" class = "select_gallery promoter-select" >
< option value = "0" > 请选择会长< / option >
<?php foreach ($promoters as $promoter):?>
< option value = "{$promoter['id']}" < ? php if ( $ promoter [ ' id ' ] = = $ settlement [ ' promote_id ' ] ) : ? > selected<?php endif;?> >{$promoter['nickname']}< / option >
<?php endforeach;?>
< / select >
< input type = "text" class = "txt table_text_input settlement_amount" name = "settlement_info[{$k+1}][price]" value = "{$settlement['price']}" placeholder = "扣款金额" >
< select name = "settlement_info[{$k+1}][settlment_type]" class = "select_gallery" >
< option value = "1" < ? php if ( $ settlement [ ' settlment_type ' ] = = 1 ) : ? > selected<?php endif;?> >线上结算< / option >
< option value = "2" < ? php if ( $ settlement [ ' settlment_type ' ] = = 2 ) : ? > selected<?php endif;?> >线下结算< / option >
< / select >
<?php if ($k == 0):?>
< button type = "button" class = "settlement_bnt_add" > ✚< / button >
<?php else:?>
< button type = "button" class = "bnt_remove" > ✖< / button >
<?php endif;?>
< / li >
<?php endforeach;?>
<?php else:?>
< li class = "settlement-info" >
< label > 结算方< / label >
< select name = "settlement_info[{$k+1}][promote_id]" class = "select_gallery promoter-select" >
< option value = "0" > 请选择会长< / option >
<?php foreach ($promoters as $promoter):?>
< option value = "{$promoter['id']}" > {$promoter['nickname']}< / option >
<?php endforeach;?>
< / select >
< input type = "text" class = "txt table_text_input settlement_amount" name = "settlement_info[{$k+1}][price]" value = "0" placeholder = "扣款金额" >
< select name = "settlement_info[{$k+1}][settlment_type]" class = "select_gallery" >
< option value = "1" > 线上结算< / option >
< option value = "2" > 线下结算< / option >
< / select >
< button type = "button" class = "settlement_bnt_add" > ✚< / button >
< / li >
<?php endif;?>
<?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 >
@ -144,7 +199,11 @@
< / li >
< li >
< label > 金额< / label >
< input name = "money" type = "text" class = "" placeholder = "金额" value = "{$data.money}" / >
< input name = "money" id = 'total_money' readonly type = "text" class = "" placeholder = "金额" value = "{$data.money}" / >
< / li >
< li >
< label > 奖惩确认时间< / label >
< input type = "text" id = "confirm_time" readonly name = "confirm_time" class = "" value = "{$data['confirm_time']}" placeholder = "奖惩确认时间" / >
< / li >
< li >
< label > 备注< / label >
@ -174,15 +233,58 @@
< 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);
});
$(".settlement_bnt_add").bind("click",function(){
var count = $(".settlement-info").length
var promoter_select = $(".promoter-select:first").clone()//.find("option:selected").attr("selected",false).html();
promoter_select.find("option:selected").attr("selected",false);
// promoter_select = promoter_select.get(0)
var a= `< li class = "settlement-info" >
< label > -< / label >
< select name = "settlement_info[`+(count+1)+`][promote_id]" class = "select_gallery promoter-select" >
< / select >
< input type = "text" class = "txt table_text_input settlement_amount" name = "settlement_info[`+(count+1)+`][price]" value = "0" placeholder = "扣款金额" >
< select name = "settlement_info[`+(count+1)+`][settlment_type]" class = "select_gallery" >
< option value = "1" > 线上结算< / option >
< option value = "2" > 线下结算< / option >
< / select >
< button type = "button" class = "bnt_remove" > ✖< / button >
< / li > `;
$(".settlement-info:last").after(a);
$("select[name='settlement_info["+(count+1)+"][promote_id]']").html(promoter_select.html())
});
$(document).on('input propertychange', '.settlement_amount', function(){
if (isNaN($(this).val())) {
s=$(this).val().substring(0,$(this).val().Length-1);
$(this).val(s);
layer.msg('请输入数字');
countAmount();
return false;
}
countAmount();
});
function countAmount() {
var total_amount = 0;
$('.settlement_amount').each(function(){
if (parseInt($(this).val()) > 0) {
total_amount += parseInt($(this).val());
}
});
$('#total_money').val(total_amount)
}
$(document).on('click', '.bnt_remove', function(){
$(this).parents('li').remove();
countAmount();
});
var date = new Date();
var monthStart = date.getFullYear()+'-0'+(date.getMonth()+1)+'-01';
$("#reward_time").datetimepicker({
$("#reward_time, #confirm_time ").datetimepicker({
format : "yyyy-mm-dd hh:ii",
autoclose : true,
todayBtn : true,
@ -221,6 +323,33 @@
}
});
$('#company_id').html(companyData);
promoteChange();
}
});
}
$(document).on('change', '#company_id', function(){
promoteChange();
});
var promote_id = '{$data["promote_id"]}';
function promoteChange()
{
var companyId = $('#company_id').val();
$.ajax({
url:"{:U('Ajax/getPromotersByCompanyid')}",
dataType:'JSON',
data: {'company_id':companyId},
success:function(response){
var companyData = '';
$.each(response.data, function(index, item){
if (promote_id == item.id) {
companyData += "< option value = '"+item.id+"' selected > "+item.nickname+"< / option > ";
} else {
companyData += "< option value = '"+item.id+"' > "+item.nickname+"< / option > ";
}
});
$('#promote_id').html(companyData);
}
});
}