
<div class="main">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0" id="tb_head">
        <tr>
            <td class="left">
                <span>标题：</span><span class="lb_title" style="display:none" data-custom-params="url:'@Url.Action("GetFieldByIds","InfoData")?table=@Request.QueryString["table"]',textField:'title'">@Request.QueryString["detail_id"]</span>
            </td>
            <td class="right">
                <span style="color:#666" id="sign_bl"></span>
            </td>
        </tr>
    </table>
    <table border=0 cellpadding=0 cellspacing=0 class="table table-bordered" id="tb_list">
        <thead><tr>
            <td align="left">用户</td>
            <td align="center">是否签收</td>
            <td align="center">签收时间</td>
            <td align="center">签收留言</td>
        </tr>
        <tr class="item template-item">
            <td align=left><span class="lb_uid" data-custom-params="url:'@Url.Action("GetFieldByIds", "Member")',textField:'username'">{uid}</span></td>
            <td align="center"><span class="is-{state}"></span></td>
            <td align="center"><span class="lb_state" dada-state="{state}" style="display:none">{sign_date}</span></td>
            <td align="center">{sign_remark}</td>
        </tr>
    </table>
</div>

<div class="zhushi">
    <table class="tb-head" cellpadding="0" cellspacing="0" border="0" id="tb_zhushi">
        <tr>
            <td class="left">
                <span id="sign_state"></span>
                <input type="hidden" id="thedate" name="thedate" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")" />
            </td>
            <td class="right" style="color:#999">
                <span>截止日期：</span><span id="start_date" name="start_date"></span><span>到</span><span id="end_date" name="end_date"></span>
            </td>
        </tr>
    </table>
</div>
<script type="text/javascript">
    var totalNum = 0, signEdNum = 0;
    function LoadData() {
        var url = "@Url.Action("ListData")?table=@Request.QueryString["table"]&detail_id=@Request.QueryString["detail_id"]"
        $("#tb_list").ListBind(url, {callBack: "LoadedInit" });
    }
    function LoadedInit()
    {
        ConvertText($(".lb_uid"));
        var $lb_state = $(".lb_state");
        $lb_state.each(function () {
            var $this = $(this);
            var state = $this.attr("dada-state");
            if (state == "1") {
                signEdNum++;
                $this.show();
            }
            else {
                $this.hide();
            }
            totalNum++;
        });
        BindDetail();
        $("#sign_bl").text("签收率：" + signEdNum + "/" + totalNum);
    }
    LoadData();


    function BindDetail()
    {
        //绑定顶部或底部数据
        var id = Request("id");
        var $sign_state = $("#sign_state")
        if (id != "") {
            ConvertText($(".lb_title"));

            var model =@Html.Raw(Model??"null");
            if (typeof (model) == "object")
            {
                $("#tb_zhushi").FormBind(model);
            }
            var endDate = $("#end_date").text();
            var nowDate = $("#thedate").val();
            endDate = new Date(endDate.replace(/-/g, '/'));
            nowDate = new Date(nowDate.replace(/-/g, '/'));
            if (nowDate >= endDate) {
                $("#sign_state").text("状态：已结束");
            }
            else {
                $("#sign_state").text("状态：签收中");
            }
        }
    }
</script>