万材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.

430 lines
18 KiB

2 years ago
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增产品报价')" />
<th:block th:include="include :: datetimepicker-css" />
</head>
<body class="white-bg">
<div class="row">
<div class="col-sm-12 search-collapse">
<form class="form-horizontal m" id="form-productprice-add">
<div class="form-group">
<label class="col-sm-3 control-label">报价编号:</label>
<div class="col-sm-8">
<input id="SaleOrderID" th:value="${SaleOrderID}" name="SaleOrderID" 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 id="wlCode" name="wlCode" 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 id="itemname" name="Itemname" class="form-control" readonly="readonly" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">规格型号:</label>
<div class="col-sm-8">
<input id="itemstandard" name="Itemstandard" class="form-control" readonly="readonly" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">机种:</label>
<div class="col-sm-8">
<input id="machineNo" name="machineNo" class="form-control" readonly="readonly" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<input id="stockDw" name="stockDw" class="form-control" readonly="readonly" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">币别:</label>
<div class="col-sm-8">
<!--<input id="crlName" name="crlName" class="form-control" type="text">-->
<select name="crlName" class="form-control m-b" th:with="type=${@dict.getType('sys_coin_class')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单价:</label>
<div class="col-sm-8">
<input id="rmbPrice" name="rmbPrice" onchange="myFunction()" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户编号:</label>
<div class="col-sm-8">
<select name="pCode" class="form-control" id="pCode">
<option th:each="a:${wxProduct}" th:value="${a.pCode}" th:text="${a.pCode}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">客户名称:</label>
<div class="col-sm-8">
<select name="pName" class="form-control" id="pName">
<option th:each="a:${wxProduct}" th:value="${a.pCode}" th:text="${a.pName}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">登记人:</label>
<div class="col-sm-8">
<input name="writeMan" th:value="${@permission.getPrincipalProperty('userName')}">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">订价日期:</label>
<div class="col-sm-8">
<div class="input-group date">
<input id="SendDate" name="SendDate" class="form-control" placeholder="yyyy-MM-dd" type="text">
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">税率:</label>
<div class="col-sm-8">
<!--<input id="taxPercent" name="taxPercent" class="form-control" type="text">-->
<select id="taxPercent" name="taxPercent" class="form-control m-b" th:with="type=${@dict.getType('fin_customer_taxPercent')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}"
th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">不含税价:</label>
<div class="col-sm-8">
<input id="noTaxPrice" name="noTaxPrice" 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 id="taxPrice" name="taxPrice" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否含税:</label>
<div class="col-sm-8">
<select id="taxFlag" name="taxFlag" class="form-control m-b">
<option value="0" selected="selected"></option>
<option value="1"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">说明:</label>
<div class="col-sm-8">
<input name="memoText" class="form-control" type="text">
</div>
</div>
</form>
</div>
<!--成品选择弹框-->
<div class="modal inmodal" id="cpModal" tabindex="-1"
role="dilog" aria-hidden="true">
<div class="modal-dialog" style="width: 800px">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"
aria-hidden="true"></button>
<h4 class="modal-title">选择成品</h4>
</div>
<div class="modal-body" style="text-align: center;">
<div class="row">
<div class="col-md-5">
<form id="formId" class="form-group">
<label class="control-label col-md-4">成品代码:</label>
<div class="col-md-8">
<input type="text" class="form-control" name="wlCode"
id="cpCode2">
</div>
</form>
</div>
<div class="col-md-2">
<button type="button" class="btn btn-success" id="cpCodeSearch">搜索</button>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="table-responsive">
<table id="cpTable"
class="table table-striped table-responsive">
</table>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary"
onClick="selWlCode();">选择</button>
<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: bootstrap-table-editable-js" />
<th:block th:include="include :: datetimepicker-css" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "finance/productprice"
Date.prototype.Format = function (fmt) {
var o = {
"M+": this.getMonth() + 1, //月份
"d+": this.getDate(), //日
"H+": this.getHours(), //小时
"m+": this.getMinutes(), //分
"s+": this.getSeconds(), //秒
"q+": Math.floor((this.getMonth() + 3) / 3), //季度
"S": this.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
for (var k in o)
if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
return fmt;
}
$("select#pName").change(function(){
$("#pCode").val($(this).val());
});
$("select#pCode").change(function(){
console.log($(this).find("option:selected").text());
$("#pName").val($(this).find("option:selected").text());
});
// 输入单价就计算含税价(若选择含税)
function myFunction() {
var a = Number($("#rmbPrice").val());
var b = Number($("#taxPercent").val());
$("#noTaxPrice").val(a);
if (Number($("select#taxFlag").val())!==0) {
$("#taxPrice").val(Math.round((a * (b + 1))*100)/100);
// console.log( typeof (a * (b + 1)) )
}
}
// 改变税率计算含税价(若选择含税)
$("#taxPercent").change(function(){
var a = Number($("#rmbPrice").val());
var b = Number($("#taxPercent").val());
if (Number($("select#taxFlag").val())!==0) {
$("#taxPrice").val(Math.round((a * (b + 1))*100)/100);
}
});
// 选择含税则计算含税价
$("select#taxFlag").change(function(){
if ($("select#taxFlag").val()!==0) {
var a = Number($("#rmbPrice").val());
var b = Number($("#taxPercent").val());
$("#noTaxPrice").val(a);
$("#taxPrice").val(Math.round((a * (b + 1))*100)/100);
}
});
// 表单校验
$(function () {
var icon = "<i class='fa fa-times-circle'></i>";
$("#form-productprice-add").validate({
rules:{
SaleOrderID: "required",
wlCode: "required",
pCode:"required",
pName:"required",
crlName: "required",
rmbPrice: "required"
},
messages:{
SaleOrderID: icon + "请输入报价编号",
wlCode:icon + "请输入成品代码",
pCode:"请选择客户编号",
pName:"请选择客户名",
crlName: icon + "请输入币别",
rmbPrice: icon + "请输入单价",
}
})
})
$('#cpTable').bootstrapTable({
url : ctx + "ck/itemCP/list",
method : 'post',
striped : true, // 是否显示行间隔色
cache : false, // 是否使用缓存,默认为true,所以一般情况下需要设置一下这个属性(*)
pagination : true, // 是否显示分页(*)
contentType :"application/x-www-form-urlencoded",
queryParams : function(params) {
var curParams = {
// 传递参数查询参数
pageSize: params.limit,
pageNum: params.offset / params.limit + 1,
searchValue: params.search,
orderByColumn: params.sort,
isAsc: params.order
};
var json= $.extend(curParams, $.common.formToJSON("formId"));
console.log("json"+json);
return json;
},
sidePagination : "server", // 分页方式:client客户端分页,server服务端分页(*)
pageNumber : 1, // 初始化加载第一页,默认第一页
pageSize : 10, // 每页的记录行数(*)
pageList : [ 5, 10,50], // 可供选择的每页的行数(*)
clickToSelect : true, // 是否启用点击选中行
showToggle : false, // 是否显示详细视图和列表视图的切换按钮
cardView : false, // 是否显示详细视图
detailView : false, // 是否显示父子表
smartDisplay : false, // 加了这个才显示每页显示的行数
showExport : false, // 是否显示导出按钮
singleSelect : true,
height:400,
columns : [
{
checkbox: true
},
{
field: 'wldm',
title: '',
visible: false
},
{
field: 'wlCode',
title: '成品代码'
},
{
field: 'hsCode',
title: '',
visible: false
},
{
field: 'itemname',
title: '名称'
},
{
field: 'enName',
title: '',
visible: false
},
{
field: 'itemstandard',
title: '规格型号'
},
{
field: 'machineNo',
title: '机种',
},
{
field: 'stockDw',
title: '库存单位'
},
{
field: 'intakeorchina',
title: '',
visible: false
},
{
field: 'weight',
title: '单位重量'
},
{
field: 'pWldm',
title: '客户料号'
},
{
field: 'pCode',
title: '客户号'
},
{
field: 'pName',
title: '客户名'
}
]
});
//点击成品代码输入栏出模态框
$("#wlCode").focus(function () {
$("#cpModal").modal("show");
});
//点击搜索,刷新表格
$("#cpCodeSearch").click(function () {
$('#cpTable').bootstrapTable('refresh');
});
function selWlCode(){
var row=$('#cpTable').bootstrapTable('getSelections');
console.log("cpTable"+row)
$("#wlCode").val(row[0].wlCode);
$("#itemname").val(row[0].itemname);
$("#itemstandard").val(row[0].itemstandard);
$("#machineNo").val(row[0].machineNo);
$("#stockDw").val(row[0].stockDw);
$("#pCode").val(row[0].pCode);
$("#pName").val(row[0].pName);
$("#cpModal").modal("hide");
}
// 确认提交
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-productprice-add').serialize());
}
}
$("input[name='SendDate']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true,
todayBtn:true
});
var date = new Date().Format("yyyy-MM-dd");
console.log(date)
$("#SendDate").val(date);
// $("input[name='comfirmDate']").datetimepicker({
// format: "yyyy-mm-dd",
// minView: "month",
// autoclose: true
// });
//
// $("input[name='auditingDatetime']").datetimepicker({
// format: "yyyy-mm-dd",
// minView: "month",
// autoclose: true
// });
//
// $("input[name='approveDate']").datetimepicker({
// format: "yyyy-mm-dd",
// minView: "month",
// autoclose: true
// });
</script>
</body>
</html>