diff --git a/Application/Admin/Controller/PresidentDepositController.class.php b/Application/Admin/Controller/PresidentDepositController.class.php index bc72db3c6..8f53211e9 100644 --- a/Application/Admin/Controller/PresidentDepositController.class.php +++ b/Application/Admin/Controller/PresidentDepositController.class.php @@ -141,17 +141,18 @@ class PresidentDepositController extends ThinkController $promotes = []; $count = 0; - if (I('export', 0) == 1) { + $totalQuery = clone $query; + if (I('export', 0) == 1 || $row == 'all') { $promotes = $query->select(); } else { - $totalQuery = clone $query; $countQuery = clone $query; $promotes = $query->page($page, $row)->select(); - // 汇总金额 - $total = M('president_deposit', 'tab_')->where(['promote_id'=>['in', $totalQuery->getField('id', true)]])->field('sum(amount) as totalAmount, sum(if(status = 1, amount, 0)) as confirmedAmount, sum(if(status = 2, amount, 0)) as refundedAmount')->find(); $count = $countQuery->count(); } + // 汇总金额 + $total = M('president_deposit', 'tab_')->where(['promote_id'=>['in', $totalQuery->getField('id', true)]])->field('sum(amount) as totalAmount, sum(if(status = 1, amount, 0)) as confirmedAmount, sum(if(status = 2, amount, 0)) as refundedAmount')->find(); + $relationQuery = M('promote_company', 'tab_')->field(['id', 'company_name']); $promotes = $this->mergeOneReletions('company', $promotes, $relationQuery, 'company_id', 'id'); $relationQuery = M('president_deposit', 'tab_'); @@ -213,7 +214,7 @@ class PresidentDepositController extends ThinkController $record['pay_confirm_time'] = '--'; $record['refund_time'] = '--'; $record['pay_accept_time'] = '--'; - $record['status_text'] = '--'; + $record['status_text'] = '市场待确认'; $record['has_record'] = false; $record['status'] = 0; $record['pay_type'] = 0; @@ -246,7 +247,7 @@ class PresidentDepositController extends ThinkController } $this->checkListOrCountAuthRestMap($map,[]); $total['unconfirmedamount'] = $total['totalamount'] - $total['confirmedamount'] - $total['refundedamount']; - $page = set_pagination($count, $row); + $page = set_pagination($count, $row == 'all' ? 1 : $row); if($page) { $this->assign('_page', $page); } @@ -528,12 +529,12 @@ class PresidentDepositController extends ThinkController break; } // 如果不是无需押金,并且没有填写收到押金时间 - if ($record['pay_type'] != PresidentDepositService::PAY_TYPE_NONE && empty($record['pay_accept_time'])) { - $this->ajaxReturn([ - 'status' => 0, - 'message' => '含有待确认收到押金时间记录,不可批量操作' - ]); - } + // if ($record['pay_type'] != PresidentDepositService::PAY_TYPE_NONE && empty($record['pay_accept_time'])) { + // $this->ajaxReturn([ + // 'status' => 0, + // 'message' => '含有待确认收到押金时间记录,不可批量操作' + // ]); + // } } if (!$checkStatus) { $this->ajaxReturn([ @@ -560,7 +561,8 @@ class PresidentDepositController extends ThinkController M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->save([ 'status' => 1, 'pay_confirm_time' => time(), - 'update_time' => time() + 'update_time' => time(), + 'pay_accept_time' => strtotime(I('accept_time')) ]); $this->ajaxReturn([ 'status' => 1, diff --git a/Application/Admin/View/PresidentDeposit/records.html b/Application/Admin/View/PresidentDeposit/records.html index 0cacd8e01..18ff5be20 100644 --- a/Application/Admin/View/PresidentDeposit/records.html +++ b/Application/Admin/View/PresidentDeposit/records.html @@ -257,6 +257,14 @@ //导航高亮 highlight_subnav('{:U('PresidentDeposit/records')}'); $(function(){ + // 添加全部选项 + + if ('all' == "{:I('row', 0)}") { + $("#pagechange").append(""); + } else { + $("#pagechange").append(""); + } + $('.time-select').each(function(){ laydate.render({ elem: this, @@ -358,22 +366,46 @@ $('#pay-confirm-btn').on({ click: function() { var ids = getIds(); - $.ajax({ - url: '{:U("payConfirm")}', - type: 'post', - dataType: 'json', - data: {ids: ids}, - success: function(result) { - if (result.status == 1) { - layer.msg(result.message) - setTimeout(function() { - window.location.href = window.location.href - }, 200) - } else { - layer.msg(result.message) + var accept_time = ''; + + layer.open({ + title : '押金收到时间确认', + content : ``, + success : function() { + laydate.render({ + elem: '#deposit_recept_time', + type: 'datetime', + value: new Date() + }); + }, + yes : function(index, layero) { + accept_time = $('#deposit_recept_time').val(); + if (!accept_time) { + layer.msg('请选择押金收到时间'); + return true; } + + $.ajax({ + url: '{:U("payConfirm")}', + type: 'post', + dataType: 'json', + data: {ids: ids, accept_time : accept_time}, + success: function(result) { + if (result.status == 1) { + layer.msg(result.message) + setTimeout(function() { + window.location.href = window.location.href + }, 200) + } else { + layer.msg(result.message) + layer.close(index); + } + } + }) + return true; } - }) + }); + } }) function getIds() { diff --git a/Application/Base/Service/PresidentDepositService.class.php b/Application/Base/Service/PresidentDepositService.class.php index 2dcd8db0c..ef12da126 100644 --- a/Application/Base/Service/PresidentDepositService.class.php +++ b/Application/Base/Service/PresidentDepositService.class.php @@ -27,7 +27,7 @@ class PresidentDepositService ]; public static $statusList = [ - 0 => '待确认', + 0 => '财务待确认', 1 => '已收到', 2 => '已退款', ];