<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
<title>物流运费管理</title>
<meta name="decorator" content="default"/>
<script src="/web/static/jquery/jquery-1.8.3.min.js" type="text/javascript"></script>
<link href="/web/static/bootstrap/2.3.1/css_cerulean/bootstrap.min.css" type="text/css" rel="stylesheet" />
<script src="/web/static/bootstrap/2.3.1/js/bootstrap.min.js" type="text/javascript"></script>
<link href="/web/static/bootstrap/2.3.1/awesome/font-awesome.min.css" type="text/css" rel="stylesheet" />
<!--[if lte IE 7]><link href="/web/static/bootstrap/2.3.1/awesome/font-awesome-ie7.min.css" type="text/css" rel="stylesheet" /><![endif]-->
<!--[if lte IE 6]><link href="/web/static/bootstrap/bsie/css/bootstrap-ie6.min.css" type="text/css" rel="stylesheet" />
<script src="/web/static/bootstrap/bsie/js/bootstrap-ie.min.js" type="text/javascript"></script><![endif]-->
<link href="/web/static/jquery-select2/3.4/select2.min.css" rel="stylesheet" />
<script src="/web/static/jquery-select2/3.4/select2.min.js" type="text/javascript"></script>
<link href="/web/static/jquery-validation/1.11.0/jquery.validate.min.css" type="text/css" rel="stylesheet" />
<script src="/web/static/jquery-validation/1.11.0/jquery.validate.min.js" type="text/javascript"></script>
<link href="/web/static/jquery-jbox/2.3/Skins/Bootstrap/jbox.min.css" rel="stylesheet" />
<script src="/web/static/jquery-jbox/2.3/jquery.jBox-2.3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
//$("#name").focus();
$("#inputForm").validate({
submitHandler: function(form){
loading('正在提交,请稍等...');
form.submit();
},
errorContainer: "#messageBox",
errorPlacement: function(error, element) {
$("#messageBox").text("输入有误,请先更正。");
if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
error.appendTo(element.parent().parent());
} else {
error.insertAfter(element);
}
}
});
$('#mySelect').select2({
placeholder:'请选择',//默认文字提示
// tags: true,//允许手动添加
//allowClear: true,//允许清空
});
$('#mySelect2').select2({
placeholder:'请选择',//默认文字提示
// tags: true,//允许手动添加
//allowClear: true,//允许清空
});
//当页面加载好,ajax异步请求后台查询所有公司id接口
$.ajax({
url:"/web/a/logistics/channel/logisticsChannel/channelIds",
type: 'post',
data: {
},
async: true, //如果不加,无法实现数据传值 false就是同步请求,true 是异步请求
dataType: 'json',
success:function(data){
console.log(data)
$(data).each(function (key) { //循环读取后台传来的Json数据
var id = data[key].id; //公司id
var channelName = data[key].channelName; //公司名称
$('#mySelect').append("<option value='" + id + "'>" + channelName + "</option>");
});
//$('#mySelect').select2('val','val1');
}
})
$("#mySelect").on('change',function(){
//alert($("#mySelect option:selected").attr("value"))
var id = $("#mySelect option:selected").attr("value")
$.ajax({
url:"/web/a/logistics/channelarea/logisticsChannelArea/areaIds2?channelId="+id,
type: 'post',
data: {
},
async: true, //如果不加,无法实现数据传值 false就是同步请求,true 是异步请求
dataType: 'json',
success:function(data){
//清空下拉框原来options
$("#mySelect2").empty()
$("#mySelect2").select2("data",null)
$('#mySelect2').append("<option value='' selected='selected' style='display: none'></option>");
// alert($("#mySelect2 option:selected").attr("value"))
//alert("后端接受"+id)
//console.log(data)
$(data).each(function (key) { //循环读取后台传来的Json数据
var id = data[key].id; //公司id
var channelAreaName = data[key].channelAreaName; //公司名称
$('#mySelect2').append("<option value='" + id + "'>" + channelAreaName + "</option>");
});
}
})
})
})
</script>
</head>
<body>
<ul class="nav nav-tabs">
<li><a href="${ctx}/logistics/prices/logisticsPrices/">物流运费管理</a></li>
<li class="active"><a href="${ctx}/logistics/prices/logisticsPrices/toAdd?id=${logisticsPrices.id}">物流运费管理<shiro:hasPermission name="logistics:prices:logisticsPrices:edit">${not empty logisticsPrices.id?'修改':'添加'}</shiro:hasPermission><shiro:lacksPermission name="logistics:prices:logisticsPrices:edit">查看</shiro:lacksPermission></a></li>
</ul><br/>
<form:form id="inputForm" modelAttribute="logisticsPrices" action="${ctx}/logistics/prices/logisticsPrices/add" method="post" class="form-horizontal">
<form:hidden path="id"/>
<sys:message content="${message}"/>
<div class="control-group">
<label class="control-label">渠道名称:</label>
<div class="controls">
<select id="mySelect" class="select2" style="width: 200px;height: 30px;" name="channelId" required="true">
<option value=""></option>
</select>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">分组名称:</label>
<div class="controls">
<select id="mySelect2" class="select2" style="width: 200px;height: 30px;" name="channelAreaId" required="true">
<option value="" ></option>
</select>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">最小重量:</label>
<div class="controls">
<form:input path="minWeight" htmlEscape="false" class="input-xlarge number" required="true"/>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">最大重量:</label>
<div class="controls">
<form:input path="maxWeight" htmlEscape="false" class="input-xlarge number" required="true"/>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="control-group">
<label class="control-label">物流价格:</label>
<div class="controls">
<form:input path="prices" htmlEscape="false" class="input-xlarge " required="true"/>
<span class="help-inline"><font color="red">*</font> </span>
</div>
</div>
<div class="form-actions">
<shiro:hasPermission name="logistics:prices:logisticsPrices:edit"><input id="btnSubmit" class="btn btn-primary" type="submit" value="保 存"/> </shiro:hasPermission>
<input id="btnCancel" class="btn" type="button" value="返 回" onclick="history.go(-1)"/>
</div>
</form:form>
</body>
</html>