fix(admin): 下线退款重发功能并优化用户详情页布局
- 移除后台订单和支付流水的退款重发按钮及接口 - 新增用户详情页分区导航和资金流水筛选功能 - 升级账号安全页面为企业资质认证功能 - 新增企业资质相关测试用例和图标 - 升级版本号至1.0.96
这个提交包含在:
@@ -47,9 +47,11 @@ class Order extends Backend
|
||||
return $this->selectpage();
|
||||
}
|
||||
[$where, $sort, $order, $offset, $limit] = $this->buildparams();
|
||||
$scopeUserId = $this->request->get('scope_user_id/d', 0);
|
||||
$list = $this->model
|
||||
->with(['user', 'master'])
|
||||
->where($where)
|
||||
->where(function ($query) use ($scopeUserId) { if ($scopeUserId > 0) $query->where('order.user_id', $scopeUserId); })
|
||||
->order($sort, $order)
|
||||
->paginate($limit);
|
||||
|
||||
@@ -762,69 +764,7 @@ class Order extends Backend
|
||||
*/
|
||||
public function retryrefund($ids = null)
|
||||
{
|
||||
if (!$this->request->isPost()) {
|
||||
$this->error('非法请求方式');
|
||||
}
|
||||
$payOrderId = $this->request->post('pay_order_id/d', 0);
|
||||
if ($payOrderId <= 0) {
|
||||
$payOrderId = (int)$ids;
|
||||
}
|
||||
$po = Db::name('pay_order')->where('id', $payOrderId)->find();
|
||||
if (!$po) {
|
||||
$this->error('未找到指定的支付交易流水');
|
||||
}
|
||||
|
||||
$order = Db::name('order')->where('id', (int)$po['order_id'])->find();
|
||||
if (!$order) {
|
||||
$this->error('关联业务订单不存在');
|
||||
}
|
||||
if ((int)$order['settle_status'] === 1) {
|
||||
$this->error('该工单已完成向师傅结算分账,不允许再执行退款');
|
||||
}
|
||||
|
||||
$status = (string)($po['status'] ?? '');
|
||||
if ($status === 'refunding') {
|
||||
$this->error('该流水处于微信退款处理中,请先点击【同步微信状态】核实是否已到账,切勿盲目重退');
|
||||
}
|
||||
if (!in_array($status, ['refund_failed', 'paid'], true)) {
|
||||
$this->error('当前流水状态为「' . \app\common\library\PaymentService::payOrderStatusLabel($status) . '」,不可发起原路退款');
|
||||
}
|
||||
|
||||
$reason = trim($this->request->post('reason/s', ''));
|
||||
try {
|
||||
$after = \app\common\library\PaymentService::refundSinglePayOrder(
|
||||
$payOrderId,
|
||||
$reason !== '' ? $reason : '管理员后台手动发起/重试原路退款'
|
||||
);
|
||||
} catch (\Throwable $e) {
|
||||
$this->error('发起原路退款失败:' . $e->getMessage());
|
||||
}
|
||||
|
||||
// 若主工单已处于取消状态且本笔退款受理/到账成功,同步汇总真实退款金额
|
||||
if ((int)$order['status'] === 9 && in_array($after['status'] ?? '', ['refunding', 'refunded'], true)) {
|
||||
$allPaid = Db::name('pay_order')
|
||||
->where('order_id', (int)$order['id'])
|
||||
->whereIn('status', ['paid', 'refunding', 'refunded', 'refund_failed'])
|
||||
->select();
|
||||
$hasUnsettledRefund = false;
|
||||
$sumRefund = 0.00;
|
||||
foreach ($allPaid as $item) {
|
||||
if (in_array($item['status'], ['refunding', 'refunded'], true)) {
|
||||
$sumRefund = round($sumRefund + (float)($item['refund_amount'] ?: $item['amount']), 2);
|
||||
} else {
|
||||
$hasUnsettledRefund = true;
|
||||
}
|
||||
}
|
||||
Db::name('order')->where('id', (int)$order['id'])->update([
|
||||
'pay_status' => $hasUnsettledRefund ? (int)$order['pay_status'] : 2,
|
||||
'refund_amount' => $sumRefund,
|
||||
'updatetime' => time(),
|
||||
]);
|
||||
}
|
||||
|
||||
$statusLabel = \app\common\library\PaymentService::payOrderStatusLabel($after['status'] ?? '');
|
||||
$refundLabel = \app\common\library\PaymentService::refundStatusLabel($after['refund_status'] ?? 'none');
|
||||
$this->success('微信原路退款请求已提交,当前状态:' . $statusLabel . '(' . $refundLabel . ')');
|
||||
$this->error('退款重发暂不可用:请先核对原退款单及金额,再通过订单售后流程处理');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
在新工单中引用
屏蔽一个用户