<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="YSYF.aspx.cs" Inherits="DSWeb.Areas.Mobile.Views.Approval.YSYF" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta name="viewport" content="width=device-width, initial-scale=1" />
    <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.css">
    <script src="http://code.jquery.com/jquery-1.8.3.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.3.2/jquery.mobile-1.3.2.min.js"></script>
    <script src="http://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
    <title></title>
    <script>
        var billnos = '';
      
        $(document).ready(function () {
            $('#search').val($('#hdkeyword').val());
            $('#search').keypress(function (event) {
                if (event.keyCode == '13') {
                    var currurl = window.location.href;
                    var currsplit = currurl.split('?');
                    if (currsplit.length > 0) {
                        currurl = currsplit[0];
                    }
                    currurl += '?search=' + $(this).val();
                    window.location.href = currurl;
                }
            });

            $("#btnBack").click(function () {
                wx.closeWindow();

            });
            $("#btnCallBack").click(function () {
                wx.closeWindow();
            });

            $(".ckbBill").click(function () {
                if ($(this).is(':checked')) {
                    billnos += $(this).val() + ',';
                } else {
                    billnos = billnos.replace($(this).val() + ',', "");
                }
            });
            $("#btnOK").click(function () {
                var billnostr = billnos.substring(0, billnos.length - 1);
                var uid = $("#hduid").val();
                var uname = $("#hdusername").val();
                var comid = $("#hdcomid").val();
                if (billnostr.length == 0) {
                    alert('请选择要审批的数据!');
                    return;
                }
                $.getJSON("/Mobile/Approval/DoYSYFWithBillNoAndUid",
                    {
                        bsnos: billnostr,
                        userid: uid,
                        showname: uname,
                        comid: comid
                    },
                    function (data) {

                        if (data.Success) {
                            $("#infop").html("操作成功!");
                            setTimeout(function () {
                                window.location.reload();
                            }, 20);
                        } else {
                            $("#infop").html(data.Message);
                        }
                    })
            });
            $("#btnOKALL").click(function () {
                billnos = '';
                //遍历所有checkbox
//                $(".ckbBill").each(function () {
//                    billnos += $(this).val() + ',';
//                });
                $("#dvContent :checkbox").attr("checked", true);  
                //访问接口
//                var billnostr = billnos.substring(0, billnos.length - 1);
//                var uid = $("#hduid").val();
//                var uname = $("#hdusername").val();
//                var comid = $("#hdcomid").val();
//                $.getJSON("/Mobile/Approval/DoYSYFWithBillNoAndUid",
//                    { bsnos: billnostr,
//                        userid: uid,
//                        showname: uname,
//                        comid: comid
//                    },
//                    function (data) {

//                        if (data.Success) {
//                            $("#infop").html("操作成功!");
//                            setTimeout(function () {
//                                window.location.reload();
//                            }, 20);
//                        } else {
//                            $("#infop").html(data.Message);
//                        }
//                    })
            });
        });
    </script>
</head>
<body>
   
     
    <div data-role="page" id="pageone">
        <div id="dvContent" data-role="content">
            <div data-role="fieldcontain">
                <input  type="search" name="search" id="search" placeholder="提单号">
            </div>

            <ul data-role="listview" style="margin-top:20px" >
                <%=model.content %>
            </ul>
        </div>
         <div data-role="footer" data-position="fixed">
            <div data-role="navbar" id="navbar">
                <ul id="ulfoot">
                    <%=model.footer %>
                </ul>
            </div>
        </div>
    </div>
        <div data-role="page" id="pagethree">
        <div data-role="header">
            <h1>
                操作结果</h1>
        </div>
        <div data-role="content">
            <p id="infop" style="color: Red; font-size: 12px">
            </p>
        </div>
        <div data-role="footer">
            <ul id="ul2">
               <li> <a href="#pagethree" id="btnCallBack" data-icon="check" >确认</a></li> 
            </ul>
        </div>
    </div>
     <input id="hduid" type="hidden" runat="server">
     <input id="hdusername" type="hidden" runat="server">
     <input id="hdcomid" type="hidden" runat="server">
     <input id="hdkeyword" type="hidden" runat="server">
</body>
</html>