文件
yjyf/server/application/admin/view/order/detail.html

590 行
37 KiB
HTML

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<style>
.order-detail-container { padding: 5px 10px; font-size: 13px; color: #334155; }
.od-hero {
background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
border: 1px solid #fed7aa;
border-radius: 12px;
padding: 18px 22px;
margin-bottom: 16px;
display: flex;
align-items: center;
justify-content: space-between;
gap: 16px;
flex-wrap: wrap;
box-shadow: 0 4px 15px -3px rgba(249, 115, 22, 0.08);
}
.od-hero-left .od-no-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.od-order-no { font-size: 19px; font-weight: 700; color: #9a3412; font-family: monospace; }
.od-status-badge {
padding: 3px 12px;
border-radius: 20px;
font-size: 12px;
font-weight: 600;
background: #ea580c;
color: #fff;
}
.od-status-badge.is-cancel { background: #64748b; }
.od-status-badge.is-aftersale { background: #dc2626; }
.od-status-badge.is-done { background: #16a34a; }
.od-hero-sub { color: #9a3412; font-size: 12.5px; }
.od-hero-right { display: flex; align-items: center; gap: 20px; text-align: right; }
.od-price-box .od-price-label { font-size: 12px; color: #9a3412; margin-bottom: 2px; }
.od-price-box .od-price-val { font-size: 26px; font-weight: 800; color: #ea580c; line-height: 1; font-variant-numeric: tabular-nums; }
.od-verify-pill { background: #ffffff; border: 1px dashed #f97316; border-radius: 8px; padding: 6px 14px; text-align: center; }
.od-verify-pill .v-label { font-size: 11px; color: #64748b; margin-bottom: 2px; }
.od-verify-pill .v-code { font-size: 16px; font-weight: 700; color: #0f172a; letter-spacing: 2px; font-family: monospace; }
.od-step-bar {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 10px;
padding: 14px 20px;
margin-bottom: 16px;
display: flex;
justify-content: space-between;
position: relative;
}
.od-step-bar::before {
content: '';
position: absolute;
top: 26px;
left: 50px;
right: 50px;
height: 2px;
background: #f1f5f9;
z-index: 1;
}
.od-step-item { position: relative; z-index: 2; text-align: center; min-width: 72px; }
.od-step-dot {
width: 26px;
height: 26px;
border-radius: 50%;
background: #e2e8f0;
color: #94a3b8;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 12px;
margin-bottom: 5px;
font-weight: 600;
}
.od-step-item.active .od-step-dot { background: #ea580c; color: #fff; box-shadow: 0 0 0 4px rgba(234, 88, 12, 0.2); }
.od-step-item.passed .od-step-dot { background: #10b981; color: #fff; }
.od-step-name { font-size: 12px; font-weight: 500; color: #475569; }
.od-step-item.active .od-step-name { color: #ea580c; font-weight: 700; }
.od-card {
background: #ffffff;
border: 1px solid #e2e8f0;
border-radius: 10px;
margin-bottom: 16px;
overflow: hidden;
}
.od-card-header {
padding: 10px 16px;
background: #f8fafc;
border-bottom: 1px solid #e2e8f0;
display: flex;
align-items: center;
justify-content: space-between;
}
.od-card-title { font-size: 13.5px; font-weight: 700; color: #1e293b; margin: 0; display: flex; align-items: center; gap: 8px; }
.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-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; }
.od-gallery-item img { width: 100%; height: 100%; object-fit: cover; cursor: pointer; }
.od-gallery-tag { position: absolute; bottom: 0; left: 0; right: 0; background: rgba(15, 23, 42, 0.72); color: #fff; font-size: 11px; text-align: center; padding: 2px 4px; }
.od-timeline { position: relative; padding-left: 20px; border-left: 2px solid #e2e8f0; margin-left: 10px; margin-top: 6px; }
.od-tl-item { position: relative; margin-bottom: 14px; }
.od-tl-item:last-child { margin-bottom: 0; }
.od-tl-item::before { content: ''; position: absolute; left: -26px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: #ea580c; border: 2px solid #fff; box-shadow: 0 0 0 2px #ea580c; }
.od-tl-time { font-size: 12px; color: #94a3b8; }
.od-tl-title { font-size: 13px; font-weight: 600; color: #1e293b; }
.od-tl-desc { font-size: 12px; color: #64748b; margin-top: 2px; }
</style>
<div class="order-detail-container">
<!-- 1. Hero 顶部看板 -->
<div class="od-hero">
<div class="od-hero-left">
<div class="od-no-wrap">
<span class="od-order-no"><i class="fa fa-file-text-o"></i> {$row.order_no|htmlentities}</span>
<span class="od-status-badge {if $row.status==9}is-cancel{elseif $row.status==10/}is-aftersale{elseif $row.status==8/}is-done{/if}">{$row.status_text}</span>
{if $row.urgent}<span class="label label-danger"><i class="fa fa-bolt"></i> 加急工单</span>{/if}
{if !empty($merchantOrder)}<span class="label label-primary"><i class="fa fa-building-o"></i> 企业工单:{$merchantOrder.merchant_name|htmlentities}</span>{/if}
</div>
<div class="od-hero-sub">
<span>下单客户: <strong>{$row.user.nickname|default=$row.user.username|default='微信用户'|htmlentities}</strong>{if !empty($row.user.mobile)} ({$row.user.mobile|htmlentities}){/if}</span>
<span style="margin: 0 8px;">|</span>
<span>下单时间: {$row.createtime|datetime}</span>
<span style="margin: 0 8px;">|</span>
<span>计价模式: {$row.price_type_text|default='一口价'}</span>
</div>
</div>
<div class="od-hero-right">
<div class="od-verify-pill">
<div class="v-label">完工核销码</div>
<div class="v-code">{$row.verify_code|default='--'}</div>
</div>
<div class="od-price-box">
<div class="od-price-label">订单实付金额</div>
<div class="od-price-val">¥{$row.pay_amount}</div>
</div>
</div>
</div>
<!-- 2. 履约步进状态条(精确兼容取消单与售后单) -->
{if $row.status == 9}
<div class="alert alert-warning" style="border-radius:10px; margin-bottom:16px;">
<i class="fa fa-ban"></i> <strong>该工单已取消终止</strong>
{if !empty($row.cancel_reason)} · 取消原因:{$row.cancel_reason|htmlentities}{/if}
{if $row.refund_amount > 0} · 已原路退款:<strong>¥{$row.refund_amount}</strong>{/if}
</div>
{elseif $row.status == 10 /}
<div class="alert alert-danger" style="border-radius:10px; margin-bottom:16px;">
<i class="fa fa-exclamation-triangle"></i> <strong>该工单当前处于售后争议处理中</strong>,请结合下方现场照片与申诉记录协同处置。
</div>
{else /}
<div class="od-step-bar">
<div class="od-step-item {if $row.status > 0}passed{elseif $row.status == 0/}active{/if}">
<div class="od-step-dot">{if $row.status > 0}<i class="fa fa-check"></i>{else/}1{/if}</div>
<div class="od-step-name">{if $row.status == 2}报价中{elseif $row.status == 1/}待接单{else/}客户下单{/if}</div>
</div>
<div class="od-step-item {if $row.status > 4}passed{elseif $row.status == 3 || $row.status == 4/}active{/if}">
<div class="od-step-dot">{if $row.status > 4}<i class="fa fa-check"></i>{else/}2{/if}</div>
<div class="od-step-name">师傅接单/待上门</div>
</div>
<div class="od-step-item {if $row.status > 5}passed{elseif $row.status == 5/}active{/if}">
<div class="od-step-dot">{if $row.status > 5}<i class="fa fa-check"></i>{else/}3{/if}</div>
<div class="od-step-name">上门签到</div>
</div>
<div class="od-step-item {if $row.status > 6}passed{elseif $row.status == 6/}active{/if}">
<div class="od-step-dot">{if $row.status > 6}<i class="fa fa-check"></i>{else/}4{/if}</div>
<div class="od-step-name">施工服务中</div>
</div>
<div class="od-step-item {if $row.status > 7}passed{elseif $row.status == 7/}active{/if}">
<div class="od-step-dot">{if $row.status > 7}<i class="fa fa-check"></i>{else/}5{/if}</div>
<div class="od-step-name">待核销验收</div>
</div>
<div class="od-step-item {if $row.status == 8}passed active{/if}">
<div class="od-step-dot">{if $row.status == 8}<i class="fa fa-check"></i>{else/}6{/if}</div>
<div class="od-step-name">已完成结算</div>
</div>
</div>
{/if}
<!-- 3. 主体卡片区 -->
<div class="row">
<!-- 卡片 A: 工项、物流与上门信息 -->
<div class="col-xs-12 col-sm-6">
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-wrench"></i> 服务项目、到货物流与上门地址</h4>
</div>
<div class="od-card-body">
<div class="od-grid-list">
<div class="od-item"><span class="od-item-k">服务名称:</span><span class="od-item-v"><strong>{$row.service_name|htmlentities}</strong></span></div>
<div class="od-item">
<span class="od-item-k">预约上门:</span>
<span class="od-item-v" style="color:#ea580c; font-weight:700;">
{if $row.appoint_time > 0}{$row.appoint_time|datetime}{else/}未指定(尽快上门){/if}
</span>
</div>
<div class="od-item"><span class="od-item-k">现场联系人:</span><span class="od-item-v">{$row.contact|htmlentities}</span></div>
<div class="od-item"><span class="od-item-k">联系电话:</span><span class="od-item-v"><strong>{$row.mobile|htmlentities}</strong></span></div>
<div class="od-item" style="grid-column: span 2;"><span class="od-item-k">上门地址:</span><span class="od-item-v">{$row.province|htmlentities}{$row.city|htmlentities}{$row.district|htmlentities}{$row.address|htmlentities}</span></div>
<div class="od-item"><span class="od-item-k">楼层电梯:</span><span class="od-item-v">{$row.floor} 层 · {if $row.has_elevator}有电梯{else/}无电梯(步梯){/if}</span></div>
<div class="od-item"><span class="od-item-k">施工规格:</span><span class="od-item-v">{$row.goods_model|default='标准通用款'|htmlentities} × {$row.goods_num}</span></div>
<div class="od-item">
<span class="od-item-k">货品到货:</span>
<span class="od-item-v">
{if $row.goods_arrived == 1}<span class="label label-success">已到货可装</span>{else/}<span class="label label-default">物流在途/未登记</span>{/if}
</span>
</div>
<div class="od-item">
<span class="od-item-k">物流单号:</span>
<span class="od-item-v">
{if !empty($row.express_no)}{$row.express_company|default='物流'|htmlentities} <code>{$row.express_no|htmlentities}</code>{else/}<span class="text-muted">无</span>{/if}
</span>
</div>
{if !empty($merchantOrder)}
<div class="od-item" style="grid-column: span 2;">
<span class="od-item-k">发包商户:</span>
<span class="od-item-v">
{$merchantOrder.merchant_name|htmlentities}(对接人:{$merchantOrder.merchant_contact|htmlentities} {$merchantOrder.merchant_mobile|htmlentities})
{if !empty($merchantOrder.batch_no)} · 批次 <code>{$merchantOrder.batch_no|htmlentities}</code>{/if}
{if !empty($row.source_order_no)} · 外部单号 <code>{$row.source_order_no|htmlentities}</code>{/if}
</span>
</div>
{/if}
{if !empty($row.remark)}
<div class="od-item" style="grid-column: span 2;"><span class="od-item-k">客户备注:</span><span class="od-item-v" style="color:#d97706;">{$row.remark|htmlentities}</span></div>
{/if}
</div>
{if !empty($goodsList)}
<div style="margin-top: 14px; border-top: 1px dashed #e2e8f0; padding-top: 12px;">
<div style="font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 8px;">多商品及增项服务清单:</div>
<table class="table table-bordered table-condensed" style="margin-bottom: 0; font-size: 12px;">
<thead><tr class="active"><th>商品名称</th><th>规格型号</th><th>数量</th><th>加选增项</th><th>单价</th></tr></thead>
<tbody>
{foreach name="goodsList" item="g"}
<tr>
<td><strong>{$g.goods_name|default='-'|htmlentities}</strong></td>
<td>{$g.goods_model|default='-'|htmlentities}</td>
<td>{$g.goods_num}</td>
<td>{$g.addon_services|default='无'|htmlentities}</td>
<td>¥{$g.base_price}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{/if}
</div>
</div>
</div>
<!-- 卡片 B: 接单师傅画像与履约节点 -->
<div class="col-xs-12 col-sm-6">
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-user-circle"></i> 承接师傅与关键履约时间轴</h4>
</div>
<div class="od-card-body">
{if $row.master_id && $row.master}
<div style="display:flex; align-items:center; gap:14px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 1px solid #f1f5f9;">
<img src="{$row.master.avatar|default='/assets/img/avatar.png'|htmlentities}" onerror="this.src='/assets/img/avatar.png'" style="width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid #fed7aa;" />
<div>
<div style="font-size: 15px; font-weight: 700; color: #1e293b; display:flex; align-items:center; gap:8px;">
<span>{$row.master.realname|htmlentities}</span>
<span class="badge" style="background:#ea580c; font-weight:normal;"><i class="fa fa-star"></i> {$row.master.score}</span>
</div>
<div style="font-size: 12px; color: #64748b; margin-top: 3px;">
手机: <strong>{$row.master.mobile|htmlentities}</strong> · 城市: {$row.master.city|default='-'|htmlentities} · 累计完工: {$row.master.order_count} 单
</div>
</div>
</div>
{else /}
<div class="alert alert-warning" style="margin-bottom: 14px; padding: 10px 14px;">
<i class="fa fa-info-circle"></i> 当前工单尚未指派师傅,可在订单列表点击「派单」人工调度指派。
</div>
{/if}
<div class="od-grid-list">
<div class="od-item"><span class="od-item-k">接单时间:</span><span class="od-item-v">{:$row.accept_time > 0 ? datetime($row.accept_time) : '未接单'}</span></div>
<div class="od-item"><span class="od-item-k">电话预约:</span><span class="od-item-v">{:$row.contact_time > 0 ? datetime($row.contact_time) : '未记录'}</span></div>
<div class="od-item"><span class="od-item-k">签到到达:</span><span class="od-item-v">{:$row.arrive_time > 0 ? datetime($row.arrive_time) : '未到达'}</span></div>
<div class="od-item"><span class="od-item-k">开工施工:</span><span class="od-item-v">{:$row.start_time > 0 ? datetime($row.start_time) : '未开工'}</span></div>
<div class="od-item"><span class="od-item-k">完工提交:</span><span class="od-item-v">{:$row.finish_time > 0 ? datetime($row.finish_time) : '未完工'}</span></div>
<div class="od-item"><span class="od-item-k">核销验收:</span><span class="od-item-v">{if $row.verify_time > 0}<span class="text-success">{:datetime($row.verify_time)}</span>{else/}<span class="label label-default">待核销</span>{/if}</span></div>
</div>
</div>
</div>
</div>
</div>
<!-- 师傅竞标报价记录(针对报价单或有报价记录的工单) -->
{if !empty($quoteList)}
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-gavel"></i> 师傅竞标报价记录 ({:count($quoteList)})</h4>
</div>
<div class="od-card-body" style="padding: 12px 16px;">
<table class="table table-bordered table-hover table-condensed" style="margin-bottom:0; font-size:12px;">
<thead>
<tr class="active">
<th>报价师傅</th>
<th>联系电话</th>
<th>服务评分</th>
<th>报价金额</th>
<th>施工方案与报价说明</th>
<th>状态</th>
<th>报价时间</th>
</tr>
</thead>
<tbody>
{foreach name="quoteList" item="qt"}
<tr>
<td><strong>{$qt.master_name|default='-'|htmlentities}</strong></td>
<td>{$qt.master_mobile|default='-'|htmlentities}</td>
<td><span style="color:#d97706;"><i class="fa fa-star"></i> {$qt.master_score|default='5.0'}</span></td>
<td><strong style="color:#ea580c;">¥{$qt.amount}</strong></td>
<td>{$qt.description|default='-'|htmlentities}</td>
<td>
{if $qt.status == 'accept'}<span class="label label-success">已中标采纳</span>
{elseif $qt.status == 'reject'/}<span class="label label-default">未中标</span>
{else/}<span class="label label-warning">待雇主确认</span>{/if}
</td>
<td>{$qt.createtime|datetime}</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
</div>
{/if}
<div class="row">
<!-- 卡片 C: 资金流转与开票结算 -->
<div class="col-xs-12 col-sm-6">
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-cny"></i> 资金构成、结算分成与发票状态</h4>
</div>
<div class="od-card-body">
<div class="od-grid-list">
<div class="od-item"><span class="od-item-k">基础服务费:</span><span class="od-item-v">¥{$row.base_amount}</span></div>
<div class="od-item"><span class="od-item-k">步梯楼层费:</span><span class="od-item-v">¥{$row.floor_amount}</span></div>
<div class="od-item"><span class="od-item-k">远程/加急费:</span><span class="od-item-v">¥{:number_format($row.distance_amount + $row.urgent_amount, 2, '.', '')}</span></div>
<div class="od-item"><span class="od-item-k">优惠券抵扣:</span><span class="od-item-v" style="color:#16a34a;">-¥{$row.discount_amount}</span></div>
<div class="od-item">
<span class="od-item-k">现场补差价:</span>
<span class="od-item-v">
{if $row.diff_amount > 0}
¥{$row.diff_amount}
{if $row.diff_status == 2}<span class="label label-success">已支付</span>{else/}<span class="label label-warning">待支付</span>{/if}
{else/}无{/if}
</span>
</div>
<div class="od-item"><span class="od-item-k">实付总金额:</span><span class="od-item-v" style="color:#ea580c; font-size:15px; font-weight:700;">¥{$row.pay_amount}</span></div>
</div>
<div style="margin-top: 14px; padding-top: 12px; border-top: 1px dashed #e2e8f0;">
<div class="od-grid-list">
<div class="od-item"><span class="od-item-k">支付状态:</span><span class="od-item-v"><span class="label {if $row.pay_status==1}label-success{elseif $row.pay_status==2/}label-danger{else/}label-default{/if}">{$row.pay_status_text}</span></span></div>
<div class="od-item"><span class="od-item-k">支付渠道:</span><span class="od-item-v">{$row.pay_type|default='微信支付'|htmlentities}</span></div>
<div class="od-item" style="grid-column: span 2;"><span class="od-item-k">交易流水号:</span><span class="od-item-v"><code>{$row.transaction_id|default='-'|htmlentities}</code></span></div>
<div class="od-item"><span class="od-item-k">抽佣规则快照:</span><span class="od-item-v"><span class="label label-info">{if !empty($settle)}{$settle.commission_rate|htmlentities}%{else/}{$settlePreview.commission_rate|default='10.00'|htmlentities}%{/if}</span> <small class="text-muted">{$settlePreview.rule_name|default=''|htmlentities}</small></span></div>
<div class="od-item"><span class="od-item-k">结算状态:</span><span class="od-item-v">{$row.settle_status_text}</span></div>
<div class="od-item" style="grid-column: span 2;"><span class="od-item-k">师傅结算款:</span><span class="od-item-v" style="color:#10b981; font-weight:700;">{if !empty($settle)}¥{$settle.settle_amount}(平台抽佣 ¥{$settle.commission}){elseif $row.settle_status == 1/}¥{$row.settle_amount}{else/}预计 ¥{:number_format($settlePreview.settle_amount, 2, '.', '')}(预计抽佣 ¥{:number_format($settlePreview.commission, 2, '.', '')}){/if}</span></div>
<div class="od-item" style="grid-column: span 2;">
<span class="od-item-k">发票状态:</span>
<span class="od-item-v">
{if $row.invoice_status == 'issued'}
<span class="label label-success">已开票</span>
{if !empty($invoiceInfo)} 申请单 <code>{$invoiceInfo.invoice_sn|htmlentities}</code>({$invoiceInfo.title|htmlentities}){/if}
{elseif $row.invoice_status == 'wait' /}
<span class="label label-warning">开票审核中</span>
{if !empty($invoiceInfo)} 申请单 <code>{$invoiceInfo.invoice_sn|htmlentities}</code>{/if}
{else /}
<span class="text-muted">未申请开票</span>
{/if}
</span>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- 卡片 D: 服务评价与申诉争议 -->
<div class="col-xs-12 col-sm-6">
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-star"></i> 雇主评价与售后记录</h4>
</div>
<div class="od-card-body">
{if !empty($review)}
<div style="margin-bottom: 10px;">
<span style="font-size: 15px; color: #f59e0b;">
<?php for($i=0; $i<(int)$review['score']; $i++): ?><i class="fa fa-star" style="margin-right:2px;"></i><?php endfor; ?>
</span>
<span style="font-size: 13px; font-weight: 700; color: #b45309; margin-left: 6px;">{$review.score} 星评价</span>
{if $review.status == 'hidden'}<span class="label label-default" style="margin-left:6px;">已隐藏</span>{/if}
{if !empty($review.tags_arr)}
<div style="margin-top: 6px;">
{foreach name="review.tags_arr" item="t"}
<span class="label label-default" style="margin-right: 4px; background:#f1f5f9; color:#334155;">{$t|htmlentities}</span>
{/foreach}
</div>
{/if}
</div>
<div style="background: #f8fafc; border-radius: 8px; padding: 10px 12px; font-size: 13px; color: #1e293b; margin-bottom: 8px;">
<strong>雇主评价:</strong>{$review.content|default='用户未填写文字评价'|htmlentities}
</div>
{if !empty($review.reply)}
<div style="background: #fff7ed; border-radius: 8px; padding: 8px 12px; font-size: 12px; color: #9a3412;">
<strong>师傅回复:</strong>{$review.reply|htmlentities}
</div>
{/if}
{else /}
<div style="text-align: center; padding: 22px 0; color: #94a3b8;">
<i class="fa fa-comment-o" style="font-size: 26px; margin-bottom: 6px;"></i>
<div>客户暂未提交服务评价</div>
</div>
{/if}
{if !empty($appealList)}
<div style="margin-top: 12px; padding-top: 10px; border-top: 1px dashed #fecaca;">
<div style="font-size: 12px; font-weight: 700; color: #dc2626; margin-bottom: 6px;"><i class="fa fa-shield"></i> 关联申诉争议记录:</div>
{foreach name="appealList" item="ap"}
<div style="background:#fef2f2; border:1px solid #fecaca; border-radius:6px; padding:8px 10px; font-size:12px; margin-bottom:6px;">
<div><strong>师傅:</strong>{$ap.master_name|default='-'|htmlentities} · <strong>状态:</strong>{$ap.status|htmlentities}</div>
<div style="margin-top:2px;"><strong>申诉理由:</strong>{$ap.content|htmlentities}</div>
{if !empty($ap.reply)}<div style="margin-top:2px;color:#15803d;"><strong>平台裁决:</strong>{$ap.reply|htmlentities}</div>{/if}
</div>
{/foreach}
</div>
{/if}
</div>
</div>
</div>
</div>
<!-- 3.5 微信支付与原路退款交易流水诊断 -->
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-wechat"></i> 微信支付与原路退款交易流水 ({:count($payOrders)})</h4>
<span class="text-muted" style="font-size:12px;">展示网关真实回执、异常中文诊断与人工同步/重退入口</span>
</div>
<div class="od-card-body">
{if !empty($payOrders)}
<div class="table-responsive">
<table class="table table-bordered table-condensed" style="margin-bottom:0; font-size:12.5px;">
<thead>
<tr style="background:#f8fafc;">
<th style="width:55px;">ID</th>
<th style="width:105px;">支付场景</th>
<th>商户单号 / 微信单号 / 退款单号</th>
<th style="width:90px;">金额</th>
<th style="width:130px;">流水 / 退款状态</th>
<th>失败错误码与中文诊断</th>
<th style="width:140px;">操作</th>
</tr>
</thead>
<tbody>
{foreach name="payOrders" item="po"}
<tr>
<td>#{$po.id}</td>
<td>{$po.scene_text|htmlentities}</td>
<td>
<div>商户:<code>{$po.out_trade_no|htmlentities}</code></div>
{if !empty($po.transaction_id)}<div style="margin-top:2px;">微信:<code>{$po.transaction_id|htmlentities}</code></div>{/if}
{if !empty($po.refund_no)}<div style="margin-top:2px;">退款单:<code>{$po.refund_no|htmlentities}</code>{if !empty($po.refund_id)}({$po.refund_id|htmlentities}){/if}</div>{/if}
</td>
<td>
<div style="font-weight:700; color:#ea580c;">¥{$po.amount|number_format=2}</div>
{if $po.refund_amount > 0}<div style="font-size:11px; color:#64748b;">退 ¥{$po.refund_amount|number_format=2}</div>{/if}
</td>
<td>
{if $po.status == 'paid'}<span class="label label-success">{$po.status_text}</span>
{elseif $po.status == 'refunded'/}<span class="label label-info">{$po.status_text}</span>
{elseif $po.status == 'refunding'/}<span class="label label-warning">{$po.status_text}</span>
{elseif $po.status == 'pay_failed' || $po.status == 'refund_failed'/}<span class="label label-danger">{$po.status_text}</span>
{else/}<span class="label label-default">{$po.status_text}</span>{/if}
{if $po.refund_status && $po.refund_status != 'none'}
<div style="margin-top:4px; font-size:11px; color:#475569;">{$po.refund_status_text}</div>
{/if}
{if !empty($po.last_sync_time)}
<div style="margin-top:2px; font-size:11px; color:#94a3b8;">同步于 {:date('m-d H:i:s', $po.last_sync_time)}</div>
{/if}
</td>
<td>
{if !empty($po.fail_reason) || !empty($po.fail_code)}
<div style="background:#fef2f2; border:1px solid #fecaca; color:#b91c1c; border-radius:6px; padding:6px 8px; line-height:1.5;">
{if !empty($po.fail_code)}<div><strong>错误码:</strong><code>{$po.fail_code|htmlentities}</code></div>{/if}
<div><strong>原因:</strong>{$po.fail_reason|default='未知异常'|htmlentities}</div>
</div>
{else /}
<span class="text-muted">-</span>
{/if}
</td>
<td>
{if $po.status == 'pending' || $po.status == 'pay_failed' || $po.status == 'refunding' || $po.status == 'refund_failed'}
<button type="button" class="btn btn-xs btn-warning js-sync-pay-order" data-id="{$po.id}" style="margin-bottom:4px;">
<i class="fa fa-refresh"></i> 同步微信状态
</button>
{/if}
{if $po.status == 'refund_failed' || ($po.status == 'paid' && $row.status == 9 && $row.settle_status != 1)}
<button type="button" class="btn btn-xs btn-danger js-retry-refund" data-id="{$po.id}" data-outno="{$po.out_trade_no|htmlentities}">
<i class="fa fa-undo"></i> 重试原路退款
</button>
{/if}
{if $po.status == 'refunded' || $po.status == 'closed' || ($po.status == 'paid' && ($row.status != 9 || $row.settle_status == 1))}
<span class="text-muted" style="font-size:11px;">无需人工处置</span>
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
</div>
{elseif $row.pay_status == 1 && ($row.pay_type == 'wechat' || $row.pay_type == '')/}
<div style="background:#fef2f2; border:1px solid #fecaca; color:#b91c1c; border-radius:6px; padding:10px 12px;">
<i class="fa fa-exclamation-triangle"></i> <strong>资金流水缺失告警:</strong>当前订单显示已支付(渠道:{$row.pay_type|default='未记录'|htmlentities}),但未关联任何 <code>fa_pay_order</code> 微信交易单,系统已禁止自动假退款,如需退款请先核查微信商户平台流水。
</div>
{else /}
<div class="text-muted" style="padding:8px 0;">暂无微信支付交易流水记录</div>
{/if}
</div>
</div>
<!-- 4. 现场施工取证照片画廊 -->
<div class="od-card">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-camera"></i> 现场施工与验收取证图集 ({:count($mediaList)})</h4>
<span class="text-muted" style="font-size:12px;"><i class="fa fa-search-plus"></i> 点击图片查看原图</span>
</div>
<div class="od-card-body">
{if !empty($mediaList)}
<div class="od-gallery-grid">
{foreach name="mediaList" item="m"}
<div class="od-gallery-item">
<a href="{$m.url|htmlentities}" target="_blank">
<img src="{$m.url|htmlentities}" onerror="this.src='/assets/img/qrcode.png'" />
</a>
<div class="od-gallery-tag">
{if $m.stage=='arrive'}上门签到
{elseif $m.stage=='work' || $m.stage=='process'/}施工过程
{elseif $m.stage=='finish'/}完工验收
{elseif $m.stage=='damage'/}异常报损
{else/}现场取证{/if}
</div>
</div>
{/foreach}
</div>
{else /}
<div style="text-align: center; padding: 16px 0; color: #94a3b8;">暂无现场施工取证照片</div>
{/if}
</div>
</div>
<!-- 5. 完整操作日志时间轴 -->
<div class="od-card" style="margin-bottom:0;">
<div class="od-card-header">
<h4 class="od-card-title"><i class="fa fa-history"></i> 工单全生命周期操作日志 ({:count($logList)})</h4>
</div>
<div class="od-card-body">
{if !empty($logList)}
<div class="od-timeline">
{foreach name="logList" item="log"}
<div class="od-tl-item">
<div class="od-tl-time">{$log.createtime|datetime} · 操作端:{$log.operator_type|default='system'|htmlentities}</div>
<div class="od-tl-title">{$log.status_label|htmlentities}</div>
<div class="od-tl-desc">{$log.remark|htmlentities}</div>
</div>
{/foreach}
</div>
{else /}
<div style="text-align: center; padding: 16px 0; color: #94a3b8;">暂无状态流转日志</div>
{/if}
</div>
</div>
<div class="form-group layer-footer">
<label class="control-label col-xs-12 col-sm-2"></label>
<div class="col-xs-12 col-sm-8">
<button type="button" class="btn btn-primary btn-embossed" onclick="parent.Layer.closeAll();"><i class="fa fa-check"></i> 关闭看板</button>
</div>
</div>
</div>