/**
 * Created by ICHUNT on 2018/10/10.
 */
layui.use('form', function() {
    var form=layui.form;
    form.on('submit(load)', function(data) {
        layer.prompt({formType: 2,maxlength:100,title:'填写原因'},function(val, index){
            if(!val) {
                return layer.msg('请填写原因',{icon:5});
            }
            layer.msg('提交中', {
                icon: 16
                ,shade: 0.01
                ,time:10000
            });
            data.field.auth_cause=val;
            $.ajax({
                url:'/api/ApiAuthPaymentDays',
                type:'post',
                data:data.field,
                async: false,
                dataType:'json',
                timeout:10000,
                success:function (res) {
                    if(!res) return layer.msg('网络错误,请重试',{icon:5});
                    layer.msg(res.errmsg,{icon:6});
                    if(res.errcode==0) window.parent.location.reload();
                },
                error:function(){
                    return layer.msg('网络错误,请重试',{icon:5});
                }
            });
            layer.close(index);
        });

    })
});