{% extends 'obj_form.html' %}

{% block form_content %}

<script>
    $(document).ready(function () {

        $('.btn-save').click(function () {
            $.SubmitForm('#obj_form form', '{{request.path}}');
            $('#modal_order').modal('hide')
        });

        $('.datepicker').datepicker({dateFormat: 'yy-mm-dd'});
        $('.datepicker').datepicker('setDate',new Date());
        setDatePickerZh();

        $("#id_deliver_company").on('change',function (){
            $("#deliver_company_name").val($(this).find("option:selected").text());
        })

    })

</script>
<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">订单信息</h3>
    </div>
    <div class="panel-body">
        <p><b>订单状态：</b>{{ order.status.status_name }}</p>
        <p><b>订单号码：</b>{{ order.order_number }}</p>
        <p><b>订单总价：</b>{{ product.product_cost }}</p>
        <p><b>下单时间：</b>{{ product.tm }}</p>
        <p><b>订单备注：</b>{{ product.remarks }}</p>
        <p><b>姓名：</b>{{ order.user_name }}</p>
        <p><b>电话：</b>{{ order.user_phone }}</p>
        <p><b>地址：</b>{{ order.user_address }}</p>

        {% ifequal order.status.id 1 %}
        <a class="btn btn-primary" data-toggle="modal" data-target="#modal_order"> 发货</a>
        {% endifequal %}

    </div>
</div>
<div class="panel panel-default">
    <div class="panel-heading">
        <h3 class="panel-title">商品信息</h3>
    </div>
    <div class="panel-body">
        <p><img src="{{domain}}/media/{{product.product_image}}" style="width:100px"/></p>
        <p><b>商品名称：</b>{{ product.product_name }}</p>
        <p><b>兑换数量：</b>{{ product.num }}</p>
        <p><b>总价值：</b>{{ product.product_cost }}</p>
    </div>
</div>

<div class="modal fade" id="modal_order" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span>
                </button>
                <h4 class="modal-title">发货</h4>
            </div>
            <div class="modal-body">
                <div class="form-group">
                    <label>物流公司</label>
                    {{form.deliver_company}}
                </div>
                <div class="form-group">
                    <label>物流单号</label>
                    {{form.deliver_company_code}}
                </div>
                <div class="form-group">
                    <label>发货时间</label>
                    <input class="datepicker form-control" id="dt_fr" name="deliver_tm" />
                </div>
                <input type="hidden" name="status" value="2">
                <input type="hidden" name="deliver_company_name" id="deliver_company_name" value="2">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                <button type="button" class="btn btn-primary btn-save">确定</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->

<script>


</script>
{% endblock %}