{include file="public/header" /}
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>

<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <div class="subject">
                <h3>兑换礼品【</h3>
                <h5></h5>
            </div>
            {include file="public/admin_items" /}
        </div>
    </div>
    
    <?php if (is_array($order_info) && count($order_info)>0){ ?>
    <form id="ship_form" method="post" name="ship_form" action="{:url('pointorder/order_ship',['id'=>$Request.get.id])}">
        <table class="ds-default-table">
            <tbody>
            <tr class="noborder">
                <td colspan="2"><label>{$Think.lang.admin_pointorder_membername}:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">{$order_info.point_buyername}</td>
                <td class="vatop tips"></td>
            </tr>
            <tr>
                <td colspan="2"><label> {$Think.lang.admin_pointorder_ordersn}:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform">{$order_info.point_ordersn}</td>
                <td class="vatop tips"></td>
            </tr>
            <tr>
                <td colspan="2"><label class="validation" for="shippingcode"> {$Think.lang.admin_pointorder_shipping_code}:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform"><input type="text" id="shippingcode" name="shippingcode" class="txt" value="{$order_info.point_shippingcode}"></td>
                <td class="vatop tips"></td>
            </tr>
            <tr>
                <td colspan="2"><label class="validation">配送公司:</label></td>
            </tr>
            <tr class="noborder">
                <td class="vatop rowform" colspan="2">
                    <select name="e_code">
                        <option value="">不使用配送公司</option>
                        {volist name="express_list" id="v"}
                        <option value="{$v.e_code}" {$order_info.point_shipping_ecode == $v.e_code ? 'selected' :''}>{$v.e_name}</option>
                        {/volist}
                    </select>
                </td>
            </tr>
            <tfoot>
            <tr class="tfoot">
                <td colspan="2" >
                    <a href="JavaScript:void(0);" class="btn" id="submitBtn"><span>{$Think.lang.ds_submit}</span></a>
                </td>
            </tr>
            </tfoot>
        </table>
    </form>
    <?php } else { ?>
    <div class='msgdiv'> {$errormsg} <br>
        <br>
        <a class="forward" href="{:url('pointorder/pointorder_list')}">{$Think.lang.admin_pointorder_gobacklist}</a> </div>
    <?php } ?>

</div>

<script type="text/javascript">
    $(function(){
        //按钮先执行验证再提交表单
        $("#submitBtn").click(function(){
            if($("#ship_form").valid()){
                $("#ship_form").submit();
            }
        });
        $('#ship_form').validate({
            errorPlacement: function(error, element){
                error.appendTo(element.parent().parent().prev().find('td:first'));
            },
            rules : {
                shippingcode  : {
                    required : true
                },
                shippingdesc  : {
                    required : true
                }
            },
            messages : {
                shippingcode  : {
                    required : '{$Think.lang.admin_pointorder_ship_code_nullerror}'
                },
                shippingdesc  : {
                    required : '请填写发货描述'
                }
            }
        });
    });
</script>