master
yulingwei 4 years ago
parent d46fa808c0
commit de0fc5e074

@ -481,10 +481,10 @@ class StatementMangementController extends ThinkController
}
if ($accounts) {
foreach ($accounts as $index => $account) {
if (checkAccount($user_types[$index],$account)==1) {
if (trim($account) == '') {
unset($accounts[$index]);
} else if (checkAccount($user_types[$index],$account)==1) {
$data['accounts'][] = array_merge(['account'=>$account], ['user_type'=>$user_types[$index]]);
} else {
return $this->error('账号'.$account.'不存在,请重新输入');

@ -81,7 +81,7 @@
<tr>
<td class="l"><i class="mustmark">*</i>类型:</td>
<td class="r">
<select name="type" id='form-type' class="select_gallery">
<select name="type" id='form-type' class="form-pop-select">
<option value="1">奖励</option>
<option value="2">惩罚</option>
</select>
@ -91,7 +91,7 @@
<tr>
<td class="l"><i class="mustmark">*</i>公司类型:</td>
<td class="r">
<select name="company_type" id='form-company-type' class="select_gallery">
<select name="company_type" id='form-company-type' class="form-pop-select">
<?php foreach($companyTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
@ -102,7 +102,7 @@
<tr>
<td class="l"><i class="mustmark">*</i>公司/部门:</td>
<td class="r">
<select name="company_id" id='form-company-id' class="select_gallery">
<select name="company_id" id='form-company-id' class="select_gallery form-pop-select">
<option value="0">其他</option>
</select>
</td>
@ -117,7 +117,7 @@
<tr>
<td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r">
<select name="promote_account" id="form-promote-account" class="select_gallery">
<select name="promote_account" id="form-promote-account" class="select_gallery form-pop-select">
<option value="0">其他</option>
</select>
</td>
@ -132,7 +132,7 @@
<tr>
<td class="l"><i class="mustmark">*</i>结算方式:</td>
<td class="r">
<select name="settlement_type" id='form-settlement-type' class="select_gallery">
<select name="settlement_type" id='form-settlement-type' class="form-pop-select">
<?php foreach($settlementTypes as $index => $type):?>
<option value="{$index}">{$type}</option>
<?php endforeach;?>
@ -264,7 +264,7 @@
<?php else:?>
<li class="user-account">
<label>涉及账号</label>
<select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<select name="user_type[]" class="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>
@ -276,7 +276,7 @@
<?php else:?>
<li class="user-account">
<label>涉及账号</label>
<select name="user_type[]" class="select_gallery user_type" onchange="userAccountChange(this)">
<select name="user_type[]" class="user_type" onchange="userAccountChange(this)">
<option value="1">推广员</option>
<option value="2">玩家</option>
</select>
@ -377,9 +377,7 @@
content: $('#pop-form'),
zIndex: 1,
end : function(){
$('#item-form')[0].reset() // 重置数据
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
resetPopForm();
}
});
}
@ -430,11 +428,50 @@
data['promote_account'] = $("#form-promote-account").val();
}
if (data['amount'] == '0') {
layer.msg('请填写金额');
return false;
}
if (data['company_id'] == '0' && data['company_name'] == '') {
layer.msg('请选择或者填写公司/部门');
return false;
}
if (data['promote_account'] == '') {
layer.msg('请选择或者填写会长账号');
return false;
}
var flag = false;
// 判断相反的是否已经存在该公司节点
$('.reward-data-info,.punish-data-info').each(function(){
var node_info = $(this).find('.info').val();
if (node_info) {
var otherData = JSON.parse(node_info);
// console.log(otherData)
// console.log((data['company_name'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) );
// console.log(data['company_type'] == otherData['company_type'] );
// 判断对立面是否有相同的公司或者部门
if ((data['company_type'] == otherData['company_type'])
&& (data['company_name'] != '0' ? data['company_id'] == otherData['company_id'] : data['company_name'] == otherData['company_name']) ) {
//console.log('已有相此公司的奖罚,请检查')
layer.closeAll();
layer.msg('已有此公司的奖罚,请检查');
flag = true;
}
}
});
if (flag) {
return false;
}
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">
<!-- 奖励信息 -->
@ -481,12 +518,23 @@
});
$(emptyNode).removeClass('empty-'+type_dec);
countAmount();
$('#item-form')[0].reset()
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
resetPopForm();
layer.closeAll();
});
function resetPopForm()
{
$('#item-form')[0].reset() // 重置数据
$('.form-pop-select').select2();
companyTypeChange();
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
var promoteData = "<option value='0' selected>其他</option>";
$("#form-promote-account").empty();
$('#form-promote-account').html(promoteData);
$("#form-promote-account").select2();
}
// 全部总金额重算
function countAmount()
{

Loading…
Cancel
Save