master
yulingwei 4 years ago
parent 80e89c651a
commit 33049f5a9f

@ -38,6 +38,95 @@ class PresidentDepositController extends ThinkController
$idStrWhere[] = '1<>1';
}
}
if (!empty(I('pay_confirm_time_start')) && empty(I('pay_confirm_time_end'))) {
$startTime = strtotime(I('pay_confirm_time_start'));
$endTime = strtotime(I('pay_confirm_time_end'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time >= {$startTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
} else if (empty(I('pay_confirm_time_start')) && !empty(I('pay_confirm_time_end'))) {
$startTime = strtotime(I('pay_confirm_time_start'));
$endTime = strtotime(I('pay_confirm_time_end'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
} else if (!empty(I('pay_confirm_time_start')) && !empty(I('pay_confirm_time_end'))) {
$startTime = strtotime(I('pay_confirm_time_start'));
$endTime = strtotime(I('pay_confirm_time_end'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time >= {$startTime} and pay_confirm_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
}
if (!empty(I('refund_time_start')) && empty(I('refund_time_end'))) {
$startTime = strtotime(I('refund_time_start'));
$endTime = strtotime(I('refund_time_end'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("refund_time >= {$startTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
} else if (empty(I('refund_time_start')) && !empty(I('refund_time_end'))) {
$startTime = strtotime(I('refund_time_start'));
$endTime = strtotime(I('refund_time_end'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("refund_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
} else if (!empty(I('refund_time_start')) && !empty(I('refund_time_end'))) {
$startTime = strtotime(I('refund_time_start'));
$endTime = strtotime(I('refund_time_end'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("refund_time >= {$startTime} and refund_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
}
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'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time >= {$startTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
} 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'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_confirm_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
} 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'));
$tempPromoteIds = M('president_deposit', 'tab_')->where("pay_accept_time >= {$startTime} and pay_accept_time <= {$endTime}")->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
$idStrWhere[] = 'id in (' . implode(',', $tempPromoteIds) . ')';
} else {
$idStrWhere[] = '1<>1';
}
}
if ($payType !== '') {
$tempPromoteIds = M('president_deposit', 'tab_')->where(['pay_type' => $payType])->getField('promote_id', true);
if (count($tempPromoteIds) > 0) {
@ -47,7 +136,7 @@ class PresidentDepositController extends ThinkController
}
}
if (count($idStrWhere) > 0) {
$query->where(['_string' => implode(' and ', $idStrWhere)]);
$query->where(['_string' => implode(' and ', array_unique($idStrWhere))]);
}
$promotes = [];
@ -90,10 +179,10 @@ class PresidentDepositController extends ThinkController
if ($promote['presidentDeposit']) {
$presidentDeposit = $promote['presidentDeposit'];
$promoteBelong = $promote['promoteBelong'];
if ($presidentDeposit['pay_type'] == 3) {
if ($presidentDeposit['pay_type'] == PresidentDepositService::PAY_TYPE_NONE) {
$record['payer'] = '--';
$record['pay_account'] = '--';
$record['amount'] = '--';
$record['amount'] = '';
} else {
$record['payer'] = $presidentDeposit['payer'];
$record['pay_account'] = $presidentDeposit['pay_account'];
@ -104,6 +193,8 @@ class PresidentDepositController extends ThinkController
$record['create_time'] = $presidentDeposit['create_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['create_time']);
$record['verify_time'] = $promoteBelong && $promoteBelong['verify_time'] != 0 ? date('Y-m-d H:i:s', $promoteBelong['verify_time']) : '--';
$record['pay_confirm_time'] = $presidentDeposit['pay_confirm_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['pay_confirm_time']);
$record['refund_time'] = $presidentDeposit['refund_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['refund_time']);
$record['pay_accept_time'] = $presidentDeposit['pay_accept_time'] == 0 ? '--' : date('Y-m-d H:i:s', $presidentDeposit['pay_accept_time']);
$record['status_text'] = $statusList[$presidentDeposit['status']];
$record['has_record'] = true;
$record['status'] = $presidentDeposit['status'];
@ -117,6 +208,8 @@ class PresidentDepositController extends ThinkController
$record['create_time'] = '--';
$record['verify_time'] = '--';
$record['pay_confirm_time'] = '--';
$record['refund_time'] = '--';
$record['pay_accept_time'] = '--';
$record['status_text'] = '--';
$record['has_record'] = false;
$record['status'] = 0;
@ -129,15 +222,17 @@ class PresidentDepositController extends ThinkController
'company_name' => '所属推广公司',
'account' => '会长账号',
'company_belong_text' => '工会类型',
'payer' => '付款人',
'payer' => '退押金账户名',
'pay_way_text' => '付款方式',
'pay_account' => '账号',
'pay_account' => '退押金账号',
'pay_type_text' => '押金类型',
'create_time' => '审批时间',
'amount' => '押金金额',
'verify_time' => '会长申请时间',
'status_text' => '押金状态',
'pay_confirm_time' => '押金确认时间',
'refund_time' => '押金退款时间',
'pay_accept_time' => '押金收到时间',
];
addOperationLog(['op_type'=>3,'key'=>getNowDate(),'op_name'=>'导出会长押金记录','url'=>U('PresidentDeposit/records'),'menu'=>'推广员-结算管理-奖罚记录管理-导出会长押金记录']);
@ -149,10 +244,14 @@ class PresidentDepositController extends ThinkController
$this->checkListOrCountAuthRestMap($map,[]);
// 汇总金额
$total = M('president_deposit', 'tab_')->field('sum(amount) as totalAmount, sum(if(status = 1, amount, 0)) as confirmedAmount')->find();
$total['unconfirmedamount'] = $total['totalamount'] - $total['confirmedamount'];
$page = set_pagination($count, $row);
if($page) {
$this->assign('_page', $page);
}
$this->assign('total', $total);
$this->assign('payWays', $payWays);
$this->assign('payTypes', $payTypes);
$this->assign('companyTypes', $companyTypes);
@ -215,6 +314,9 @@ class PresidentDepositController extends ThinkController
$payAccount = I('pay_account', '');
$amount = I('amount', '');
$payer = I('payer', '');
$payAcceptTime = I('pay_accept_time', 0) ? strtotime(I('pay_accept_time')): 0;
$refundTime = I('refund_time', 0) ? strtotime(I('refund_time')): 0;
$record = M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->find();
@ -253,6 +355,8 @@ class PresidentDepositController extends ThinkController
$data['payer'] = $payer;
$data['create_time'] = time();
$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'=>'推广员-结算单管理-奖罚记录管理-新增会长押金']);
@ -283,10 +387,24 @@ class PresidentDepositController extends ThinkController
} */
$data = [];
// 切换类型
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['pay_accept_time'] = $payAcceptTime;
$data['refund_time'] = $refundTime;
$data['pay_way'] = $payType == 2 ? 4 : $payWay;
$data['pay_type'] = $payType;
$data['pay_account'] = $payAccount;
$data['amount'] = floatval($amount);
$data['status'] = $payStatus ?? $record['status'];
$data['payer'] = $payer;
$data['update_time'] = time();
M('president_deposit', 'tab_')->where(['promote_id' => $promoteId])->save($data);
@ -321,7 +439,7 @@ class PresidentDepositController extends ThinkController
$data['payer'] = '';
$data['create_time'] = time();
$data['update_time'] = time();
$data['status'] = 1;
if (!$record) {
$data['promote_id'] = $promoteId;
M('president_deposit', 'tab_')->add($data);
@ -404,12 +522,19 @@ class PresidentDepositController extends ThinkController
]);
}
$checkStatus = true;
$records = M('president_deposit', 'tab_')->field(['id', 'status'])->where(['promote_id' => ['in', $promoteIds]])->select();
$records = M('president_deposit', 'tab_')->where(['promote_id' => ['in', $promoteIds]])->select();
foreach ($records as $record) {
if ($record['status'] != 0) {
$checkStatus = false;
break;
}
// 如果不是无需押金,并且没有填写收到押金时间
if ($record['pay_type'] != PresidentDepositService::PAY_TYPE_NONE && empty($record['pay_accept_time'])) {
$this->ajaxReturn([
'status' => 0,
'message' => '含有待确认收到押金时间记录,不可批量操作'
]);
}
}
if (!$checkStatus) {
$this->ajaxReturn([

@ -7,6 +7,7 @@
<script type="text/javascript" src="__STATIC__/uploadify/jquery.uploadify.min.js"></script>
<script type="text/javascript" src="__STATIC__/provincecityarea/AreaData_min.js"></script>
<script src="__STATIC__/layer/layer.js"></script>
<script src="__STATIC__/laydate/laydate.js"></script>
<script type="text/javascript" src="__JS__/select2.min.js"></script>
<style>
@ -132,6 +133,18 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">押金收到时间:</td>
<td class="r">
<input type="text" class="txt time-stamp" name="pay_accept_time" id="pay_accept_time" value="<?= $record['pay_accept_time']?date('Y-m-d H:i:s', $record['pay_accept_time']):''?>" readonly>
</td>
</tr>
<tr>
<td class="l">押金退款时间:</td>
<td class="r">
<input type="text" class="txt time-stamp" name="refund_time" id="refund_time" value="<?=$record['refund_time']?date('Y-m-d H:i:s', $record['refund_time']):''?>" readonly>
</td>
</tr>
</tbody>
</table>
</div>
@ -182,6 +195,27 @@ $(function(){
minView:'year',
maxView:'year',
});
$('.time-stamp').each(function(){
laydate.render({
elem: this,
type: 'datetime'
});
})
// $('.time-stamp').datetimepicker({
// format: 'yyyy-mm-dd hh:ii:ss',
// dateFormat: 'yyyy-mm-dd',//日期显示格式
// timeFormat: 'HH:mm:ss',//时间显示格式
// autoclose : true,
// todayBtn : true,
// todayHighlight : true,
// language : 'zh-CN',
// startView : 2,//月视图
// showMeridian : true,
// pickerPosition : "bottom-left",
// minuteStep : 1
// });
showTab();
$('#pay_type').change(function() {

@ -2,6 +2,7 @@
<block name="css">
<link rel="stylesheet" href="__CSS__/select2.min.css" type="text/css" />
<link rel="stylesheet" href="__CSS__/promote.css" type="text/css"/>
<script src="__STATIC__/laydate/laydate.js"></script>
<link rel="stylesheet" type="text/css" href="__STATIC__/webuploader/webuploader.css" media="all">
<style>
.select2-container--default .select2-selection--single {
@ -96,6 +97,36 @@
<?php endforeach;?>
</select>
</div>
<div class="input-list input-list-promote search_label_rehab">
<input type="text" readonly name="pay_confirm_time_start" class="time-select" value="{:I('pay_confirm_time_start')}"
placeholder="押金确认开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly name="pay_confirm_time_end" class="time-select" value="{:I('pay_confirm_time_end')}"
placeholder="押金确认结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<input type="text" readonly name="refund_time_start" class="time-select" value="{:I('refund_time_start')}"
placeholder="押金退款开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly name="refund_time_end" class="time-select" value="{:I('refund_time_end')}"
placeholder="押金退款结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list input-list-promote search_label_rehab">
<input type="text" readonly name="pay_accept_time_start" class="time-select" value="{:I('pay_accept_time_start')}"
placeholder="押金收到开始时间"/>
-
<div class="input-append date" id="datetimepicker" style="display:inline-block">
<input type="text" readonly name="pay_accept_time_end" class="time-select" value="{:I('pay_accept_time_end')}"
placeholder="押金收到结束时间"/>
<span class="add-on"><i class="icon-th"></i></span>
</div>
</div>
<div class="input-list">
<a class="sch-btn" href="javascript:;" id="search" url="{:U('PresidentDeposit/records')}">搜索</a>
</div>
@ -118,15 +149,17 @@
<th>所属推广公司</th>
<th>会长账号</th>
<th>工会类型</th>
<th>付款人</th>
<th>退押金账户名</th>
<th>付款方式</th>
<th>账号</th>
<th>退押金账号</th>
<th>押金类型</th>
<th>审批时间</th>
<th>押金金额</th>
<th>会长申请时间</th>
<th>押金状态</th>
<th>押金确认时间</th>
<th>押金退款时间</th>
<th>押金收到时间</th>
<th>操作</th>
</tr>
</thead>
@ -134,7 +167,7 @@
<!-- 列表 -->
<tbody>
<empty name ="records">
<td colspan="14" class="text-center">aOh! 暂时还没有内容!</td>
<td colspan="99" class="text-center">aOh! 暂时还没有内容!</td>
<else />
<volist name="records" id="data">
<tr data-id="<?=$data['id']?>">
@ -157,7 +190,8 @@
<td>{$data.verify_time}</td>
<td>{$data.status_text}</td>
<td>{$data.pay_confirm_time}</td>
<td>{$data.refund_time}</td>
<td>{$data.pay_accept_time}</td>
<?php if($data['has_record']):?>
<td>
<div class="partakebtn">
@ -179,6 +213,13 @@
</tr>
</volist>
</empty>
<tr>
<td colspan="99" class="text-center">
<span>总押金:{$total['totalamount']}</span>&nbsp;&nbsp;&nbsp;&nbsp;
<span>待确认押金:{$total['unconfirmedamount']}</span>&nbsp;&nbsp;&nbsp;&nbsp;
<span>已确认押金:{$total['confirmedamount']}</span>
</td>
</tr>
</tbody>
</table>
</div>
@ -215,8 +256,44 @@
//导航高亮
highlight_subnav('{:U('PresidentDeposit/records')}');
$(function(){
$('.time-select').each(function(){
laydate.render({
elem: this,
type: 'date'
});
});
//搜索功能
$("#search").click(function(){
var sdate = Date.parse($("input[name='pay_confirm_time_start']").val()) / 1000;
var edate = Date.parse($("input[name='pay_confirm_time_end']").val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
var sdate = Date.parse($("input[name='refund_time_start']").val()) / 1000;
var edate = Date.parse($("input[name='refund_time_end']").val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
var sdate = Date.parse($("input[name='pay_accept_time_start']").val()) / 1000;
var edate = Date.parse($("input[name='pay_accept_time_end']").val()) / 1000;
if (sdate > edate) {
layer.msg('开始时间必须小于等于结束时间');
return false;
}
if ((edate - sdate) > 2592000) {
layer.msg('时间间隔不能超过31天请重新选择日期');
return false;
}
var url = $(this).attr('url');
var query = $('.jssearch').find('input').serialize();
query += "&"+$('.jssearch').find('select').serialize();

@ -108,6 +108,20 @@
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">押金退款时间:</td>
<td class="r table_radio">
<span class="form_radio table_btn"><?=$record['refund_time']?date('Y-m-d H:i:s', $record['refund_time']) : ''?></span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">押金收到时间:</td>
<td class="r table_radio">
<span class="form_radio table_btn"><?=$record['pay_accept_time']?date('Y-m-d H:i:s', $record['pay_accept_time']) : ''?></span>
<span class="notice-text"></span>
</td>
</tr>
<tr>
<td class="l">付款人:</td>
<td class="r table_radio">

@ -2165,4 +2165,8 @@ CREATE TABLE `tab_payment_member` (
INSERT INTO `tab_payment_member` (`id`, `real_name`, `mobile`, `last_login_time`) VALUES ('1', '胡歌', '18959188422', '0')
--- 押金收到时间
ALTER TABLE `tab_president_deposit`
ADD COLUMN `pay_accept_time` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '押金收到时间' AFTER `pay_confirm_time`;

Loading…
Cancel
Save