万材erp项目
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

125 lines
5.2 KiB

2 years ago
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增送货地址')" />
<link th:href="@{/ajax/libs/select2/select2.css}" rel="stylesheet">
<link th:href="@{/ajax/libs/select2/select2-bootstrap.css}" rel="stylesheet">
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-shippingaddress-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户/企业代码:</label>
<div class="col-sm-8">
<select name="enterpriseCode" class="form-control m-b" required>
<option value="">请选择客户代码</option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">客户/企业名称:</label>
<div class="col-sm-8">
<input name="enterpriseName" class="form-control" type="text" required readonly>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">联系人电话:</label>
<div class="col-sm-8">
<input name="customerPhone" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">联系人:</label>
<div class="col-sm-8">
<input name="customerName" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label is-required">送货地址:</label>
<div class="col-sm-8">
<input name="deliveryAddress" class="form-control" type="text" required>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">联系人2:</label>
<div class="col-sm-8">
<input name="customerNameTwo" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">详细描述:</label>
<div class="col-sm-8">
<input name="detailedDescription" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">厂区:</label>
<div class="col-sm-8">
<input name="plantArea" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">邮编:</label>
<div class="col-sm-8">
<input name="postalCode" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">传真:</label>
<div class="col-sm-8">
<input name="customerFax" class="form-control" type="text">
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js"/>
<script th:inline="javascript">
var prefix = ctx + "system/shippingaddress"
$("#form-shippingaddress-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-shippingaddress-add').serialize());
}
}
//客户信息
var customerodata = []
$.ajax({
url: ctx + "system/customer/list",
type: "POST",
success: function (res) {
// console.log(res)
if (res.rows.length > 0) {
customerodata = res.rows;
//alert(JSON.stringify(data));
console.log(res.rows)
for (let i in customerodata) {
$("select[name='enterpriseCode']").append("<option value='" + customerodata[i].enterpriseCode + "'>" + customerodata[i].enterpriseCode + "</option>");
}
} else {
$.modal.msgError(res.msg);
}
},
error: function () {
$.modal.msgError("后台出错啦!");
}
})
$("select[name='enterpriseCode']").change(function () {
var enterpriseCode = $(this).val();
for (i = 0; i < customerodata.length; i++) {
if (customerodata[i].enterpriseCode === enterpriseCode) {
$("input[name='enterpriseName']").val(customerodata[i].enterpriseName)
}
}
})
</script>
</body>
</html>