<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>发起投诉</title>
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="decorator" content="base" />
<style>
.mark {
	color: #ff5151 !important;
}
</style>
</head>
<body>
	<div class="">
		<div class="layui-card">
			<div class="layui-form layui-card-body pt-20" style="margin-left:70px;" lay-filter="layuiadmin-form-useradmin" id="layuiadmin-form-useradmin">
				<div class=" layui-form-item layui-form-text">
					<label class="layui-form-label">
						<span class="mark">*</span>
						支付凭证：
					</label>
					<div class="layui-input-block">
						<div class="upload-container" id="uploader">
							<img src="" alt="img placeholder" style="width: 80px; height: 80px;" id="pic">
						</div>
					</div>
					<input type="hidden" name="imgs" id="imgs" value="imgs-test" lay-verify="imgsCheck">
				</div>
				<div class="layui-form-item" style="margin-top: 40px;">
					<div class="layui-input-block" style="margin-left: 10px;">
						您确定需要给
						<span style="color: #FFB800;"> ${site!=null ? site.columns.name : '' } </span>
						结账了吗？
					</div>
				</div>
				<div class="layui-form-item layui-hide ">
					<input type="button" lay-submit lay-filter="sureSubmit" id="sureSubmit" value="确认">
				</div>
			</div>
		</div>
	</div>
	<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
	<script>
    function complaintType() {
        return $("#complaintType").val();
    }
    var imgs="";
    //Demo
    layui.use(['form', 'upload'], function () {
        var form = layui.form,
        $ = layui.$;
        
        function isBlank(val){
        	if(val==null || $.trim(val)=='' || val==undefined){
        		return true;
        	}
        	return false;
        }
        
        form.verify({
            imgsCheck: function(value, item){ //value：表单的值、item：表单的DOM对象
                if(isBlank(value)){
                	return "请上传支付凭证！";
                }
            }
        });

        var upload = layui.upload;
        //执行实例
        var uploadInst = upload.render({
            elem: '#uploader' //绑定元素
            , url: '${ctx}/common/uploadFile' //上传接口
            ,size:5*1024
            ,number:1
            ,before: function(obj){
                //预读本地文件示例，不支持ie8
                obj.preview(function (index, file, result) {
                	
                });
            }
            , done: function (res) {
            	if(res.code > 0){
            		return layer.msg("上传失败！",{icon:2});
            	}
            	var imgPath = res.path;
            	$('#pic').attr('src', '${commonStaticImgPath}'+imgPath); //图片链接（base64）
                $("#pic").show();
            	$("#imgs").val(imgPath);
            }
            , error: function () {
                //请求异常回调 演示失败状态
            }
        });

    });
</script>
</body>
</html>
