feat(front): 新增售后申请图片上传功能
- 支持最多上传3张售后凭证图片 - 提供图片预览和删除功能 - 上传图片随售后申请一起提交
这个提交包含在:
@@ -26,9 +26,11 @@ class RechargeRefund extends Backend
|
||||
if (!$pay) $this->error('充值订单不存在');
|
||||
if ($this->request->isPost()) {
|
||||
$this->token();
|
||||
try { RechargeRefundService::create((int)$ids, $this->request->post('amount', ''), $this->request->post('reason', ''), $this->auth->id); }
|
||||
try { $refund = RechargeRefundService::create((int)$ids, $this->request->post('amount', ''), $this->request->post('reason', ''), $this->auth->id); }
|
||||
catch (\Throwable $e) { $this->error($e->getMessage()); }
|
||||
$this->success('退款申请已提交,余额已占用,等待审核');
|
||||
try { $result = RechargeRefundService::submit((int)$refund['id'], $this->auth->id); }
|
||||
catch (\Throwable $e) { $this->error('退款记录已创建,余额保持占用;请到充值退款记录核实处理:' . $e->getMessage()); }
|
||||
$this->success('退款已发起,当前状态:' . $result['status']);
|
||||
}
|
||||
$this->view->assign('pay', $pay);
|
||||
$this->view->assign('balance', Db::name('user')->where('id', (int)$pay['user_id'])->value('money'));
|
||||
@@ -45,15 +47,13 @@ class RechargeRefund extends Backend
|
||||
try {
|
||||
if ($action === 'reject') {
|
||||
RechargeRefundService::reject((int)$ids, $this->auth->id, $this->request->post('note', ''));
|
||||
$this->success('已驳回并释放余额');
|
||||
$this->success('已取消并释放余额');
|
||||
}
|
||||
if ($action !== 'approve') throw new \InvalidArgumentException('无效操作');
|
||||
RechargeRefundService::begin((int)$ids, $this->auth->id, $this->request->post('note', ''));
|
||||
RechargeRefundService::submit((int)$ids, $this->auth->id);
|
||||
} catch (\think\exception\HttpResponseException $e) { throw $e; }
|
||||
catch (\Throwable $e) { $this->error($e->getMessage()); }
|
||||
try { RechargeRefundService::send((int)$ids); }
|
||||
catch (\Throwable $e) { $this->error('申请已审核,微信结果待核实,余额保持占用:' . $e->getMessage()); }
|
||||
$this->success('退款请求已处理,请查看退款状态');
|
||||
catch (\Throwable $e) { $this->error('处理未完成,请查看退款记录及余额占用状态:' . $e->getMessage()); }
|
||||
$this->success('退款已发起,请查看退款状态');
|
||||
}
|
||||
$this->view->assign('row', $row);
|
||||
return $this->view->fetch();
|
||||
|
||||
@@ -187,7 +187,7 @@
|
||||
</div>
|
||||
<div class="po-guide-body">
|
||||
<strong>操作指引:</strong>
|
||||
{if $rechargeOnly}可对已支付的充值订单申请原路退款,提交后占用余额,审核通过后向微信退款。{else /}展示全站微信支付与原路退款记录。充值退款请使用充值订单中的专用入口。{/if}
|
||||
{if $rechargeOnly}可对已支付的充值订单发起原路退款,确认后占用余额并向微信提交退款。{else /}展示全站微信支付与原路退款记录。充值退款请使用充值订单中的专用入口。{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -4,5 +4,5 @@
|
||||
<div class="form-group"><label class="control-label col-sm-3">充值 / 已退</label><div class="col-sm-8"><p class="form-control-static">¥{$pay.amount|htmlentities} / ¥{$pay.refund_amount|htmlentities},当前可用余额 ¥{$balance|htmlentities}</p></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">退款金额</label><div class="col-sm-8"><input class="form-control" name="amount" data-rule="required" placeholder="最多两位小数"></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">退款原因</label><div class="col-sm-8"><textarea class="form-control" name="reason" maxlength="255" data-rule="required"></textarea></div></div>
|
||||
<div class="form-group"><div class="col-sm-offset-3 col-sm-8"><p>提交后将立即占用余额,审核通过后向微信发起退款。</p><button type="submit" class="btn btn-primary">提交申请</button></div></div>
|
||||
<div class="form-group"><div class="col-sm-offset-3 col-sm-8"><p>确认后立即占用余额并向微信发起原路退款。</p><button type="submit" class="btn btn-primary">确认退款</button></div></div>
|
||||
</form>
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<div class="panel panel-default panel-intro">
|
||||
<div class="panel-heading"><h4>充值退款申请</h4><p>退款处理中、状态未知及异常时,余额保持占用;请核实微信状态。</p></div>
|
||||
<div class="panel-heading"><h4>充值退款记录</h4><p>退款处理中、状态未知及异常时,余额保持占用;请核实微信状态。</p></div>
|
||||
<div class="panel-body">
|
||||
<form class="form-inline" method="get"><label>状态 <select name="status" class="form-control"><option value="">全部</option><option value="pending">待审核</option><option value="submitting">提交中</option><option value="processing">退款处理中</option><option value="unknown">结果未知</option><option value="abnormal">异常待处理</option><option value="success">退款成功</option><option value="closed">微信关闭</option><option value="rejected">已驳回</option></select></label> <button class="btn btn-default">查询</button></form>
|
||||
<div class="table-responsive"><table class="table table-striped table-bordered"><thead><tr><th>申请单号</th><th>充值支付单号</th><th>用户</th><th>金额</th><th>状态</th><th>申请原因 / 审核备注</th><th>操作人 / 审核人 ID</th><th>申请时间</th><th>操作</th></tr></thead><tbody>
|
||||
<form class="form-inline" method="get"><label>状态 <select name="status" class="form-control"><option value="">全部</option><option value="pending">待提交</option><option value="submitting">提交中</option><option value="processing">退款处理中</option><option value="unknown">结果未知</option><option value="abnormal">异常待处理</option><option value="success">退款成功</option><option value="closed">微信关闭</option><option value="rejected">已取消</option></select></label> <button class="btn btn-default">查询</button></form>
|
||||
<div class="table-responsive"><table class="table table-striped table-bordered"><thead><tr><th>退款单号</th><th>充值支付单号</th><th>用户</th><th>金额</th><th>状态</th><th>退款原因 / 处理备注</th><th>操作人 / 处理人 ID</th><th>创建时间</th><th>操作</th></tr></thead><tbody>
|
||||
{volist name="list" id="row"}
|
||||
<tr><td>{$row.refund_no|htmlentities}</td><td>{$row.out_trade_no|htmlentities}</td><td>{$row.nickname|htmlentities} {$row.mobile|htmlentities}</td><td>¥{$row.amount|htmlentities}</td><td>{$row.status|htmlentities}</td><td>{$row.reason|htmlentities}<br>{$row.audit_note|htmlentities}<br>{$row.error|htmlentities}</td><td>{$row.operator_id|htmlentities} / {$row.reviewer_id|htmlentities}</td><td>{$row.createtime|date='Y-m-d H:i:s',###}</td><td>
|
||||
{if $row.status == 'pending' && $auth->check('recharge_refund/review')}<a href="{:url('recharge_refund/review', ['ids'=>$row.id])}" class="btn btn-xs btn-primary btn-dialog" title="审核退款">审核</a>{/if}
|
||||
{if $row.status == 'pending' && $auth->check('recharge_refund/review')}<a href="{:url('recharge_refund/review', ['ids'=>$row.id])}" class="btn btn-xs btn-primary btn-dialog" title="处理未提交退款">处理</a>{/if}
|
||||
{if in_array($row.status, ['submitting','unknown','processing','abnormal']) && $auth->check('recharge_refund/resolve')}<a href="{:url('recharge_refund/resolve', ['ids'=>$row.id])}" class="btn btn-xs btn-warning btn-dialog" title="处理退款">处理</a>{/if}
|
||||
</td></tr>
|
||||
{/volist}
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
{:token()}
|
||||
<div class="form-group"><label class="control-label col-sm-3">退款单号</label><div class="col-sm-8"><p class="form-control-static">{$row.refund_no|htmlentities}</p></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">退款金额</label><div class="col-sm-8"><p class="form-control-static">¥{$row.amount|htmlentities}</p></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">申请原因</label><div class="col-sm-8"><p class="form-control-static">{$row.reason|htmlentities}</p></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">审核结果</label><div class="col-sm-8"><select name="action" class="form-control"><option value="approve">通过并发起微信退款</option><option value="reject">驳回并释放余额</option></select></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">审核备注</label><div class="col-sm-8"><textarea class="form-control" name="note" maxlength="255" placeholder="驳回时必填"></textarea></div></div>
|
||||
<div class="form-group"><div class="col-sm-offset-3 col-sm-8"><button type="submit" class="btn btn-primary">确认审核</button></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">退款原因</label><div class="col-sm-8"><p class="form-control-static">{$row.reason|htmlentities}</p></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">处理方式</label><div class="col-sm-8"><select name="action" class="form-control"><option value="approve">继续发起微信退款</option><option value="reject">取消并释放余额</option></select></div></div>
|
||||
<div class="form-group"><label class="control-label col-sm-3">处理备注</label><div class="col-sm-8"><textarea class="form-control" name="note" maxlength="255" placeholder="取消时必填"></textarea></div></div>
|
||||
<div class="form-group"><div class="col-sm-offset-3 col-sm-8"><button type="submit" class="btn btn-primary">确认处理</button></div></div>
|
||||
</form>
|
||||
|
||||
@@ -3337,12 +3337,12 @@ class Master extends Base
|
||||
default:
|
||||
return [
|
||||
[
|
||||
'title' => '电子特种作业操作证示例',
|
||||
'title' => '特种作业操作证正面示例',
|
||||
'url' => '/static/images/master/cert-sample-special-card.png',
|
||||
],
|
||||
[
|
||||
'title' => '纸质特种作业资格证示例',
|
||||
'url' => '/static/images/master/cert-sample-qualification.png',
|
||||
'title' => '特种作业操作证背面示例',
|
||||
'url' => '/static/images/master/cert-sample-special-card-back.png',
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
@@ -2579,7 +2579,7 @@ class PaymentService
|
||||
}
|
||||
Db::name('order')->where('id', $orderId)->update($quoteOrderUpdate);
|
||||
self::addOrderLog($orderId, OrderStatus::SCHEDULED, '买家选定师傅报价并使用余额支付差价 ¥' . number_format($payAmount, 2, '.', ''), 'user', $operatorUid);
|
||||
self::sendMasterAndUserMessage($masterId, $operatorUid, '师傅已被选定', '客户已选定您的报价并完成支付,请及时预约上门');
|
||||
self::sendNotify('master', $masterId, '师傅已被选定', '客户已选定您的报价并完成支付,请及时预约上门', 'order', $orderId);
|
||||
} elseif ($scene === 'diff') {
|
||||
$newPayTotal = round((float)$lockedOrder['pay_amount'] + $payAmount, 2);
|
||||
$newTotalAmount = round((float)$lockedOrder['total_amount'] + $payAmount, 2);
|
||||
|
||||
@@ -36,13 +36,19 @@ final class RechargeRefundService
|
||||
} catch (\Throwable $e) { Db::rollback(); throw $e; }
|
||||
}
|
||||
|
||||
public static function submit($refundId, $operatorId)
|
||||
{
|
||||
self::begin($refundId, $operatorId, '');
|
||||
return self::send($refundId);
|
||||
}
|
||||
|
||||
public static function begin($refundId, $reviewerId, $note)
|
||||
{
|
||||
if ((int)$reviewerId <= 0 || mb_strlen(trim((string)$note)) > 255) throw new \InvalidArgumentException('审核信息不正确');
|
||||
$changed = Db::name('recharge_refund')->where('id', (int)$refundId)->where('status', 'pending')->update([
|
||||
'status'=>'submitting', 'reviewer_id'=>(int)$reviewerId, 'audit_note'=>trim((string)$note), 'updatetime'=>time()
|
||||
]);
|
||||
if (!$changed) throw new \InvalidArgumentException('退款申请不在待审核状态');
|
||||
if (!$changed) throw new \InvalidArgumentException('退款记录不在待提交状态');
|
||||
return Db::name('recharge_refund')->where('id', (int)$refundId)->find();
|
||||
}
|
||||
|
||||
@@ -125,18 +131,18 @@ final class RechargeRefundService
|
||||
public static function reject($refundId, $reviewerId, $note)
|
||||
{
|
||||
$note = trim((string)$note);
|
||||
if ($note === '' || mb_strlen($note) > 255 || (int)$reviewerId <= 0) throw new \InvalidArgumentException('请填写驳回原因');
|
||||
if ($note === '' || mb_strlen($note) > 255 || (int)$reviewerId <= 0) throw new \InvalidArgumentException('请填写取消原因');
|
||||
$initial = Db::name('recharge_refund')->where('id', (int)$refundId)->find();
|
||||
if (!$initial) throw new \InvalidArgumentException('退款申请不存在');
|
||||
Db::startTrans();
|
||||
try {
|
||||
$user = Db::name('user')->where('id', (int)$initial['user_id'])->lock(true)->find();
|
||||
$refund = Db::name('recharge_refund')->where('id', (int)$refundId)->lock(true)->find();
|
||||
if (!$user || !$refund || $refund['status'] !== 'pending') throw new \InvalidArgumentException('当前状态不允许驳回');
|
||||
if (!$user || !$refund || $refund['status'] !== 'pending') throw new \InvalidArgumentException('当前状态不允许取消');
|
||||
$balance = number_format(((int)round((float)$user['money'] * 100) + (int)round((float)$refund['amount'] * 100)) / 100, 2, '.', '');
|
||||
$now = time();
|
||||
Db::name('user')->where('id', (int)$user['id'])->update(['money'=>$balance,'updatetime'=>$now]);
|
||||
Db::name('wallet_log')->insert(['user_type'=>'user','user_id'=>(int)$user['id'],'type'=>'recharge_refund_release','amount'=>$refund['amount'],'balance'=>$balance,'order_id'=>0,'remark'=>'充值退款驳回释放余额(退款单 '.$refund['refund_no'].')','createtime'=>$now]);
|
||||
Db::name('wallet_log')->insert(['user_type'=>'user','user_id'=>(int)$user['id'],'type'=>'recharge_refund_release','amount'=>$refund['amount'],'balance'=>$balance,'order_id'=>0,'remark'=>'充值退款取消释放余额(退款单 '.$refund['refund_no'].')','createtime'=>$now]);
|
||||
Db::name('recharge_refund')->where('id', (int)$refundId)->update(['status'=>'rejected','reviewer_id'=>(int)$reviewerId,'audit_note'=>$note,'updatetime'=>$now]);
|
||||
Db::commit();
|
||||
} catch (\Throwable $e) { Db::rollback(); throw $e; }
|
||||
|
||||
在新工单中引用
屏蔽一个用户