{% load i18n %}
<style>
    #confirm-url-modal .lb{
        margin-top:10px;
    }

</style>

<script type="text/javascript">
    $(document).ready(function(){       
        

        $('.btn-confirm').removeAttr("style",""); 
        $('.btn-confirm').unbind('click').bind('click',function(){    
            var realname=$('#realname').val();
            var me=$(this);
            var obj_id=$('#obj_id').val();
            if($.isEmpty(realname)){
                toastr.error("收款人实名不能为空！", "操作错误：",
                    {timeOut: 800, positionClass: "toast-center-center"}
                );
                
            }else{
                
                $(me).hide();     
                $.ajax({
                    type: 'post',
                    data:JSON.stringify({"realname":realname}), 
                    url: '{{request.path}}',    
                    success: function(data) {
                        $('#'+obj_id).find('td:nth-child(9)').text(realname);
                        $('#confirm-url-modal').modal('hide');                        
                    },
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert('连接服务器失败');                        
                    }                    
                });
                $(me).show();
                return; // 阻止表单自动提交事件  
            }
        });     



        
        {% if is_saved %}   
            $('#confirm-url-modal').modal('hide');                 
            var url=$('#list-tt').attr('current');
            $.ajax({
                type:'GET',
                processData: false,
                contentType: 'application/json; charset=utf-8',
                url:url,
                success: function (html) { 
                    $('#div-list').html(html);                    
                    return;
                },
                error: function(XMLHttpRequest, textStatus, errorThrown) {
                    alert('连接服务器失败');
                    return;
                }
            });
            
        {% endif %}
       
    });
</script>


   
<div class="row">    
    <form role="form" method='POST' class="form-horizontal">    
        <input id="obj_id" type='hidden' value='{{obj.id}}' />
        <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '经销商名称:' %} </label>
            <div class="col-sm-10 lb">{{ obj.payee_company.name }}</div>
        </div> 
        <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '微信昵称:' %} </label>
            <div class="col-sm-10 lb">{{ obj.payee_wxopenid.wx_nickname }}</div>
        </div> 

        <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '收款人实名:' %} </label>
            <div class="col-sm-10 lb">{{ obj.realname }}</div>
        </div> 
         <div class="form-group ">
            <label class="col-sm-2 control-label ">{% trans '修改后实名:' %} </label>
            <div class="col-sm-10"><input id='realname' class='form-control' /></div>
        </div>      
    </form>
</div>

