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

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

        $('#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 dt_paid=$('#dt_paid').val();
            var bank_statement=$('#bank_statement').val();
            $(this).hide();
            if (clss.indexOf('btn-cancel')>-1){
                $('#custom-url-modal').modal('hide');                 
                $('#cb-casher-'+app_id).attr("checked", false);
            } else{
                if (clss.indexOf('btn-bankpaid')>-1){
                    act='rebateapplication_bankpaid';                   
                };
                //if(dt_paid=='' || bank_statement==''){
                if(dt_paid==''){
                    //alert('付款日期和银行流水单号不能为空'); 
                    alert('付款日期');
                    $(this).show();
                }else{                 
                    $.ajax({
                        type:'POST',
                        url:'/sales/channelretate/period/action/'+act+'/',
                        dataType:'json',
                        contentType: "application/json; charset=utf-8",   
                        data:JSON.stringify({"id":app_id,"action":act,"dt_paid":dt_paid,'bank_statement':bank_statement}),
                        success: function(data) {  
                            $(this).show();
                            if(data.e!=''){
                                toastr.error(data.e); 
                            }else{                        
                                toastr.success('当前提现申请已'+data.status);                           
                                $('#'+app_id).find('td:nth-child(11)').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('连接服务器失败');
                            $(this).show();
                            return;                        
                        }  
                    });                
                };
            };           
            
        });
    });
</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>{{bank_name}}</b> 
        </div>
        <div style="margin-left:2rem;">
            开户帐号: <b>{{bank_account}}</b>
        </div>
        <div style="margin-left:1.5rem;">
            付款金额: ￥ <b>{{amount}}</b> 
        </div>               
    </div>    
</div>

<div class='clearfix'></div>
<div class="form-group row" style='margin-top:10px;'>
    <label class="col-sm-1 control-label">付款日期</label>
    <div class="col-sm-11"><input id='dt_paid' class='form-control datepicker' required="required" /> </div>        
</div>  
    
<div class="form-group row" style='margin-top:10px;'>
    <label class="col-sm-1 control-label">银行水单</label>
    <div class="col-sm-11"><input id='bank_statement' class='form-control' required="required" value='' /> </div>        
</div>    
        
