推广平台->财务管理->提现记录--添加撤销提现

master
chenxiaojun 5 years ago
parent e0c0f50c7d
commit ca2935763b

@ -15,6 +15,7 @@ class FinanceController extends BaseController
{
//提现状态
public static $withdrawStatus = [
-2 => '已撤销',
-1 => '审核未通过',
0 => '待审核',
1 => '汇款中',
@ -200,7 +201,7 @@ class FinanceController extends BaseController
$map['pay_order_number'] = $payOrderNumber;
}
if (isset($_GET['status'])) {
if ($status == -2) {
if ($status == -99) {
$map['selle_status'] = 0;
} else {
$withdrawMap['promote_id'] = $this->loginPromote['id'];
@ -277,8 +278,7 @@ class FinanceController extends BaseController
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$modelList = [];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
@ -329,6 +329,7 @@ class FinanceController extends BaseController
$add['status'] = 0;
$add['widthdraw_number'] = $this->produceWithdrawNumber();
$add['settlement_end_time'] = $thisDay - 1;
$add['spend_ids'] = '';
M()->startTrans();//开启事物
$withdrawId = M('withdraw', 'tab_')->add($add);
@ -399,12 +400,10 @@ class FinanceController extends BaseController
}
if (isset($_GET['status']) && $_GET['status'] !== '') {
$status = intval($_GET['status']);
if (!isset(FinanceController::$withdrawStatus[$status])) {
$this->error('参数异常');
}
if (isset(FinanceController::$withdrawStatus[$status])) {
$map['status'] = $status;
}
}
$data = $model->field('id,widthdraw_number,create_time,settlement_end_time,sum_money,status,respond,transfer_proof')
->where($map)
@ -420,8 +419,15 @@ class FinanceController extends BaseController
$list['create_time'] = date('Y-m-d H:i:s', $list['create_time']);
$list['settlement_end_time'] = date('Y-m-d H:i:s', $list['settlement_end_time']);
$list['status_name'] = FinanceController::$withdrawStatus[$list['status']];
if ($list['status'] == -1) {
switch ($list['status']) {
case -2:
$list['status_name'] = '<span style="color: #bbbaba;">' . $list['status_name'] . '</span>';
break;
case -1:
$list['status_name'] = '<span style="color: red;">' . $list['status_name'] . '</span>';
break;
default:
break;
}
}
}
@ -572,8 +578,7 @@ class FinanceController extends BaseController
//是否是会长
$this->purview();
//验证安全密码
$metaTitle = '结算明细';
$modelList = ['财务管理', $metaTitle];
$modelList = [];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
@ -606,4 +611,69 @@ class FinanceController extends BaseController
}
$this->ajaxReturn($data);
}
//撤销提现
public function cancelWithdraw()
{
//是否是会长
$this->purview();
//验证安全密码
$modelList = [];
$res = $this->verifyPasswordView($modelList, false);
if ($res == false) {
$data['status'] = 0;
$data['msg'] = '权限异常';
$this->ajaxReturn($data);
}
$id = intval(I('id', 0));
$data = M('withdraw', 'tab_')->find($id);
if (empty($data) || !in_array($data['status'], [-1, 0])) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
if ($data['promote_id'] != $this->loginPromote['id']) {
$data['status'] = 0;
$data['msg'] = '权限异常';
$this->ajaxReturn($data);
}
$spendMap['withdraw_id'] = $id;
$spendIds = M('Spend', 'tab_')->where($spendMap)->getField('id', true);
if (empty($spendIds)) {
$data['status'] = 0;
$data['msg'] = '数据异常';
$this->ajaxReturn($data);
}
$spendIds = implode(',', $spendIds);
$time = time();
$withdrawSave['id'] = $id;
$withdrawSave['status'] = -2;
$withdrawSave['spend_ids'] = $spendIds;
$withdrawSave['last_up_update_time'] = $time;
M('withdraw', 'tab_')->startTrans();//开启事物
$withdrawRes = M('withdraw', 'tab_')->save($withdrawSave);
if ($withdrawRes === false) {
M('withdraw', 'tab_')->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '撤销失败';
$this->ajaxReturn($data);
}
$spendSave['selle_status'] = 0;
$spendSave['withdraw_id'] = 0;
$spendRes = M('spend', 'tab_')->where($spendMap)->save($spendSave);
if ($spendRes === false) {
M('withdraw', 'tab_')->rollback();//事物回滚
$data['status'] = 0;
$data['msg'] = '撤销失败';
} else {
M('withdraw', 'tab_')->commit();//事物提交
$data['status'] = 1;
$data['msg'] = '撤销成功';
}
$this->ajaxReturn($data);
}
}

@ -103,8 +103,8 @@
<div class="form-group normal_space">
<select id="status" name="status" class="reselect select_gallery" style="min-width:200px;width: 175px;">
<option value="" title="请选择状态">请选择状态</option>
<option value="-2" title="未提现"
<if condition="I('status') eq -2">selected</if>
<option value="-99" title="未提现"
<if condition="I('status') eq -99">selected</if>
>未提现 </option>
<?php foreach (promoteWithdrawStatus() as $key => $value) :?>
<option value="{$key}" title="{$value}"

@ -136,6 +136,10 @@
<div class="btn btn-role btn-role-border <if condition='$status eq 2'>highlight</if>" status="2">
<p>已汇款</p>
</div>
<div class="btn btn-role btn-role-border <if condition='$status eq -2'>highlight</if>" status="-2">
<p>已撤销</p>
</div>
</div>
</div>
<div class="page-list apply-app_apply-list query-recharge-list">
@ -177,6 +181,9 @@
<span class="renew-review" data-id="{$vo['id']}" style="color: #0bb20c;cursor: pointer;">重新审核</span>
</if>
<a href="{:U('settlementOrder', array('id'=>$vo['id']))}">结算单</a>
<if condition="$vo['status'] eq -1 or $vo['status'] eq 0">
<span class="cancel-withdraw" data-id="{$vo['id']}" style="color: red;cursor: pointer;">撤销提现</span>
</if>
</td>
</tr>
</volist>
@ -293,6 +300,35 @@
}
});
});
$('.cancel-withdraw').click(function () {
var id = parseInt($(this).attr('data-id'));
var msg = "确定要撤销提现吗?";
layer.confirm(msg, {
title: '提示',
btn: ['确定', '取消'],
}, function () {
$.ajax({
type: 'post',
url: '{:U("cancelWithdraw")}',
dataType: 'json',
data: {id:id},
success: function (data) {
if (data.status == 1) {
layer.msg(data.msg, {icon: 1});
setTimeout(function(){
window.location.reload();
},2000);
} else {
layer.msg(data.msg, {icon: 5});
}
},
error: function (result) {
layer.msg('网络异常', {icon: 5});
}
});
});
});
});
</script>

@ -528,3 +528,8 @@ ADD INDEX `search`(`game_id`, `server_id`, `role_id`, `create_time`) USING BTREE
ADD INDEX `create_time`(`create_time`) USING BTREE;
ADD INDEX `recharge_cost`(`recharge_cost`) USING BTREE,
ADD INDEX `recharge_count`(`recharge_count`) USING BTREE;
--
ALTER TABLE `tab_withdraw`
ADD COLUMN `last_up_update_time` int(10) NOT NULL DEFAULT 0 COMMENT '最后更新时间',
ADD COLUMN `spend_ids` longtext NOT NULL COMMENT '充值订单id';
Loading…
Cancel
Save