diff --git a/server/application/admin/controller/Order.php b/server/application/admin/controller/Order.php index 18d41fa..1394b60 100644 --- a/server/application/admin/controller/Order.php +++ b/server/application/admin/controller/Order.php @@ -3,6 +3,7 @@ namespace app\admin\controller; use app\common\controller\Backend; +use app\common\library\OrderDetailDisplay; use app\common\library\CommissionService; use app\common\library\OrderStatus; use think\Db; @@ -584,7 +585,14 @@ class Order extends Backend } // 1. 多商品/多工项明细 - $goodsList = Db::name('order_goods')->where('order_id', $row['id'])->select(); + $goodsList = Db::name('order_goods')->where('order_id', $row['id'])->order('id asc')->select(); + $goodsPayload = json_decode((string)$row['goods_images'], true); + $goodsSnapshots = is_array($goodsPayload) && isset($goodsPayload['goods_list']) && is_array($goodsPayload['goods_list']) ? $goodsPayload['goods_list'] : []; + foreach ($goodsList as $index => &$goods) { + $snapshot = isset($goodsSnapshots[$index]) && is_array($goodsSnapshots[$index]) ? $goodsSnapshots[$index] : []; + $goods['service_text'] = OrderDetailDisplay::services($goods['addon_services'] ?? '', $snapshot); + } + unset($goods); // 2. 现场施工取证图片 (区分签到、过程、完工、报损) $mediaList = Db::name('order_media')->where('order_id', $row['id'])->order('id asc')->select(); @@ -594,6 +602,7 @@ class Order extends Backend $logList = Db::name('order_log')->where('order_id', $row['id'])->order('createtime asc, id asc')->select(); foreach ($logList as &$lg) { $lg['status_label'] = isset($statusMap[(int)$lg['status']]) ? $statusMap[(int)$lg['status']] : '状态变更'; + $lg['operator_label'] = OrderDetailDisplay::operator($lg['operator_type'] ?? ''); } unset($lg); @@ -605,6 +614,10 @@ class Order extends Backend ->where('q.order_id', $row['id']) ->order('q.id desc') ->select(); + foreach ($quoteList as &$quote) { + $quote['display_status'] = OrderDetailDisplay::quoteStatus($quote['status'] ?? ''); + } + unset($quote); // 5. 客户评价与回复(兼容 JSON 数组或逗号分隔标签) $review = Db::name('review')->where('order_id', $row['id'])->find(); @@ -650,6 +663,11 @@ class Order extends Backend ->field('a.*, m.realname as master_name') ->order('a.id desc') ->select(); + $appealStatus = ['wait' => '待处理', 'handling' => '处理中', 'done' => '已处理', 'reject' => '已驳回']; + foreach ($appealList as &$appeal) { + $appeal['display_status'] = $appealStatus[$appeal['status']] ?? '未知状态'; + } + unset($appeal); // 10. 微信支付与原路退款交易流水(含失败错误码及中文诊断原因) $sceneMap = [ @@ -666,11 +684,20 @@ class Order extends Backend $poItem['scene_text'] = $sceneMap[$poItem['scene'] ?? ''] ?? ($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); + $poItem['is_balance'] = $poItem['payment_type_text'] === '余额支付'; } unset($poItem); + $payGroups = OrderDetailDisplay::groupPaymentRecords($payOrders); + $paySections = [ + ['type' => 'settled', 'items' => $payGroups['settled']], + ['type' => 'attempts', 'items' => $payGroups['attempts']], + ]; $this->view->assign([ 'row' => $row, + 'amountLabel' => OrderDetailDisplay::amountLabel($row->toArray()), + 'paymentTypeLabel' => OrderDetailDisplay::paymentType($row['pay_type'] ?? ''), 'goodsList' => $goodsList, 'mediaList' => $mediaList, 'logList' => $logList, @@ -682,6 +709,8 @@ class Order extends Backend 'invoiceInfo' => $invoiceInfo, 'appealList' => $appealList, 'payOrders' => $payOrders, + 'payGroups' => $payGroups, + 'paySections' => $paySections, ]); return $this->view->fetch(); diff --git a/server/application/admin/view/order/detail.html b/server/application/admin/view/order/detail.html index a86cd3a..7fb93ca 100644 --- a/server/application/admin/view/order/detail.html +++ b/server/application/admin/view/order/detail.html @@ -92,10 +92,38 @@ .od-card-title i { color: #f97316; } .od-card-body { padding: 16px; } - .od-grid-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; } - .od-item { display: flex; align-items: baseline; font-size: 13px; line-height: 1.5; } - .od-item-k { min-width: 84px; color: #64748b; flex-shrink: 0; } - .od-item-v { color: #0f172a; font-weight: 500; word-break: break-all; } + .od-grid-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; } + .od-item { display: flex; align-items: baseline; min-width: 0; font-size: 13px; line-height: 1.5; } + .od-item-k { min-width: 70px; padding-right: 8px; color: #64748b; flex-shrink: 0; white-space: nowrap; } + .od-item-v { min-width: 0; color: #0f172a; font-weight: 500; overflow-wrap: anywhere; } + .od-item-v.od-datetime { white-space: nowrap; } + .od-table-scroll { overflow-x: auto; } + .od-table-scroll .table { width: 100%; } + .od-table-scroll .table th, .od-table-scroll .table td { padding: 6px 8px; } + .od-table-scroll .table td { white-space: nowrap; } + .order-detail-container .table th { white-space: nowrap; } + .od-pay-scroll { overflow-x: auto; } + .od-pay-table { width: 100%; min-width: 820px; table-layout: fixed; } + .order-detail-container .od-pay-table > thead > tr > th, + .order-detail-container .od-pay-table > tbody > tr > td { padding: 9px 8px; vertical-align: top; } + .od-pay-table .od-pay-id { width: 48px; } + .od-pay-table .od-pay-scene { width: 92px; white-space: nowrap; } + .od-pay-table .od-pay-number { width: 210px; overflow-wrap: anywhere; } + .od-pay-table .od-pay-amount { width: 80px; white-space: nowrap; } + .od-pay-table .od-pay-status { width: 100px; } + .od-pay-table .od-pay-action { width: 130px; } + .od-pay-table code { white-space: normal; overflow-wrap: anywhere; } + .od-pay-note { border-radius: 6px; padding: 6px 8px; line-height: 1.5; background: #f8fafc; border: 1px solid #e2e8f0; color: #475569; overflow-wrap: anywhere; } + .od-pay-note.is-error { background: #fef2f2; border-color: #fecaca; color: #b91c1c; } + .od-pay-attempts { margin-top: 14px; border: 1px solid #e2e8f0; border-radius: 8px; } + .od-pay-attempts > summary { padding: 10px 12px; cursor: pointer; color: #334155; font-weight: 600; } + .od-pay-attempts > summary:focus-visible { outline: 2px solid #ea580c; outline-offset: 2px; } + .od-pay-attempts .od-pay-scroll { padding: 0 10px 10px; } + .od-pay-warning { color: #b45309; font-weight: 500; margin-left: 8px; } + @media (max-width: 520px) { + .od-grid-list { grid-template-columns: minmax(0, 1fr); } + .od-grid-list .od-item { grid-column: auto !important; } + } .od-gallery-grid { display: flex; flex-wrap: wrap; gap: 12px; } .od-gallery-item { position: relative; width: 108px; height: 108px; border-radius: 8px; overflow: hidden; border: 1px solid #e2e8f0; background: #f8fafc; } @@ -135,7 +163,7 @@
| 商品名称 | 规格型号 | 数量 | 加选增项 | 单价 |
|---|---|---|---|---|
| {$g.goods_name|default='-'|htmlentities} | -{$g.goods_model|default='-'|htmlentities} | -{$g.goods_num} | -{$g.addon_services|default='无'|htmlentities} | -¥{$g.base_price} | -
| 商品 | 规格 | 数量 | 服务项目 | 单价 |
|---|---|---|---|---|
| {$g.goods_name|default='-'|htmlentities} | +{$g.goods_model|default='-'|htmlentities} | +{$g.goods_num} | +{$g.service_text|default='未记录'|htmlentities} | +¥{$g.base_price} | +
| 联系电话 | 服务评分 | 报价金额 | -施工方案与报价说明 | +报价说明 | 状态 | 报价时间 | @@ -320,9 +354,7 @@¥{$qt.amount} | {$qt.description|default='-'|htmlentities} | - {if $qt.status == 'accept'}已中标采纳 - {elseif $qt.status == 'reject'/}未中标 - {else/}待雇主确认{/if} + {$qt.display_status|htmlentities} | {$qt.createtime|datetime} | @@ -338,13 +370,14 @@
|---|
| ID | -支付场景 | -商户单号 / 微信单号 / 退款单号 | -金额 | -流水 / 退款状态 | -失败错误码与中文诊断 | -操作 | +ID | +支付场景 | +交易单号 | +金额 | +交易状态 | +状态说明 | +操作 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| #{$po.id} | -{$po.scene_text|htmlentities} | -+ | {$po.scene_text|htmlentities} {$po.payment_type_text|htmlentities} |
+
商户:
- {if !empty($po.transaction_id)}{$po.out_trade_no|htmlentities}微信: {/if}
+ {if !empty($po.transaction_id) && !$po.is_balance}{$po.transaction_id|htmlentities}微信: {/if}
{if !empty($po.refund_no)}{$po.transaction_id|htmlentities}退款单: {/if}
{$po.refund_no|htmlentities}{if !empty($po.refund_id)}({$po.refund_id|htmlentities}){/if} |
@@ -490,16 +531,16 @@ |
{if !empty($po.fail_reason) || !empty($po.fail_code)}
-
- {if !empty($po.fail_code)} 错误码: {/if}
- {$po.fail_code|htmlentities}原因:{$po.fail_reason|default='未知异常'|htmlentities}
+
+ {if !empty($po.fail_reason)}
{else /}
-
{/if}
{$po.fail_reason|htmlentities} {/if}
+ {if !empty($po.fail_code)}代码: {/if}
{$po.fail_code|htmlentities} |
- {if $po.status == 'pending' || $po.status == 'pay_failed' || $po.status == 'refunding' || $po.status == 'refund_failed'} + {if !$po.is_balance && ($po.status == 'pending' || $po.status == 'pay_failed' || $po.status == 'refunding' || $po.status == 'refund_failed')} @@ -518,9 +559,12 @@ |
fa_pay_order 微信交易单,系统已禁止自动假退款,如需退款请先核查微信商户平台流水。
+ 缺少支付记录:订单显示已支付,但未找到对应的微信支付记录。如需退款,请先核查微信商户平台流水。