master
yulingwei 4 years ago
parent d46fa808c0
commit de0fc5e074

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

@ -81,7 +81,7 @@
<tr> <tr>
<td class="l"><i class="mustmark">*</i>类型:</td> <td class="l"><i class="mustmark">*</i>类型:</td>
<td class="r"> <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="1">奖励</option>
<option value="2">惩罚</option> <option value="2">惩罚</option>
</select> </select>
@ -91,7 +91,7 @@
<tr> <tr>
<td class="l"><i class="mustmark">*</i>公司类型:</td> <td class="l"><i class="mustmark">*</i>公司类型:</td>
<td class="r"> <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):?> <?php foreach($companyTypes as $index => $type):?>
<option value="{$index}">{$type}</option> <option value="{$index}">{$type}</option>
<?php endforeach;?> <?php endforeach;?>
@ -102,7 +102,7 @@
<tr> <tr>
<td class="l"><i class="mustmark">*</i>公司/部门:</td> <td class="l"><i class="mustmark">*</i>公司/部门:</td>
<td class="r"> <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> <option value="0">其他</option>
</select> </select>
</td> </td>
@ -117,7 +117,7 @@
<tr> <tr>
<td class="l"><i class="mustmark">*</i>会长账号:</td> <td class="l"><i class="mustmark">*</i>会长账号:</td>
<td class="r"> <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> <option value="0">其他</option>
</select> </select>
</td> </td>
@ -132,7 +132,7 @@
<tr> <tr>
<td class="l"><i class="mustmark">*</i>结算方式:</td> <td class="l"><i class="mustmark">*</i>结算方式:</td>
<td class="r"> <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):?> <?php foreach($settlementTypes as $index => $type):?>
<option value="{$index}">{$type}</option> <option value="{$index}">{$type}</option>
<?php endforeach;?> <?php endforeach;?>
@ -264,7 +264,7 @@
<?php else:?> <?php else:?>
<li class="user-account"> <li class="user-account">
<label>涉及账号</label> <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="1" <?php if ($account['user_type'] == 1):?>selected<?php endif;?>>推广员</option>
<option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option> <option value="2" <?php if ($account['user_type'] == 2):?>selected<?php endif;?>>玩家</option>
</select> </select>
@ -276,7 +276,7 @@
<?php else:?> <?php else:?>
<li class="user-account"> <li class="user-account">
<label>涉及账号</label> <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="1">推广员</option>
<option value="2">玩家</option> <option value="2">玩家</option>
</select> </select>
@ -377,9 +377,7 @@
content: $('#pop-form'), content: $('#pop-form'),
zIndex: 1, zIndex: 1,
end : function(){ end : function(){
$('#item-form')[0].reset() // 重置数据 resetPopForm();
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
} }
}); });
} }
@ -430,11 +428,50 @@
data['promote_account'] = $("#form-promote-account").val(); 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 type_dec = data['type'] == 1 ? 'reward' : 'punish';
// 找到空闲的节点,如果没有,则创建一行 // 找到空闲的节点,如果没有,则创建一行
var emptyNode = $('.table-body tr,.empty-'+type_dec+':first'); var emptyNode = $('.table-body tr,.empty-'+type_dec+':first');
if (emptyNode.length == 0) { if (emptyNode.length == 0) {
console.log(emptyNode.length)
var newNodeHtml = var newNodeHtml =
`<tr class="empty-reward empty-punish"> `<tr class="empty-reward empty-punish">
<!-- 奖励信息 --> <!-- 奖励信息 -->
@ -481,12 +518,23 @@
}); });
$(emptyNode).removeClass('empty-'+type_dec); $(emptyNode).removeClass('empty-'+type_dec);
countAmount(); countAmount();
$('#item-form')[0].reset() resetPopForm();
$('#form-company-name').attr('readonly', false);
$('#form-promote-account-input').attr('readonly', false);
layer.closeAll(); 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() function countAmount()
{ {

Loading…
Cancel
Save