@extends('merchant_admin.layouts.app')

@section('title', '商家订单详情')
@section('page_title', '商家订单详情')

@section('content')
<div class="card mb-20">
    <h3>订单 {{ $order->order_no }}</h3>
    <table>
        <tr><th>ID</th><td>{{ $order->id }}</td></tr>
        <tr><th>平台</th><td>{{ $order->platform }}</td></tr>
        <tr><th>订单状态</th><td>{{ $order->status }}</td></tr>
        <tr><th>支付渠道</th><td>{{ $order->payment_channel }}</td></tr>
        <tr><th>支付状态</th><td>{{ $order->payment_status }}</td></tr>
        <tr><th>买家</th><td>{{ $order->buyer_name }}</td></tr>
        <tr><th>手机</th><td>{{ $order->buyer_phone }}</td></tr>
        <tr><th>邮箱</th><td>{{ $order->buyer_email }}</td></tr>
        <tr><th>应付金额</th><td>¥{{ number_format($order->pay_amount, 2) }}</td></tr>
        <tr><th>备注</th><td>{{ $order->remark }}</td></tr>
        <tr><th>创建时间</th><td>{{ $order->created_at }}</td></tr>
    </table>
</div>

<div class="card">
    <h3>订单明细</h3>
    <table>
        <thead><tr><th>ID</th><th>商品</th><th>SKU</th><th>单价</th><th>数量</th><th>小计</th><th>快照</th></tr></thead>
        <tbody>
        @forelse($order->items as $item)
            <tr>
                <td>{{ $item->id }}</td>
                <td>{{ $item->product_title }}</td>
                <td>{{ $item->product_sku }}</td>
                <td>¥{{ number_format($item->product_price, 2) }}</td>
                <td>{{ $item->quantity }}</td>
                <td>¥{{ number_format($item->line_total_amount, 2) }}</td>
                <td>@if(!empty($item->snapshot)) 分类：{{ $item->snapshot['category'] ?? '-' }} @else - @endif</td>
            </tr>
        @empty
            <tr><td colspan="7" class="muted">暂无订单明细</td></tr>
        @endforelse
        </tbody>
    </table>
    <p class="mt-16"><a href="/merchant-admin/orders">返回订单列表</a></p>
</div>
@endsection
