master
ELF 5 years ago
parent a512fb224e
commit ef56ea2180

@ -218,14 +218,18 @@ class PresidentDepositController extends ThinkController
$promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find();
if (!$record) {
if ($payType == 0) {
return $this->error('请选择押金付款方式');
}
if ($payType == 3) {
$this->handleNoDeposit($promoteId);
return $this->success('保存成功', U('records'));
}
if ($payType != 2 && $payWay == 0) {
return $this->error('请选择付款方式');
}
if ($payType == 0) {
return $this->error('请选择押金付款方式');
}
if ($payType != 2 && $payWay == 0) {
return $this->error('请选择付款方式');
}
if (!$record) {
if ($amount !== '') {
if (!is_numeric($amount)) {
return $this->error('请输入正确金额');
@ -250,8 +254,7 @@ class PresidentDepositController extends ThinkController
M('president_deposit', 'tab_')->add($data);
addOperationLog(['op_type'=>0,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'新增会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-奖罚记录管理-新增会长押金']);
return $this->success('保存成功', U('PresidentDeposit/records'));
return $this->success('保存成功', U('records'));
}
/* if ($record['status'] != 0) {
@ -278,6 +281,8 @@ class PresidentDepositController extends ThinkController
}
$data = [];
$data['pay_way'] = $payType == 2 ? 4 : $payWay;
$data['pay_type'] = $payType;
$data['pay_account'] = $payAccount;
$data['amount'] = floatval($amount);
$data['payer'] = $payer;
@ -286,7 +291,7 @@ class PresidentDepositController extends ThinkController
addOperationLog(['op_type'=>1,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'编辑会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-会长押金管理-编辑会长押金']);
return $this->success('保存成功');
return $this->success('保存成功', U('records'));
}
public function delete()
@ -302,28 +307,34 @@ class PresidentDepositController extends ThinkController
]);
}
public function noDeposit()
public function handleNoDeposit($promoteId)
{
$promoteId = I('id', 0);
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
$data = [];
$data['pay_way'] = 0;
$data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE;
$data['pay_account'] = '';
$data['amount'] = 0;
$data['payer'] = '';
$data['create_time'] = time();
$data['update_time'] = time();
if (!$record) {
$data = [];
$data['pay_way'] = 0;
$data['pay_type'] = PresidentDepositService::PAY_TYPE_NONE;
$data['promote_id'] = $promoteId;
$data['pay_account'] = '';
$data['amount'] = 0;
$data['payer'] = '';
$data['create_time'] = time();
$data['update_time'] = time();
M('president_deposit', 'tab_')->add($data);
$promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find();
addOperationLog(['op_type'=>1,'key'=>$promoteData['account'],'op_name'=>'编辑无需押金','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算单管理-会长押金管理-无需押金']);
} else {
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
}
$promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find();
addOperationLog(['op_type'=>1,'key'=>$promoteData['account'],'op_name'=>'编辑无需押金','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算单管理-会长押金管理-无需押金']);
}
public function noDeposit()
{
$promoteId = I('id', 0);
$this->handleNoDeposit($promoteId);
$this->ajaxReturn([
'status' => 1,
'message' => '操作成功'

@ -90,7 +90,7 @@
<tr>
<td class="l"><i class="mustmark">*</i>押金付款方式:</td>
<td class="r">
<select name="pay_type" id="pay_type" class="select_gallery" <?php if($record):?>disabled<?php endif;?>>
<select name="pay_type" id="pay_type" class="select_gallery">
<option value="">押金付款方式</option>
<?php foreach($payTypes as $key => $name):?>
<option value="<?=$key?>" <?php if($record && $record['pay_type'] == $key):?>selected<?php endif;?>><?=$name?></option>
@ -99,10 +99,10 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<tr class="need-amount" <?php if($record && $record['pay_type']==3):?>style="display:none;"<?php endif;?>>
<td class="l"><i class="mustmark">*</i>付款方式:</td>
<td class="r">
<select name="pay_way" id="pay_way" class="select_gallery" <?php if($record):?>disabled<?php endif;?>>
<select name="pay_way" id="pay_way" class="select_gallery">
<option value="">付款方式</option>
<?php foreach($payWays as $key => $name):?>
<option value="<?=$key?>" <?php if($record && $record['pay_way'] == $key):?>selected<?php endif;?>><?=$name?></option>
@ -111,21 +111,21 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<tr class="need-amount" <?php if($record && $record['pay_type']==3):?>style="display:none;"<?php endif;?>>
<td class="l"><?php if($record):?><i class="mustmark">*</i><?php endif?>金额:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="amount" id="amount" value="<?=$record?$record['amount']:''?>" placeholder="请输入金额">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<tr class="need-amount" <?php if($record && $record['pay_type']==3):?>style="display:none;"<?php endif;?>>
<td class="l"><?php if($record):?><i class="mustmark">*</i><?php endif?>付款人:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="payer" id="payer" value="<?=$record?$record['payer']:''?>" placeholder="请输入付款人">
<span class="notice-text"></span>
</td>
</tr>
<tr>
<tr class="need-amount" <?php if($record && $record['pay_type']==3):?>style="display:none;"<?php endif;?>>
<td class="l"><?php if($record):?><i class="mustmark">*</i><?php endif?>付款账号:</td>
<td class="r table_radio">
<input type="text" class="txt ratio" name="pay_account" id="pay_account" value="<?=$record?$record['pay_account']:''?>" placeholder="请输入付款账号">
@ -187,10 +187,14 @@ $(function(){
$('#pay_type').change(function() {
var val = $(this).val()
if (val == 2) {
$('.need-amount').show();
$("#pay_way option[value='4']").removeProp('disabled');
$('#pay_way').val('4').select2()
$('#pay_way').attr('disabled', 'disabled')
} else if(val == 3) {
$('.need-amount').hide();
} else {
$('.need-amount').show();
$('#pay_way').removeAttr('disabled');
$("#pay_way option[value='4']").prop('disabled', true);
$('#pay_way').val('').select2()

Loading…
Cancel
Save