|
|
|
@ -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,
|
|
|
|
|