<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<!DOCTYPE HTML>
<html>
<head>
<meta name="decorator" content="base" />
<meta charset="utf-8">
<title>layuiAdmin 网站用户</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">
<link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/css/layui.css" media="all">
<link rel="stylesheet" href="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/style/admin.css" media="all">
<link rel="stylesheet" href="${ctxPlugin}/static/css/reset.css" media="all">
<title>资料设置</title>
<style>
.menuItem:hover {
	background-color: #f0f0f0;
}

.ul-li {
	float: left;
}

.layui-table-cell {
	height: inherit;
}

.mark {
	color: #ff5151 !important;
}

.readonly {
	background-color: #eeeeee;
}
</style>

</head>
<body>
	<div class="layui-fluid">
		<div class="layui-card">
			<div class="layui-tab layui-tab-brief">
				<ul class="layui-tab-title">
					<sfTags:pagePermission authFlag="SITE_SETTLEMENT_SET_T" html='<li >
						<a href="${ctx}/yangguang/siteSettlementSet/siteSettlementSetList">结算方案设置</a>
					</li>'/>
					<sfTags:pagePermission authFlag="SITE_MELEAGE_SET_T" html='<li class="layui-this">
						<a href="${ctx}/yangguang/orderMileageSet/orderSiteMileageSetPage">里程费用设置</a>
					</li>'/>
				</ul>
			</div>
			<div class="layui-card-body">
				<div class="layui-form" action="#" lay-filter="component-form-element">
					<div class="layui-row layui-col-space12 layui-form-item">
						<div class="layui-col-lg6 layui-col-sm6">
							<label class="layui-form-label" style="margin-left: 200px">保内</label>
						</div>
						<div class="layui-col-lg6 layui-col-sm6">
							<label class="layui-form-label" style="margin-left: 0px">保外</label>
						</div>
						<div class="layui-col-lg4 layui-col-sm4">
							<label class="layui-form-label">初始化里程：</label>
							<div class="layui-input-block">
								<input type="text" name="initialValueNei" value="${initialValue}" readonly="readonly" lay-verify="numberLimit" placeholder="最多保留两位小数" autocomplete="off" class="layui-input readonly">
							</div>
						</div>
						<span style="float:left"> &nbsp;公&nbsp;里&nbsp;&nbsp;</span>
						<div class="layui-col-lg4 layui-col-sm4">
							<label class="layui-form-label">初始化里程：</label>
							<div class="layui-input-block">
								<input type="text" name="initialValueWai" value="${rd2.columns.initial_value}" readonly="readonly" lay-verify="numberLimit" placeholder="最多保留两位小数" autocomplete="off" class="layui-input readonly">
							</div>
						</div>
						<span style="float:left">公里  </span>

						<div class="layui-col-lg4 layui-col-sm4">
							<label class="layui-form-label">超过后：</label>
							<div class="layui-input-block">
								<input type="text" name="amountNei" value="${amount}" readonly="readonly" lay-verify="numberLimit" placeholder="最多保留两位小数" autocomplete="off" class="layui-input readonly">
							</div>
						</div>
						<span style="float:left">元/公里</span>
						<div class="layui-col-lg4 layui-col-sm4">
							<label class="layui-form-label">超过后：</label>
							<div class="layui-input-block">
								<input type="text" name="amountWai" value="${rd2.columns.amount}" readonly="readonly" lay-verify="numberLimit" placeholder="最多保留两位小数" autocomplete="off" class="layui-input readonly">
							</div>
						</div>
						<span style="float:left">元/公里</span>
					</div>
					<div class="layui-col-xs12 text-c mt-20">
						<sfTags:pagePermission authFlag="SITE_MELEAGE_SET_EDIT_B" html='<button class="layui-btn" type="button" id="editShow">编辑</button>'/>
						<button class="layui-btn saveShow layui-hide" lay-submit="callOrder" id="saveShow" lay-filter="callOrder">保存</button>
						<button class="layui-btn saveShow layui-hide" type="button" id="cancelEdit">取消</button>
					</div>
				</div>
			</div>
		</div>
	</div>

	<script src="${ctxPlugin}/lib/layuiAdmin/dist/layuiadmin/layui/layui.js"></script>
	<script type="text/javascript">
		var saveMark = false;
		layui.use([ 'table', 'laypage', 'layer', 'form', 'element' ], function() {
			var $ = layui.$, form = layui.form, table = layui.table;
			var table = layui.table;
			form.verify({
				numberLimit : [ /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2}))|0)$/, '初始里程格式有误，最多保留两位小数！' ],
				priceRule : [ /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2}))|0|)$/, '超过后的金额格式有误！' ]
			});
			function isBlank(val) {
				if (val == null || $.trim(val) == '' || val == undefined) {
					return true;
				}
				return false;
			}

			layui.form.on('submit(callOrder)', function(data) {//
				var params = data.field; //获取提交的字段
				params.type="2";
				$.ajax({
					type:"post",
					url:"${ctx}/yangguang/orderMileageSet/save",
					data:params,
					success:function(data){
						if(data.code=='200'){
							layer.msg("保存成功！");
							reloadPage();
						}else{
							layer.msg(data.errMsg, {icon : 2});
						}
					},
					error:function(e){
						layer.msg("请先维护服务品类！", {icon : 2});
					}
				});
			});
			
			$("#editShow").click(function(){
				$('input[type="text"]').attr("readonly",false).removeClass("readonly");
				//$("#initialValue").removeClass("readonly");
				$("#editShow").addClass("layui-hide");
				$(".saveShow").removeClass("layui-hide");
			});
			
			$("#cancelEdit").click(function(){
				location.reload();
			});
			
			function reloadPage(){
				$("#editShow").removeClass("layui-hide");
				$(".saveShow").addClass("layui-hide");
                $('input[type="text"]').attr("readonly",true).addClass("readonly");
                location.reload();
			};



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