<div class="box box-info" style="padding-bottom:20px;">
    <div class="box-header with-border">
        <h3 class="box-title">订单编号：{{ $order->order_no }}</h3>
        <div class="box-tools">
            <div class="btn-group pull-right" style="margin-right: 5px">
                <a href="?_={{ time() }}" class="btn btn-sm btn-primary" title="">
                    <i class="fa fa-refresh"></i><span class="hidden-xs"> 刷新</span>
                </a>
            </div>
            <div class="btn-group pull-right" style="margin-right: 5px">
                <a href="{{ url()->previous()}}" class="btn btn-sm btn-default" title="返回订单列表">
                    <i class="fa fa-list"></i><span class="hidden-xs"> 返回订单列表</span>
                </a>
            </div>
        </div>
    </div>

    <style type="text/css" media="screen">
        .step {
            width: 60%;
            margin: 20px 20%;
            border-bottom: 5px solid #00c0ef;
            border-radius: 0 0 5px 5px;
        }

        .step ul {
            display: flex;
            list-style-type: none;
            margin: 0;
            padding: 0;
        }

        .step ul li {
            display: block;
            flex: 1;
            margin: 0;
            text-align: center;
            line-height: 40px;
        }

        .act {
            border-radius: 5px 5px 0 0;
            color: #fff;
            background: #00c0ef;
        }
    </style>

    <div class="step">
        <ul>
            @foreach(\Modules\Mall\Models\Order::STATUS_MAP as $key=>$status)
                <li @if($order->state==$key) class="act" @endif>{{ $status }}</li>
            @endforeach
        </ul>
    </div>

    <div class="row" style="padding: 0 20px">
        <div class="col-md-12">
            <div class="box box-warning box-solid">
                <div class="box-header with-border">
                    <h3 class="box-title">订单信息</h3>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th width="100">订单信息</th>
                            <th>购买人</th>
                            <th>收货信息</th>
                            <th>费用信息</th>
                            <th>订单状态</th>
                            <th>支付渠道</th>
                            <th>支付时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>{{ $order->order_no }}</td>
                            <td>{{ $order->user->info->nickname }}</td>
                            <td>
                                @if ($order->express)
                                    <p>收件人：{{$order->express->name}}</p>
                                    <p>电话：{{$order->express->mobile}}</p>
                                    <p>地址：{{$order->express->getFullAddress()}}</p>

                                @endif
                            </td>
                            <td>
                                <p>商品总额：￥ {{$order->amount}}元</p>
                                <p>订单总额：￥ {{$order->total}}元</p>
                                <p>说明： {{$order->remark}}</p>

                                <p style="color:#b12704;font-weight: bold">运费：￥ {{$order->freight}}元</p>
                                <p style="color:#b12704;font-weight: bold"></p>
                                <p style="color:#b12704;font-weight: bold">
                                    支付总额： ￥ {{$order->total}}元
                                </p>

                            </td>
                            <td>{{ $order->state_text }}</td>
                            <td>{{ $order->payment->driver_text ?? '---' }}</td>
                            <td>{{ $order->paid_at }}</td>

                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

    <div class="row" style="padding: 0 20px">
        <div class="col-md-12">
            <div class="box box-warning box-solid">
                <div class="box-header with-border">
                    <h3 class="box-title">商品信息</h3>
                </div>
                <div class="box-body table-responsive">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th>id</th>
                            <th>商品名称</th>
                            {{--                            <th>属性</th>--}}
                            <th>数量</th>
                            <th>单价</th>
                            {{--                            <th>水晶</th>--}}
                            {{--                            <th>退款/退货</th>--}}
                        </tr>
                        </thead>
                        <tbody>
                        @foreach ($order->items as $item)
                            <tr>
                                <td>{{ $item->id }}</td>
                                <td>{{ $item->source['goods_name'] }}</td>
                                {{--                                <td>{{ $item->source['unit']??'---' }}</td>--}}
                                <td>{{ $item->qty }}</td>
                                <td>{{ $item->price }}</td>
                                {{--                                <td>{{ $item->source['score'] }}</td>--}}
                                {{--                                <td>{{ $item->isRefund()?'是':'否' }}</td>--}}
                            </tr>
                        @endforeach

                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
    @if ($order->express)
        <div class="row" style="padding: 0 20px">
            <div class="col-md-12">
                <div class="box box-warning box-solid">
                    <div class="box-header with-border">
                        <h3 class="box-title">物流信息</h3>
                    </div>
                    <div class="box-body table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th width="100">Id</th>
                                <th>类型</th>
                                <th>收件人</th>
                                <th>电话</th>
                                <th>地址</th>
                                @if($order->express->express_no)
                                    <th>物流公司</th>
                                    <th>物流单号</th>
                                @endif
                                <th>经办人</th>
                            </tr>
                            </thead>
                            <tbody>
                            <tr>
                                <td>{{ $order->express->id }}</td>
                                <td>{{ $order->express->type_text }}</td>
                                <td>{{ $order->express->name }}</td>
                                <td>{{ $order->express->mobile }}</td>
                                <td>{{ $order->express->getFullAddress() }}</td>
                                @if($order->express->express_no)
                                    <td>物流公司：{{$order->express->express->name}}</td>
                                    <td>物流单号：{{$order->express->express_no }}</td>
                                @endif
                                <th>{{ $order->express->person }}</th>
                            </tr>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    @endif

    @if ($order->payments->isNotEmpty())
        <div class="row" style="padding: 0 20px">
            <div class="col-md-12">
                <div class="box box-warning box-solid">
                    <div class="box-header with-border">
                        <h3 class="box-title">支付信息</h3>
                    </div>
                    <div class="box-body table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th width="100">Id</th>
                                <th>支付方式</th>
                                <th>支付金额(元)</th>
                                <th>流水号</th>
                                <th>支付单号</th>
                                <th>状态</th>
                                <th>支付时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach ($order->payments as $payment)
                                <tr>
                                    <td>{{ $payment->id }}</td>
                                    <td>{{ $payment->driver_text }}</td>
                                    <td>{{ $payment->total }}</td>
                                    <td>{{ $payment->trade_id }}</td>
                                    <td>{{ $payment->transaction_id }}</td>
                                    <td>{{ $payment->state_text }}</td>
                                    <td>{{ $payment->created_at }}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    @endif

    @if ($order->refunds->isNotEmpty())
        <div class="row" style="padding: 0 20px">
            <div class="col-md-12">
                <div class="box box-warning box-solid">
                    <div class="box-header with-border">
                        <h3 class="box-title">退款/货信息</h3>
                    </div>
                    <div class="box-body table-responsive">
                        <table class="table table-hover">
                            <thead>
                            <tr>
                                <th width="100">退款/货单号</th>
                                <th>申请退款金额</th>
                                <th>实退金额</th>
                                <th>状态</th>
                                <th>申请时间</th>
                                <th>退款时间</th>
                            </tr>
                            </thead>
                            <tbody>
                            @foreach ($order->refunds as $refund)
                                <tr>
                                    <td>{{ $refund->refund_no }}</td>
                                    <td>{{ $refund->refund_total }}</td>
                                    <td>{{ $refund->actual_total }}</td>
                                    <td>{{ $refund->state_text }}</td>
                                    <td>{{ $refund->created_at }}</td>
                                    <td>{{ $refund->refunded_at }}</td>
                                </tr>
                            @endforeach
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    @endif

</div>
