@extends('base.base')
@section('base')
    <style>
        .form-inline .form-group {
            margin-bottom: 10px;
        }
    </style>
    <!-- 内容区域 -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                        <i class="mdi mdi-settings"></i>
                    </span>
                    阿瑞结算
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">阿瑞结算</a></li>
                        <li class="breadcrumb-item active" aria-current="page">阿瑞结算</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">阿瑞结算</h4>
                            {{--                            <form class="well form-group margin-top-20" method="get" action='/admin/recharge/list'>--}}
                            <form class="well form-inline margin-top-20" method="get">
                                <div>

                                    <div class="form-group">
                                        <span style="padding-left: 10px">选择日期(当地)：</span>
                                        <input type="date" step="01" name="start_time" class="form-control" id="start_time"
                                               value="{{$start_time}}" onclick="start_times('start_time')"/>&nbsp;&nbsp;
                                        <input type="date" step="01" name="end_time" class="form-control" id="end_time"
                                               value="{{$end_time}}"  onclick="end_times('end_time')"/>&nbsp;&nbsp;


                                        <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="搜索"/>&nbsp;&nbsp;
                                    </div>

                                </div>
                            </form>
                            <table class="table table-bordered" id="tables">
                                <thead>
                                <tr>
                                    <th >货号</th>
                                    <th >牌子</th>
                                    <th >酱油</th>
                                    <th >打包</th>
                                    <th >去包装</th>
                                    <th >水量</th>
                                    <th >水杂</th>
                                    <th >净重</th>

                                </tr>
                                </thead>
                                <tbody>

                                @foreach($res as $k=>$v)
                                    <tr >

                                        <td>{{ $v->Channel }}</td>
                                        <td>{{ $v->Remarks }}</td>
                                        <td>{{ $v->amount }}</td>
                                        <td>{{ $v->payment_fee }}</td>
                                        <td>{{ $v->amountReal }}</td>
                                        <td>{{ $v->WithDraw }}</td>
                                        <td>{{ $v->withdraw_fee }}</td>
                                        <td>{{$v->NetAmount}}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>

        var params = {
            'start_time' : '{{$start_time}}',

            'end_time':'{{$end_time}}',

        }

        function start_times(id) {

            // getFormat('00', '00', '00');

            // document.getElementById(id).value = format
        }

        function end_times(id) {
            // getFormat('00', '00', '00');
            // document.getElementById(id).value = format
        }

        function create_start_times() {

            getFormat('00', '00', '00');

            document.getElementById("create_start_time").value = format
        }

        function create_end_times() {
            getFormat('00', '00', '00');
            document.getElementById("create_end_time").value = format
        }

        function register_start_timeFunc(){
            getFormat('00', '00', '00');

            document.getElementById("register_start_time").value = format
        }

        function register_end_timeFunc(){
            getFormat('23', '59', '59');
            document.getElementById("register_end_time").value = format
        }

        function sort_money_func(obj, val) {
            if (val == 'asc') {
                $(".sort_money svg:eq(1)").children('path').attr('fill', '#707071');
                $(obj).children('path').attr('fill', 'red')

            } else {
                $(obj).children('path').attr('fill', 'red')
                $(".sort_money svg:eq(0)").children('path').attr('fill', '#707071');
            }

            params.amountSort = val
            $.ajax({
                type: "get",
                url: "/admin/recharge/list",
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                },
                data: params,
                success: function (msg) {

                    if (msg) {
                        $(".main-panel").html(msg)

                    }
                }
            })
        }



        $(function () {
            cutStr(50);
        });


    </script>
@endsection
