<table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table">
    <form id="theFrm">
        <input type="hidden" name="ticket_id" id="ticket_id" value="<?=$ticket_info->id?>">
        <tr>
            <td width="100" height="25" class="td_bg">所属分类</td>
            <td height="25" class="td_bg"><?=$ticket_info->type->name?></select>
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="td_bg">礼券编号</td>
            <td height="25" class="td_bg"><?=sprintf("%07d",$ticket_info->code)?></td>
        </tr>
        <tr>
            <td width="100" height="25" class="td_bg">礼品</td>
            <td height="25" class="td_bg"><select name="gift_id" id="gift_id">
                    <option value="0">请选择</option>
                    <?php
                    foreach ($gift_items as $gift_info) {
                        echo '<option value="' . $gift_info->id . '"';
                        echo '>' . $gift_info->name . '</option>';
                    }
                    ?>
                </select>
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="td_bg">快递方式</td>
            <td height="25" class="td_bg">
                <select name="send_type" id="send_type">
                    <option value="0">请选择</option>
                    <option value="1">自上门</option>
                    <option value="2" selected>德邦快递</option>
                </select>
            </td>
        </tr>
        <tr>
            <td width="100" height="25" class="td_bg">快递单号</td>
            <td height="25" class="td_bg">
                <input name="send_no" type="text" id="send_no" value="" style="width:100px;"/>
            </td>
        </tr>
    </form>
    <tr>
        <td height="22" colspan="4" align="center" class="td_bg">
            <input id="output-btn" type=button class="ACT_btn" name=Submit1 value=" 出库 "/>
            &nbsp;&nbsp;
            <input id="back-btn" type="button" class="ACT_btn" name="Submit4" value=" 返回 ">
        </td>
    </tr>
</table>
<script type="text/javascript" language="javascript" src="/js/jquery-1.8.3.js"></script>
<script type="text/javascript" language="javascript" src="/js/ajax.js"></script>
<script type="text/javascript" language="javascript" src="/js/func.js"></script>
<script type="text/javascript" language="javascript">
    $(function () {
        //出库按钮
        $("#output-btn").click(function(){
            if(confirm('是否确认提交?')) {
                var params = $("#theFrm").serialize();
                params += '&status=1';
                $.post('/gift2/ticket2-output-save',params,function(obj){
                    alert(obj.msg);
                    if(obj.success) {
                        $('#back-btn').click();
                    }
                },'json');
            }
        });
        //退回按钮
        $("#cancel-btn").click(function(){
            if(confirm('是否确认提交?')) {
                var params = $("#theFrm").serialize();
                params += '&status=3';
                $.post('/gift2/ticket2-save',params,function(obj){
                    alert(obj.msg);
                    if(obj.success) {
                        $('#back-btn').click();
                    }
                },'json');
            }
        });

        //返回按钮
        $('#back-btn').click(function(){
            window.location.href='/gift2/ticket2-list';
        });
    })
</script>
