master
yulingwei 5 years ago
parent deac7da5ff
commit 7830cef93d

@ -107,7 +107,7 @@ class PresidentDepositController extends ThinkController
if (!empty(I('pay_accept_time_start')) && empty(I('pay_accept_time_end'))) {
$startTime = strtotime(I('pay_accept_time_start'));
$endTime = strtotime(I('pay_accept_time_end'))+ 86400;
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time >= {$startTime}")->getField('promote_id', true);
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_accept_time >= {$startTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
@ -116,7 +116,7 @@ class PresidentDepositController extends ThinkController
} else if (empty(I('pay_accept_time_start')) && !empty(I('pay_accept_time_end'))) {
$startTime = strtotime(I('pay_accept_time_start'));
$endTime = strtotime(I('pay_accept_time_end'))+ 86400;
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time <= {$endTime}")->getField('promote_id', true);
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_accept_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
@ -156,6 +156,7 @@ class PresidentDepositController extends ThinkController
$totalQuery = clone $query;
if (I('export', 0) == 1 || $row == 'all') {
$promotes = $query->select();
$count = count($promotes);
} else {
$countQuery = clone $query;
$promotes = $query->page($page, $row)->select();
@ -269,7 +270,8 @@ class PresidentDepositController extends ThinkController
}
$this->checkListOrCountAuthRestMap($map,[]);
$total['unconfirmedamount'] = $total['totalamount'] - $total['confirmedamount'] - $total['refundedamount'];
$page = set_pagination($count, $row == 'all' ? 1 : $row);
$page = set_pagination($count, $row == 'all' ? 99999999 : $row);
//dd($row == 'all' ? 99999999 : $row);
if($page) {
$this->assign('_page', $page);
}
@ -340,10 +342,16 @@ class PresidentDepositController extends ThinkController
$refundTime = I('refund_time', 0) ? strtotime(I('refund_time')): 0;
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
$promoteData = M('promote', 'tab_')->field('account')->where(['id' => $promoteId])->find();
// 市场部门无法操作押金退款和收到时间
if ((($record['pay_accept_time'] != $payAcceptTime) || ($record['refund_time'] != $refundTime)) && isMarketAdmin()) {
return $this->error('无法操作记录');
}
if ($payType == 0) {
return $this->error('请选择押金付款方式');
}
@ -368,10 +376,6 @@ class PresidentDepositController extends ThinkController
}
}
// 市场部门无法操作押金退款和收到时间
if ((($record['pay_accept_time'] != $payAcceptTime) || ($record['refund_time'] != $refundTime)) && isMarketAdmin()) {
return $this->error('无法操作记录');
}
$data = [];
// 填写押金到账时间后自动变为押金已确认到账状态,并且状态在待确认时候
@ -390,6 +394,7 @@ class PresidentDepositController extends ThinkController
$data['update_time'] = time();
$data['pay_accept_time'] = $payAcceptTime;
$data['refund_time'] = $refundTime;
M('president_deposit', 'tab_')->add($data);
addOperationLog(['op_type'=>0,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'新增会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-奖罚记录管理-新增会长押金']);
@ -424,15 +429,12 @@ class PresidentDepositController extends ThinkController
// 切换类型
if ($payType != $record['pay_type']) {
$payStatus = 0;
$data['pay_confirm_time'] = 0;
}
if ($payType == PresidentDepositService::PAY_TYPE_NONE) { // 无需押金 直接确认
$payStatus = 1;
$data['pay_confirm_time'] = time();
}
$data['refund_time'] = $data['pay_accept_time'] = $data['pay_confirm_time'] = 0;
} else {
$data['pay_accept_time'] = $payAcceptTime;
$data['refund_time'] = $refundTime;
}
$data['pay_way'] = $payType == 2 ? 4 : $payWay;
$data['pay_type'] = $payType;
$data['pay_account'] = $payAccount;
@ -440,6 +442,7 @@ class PresidentDepositController extends ThinkController
$data['status'] = $payStatus ?? $record['status'];
$data['payer'] = $payer;
$data['update_time'] = time();
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
addOperationLog(['op_type'=>1,'key'=>$promoteData['account'].'/'.$amount,'op_name'=>'编辑会长押金','url'=>U('PresidentDeposit/edit',['id'=>$promoteId]),'menu'=>'推广员-结算单管理-会长押金管理-编辑会长押金']);
@ -449,6 +452,12 @@ class PresidentDepositController extends ThinkController
public function delete()
{
if (isMarketAdmin()) {
$this->ajaxReturn([
'status' => 0,
'message' => '无法操作记录'
]);
}
$promoteId = I('id', 0);
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->delete();
@ -460,6 +469,9 @@ class PresidentDepositController extends ThinkController
]);
}
/**
* 处理无需押金
*/
public function handleNoDeposit($promoteId)
{
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
@ -470,13 +482,17 @@ class PresidentDepositController extends ThinkController
$data['pay_account'] = '';
$data['amount'] = 0;
$data['payer'] = '';
$data['pay_confirm_time'] = time();
$data['create_time'] = time();
$data['update_time'] = time();
$data['status'] = 1;
if (!$record) {
$data['pay_accept_time'] = time();
$data['promote_id'] = $promoteId;
M('president_deposit', 'tab_')->add($data);
} else {
$data['pay_accept_time'] = strtotime(I('pay_accept_time', 0));
$data['refund_time'] = strtotime(I('refund_time', 0));
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
}
@ -496,6 +512,9 @@ class PresidentDepositController extends ThinkController
public function refund()
{
if (isMarketAdmin()) {
return $this->error('无法操作记录');
}
$promoteIds = I('ids', []);
if (count($promoteIds) == 0) {
$this->ajaxReturn([
@ -547,6 +566,12 @@ class PresidentDepositController extends ThinkController
public function payConfirm()
{
if (isMarketAdmin()) {
$this->ajaxReturn([
'status' => 0,
'message' => '无权限操作记录'
]);
}
$promoteIds = I('ids', []);
if (count($promoteIds) == 0) {
$this->ajaxReturn([

@ -269,7 +269,8 @@
// 添加全部选项
if ('all' == "{:I('row', 0)}") {
$("#pagechange").append("<option value='all' selected>全部</option>");
$("#pagechange").prepend("<option value='all' selected>全部</option>");
} else {
$("#pagechange").append("<option value='all'>全部</option>");
}

Loading…
Cancel
Save