<style>
    #temp-save-info { display: none; }
    #tempSaveForm { padding: 15px; }
</style>
<div id="temp-save-info">
    <div class="order-change-main row-fluid table-responsive">
        <form id="tempSaveForm" class="form-horizontal">
            @if ($order_temp_info['temp_save_info']['customer_cn'])
             <table class="table table-bordered table-hover text-nowrap">
                <tr class="caption">
                    <th colspan="4" style="text-align: center; background: #f9f9f9;">终端客户信息</th>
                </tr> 
                <tr>
                    <th>客户名称(中文)</th>
                    <th>客户名称(英文)</th>
                    <th>客户类型</th>
                    <th>产品用途</th>
                </tr>
                <tr>
                    <td><?= $order_temp_info['temp_save_info']['customer_cn'] ?></td>
                    <td><?= $order_temp_info['temp_save_info']['customer_en'] ?></td>
                    <td><?= $order_temp_info['temp_save_info']['customer_type'] ? Config('params.end_user_type')[$order_temp_info['temp_save_info']['customer_type']] : '' ?></td>
                    <td><?= $order_temp_info['temp_save_info']['product_use'] ?></td>
                </tr>
            </table>
            @endif

            <div class="row-fluid table-responsive">
                <table class="table table-bordered table-hover text-nowrap">
                    <thead>
                        <tr>
                            <th width="20%">型号</th>
                            <th width="20%">标准品牌</th>
                            <th>调整数量</th>
                            <th>调整单价</th>
                            <th>采购员</th>
                            <th>批次</th>
                            <th>状态</th>
                        </tr>
                    </thead>

                    <tbody>
                        @if (isset($order_temp_info['temp_save_info']['change_info']))
                            @foreach ($order_temp_info['temp_save_info']['change_info'] as $k => $v)
                                <tr>
                                    <td>{{$v['goods_name']}}</td>
                                    <td>{{ isset($v['standard_brand_name']) ? $v['standard_brand_name'] : '' }}</td>
                                    <td>{{$v['goods_number']}}</td>
                                    <td>{{$v['goods_price']}}</td>
                                    <td>{{ isset($v['buyer_id']) ? App\Http\Controllers\getSalesName($v['buyer_id']) : '' }}</td>
                                    <td>{{ isset($v['batch']) ? $v['batch'] : '' }}</td>
                                    <td>
                                        <?= $v['status'] == 1 ? '正常' : '<i style="color: red;">已取消</i>' ?>

                                        @if (isset($v['is_add']))
                                            <i style="color: green;">(新增)</i>
                                        @endif
                                    </td>
                                </tr>
                            @endforeach
                        @endif
                    </tbody>
                </table>
            </div>
            
            <hr>
            <table class="table table-bordered table-hover">
                <tr>
                    <th width="20%">订单类型:</th>
                    <td>
                        @if ($order_temp_info['temp_save_info']['order_pay_type'] == 1)
                            全款
                        @elseif ($order_temp_info['temp_save_info']['order_pay_type'] == 2)
                            预付款
                        @else
                            账期
                        @endif
                    </td>
                </tr>

                <tr>
                    <th>商品总额:</th>
                    <td>{{$order_temp_info['temp_save_info']['goods_amount']}}</td>
                </tr>

                <tr>
                    <th>优惠金额:</th>
                    <td>{{$order_price_info['discount_amount']}}</td>
                </tr>

                <tr>
                    <th>附加费:</th>
                    <td>{{$order_temp_info['temp_save_info']['extra_fee']}}</td>
                </tr>

                <tr>
                    <th>运费:</th>
                    <td>{{$order_temp_info['temp_save_info']['freight_fee']}}</td>
                </tr>
                
                <?php $order_amount_temp = $order_temp_info['temp_save_info']['goods_amount'] + $order_price_info['discount_amount'] + $order_temp_info['temp_save_info']['extra_fee'] + $order_temp_info['temp_save_info']['freight_fee']; ?>
                <tr>
                    <th>订单总额:</th>
                    <td>{{$order_amount_temp}}</td>
                </tr>
                
                @if ($order_info['order_goods_type'] == 2)
                <tr>
                    <th>支付优惠:</th>
                    <td>{{$order_price_info['pay_preferential'] ? $order_price_info['pay_preferential'] : 0}}</td>
                </tr>

                <tr>
                    <th>实际支付金额:</th>
                    <td>{{$order_amount_temp + $order_price_info['pay_preferential']}}</td>
                </tr>
                @endif

                @if ($order_temp_info['temp_save_info']['order_pay_type'] == 2)
                <tr>
                    <th>定金:</th>
                    <td>{{$order_temp_info['temp_save_info']['deposit_amount']}}</td>
                </tr>
                @endif

                <tr>
                    <th>付款时间:</th>
                    <td>{{$order_temp_info['temp_save_info']['pay_time_limit'].'天'}}</td>
                </tr>

                <tr>
                    <th>发货方式:</th>
                    <td>{{$order_temp_info['temp_save_info']['zy_delivery_type'] == 1 ? '现货优先发货' : '拼单发货'}}</td>
                </tr>

                <tr>
                    <th>客服备注:</th>
                    <td>{{ $order_temp_info['temp_save_info']['kefu_remark'] }}</td>
                </tr>
            </table>
        </form>
    </div>
</div>

<script>
    var temp_save_info = '{!! json_encode($order_temp_info["temp_save_info"]) !!}';
    temp_save_info = eval('('+temp_save_info+')');
    console.log(temp_save_info)
</script>