diff --git a/db/schema_recharge_order_menu.sql b/db/schema_recharge_order_menu.sql new file mode 100644 index 0000000..1e3d3a9 --- /dev/null +++ b/db/schema_recharge_order_menu.sql @@ -0,0 +1,5 @@ +-- 独立充值订单列表;退款仍由服务端安全拦截。 +INSERT INTO `fa_auth_rule` (`type`,`pid`,`name`,`title`,`icon`,`condition`,`remark`,`ismenu`,`createtime`,`updatetime`,`weigh`,`status`) +SELECT 'file', p.id, 'pay_order/recharges', '充值订单', 'fa fa-credit-card', '', '用户微信在线充值订单', 1, UNIX_TIMESTAMP(), UNIX_TIMESTAMP(), 146, 'normal' +FROM `fa_auth_rule` p WHERE p.name='finance_manage' +AND NOT EXISTS (SELECT 1 FROM (SELECT name FROM `fa_auth_rule`) existing WHERE existing.name='pay_order/recharges'); diff --git a/server/application/admin/controller/Invoice.php b/server/application/admin/controller/Invoice.php index 35ab260..b6baac1 100644 --- a/server/application/admin/controller/Invoice.php +++ b/server/application/admin/controller/Invoice.php @@ -77,6 +77,7 @@ class Invoice extends Backend } $linkedOrders = InvoiceService::fetchLinkedOrders((string)$row['order_ids'], (int)$row['id']); $this->view->assign('row', $row); + $this->view->assign('invoiceIsImage', $this->isInvoiceImage((string)$row['invoice_file'])); $this->view->assign('linkedOrders', $linkedOrders); $this->view->assign('flowOptions', []); return $this->view->fetch('edit'); @@ -94,6 +95,7 @@ class Invoice extends Backend if (false === $this->request->isPost()) { $linkedOrders = InvoiceService::fetchLinkedOrders((string)$row['order_ids'], (int)$row['id']); $this->view->assign('row', $row); + $this->view->assign('invoiceIsImage', $this->isInvoiceImage((string)$row['invoice_file'])); $this->view->assign('linkedOrders', $linkedOrders); $this->view->assign('flowOptions', $this->statusFlow[$row['status']] ?? []); return $this->view->fetch(); @@ -169,6 +171,14 @@ class Invoice extends Backend $this->success(); } + /** 判断发票附件是否为可直接显示的图片,忽略 URL 查询参数。 */ + protected function isInvoiceImage($file) + { + $path = parse_url($file, PHP_URL_PATH); + $extension = strtolower(pathinfo(is_string($path) ? $path : '', PATHINFO_EXTENSION)); + return in_array($extension, ['jpg', 'jpeg', 'png', 'gif', 'webp', 'bmp'], true); + } + /** * 开票申请仅由用户/商户端发起,禁止后台手工添加 */ diff --git a/server/application/admin/controller/Order.php b/server/application/admin/controller/Order.php index 1394b60..c213fcd 100644 --- a/server/application/admin/controller/Order.php +++ b/server/application/admin/controller/Order.php @@ -670,18 +670,13 @@ class Order extends Backend unset($appeal); // 10. 微信支付与原路退款交易流水(含失败错误码及中文诊断原因) - $sceneMap = [ - 'order' => '主订单支付', - 'quote' => '选定师傅报价', - 'diff' => '增项补差价', - 'batch' => '批量下单', - ]; + $sceneMap = (new \app\admin\model\PayOrder)->getSceneList(); $payOrders = Db::name('pay_order') ->where('order_id', (int)$row['id']) ->order('id desc') ->select(); foreach ($payOrders as &$poItem) { - $poItem['scene_text'] = $sceneMap[$poItem['scene'] ?? ''] ?? ($poItem['scene'] ?? '-'); + $poItem['scene_text'] = $sceneMap[$poItem['scene'] ?? ''] ?? '未知场景'; $poItem['status_text'] = \app\common\library\PaymentService::payOrderStatusLabel($poItem['status'] ?? ''); $poItem['refund_status_text'] = \app\common\library\PaymentService::refundStatusLabel($poItem['refund_status'] ?? 'none'); $poItem['payment_type_text'] = OrderDetailDisplay::paymentRecordType($poItem); @@ -849,7 +844,9 @@ class Order extends Backend $orderRefunded = 0.00; $orderRefundable = 0.00; + $sceneMap = (new \app\admin\model\PayOrder)->getSceneList(); foreach ($payRows as &$po) { + $po['scene_text'] = $sceneMap[$po['scene'] ?? ''] ?? '未知场景'; $po['status_text'] = \app\common\library\PaymentService::payOrderStatusLabel($po['status']); $po['refund_total'] = round((float)$po['refund_amount'], 2); $po['refund_left'] = round((float)$po['amount'] - (float)$po['refund_amount'], 2); @@ -872,11 +869,12 @@ class Order extends Backend } elseif ((int)$order['settle_status'] === 1) { $blockReason = '该工单已完成向师傅结算分账,不允许售后退款(请先与师傅线下协商追回)'; } elseif (!$hasWxPayRows) { - $blockReason = '该订单为 mock/月结等线下渠道支付,无微信支付流水,无法线上原路退款,请联系财务线下人工处理并登记'; + $blockReason = '该订单无可用的线上支付流水,无法线上原路退款,请联系财务线下人工处理并登记'; } elseif ($orderRefundable <= 0) { $blockReason = '该订单的支付流水已全部退款,无可退余额'; } $this->view->assign('row', $order); + $this->view->assign('paymentTypeLabel', OrderDetailDisplay::paymentType($order['pay_type'] ?? '')); $this->view->assign('payRows', $payRows); $this->view->assign('orderRefunded', $orderRefunded); $this->view->assign('orderRefundable', $orderRefundable); diff --git a/server/application/admin/controller/PayOrder.php b/server/application/admin/controller/PayOrder.php index 2202369..c16b62b 100644 --- a/server/application/admin/controller/PayOrder.php +++ b/server/application/admin/controller/PayOrder.php @@ -42,28 +42,43 @@ class PayOrder extends Backend */ public function index() { + $rechargeOnly = strtolower($this->request->action()) === 'recharges'; $this->request->filter(['strip_tags', 'trim']); if (false === $this->request->isAjax()) { + $this->view->assign('rechargeOnly', $rechargeOnly); + $base = function () use ($rechargeOnly) { + $query = Db::name('pay_order'); + return $rechargeOnly ? $query->where('scene', 'recharge') : $query; + }; $stats = [ - 'total_count' => $this->model->count(), - 'total_paid_amount' => (float)$this->model->whereIn('status', ['paid', 'refunded', 'refunding', 'refund_failed'])->sum('amount'), - 'total_refund_amount' => (float)$this->model->sum('refund_amount'), - 'refunding_count' => $this->model->where('status', 'refunding')->whereOr('refund_status', 'processing')->count(), - 'abnormal_count' => $this->model->whereIn('status', ['pay_failed', 'refund_failed'])->whereOr('refund_status', 'abnormal')->count(), + 'total_count' => $base()->count(), + 'total_paid_amount' => (float)$base()->whereIn('status', ['paid', 'refunded', 'refunding', 'refund_failed'])->sum('amount'), + 'total_refund_amount' => (float)$base()->sum('refund_amount'), + 'refunding_count' => $base()->where(function ($q) { $q->where('status', 'refunding')->whereOr('refund_status', 'processing'); })->count(), + 'abnormal_count' => $base()->where(function ($q) { $q->whereIn('status', ['pay_failed', 'refund_failed'])->whereOr('refund_status', 'abnormal'); })->count(), ]; $this->view->assign('stats', $stats); - return $this->view->fetch(); + return $this->view->fetch('index'); } [$where, $sort, $order, $offset, $limit] = $this->buildparams(); - $list = $this->model + $query = $this->model ->with(['order', 'user']) - ->where($where) + ->where($where); + if ($rechargeOnly) { + $query->where('pay_order.scene', 'recharge'); + } + $list = $query ->order($sort, $order) ->paginate($limit); $result = ['total' => $list->total(), 'rows' => $list->items()]; return json($result); } + public function recharges() + { + return $this->index(); + } + /** * 主动向微信查询该笔流水的最新支付/退款状态并落库 */ @@ -136,14 +151,8 @@ class PayOrder extends Backend $user = $userId ? Db::name('user')->where('id', $userId)->field('id,nickname,username,mobile,avatar')->find() : null; $refundableAmount = round((float)$row['amount'] - (float)$row['refund_amount'], 2); - $sceneMap = [ - 'order' => '订单支付', - 'quote' => '报价支付', - 'diff' => '增项补差', - 'batch' => '批次支付', - 'recharge' => '用户充值' - ]; - $sceneText = $sceneMap[$row['scene']] ?? $row['scene']; + $sceneMap = $this->model->getSceneList(); + $sceneText = $sceneMap[$row['scene']] ?? '未知场景'; $this->view->assign('row', $row); $this->view->assign('order', $order ?: []); diff --git a/server/application/admin/controller/Settle.php b/server/application/admin/controller/Settle.php index bf60abb..82bc1fd 100644 --- a/server/application/admin/controller/Settle.php +++ b/server/application/admin/controller/Settle.php @@ -218,6 +218,7 @@ class Settle extends Backend 'order' => $order ?: [], 'master' => $master ?: [], 'walletLogs' => $walletLogs, + 'walletTypeList' => (new \app\admin\model\WalletLog)->getTypeList(), ]); } } diff --git a/server/application/admin/controller/Withdraw.php b/server/application/admin/controller/Withdraw.php index e94b0dc..535fda8 100644 --- a/server/application/admin/controller/Withdraw.php +++ b/server/application/admin/controller/Withdraw.php @@ -102,6 +102,8 @@ class Withdraw extends Backend 'master' => $master ?: [], 'recentSettles' => $recentSettles, 'walletLogs' => $walletLogs, + 'verifyStatusList' => ['pending' => '审核中', 'pass' => '已认证', 'reject' => '审核未通过'], + 'walletTypeList' => (new \app\admin\model\WalletLog)->getTypeList(), ]); return $this->view->fetch(); } diff --git a/server/application/admin/controller/user/User.php b/server/application/admin/controller/user/User.php index c145df7..10e8eee 100755 --- a/server/application/admin/controller/user/User.php +++ b/server/application/admin/controller/user/User.php @@ -205,6 +205,7 @@ class User extends Backend 'recentOrders' => $recentOrders, 'coupons' => $coupons, 'recentWalletLogs' => $recentWalletLogs, + 'walletTypeList' => (new \app\admin\model\WalletLog)->getTypeList(), 'orderCount' => (int)($orderAgg['total_cnt'] ?? 0), 'totalSpent' => number_format((float)($orderAgg['total_spent'] ?? 0), 2, '.', ''), ]); diff --git a/server/application/admin/model/PayOrder.php b/server/application/admin/model/PayOrder.php index 5173fef..89ab34e 100644 --- a/server/application/admin/model/PayOrder.php +++ b/server/application/admin/model/PayOrder.php @@ -30,7 +30,7 @@ class PayOrder extends Model */ public function getStatusList() { - return ['pending' => '待支付', 'paid' => '已支付', 'refunded' => '已退款', 'refunding' => '退款处理中', 'refund_failed' => '退款失败', 'closed' => '已关闭']; + return ['pending' => '待支付', 'paid' => '已支付', 'pay_failed' => '支付失败', 'refunded' => '已退款', 'refunding' => '退款处理中', 'refund_failed' => '退款失败', 'closed' => '已关闭']; } public function getStatusTextAttr($value, $data) @@ -60,7 +60,7 @@ class PayOrder extends Model */ public function getSceneList() { - return ['order' => '订单支付', 'prepay' => '预付款充值']; + return ['order' => '订单支付', 'quote' => '报价支付', 'diff' => '增项补差', 'batch' => '批次支付', 'recharge' => '用户在线充值', 'prepay' => '预付款充值']; } public function getSceneTextAttr($value, $data) diff --git a/server/application/admin/view/appeal/detail.html b/server/application/admin/view/appeal/detail.html index 052b301..17f2044 100644 --- a/server/application/admin/view/appeal/detail.html +++ b/server/application/admin/view/appeal/detail.html @@ -14,12 +14,12 @@
申诉工单概览 #AP{$row.id} - {$statusList[$row.status]|default=$row.status|htmlentities} + {$statusList[$row.status]|default='未知状态'|htmlentities}
-
申诉类型:{$typeList[$row.type]|default=$row.type|htmlentities}
+
申诉类型:{$typeList[$row.type]|default='未知类型'|htmlentities}
提交时间:{:date('Y-m-d H:i:s', $row.createtime)}
申诉师傅:{$master.realname|default='-'|htmlentities} {if !empty($master.mobile)}({$master.mobile|htmlentities}){/if}
师傅评分: @@ -50,7 +50,7 @@ {if !empty($order)}
关联单号:{$order.order_no|htmlentities}
-
工单状态:{$orderStatusMap[$order.status]|default=$order.status}
+
工单状态:{$orderStatusMap[$order.status]|default='未知状态'}
服务项目:{$order.service_name|default='-'|htmlentities} {if $order.goods_model}({$order.goods_model|htmlentities}){/if}
实付金额:¥{$order.pay_amount|default='0.00'|htmlentities}(师傅结算:¥{$order.settle_amount|default='0.00'|htmlentities})
下单雇主:{$order.contact|default='-'|htmlentities}({$order.mobile|default='-'|htmlentities})
@@ -100,7 +100,7 @@
平台仲裁答复记录
-
处理状态:{$statusList[$row.status]|default=$row.status|htmlentities}
+
处理状态:{$statusList[$row.status]|default='未知状态'|htmlentities}
更新时间:{:date('Y-m-d H:i:s', $row.updatetime)}
官方答复: diff --git a/server/application/admin/view/appeal/edit.html b/server/application/admin/view/appeal/edit.html index 075dc2e..2cb9d21 100644 --- a/server/application/admin/view/appeal/edit.html +++ b/server/application/admin/view/appeal/edit.html @@ -23,7 +23,7 @@

- {$typeList[$row.type]|default=$row.type|htmlentities} + {$typeList[$row.type]|default='未知类型'|htmlentities} 提交于 {:date('Y-m-d H:i', $row.createtime)}

@@ -39,7 +39,7 @@

{$order.order_no|htmlentities} - {$orderStatusMap[$order.status]|default=$order.status} + {$orderStatusMap[$order.status]|default='未知状态'}

diff --git a/server/application/admin/view/coupon/detail.html b/server/application/admin/view/coupon/detail.html index f11870e..b18c6fa 100644 --- a/server/application/admin/view/coupon/detail.html +++ b/server/application/admin/view/coupon/detail.html @@ -14,7 +14,7 @@
{$row.name|htmlentities} - {$statusList[$row.status]|default=$row.status} + {$statusList[$row.status]|default='未知状态'}
diff --git a/server/application/admin/view/invoice/edit.html b/server/application/admin/view/invoice/edit.html index b5e2aca..ad1aa04 100644 --- a/server/application/admin/view/invoice/edit.html +++ b/server/application/admin/view/invoice/edit.html @@ -1,4 +1,11 @@ +
+ {if condition="!empty($flowOptions)"} +
+ 处理步骤:① 核对下方申请信息和订单 → ② 在税务开票系统开具发票 → ③ 回到本页填写发票号码并上传文件。
+ 本页面只登记开票结果,不会自动开票或发送邮件。无法开票时请选择驳回并填写原因。 +
+ {/if}
@@ -28,7 +35,7 @@

¥{$row.amount|htmlentities} - {$typeList[$row.type]|default=$row.type} + {$typeList[$row.type]|default='未知类型'} {$titleTypeList[$row.title_type]|default='个人/非企业'} @@ -178,7 +185,7 @@

财务开票处理

-

线上开具数电发票后标记「开票完成」,填写发票号码并可上传电子发票原件(PDF/图片),申请人即可在小程序直接预览下载;无法开票时请驳回并说明原因,额度及关联订单将自动释放。

+

请先在税务开票系统开具发票,再登记结果。提交后状态不能在此修改,请核对发票号码和文件。

@@ -186,20 +193,22 @@
{foreach name="flowOptions" item="op"} {if $op == 'issued'} - + {elseif $op == 'reject' /} - + {/if} {/foreach}
+

填写真实发票号码,建议上传原件供申请人在小程序查看和下载。

+
- +
@@ -214,13 +223,14 @@
- +
- - + +
+

支持 PDF、OFD、JPG、PNG、WEBP。未上传文件时,申请人无法在线查看或下载;提交后不能在此补传。

    @@ -238,7 +248,7 @@ @@ -253,7 +263,7 @@
    -

    {$statusList[$row.status]|default=$row.status}

    +

    {$statusList[$row.status]|default='未知状态'}

    @@ -272,8 +282,16 @@
    + {if $invoiceIsImage} +
    + + 电子发票图片,点击查看大图 + +

    点击图片可查看大图

    +
    + {/if}

    - 查看/下载电子发票 + 打开电子发票原件

    diff --git a/server/application/admin/view/invoice_title/detail.html b/server/application/admin/view/invoice_title/detail.html index 62bd5c2..48528d3 100644 --- a/server/application/admin/view/invoice_title/detail.html +++ b/server/application/admin/view/invoice_title/detail.html @@ -13,12 +13,12 @@ {$row.title|htmlentities} {if $row.is_default}默认抬头{/if} - {$titleTypeList[$row.title_type]|default=$row.title_type} + {$titleTypeList[$row.title_type]|default='未知类型'}
    -
    默认票种:{$invoiceTypeList[$row.default_invoice_type]|default=$row.default_invoice_type}
    +
    默认票种:{$invoiceTypeList[$row.default_invoice_type]|default='未知类型'}
    纳税人识别号:{if $row.tax_no}{$row.tax_no|htmlentities}{else/}-{/if}
    归属用户:{$row.user.nickname|default=$row.user.username|default='-'|htmlentities}
    归属签约企业:{if $row.merchant_id}{$row.merchant.name|default='-'|htmlentities}{else/}个人业主抬头{/if}
    diff --git a/server/application/admin/view/message/detail.html b/server/application/admin/view/message/detail.html index 068f766..a0f6924 100644 --- a/server/application/admin/view/message/detail.html +++ b/server/application/admin/view/message/detail.html @@ -8,11 +8,11 @@
    接收端类型: - {$receiveTypeList[$row.receive_type]|default=$row.receive_type} + {$receiveTypeList[$row.receive_type]|default='未知类型'}
    消息分类: - {$typeList[$row.type]|default=$row.type} + {$typeList[$row.type]|default='未知类型'}
    接收人信息: diff --git a/server/application/admin/view/order/aftersale.html b/server/application/admin/view/order/aftersale.html index 745752f..7232bec 100644 --- a/server/application/admin/view/order/aftersale.html +++ b/server/application/admin/view/order/aftersale.html @@ -37,7 +37,7 @@
    下单客户:{$row.user.nickname|default=$row.user.username|htmlentities}({$row.mobile|htmlentities}) 承接师傅:{if $row.master_id && $row.master}{$row.master.realname|htmlentities}{else/}未指派{/if}
    -
    订单实付:¥{$row.pay_amount|htmlentities} 支付渠道:{$row.pay_type|htmlentities} 结算状态:{if $row.settle_status == 1}已向师傅结算{else/}未结算(可安全退款){/if}
    +
    订单实付:¥{$row.pay_amount|htmlentities} 支付渠道:{$paymentTypeLabel|htmlentities} 结算状态:{if $row.settle_status == 1}已向师傅结算{else/}未结算(可安全退款){/if}
    @@ -76,7 +76,7 @@ {foreach name="payRows" item="po"} {$po.out_trade_no|htmlentities} - {$po.scene|htmlentities} + {$po.scene_text|htmlentities} ¥{$po.amount} ¥{$po.refund_total} ¥{$po.refund_left} @@ -84,7 +84,7 @@ {/foreach} {else /} - 该订单无有效微信支付流水(如为 mock/月结渠道订单请线下人工处理) + 该订单无有效线上支付流水,请联系财务核实处理 {/if} diff --git a/server/application/admin/view/order/edit.html b/server/application/admin/view/order/edit.html index 0a1804d..2a9f784 100644 --- a/server/application/admin/view/order/edit.html +++ b/server/application/admin/view/order/edit.html @@ -241,7 +241,7 @@

    - 计价模式:{$priceTypeList[$row.price_type]|default=$row.price_type|htmlentities} + 计价模式:{$priceTypeList[$row.price_type]|default='未知类型'|htmlentities} | 支付状态: {if $row.pay_status == 1}已支付 diff --git a/server/application/admin/view/pay_order/detail.html b/server/application/admin/view/pay_order/detail.html index a2dbc06..d4a99fe 100644 --- a/server/application/admin/view/pay_order/detail.html +++ b/server/application/admin/view/pay_order/detail.html @@ -654,7 +654,7 @@ 同步微信状态 {/if} - {if ($row.status == 'refund_failed' || ($row.status == 'paid' && $refundableAmount > 0)) && $refundableAmount > 0} + {if $row.scene != 'recharge' && ($row.status == 'refund_failed' || ($row.status == 'paid' && $refundableAmount > 0)) && $refundableAmount > 0} diff --git a/server/application/admin/view/pay_order/index.html b/server/application/admin/view/pay_order/index.html index edadc89..da7c805 100644 --- a/server/application/admin/view/pay_order/index.html +++ b/server/application/admin/view/pay_order/index.html @@ -187,7 +187,7 @@

    操作指引: - 展示全站微信支付与原路退款记录。若记录长期显示“退款处理中”,可点击【同步微信】获取最新到账结果;若遇“退款失败”或有可退余额,可点击【重发退款】发起原路退回,系统会自动核实已退金额,避免重复退款。 + {if $rechargeOnly}展示用户微信在线充值记录。充值退款功能正在完善,暂不可通过退款台账发起充值退款。{else /}展示全站微信支付与原路退款记录。充值流水暂不可通过此处发起退款。{/if}
    @@ -195,7 +195,7 @@
    刷新 - + {if !$rechargeOnly}{/if}
    diff --git a/server/application/admin/view/review/detail.html b/server/application/admin/view/review/detail.html index fb32222..d557c7c 100644 --- a/server/application/admin/view/review/detail.html +++ b/server/application/admin/view/review/detail.html @@ -13,7 +13,7 @@
    服务评价详情 #RV{$row.id} - {$statusList[$row.status]|default=$row.status|htmlentities} + {$statusList[$row.status]|default='未知状态'|htmlentities}
    diff --git a/server/application/admin/view/settle/detail.html b/server/application/admin/view/settle/detail.html index 72c5bdf..d55487d 100644 --- a/server/application/admin/view/settle/detail.html +++ b/server/application/admin/view/settle/detail.html @@ -16,7 +16,7 @@
    结算单清分凭证 #ST{$row.id} - {$statusList[$row.status]|default=$row.status|htmlentities} + {$statusList[$row.status]|default='未知状态'|htmlentities}
    @@ -77,7 +77,7 @@ {volist name="walletLogs" id="wl"} #{$wl.id} - {$wl.type|htmlentities} + {$walletTypeList[$wl.type]|default='未知类型'|htmlentities} +¥{$wl.amount|htmlentities} ¥{$wl.balance|htmlentities} {$wl.remark|htmlentities} diff --git a/server/application/admin/view/settle/edit.html b/server/application/admin/view/settle/edit.html index 6e680a6..c684cd9 100644 --- a/server/application/admin/view/settle/edit.html +++ b/server/application/admin/view/settle/edit.html @@ -105,7 +105,7 @@

    - 该结算单已于 {:$row.settle_time ? date('Y-m-d H:i:s', $row.settle_time) : '-'} 归档(状态:{$statusList[$row.status]|default=$row.status}),账务已锁定。 + 该结算单已于 {:$row.settle_time ? date('Y-m-d H:i:s', $row.settle_time) : '-'} 归档(状态:{$statusList[$row.status]|default='未知状态'}),账务已锁定。

    diff --git a/server/application/admin/view/showcase/detail.html b/server/application/admin/view/showcase/detail.html index 2180a02..ea40e4b 100644 --- a/server/application/admin/view/showcase/detail.html +++ b/server/application/admin/view/showcase/detail.html @@ -13,7 +13,7 @@
    业主公开晒单详情 #SC{$row.id} - {$statusList[$row.status]|default=$row.status} + {$statusList[$row.status]|default='未知状态'}
    diff --git a/server/application/admin/view/user/user/detail.html b/server/application/admin/view/user/user/detail.html index 9d38d56..f63adea 100644 --- a/server/application/admin/view/user/user/detail.html +++ b/server/application/admin/view/user/user/detail.html @@ -151,10 +151,10 @@ #WL{$wl.id} - {if $wl.type=='recharge'}{if !empty($wl.voucher)}后台充值{else/}微信充值{/if} + {if $wl.type=='recharge'}账户充值 {elseif $wl.type=='consume'/}余额消费 - {elseif $wl.type=='refund'/}原路退款 - {else/}{$wl.type}{/if} + {elseif $wl.type=='refund'/}退回/退款 + {else/}{$walletTypeList[$wl.type]|default='未知类型'|htmlentities}{/if} {if $wl.amount > 0}+{/if}¥{:number_format($wl.amount, 2)} diff --git a/server/application/admin/view/wallet_log/detail.html b/server/application/admin/view/wallet_log/detail.html index 21ea07b..9f03a27 100644 --- a/server/application/admin/view/wallet_log/detail.html +++ b/server/application/admin/view/wallet_log/detail.html @@ -11,7 +11,7 @@
    资金流水审计凭证 #WL{$row.id} - {if !empty($recharge)}后台充值{else/}{$typeList[$row.type]|default=$row.type}{/if} + {if !empty($recharge)}后台充值{else/}{$typeList[$row.type]|default='未知类型'|htmlentities}{/if}
    @@ -27,7 +27,7 @@
    变动后余额:¥{$row.balance|htmlentities}
    记账时间:{:date('Y-m-d H:i:s', $row.createtime)}
    -
    账户归属端:{$userTypeList[$row.user_type]|default=$row.user_type}
    +
    账户归属端:{$userTypeList[$row.user_type]|default='未知类型'}
    记账摘要:{$row.remark|default='-'|htmlentities}
    diff --git a/server/application/admin/view/withdraw/detail.html b/server/application/admin/view/withdraw/detail.html index 65e3921..7525f73 100644 --- a/server/application/admin/view/withdraw/detail.html +++ b/server/application/admin/view/withdraw/detail.html @@ -16,7 +16,7 @@
    提现申请单 #WD{$row.id} - {$statusList[$row.status]|default=$row.status|htmlentities} + {$statusList[$row.status]|default='未知状态'|htmlentities}
    @@ -26,12 +26,12 @@
    应打款到账净额
    ¥{$row.arrive_amount|htmlentities}
    -
    提现渠道:{$channelList[$row.channel]|default=$row.channel|htmlentities}
    +
    提现渠道:{$channelList[$row.channel]|default='未知类型'|htmlentities}
    收款账号:{$row.account|default='微信零钱'|htmlentities}
    {if !empty($row.out_bill_no)}
    商户转账单:{$row.out_bill_no|htmlentities}
    微信转账单:{$row.transfer_bill_no|default='-'|htmlentities}
    -
    微信转账态:{$row.transfer_state_text|default=$row.transfer_state|htmlentities}
    +
    微信转账态:{$row.transfer_state_text|default='状态未记录'|htmlentities}
    确认收款时:{if $row.confirm_time}{:date('Y-m-d H:i:s', $row.confirm_time)}{else/}-{/if}
    {/if} {if !empty($row.fail_reason) || !empty($row.fail_code)} @@ -62,7 +62,7 @@
    师傅姓名:{$master.realname|htmlentities}({$master.mobile|htmlentities})
    实名状态: - {if $master.verify_status=='pass'}已实名认证{else/}{$master.verify_status|htmlentities}{/if} + {if $master.verify_status=='pass'}已实名认证{else/}{$verifyStatusList[$master.verify_status]|default='未知状态'|htmlentities}{/if}
    当前可用余额:¥{$master.money|default='0.00'|htmlentities}
    当前提现冻结:¥{$master.frozen_money|default='0.00'|htmlentities}
    @@ -129,7 +129,7 @@ {volist name="walletLogs" id="wl"} - {$wl.type|htmlentities} + {$walletTypeList[$wl.type]|default='未知类型'|htmlentities} {$wl.amount|htmlentities} ¥{$wl.balance|htmlentities} {$wl.remark|htmlentities} diff --git a/server/application/admin/view/withdraw/edit.html b/server/application/admin/view/withdraw/edit.html index fb8d554..e5bb2d5 100644 --- a/server/application/admin/view/withdraw/edit.html +++ b/server/application/admin/view/withdraw/edit.html @@ -37,7 +37,7 @@
    -

    {$channelList[$row.channel]|default=$row.channel} · {$row.account|default='微信零钱'|htmlentities}

    +

    {$channelList[$row.channel]|default='未知类型'} · {$row.account|default='微信零钱'|htmlentities}

    diff --git a/server/application/common/library/PaymentService.php b/server/application/common/library/PaymentService.php index bd720f9..d9cbd31 100644 --- a/server/application/common/library/PaymentService.php +++ b/server/application/common/library/PaymentService.php @@ -883,6 +883,9 @@ class PaymentService if (!$po) { throw new \InvalidArgumentException('支付交易单不存在'); } + if ($po['scene'] === 'recharge') { + throw new \InvalidArgumentException('充值退款须使用专用退款流程,通用退款入口已禁用'); + } if ($po['status'] === 'refunded') { return $po; } diff --git a/server/application/extra/site.php b/server/application/extra/site.php index c3f5480..9c704e3 100755 --- a/server/application/extra/site.php +++ b/server/application/extra/site.php @@ -4,7 +4,7 @@ return array ( 'name' => '优匠优服', 'beian' => '', 'cdnurl' => '', - 'version' => '1.0.92', + 'version' => '1.0.94', 'timezone' => 'Asia/Shanghai', 'forbiddenip' => '', 'languages' => diff --git a/server/public/assets/js/backend/appeal.js b/server/public/assets/js/backend/appeal.js index fd393c2..fbee6b0 100644 --- a/server/public/assets/js/backend/appeal.js +++ b/server/public/assets/js/backend/appeal.js @@ -40,7 +40,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', }}, {field: 'type', title: __('Type'), searchList: {"misjudge":__('Misjudge'),"review":__('Review'),"deduct":__('Deduct'),"other":__('Other'),"aftersale":'用户售后退款'}, formatter: function (val, row) { // 使用模型 type_text 追加属性,保证新增申诉类型与文案单一来源 - var text = row.type_text || val; + var text = row.type_text || '未知类型'; var clsMap = {misjudge: 'warning', review: 'info', deduct: 'danger', other: 'default', aftersale: 'danger'}; return '' + Fast.api.escape(text) + ''; }, custom: {misjudge: 'warning', review: 'info', deduct: 'danger', other: 'default', aftersale: 'danger'}}, diff --git a/server/public/assets/js/backend/invoice.js b/server/public/assets/js/backend/invoice.js index df9aafe..2b88c23 100644 --- a/server/public/assets/js/backend/invoice.js +++ b/server/public/assets/js/backend/invoice.js @@ -69,10 +69,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', var val = $(this).val(); if (val === 'reject') { $('#box-issued-fields').slideUp(150); + $('#invoice-issued-hint').hide(); + $('#invoice-reject-hint').show(); + $('#invoice-submit').text('确认驳回申请'); } else { $('#box-issued-fields').slideDown(150); + $('#invoice-issued-hint').show(); + $('#invoice-reject-hint').hide(); + $('#invoice-submit').text('确认登记开票结果'); } }); + $('#edit-form').on('reset', function () { + setTimeout(function () { + $('input[name="row[status]"]:checked').trigger('change'); + }, 0); + }); Controller.api.bindevent(); }, detail: function () { diff --git a/server/public/assets/js/backend/master.js b/server/public/assets/js/backend/master.js index 6096d41..a8d1f43 100644 --- a/server/public/assets/js/backend/master.js +++ b/server/public/assets/js/backend/master.js @@ -104,7 +104,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', } else if (val === 'reject') { return ' 已驳回'; } - return val || '-'; + return val ? '未知状态' : '-'; } }, {field: 'createtime', title: __('Createtime'), operate: 'RANGE', addclass: 'datetimerange', autocomplete: false, formatter: Table.api.formatter.datetime}, diff --git a/server/public/assets/js/backend/order.js b/server/public/assets/js/backend/order.js index da627f9..ce8db3e 100644 --- a/server/public/assets/js/backend/order.js +++ b/server/public/assets/js/backend/order.js @@ -79,7 +79,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', }}, {field: 'price_type', visible: false, title: '计价方式', operate: false, formatter: function (val) { var labels = {quote: '报价', custom: '自定', fixed: '一口价'}; - return escapeText(labels[val] || val); + return escapeText(labels[val] || '未知类型'); }}, { field: 'status', diff --git a/server/public/assets/js/backend/pay_order.js b/server/public/assets/js/backend/pay_order.js index 392c2b5..2fd8998 100644 --- a/server/public/assets/js/backend/pay_order.js +++ b/server/public/assets/js/backend/pay_order.js @@ -5,7 +5,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', // 初始化表格参数配置 Table.api.init({ extend: { - index_url: 'pay_order/index' + location.search, + index_url: (/(?:\/|^)recharges(?:\.html)?(?:\/|$)/i.test(location.pathname) ? 'pay_order/recharges' : 'pay_order/index') + location.search, detail_url: 'pay_order/detail', sync_url: 'pay_order/sync', retryrefund_url: 'pay_order/retryrefund', @@ -30,9 +30,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', return value ? '' + Fast.api.escape(value) + '' : '—'; }}, {field: 'user.nickname', title: '支付用户', operate: 'LIKE'}, - {field: 'scene', title: '业务场景', operate: '=', searchList: {'order': '订单支付', 'quote': '报价支付', 'diff': '增项补差', 'batch': '批次支付', 'recharge': '用户在线充值'}, formatter: function (value) { - var labels = {'order': '订单支付', 'quote': '报价支付', 'diff': '增项补差', 'batch': '批次支付', 'recharge': '用户在线充值'}; - return Fast.api.escape(labels[value] || value || ''); + {field: 'scene', title: '业务场景', operate: '=', searchList: {'order': '订单支付', 'quote': '报价支付', 'diff': '增项补差', 'batch': '批次支付', 'recharge': '用户在线充值', 'prepay': '预付款充值'}, formatter: function (value) { + var labels = {'order': '订单支付', 'quote': '报价支付', 'diff': '增项补差', 'batch': '批次支付', 'recharge': '用户在线充值', 'prepay': '预付款充值'}; + return Fast.api.escape(labels[value] || '未知场景'); }}, {field: 'amount', title: '实付金额', operate: false, align: 'right', formatter: function (value) { return '¥' + value + ''; @@ -48,7 +48,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', 'refund_failed': ['#b91c1c', '#fee2e2', '退款失败'], 'closed': ['#94a3b8', '#f8fafc', '已关闭'] }; - var item = map[value] || ['#64748b', '#f1f5f9', value]; + var item = map[value] || ['#64748b', '#f1f5f9', '未知状态']; var html = '' + item[2] + ''; return html; }}, @@ -104,7 +104,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', confirm: '确定对该笔流水重新发起微信原路退款吗?系统将自动退剩余可退金额并核实旧退款单状态。', visible: function (row) { var left = Number(row.amount) - Number(row.refund_amount); - return (row.status === 'refund_failed' || (row.status === 'paid' && left > 0)) && left > 0; + return row.scene !== 'recharge' && (row.status === 'refund_failed' || (row.status === 'paid' && left > 0)) && left > 0; }, success: function (data, ret) { table.bootstrapTable('refresh'); @@ -206,6 +206,9 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', }); }); }, + recharges: function () { + Controller.index(); + }, detail: function () { // 流水详情弹窗事件由 detail.html 内部原生脚本统一接管 Controller.api.bindevent(); diff --git a/server/public/assets/js/backend/wallet_log.js b/server/public/assets/js/backend/wallet_log.js index 3fc4de7..bc750c3 100644 --- a/server/public/assets/js/backend/wallet_log.js +++ b/server/public/assets/js/backend/wallet_log.js @@ -27,7 +27,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'backend/admin-table-layout', var mob = row.account_mobile ? ' (' + Fast.api.escape(row.account_mobile) + ')' : ''; return '' + Fast.api.escape(v || '-') + '' + mob; }}, - {field: 'type', title: '变动类型', searchList: {"recharge":"微信充值","consume":"余额消费","refund":"退回/退款","settle":"佣金结算","withdraw":"余额提现","income":"奖励补贴"}, formatter: Table.api.formatter.label, custom: {recharge: 'success', consume: 'warning', refund: 'info', settle: 'success', withdraw: 'primary', income: 'success'}}, + {field: 'type', title: '变动类型', searchList: {"recharge":"账户充值","consume":"余额消费","refund":"退回/退款","settle":"佣金结算","withdraw":"余额提现","income":"奖励补贴"}, formatter: Table.api.formatter.label, custom: {recharge: 'success', consume: 'warning', refund: 'info', settle: 'success', withdraw: 'primary', income: 'success'}}, {field: 'amount', title: '变动金额', operate: 'BETWEEN', formatter: function (v) { var num = Number(v || 0); if (num > 0) return '+¥' + num.toFixed(2) + ''; diff --git a/tests/recharge_refund_guard.php b/tests/recharge_refund_guard.php new file mode 100644 index 0000000..6a9fc33 --- /dev/null +++ b/tests/recharge_refund_guard.php @@ -0,0 +1,21 @@ +insertGetId([ + 'out_trade_no' => 'TEST' . bin2hex(random_bytes(10)), 'order_id' => 0, + 'order_no' => '', 'user_id' => 1, 'scene' => 'recharge', 'openid' => 'TEST', + 'amount' => '10.00', 'status' => 'pending', + ]); + try { + PaymentService::refundSinglePayOrder($id); + throw new RuntimeException('充值流水未被通用退款入口拦截'); + } catch (InvalidArgumentException $e) { + if (strpos($e->getMessage(), '充值退款') === false) throw $e; + } + echo "Recharge generic refund guard passed\n"; +} finally { Db::rollback(); }