<script type="text/javascript">    
    $(document).ready(function(){   
        var clss,act,app_id;

        $('#custom-url-modal .btn-act').unbind('click').bind('click',function(){  
            clss=$(this).attr('class').split(' ');
            act='';
            msg='';
            app_id=$('#custom-url-modal .app_id').val();
            var reason=$('#reject_reason').val();
            $(this).hide();
            if (clss.indexOf('btn-reject')>-1){
                act='reject';
                msg='驳回';
            } else{
                if (clss.indexOf('btn-scrap')>-1){
                    act='scrap';
                    msg='作废';
                }                
            };
            if(reason==''){
                toastr.error('原因说明不能为空'); 
            }else{                
                $.ajax({
                    type:'POST',
                    url:'/sales/channelretate/period/action/rebateapplication_reject/',
                    dataType:'json',
                    contentType: "application/json; charset=utf-8",   
                    data:JSON.stringify({"id":app_id,"action":act,"reason":reason}),
                    success: function(data) {  
                        if(data.e!=''){
                            toastr.error(data.e); 
                        }else{                        
                            toastr.success('当前提现申请已'+msg);                           
                            $('#'+app_id).find('td:nth-child(9)').text(data.status);   
                            $('#'+app_id).find('td:nth-child(11)').text('');  
                            $('#'+app_id).find('td:nth-child(12)').text('');  
                            $('#'+app_id).find('td:nth-child(13)').text('');  
                        };
                        $('#custom-url-modal').modal('hide');
                    },                
                    error: function(XMLHttpRequest, textStatus, errorThrown) {
                        alert('连接服务器失败');
                        return;
                    }  
                });
            }            
        }).show();
    });
</script>


<div class="row">
    <input class='app_id' type='hidden' value='{{id}}' />
    <div style="display: flex;padding: 1rem;font-size: 1.4rem;border-bottom: 1px solid #d5d5d5;">
        <div>
            收款人实名: <b>{{payee_name}}</b> 
        </div>
        <div style="margin-left:1.5rem;">
            申请提现金额: ￥ <b>{{amount}}</b> 
        </div>
        <div style="margin-left:2rem;">
            申请人微信: <img src="{{wx_headimgurl}}" style="width:25px;height:25px;" />
        </div>
        <div style="margin-left:0.5rem;">
            <b>{{wx_nickname}}</b>
        </div>
        <div style="margin-left:1.5rem;">
            发票图片张数: {{images | length}}
        </div>        
    </div>

    <div>
        {% for img in images %}
            <div class="col-xs-6">  
                <p class="lead" style='font-size: 1.4rem;margin-top:10px;margin-bottom:0px;'>
                    <span>上传账号: <b>{{img.user_name}}</b></span>
                    <span style='margin-left: 2rem;'>上传时间: <b>{{img.time}}</b></span>
                </p>
                <img src="{{img.image}}"  style="width:100%;max-height:500px;">
            </div>
        {% endfor %}    
    </div>
    <div class='clearfix'></div>
    <div class="form-group" style='padding-top:10px;'>
        <label class="col-sm-1 control-label">原因说明</label>
        <div class="col-sm-11"><input id='reject_reason' class='form-control' required="required" /> </div>        
    </div>    
        

</div>
