{layout:default} {class:Shop.Admin.order.cash}
<lbhead>
    <title><%=Tag("提现管理")%>-<%=site.title%></title>
</lbhead>
<lbfile>
    <link href="<%=site.AdminAssetsPath %>/plugins/daterangepicker/daterangepicker.css" rel="stylesheet">
</lbfile>
<lbpath>
    <h3 class="text-themecolor m-b-0 m-t-0"><%=Tag("提现管理")%></h3>
    <ol class="breadcrumb">
        <li class="breadcrumb-item"><a href="<%=site.AdminPath %>/Ajax/ajax_admin.aspx?__Action=MenuJump&pid=0"><%=Tag("管理首页")%></a></li>
        <li class="breadcrumb-item active"><%=Tag("提现管理")%></li>
    </ol>
</lbpath>
<lbbody>
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row">
                    <div class="col-md-9 m-b-10">
                        <%if (PageReturnMsg == ""){%>
                        <button class="btn btn-success" onclick="UpdateObj()"><i class="ti-check"></i> <%=Tag("已付款")%></button>
                        <button class="btn btn-danger" onclick="DeleteConfirm()"><i class="ti-trash"></i> <%=Tag("删除")%></button>
                        <button class="btn btn-defaut" onclick="location.href='cashalipay.aspx'"><i class="ti-credit-card"></i> <%=Tag("支付宝批量付款")%></button>
                        <%}%>
                    </div>
                    <div class="col-md-3 m-b-10">
                        <div class="input-group">
                            <input type="text" id="key" name="key" value="<%=key %>" class="form-control" onkeydown="if(event.keyCode==13){search_();}">
                            <div class="input-group-append">
                                <button type="button" class="btn btn-primary" onclick="search_();"><i class="ti-search"></i></button>
                                <button class="btn btn-default" data-toggle="modal" data-target="#SearchModal"><i class="ti-filter"></i></button>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="table-responsive">
                    <table class="table table-hover no-wrap">
                        <thead>
                            <tr>
                                <th style="width: 40px" class="selectAll">
                                    <a href="javascript:void(0);" onclick="$('input[name=\'id\']').attr('checked',!$(this).attr('checked'));$(this).attr('checked',!$(this).attr('checked'));"><%=Tag("全选")%></a>
                                </th>
                                <th>
                                    <%=Tag("时间")%>
                                </th>
                                <th>
                                    <%=Tag("金额")%>
                                </th>
                                <th>
                                    <%=Tag("会员")%>
                                </th>
                                <th>
                                    <%=Tag("收款方式")%>
                                </th>
                                <th>
                                    <%=Tag("姓名")%>
                                </th>
                                <th>
                                    <%=Tag("账户")%>
                                </th>
                                <th>
                                    <%=Tag("银行")%>
                                </th>
                                <th>
                                    <%=Tag("状态")%>
                                </th>
                                <th>
                                    <%=Tag("操作时间")%>
                                </th>
                                <th>
                                    <%=Tag("操作")%>
                                </th>
                            </tr>
                        </thead>
                        <tbody>
                            <%decimal pagemoney = 0;foreach (DB.LebiShop.Lebi_Cash model in models){%>
                            <tr ondblclick="Edit(<%=model.id %>);">
                                <td>
                                    <label class="custom-control custom-checkbox">
                                        <input type="checkbox" id="checkbox<%=model.id %>" name="id" value="<%=model.id %>" class="custom-control-input" del="true">
                                        <span class="custom-control-label"></span>
                                    </label>
                                </td>
                                <td>
                                    <%=FormatTime(model.Time_add) %>
                                </td>
                                <td>
                                    <%=model.Money-model.Fee %>
                                </td>
                                <td>
                                    <%=model.Supplier_id == 0 ? "<span class=\"label label-success\">" + Tag("会员") + "</span>" : "<span class=\"label label-danger\">" + Tag("供应商") + "</span>"%> <%=model.User_UserName %><%=model.Supplier_SubName %>
                                </td>
                                <td>
                                    <%=model.PayType == "alipay"?"<span class=\"label label-success\">" + Tag("支付宝") + "</span>" : "<span class=\"label label-danger\">" + Tag("银行转账") + "</span>"%>
                                </td>
                                <td>
                                    <%=model.AccountName %>
                                </td>
                                <td>
                                    <%=model.AccountCode %>
                                </td>
                                <td>
                                    <%=model.Bank %>
                                </td>
                                <td>
                                    <%=Shop.Bussiness.EX_Type.TypeName(model.Type_id_CashStatus)%>
                                </td>
                                <td>
                                    <%=FormatTime(model.Time_update)%>
                                </td>
                                <td>
                                    <a href="javascript:Edit(<%=model.id %>);"><%=Tag("查看") %></a>
                                </td>
                            </tr>
                            <%pagemoney += (model.Money-model.Fee);} %>
                            <tr>
                                <td colspan="2" align="right">
                                    <%=Tag("小计") %>：
                                </td>
                                <td colspan="9">
                                    <strong><%=pagemoney %></strong>
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="row">
                    <div class="col-12">
                        <nav aria-label="Page navigation ">
                            <%=PageString%>
                        </nav>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="SearchModal" tabindex="-1" role="dialog" aria-labelledby="SearchModal">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title"><%=Tag("高级搜索")%></h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                </div>
                <div class="modal-body">
                    <form>
                        <div class="form-group">
                            <select id="status" name="status" class="form-control">
                                <option value="0"><%=Tag("状态")%></option>
                                <%=Shop.Bussiness.EX_Type.TypeOption("CashStatus", status)%>
                            </select>
                        </div>
                        <div class="form-group">
                            <select id="paytype" name="paytype" class="form-control">
                                <option value=""><%=Tag("收款方式")%></option>
                                <option value="alipay" <%=paytype == "alipay"?"selected":""%>>┌<%=Tag("支付宝")%></option>
                                <option value="bank" <%=paytype == "bank"?"selected":""%>>┌<%=Tag("银行转账")%></option>
                            </select>
                        </div>
                        <div class="form-group">
                            <select id="type" name="type" class="form-control">
                                <option value="0"><%=Tag("类型")%></option>
                                <option value="1" <%=type == 1?"selected":""%>>┌<%=Tag("会员")%></option>
                                <option value="2" <%=type == 2?"selected":""%>>┌<%=Tag("供应商")%></option>
                            </select>
                        </div>
                        <div class="form-group">
                            <div class="input-group">
                                <input type="text" name="daterange" id="daterange" class="form-control">
                                <div class="input-group-append">
                                    <span class="input-group-text">
                                        <span class="ti-calendar"></span>
                                    </span>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <input type="text" id="key" name="key" class="form-control" value="<%=key %>" onkeydown="if(event.keyCode==13){modal_search_();}">
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="ti-close"></i> <%=Tag("关闭")%></button>
                    <button type="button" class="btn btn-success" onclick="modal_search_();"><i class="ti-search"></i> <%=Tag("搜索")%></button>
                </div>
            </div>
        </div>
    </div>
</lbbody>
<lbscripts>
    {MOD:DateRangePicker}
    <script>
        function search_() {
            var key = $("#key").val();
            window.location = "?key=" + escape(key);
        }
        function modal_search_() {
            $("#SearchModal").modal("hide");
            var t = $("#t").val();
            var status = $("#status").val();
            var paytype = $("#paytype").val();
            var type = $("#type").val();
            var user_id = $("#user_id").val();
            var dateFrom = "";
            var dateTo = "";
            var daterange = $("#daterange").val();
            if (daterange.indexOf(" - ") > -1) {
                dateFrom = daterange.split(" - ")[0];
                dateTo = daterange.split(" - ")[1];
            }
            var key = $("#key").val();
            window.location = "?status=" + status + "&paytype=" + paytype + "&type=" + type + "&user_id=" + user_id + "&dateFrom=" + dateFrom + "&dateTo=" + dateTo + "&key=" + escape(key);
        }
        function Edit(id) {
            $("#EditModal").modal("show");
            $.ajax({
                url: "cash_edit_window.aspx",
                type: "GET",
                cache: false,
                data: { id: id },
            }).done(function (result) {
                $("#EditModal .modal-content").html(result);
            });
        }
        function DeleteConfirm() {
            $("#Modal-Confirm").modal("show");
            $("#Confirm-Content").html("<%=Tag("确认要删除吗？")%>");
            $("#Modal-Confirm .btn-success.btn-ok").attr("onclick", "DeleteObj();");
        }
        function DeleteObj() {
            $("#Modal-Confirm").modal("hide");
            var postData = GetFormJsonData("del");
            var url = "<%=site.AdminPath %>/ajax/ajax_order.aspx?__Action=Cash_Del";
            RequestAjax(url, postData, function () { MsgBox(1, "<%=Tag("操作成功")%>", "?") });
        }
        function UpdateObj() {
            var postData = GetFormJsonData("del");
            var url = "<%=site.AdminPath %>/ajax/ajax_order.aspx?__Action=Cash_Update";
            RequestAjax(url, postData, function () { MsgBox(1, "<%=Tag("操作成功")%>", "?") });
        }
    </script>
</lbscripts>