|
|
@ -61,31 +61,35 @@ |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">开票公司名称:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="invoiceCompanyName" th:field="*{invoiceCompanyName}" class="form-control" type="text"> |
|
|
|
<select class="form-control" id="invoiceCompanyName" name="invoiceCompanyName" th:field="*{invoiceCompanyName}"> |
|
|
|
<!-- 这里动态生成开票公司名称选项 --> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">开票公司税号:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="invoiceCompanyCode" th:field="*{invoiceCompanyCode}" class="form-control" type="text"> |
|
|
|
<input name="invoiceCompanyCode" th:field="*{invoiceCompanyCode}" class="form-control" type="text" readonly> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">公司开户行:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="depositBank" th:field="*{depositBank}" class="form-control" type="text"> |
|
|
|
<input name="depositBank" th:field="*{depositBank}" class="form-control" type="text" readonly> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">公司开户账号:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text"> |
|
|
|
<input name="bankAccount" th:field="*{bankAccount}" class="form-control" type="text" readonly> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">税率:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text"> |
|
|
|
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" readonly> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
@ -120,19 +124,6 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">业务人员:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="businessMembers" th:field="*{businessMembers}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">申请人:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
|
<input name="applyUser" th:field="*{applyUser}" class="form-control" type="text"> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="form-group"> |
|
|
|
<label class="col-sm-5 control-label">邮箱:</label> |
|
|
|
<div class="col-sm-7"> |
|
|
@ -234,6 +225,8 @@ |
|
|
|
var materialProcessMethodDatas = [[${@dict.getType('processMethod')}]]; |
|
|
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
|
|
|
|
|
|
|
var taxInvoice = [[${taxInvoice}]]; |
|
|
|
|
|
|
|
var prefix = ctx + "system/salesOrder" |
|
|
|
$("#form-taxInvoice-RMBAdd").validate({ |
|
|
|
focusCleanup: true |
|
|
@ -371,6 +364,99 @@ |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取客户发票信息 |
|
|
|
$(document).ready(function() { |
|
|
|
// 初始化时默认加载客户编号列表 |
|
|
|
loadInvoiceCompanyNames(); |
|
|
|
|
|
|
|
// 监听开票公司名称下拉框的变化 |
|
|
|
$('#invoiceCompanyName').on('change', function() { |
|
|
|
var selectedInvoiceCompanyName = $(this).val(); // 获取选中的开票公司名称 |
|
|
|
if (selectedInvoiceCompanyName) { |
|
|
|
// 发起Ajax请求获取客户名称 |
|
|
|
$.ajax({ |
|
|
|
type: 'POST', |
|
|
|
url: ctx + 'system/customer/getSysInvoiceInfoByName', |
|
|
|
dataType: 'json', // 假设返回的数据格式是JSON |
|
|
|
data: { invoiceCompanyName: selectedInvoiceCompanyName }, // 数据放在这里 |
|
|
|
success: function(data) { |
|
|
|
console.log(data); |
|
|
|
// 将获取到的客户名称填充到输入框 |
|
|
|
if (!data || !data.data) { |
|
|
|
// 如果返回的数据有问题,可以给出提示或处理 |
|
|
|
$.modal.alertWarning('未能获取到开票公司信息!'); |
|
|
|
} else { |
|
|
|
fillInvoiceDetails(data.data); |
|
|
|
} |
|
|
|
}, |
|
|
|
error: function(jqXHR, textStatus, errorThrown) { |
|
|
|
console.error('Error:', textStatus, errorThrown); |
|
|
|
$.modal.alertWarning('查询开票公司名称时发生错误!'); |
|
|
|
} |
|
|
|
}); |
|
|
|
} else { |
|
|
|
// 如果没有选择开票公司名称,清开票信息输入框 |
|
|
|
clearInvoiceDetails(); |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
// 封装填充发票详情的函数 |
|
|
|
function fillInvoiceDetails(details) { |
|
|
|
$('input[name="invoiceCompanyCode"]').val(details.invoiceCompanyCode); |
|
|
|
$('input[name="depositBank"]').val(details.depositBank); |
|
|
|
$('input[name="bankAccount"]').val(details.bankAccount); |
|
|
|
} |
|
|
|
|
|
|
|
// 封装清空发票详情的函数 |
|
|
|
function clearInvoiceDetails() { |
|
|
|
$('input[name="invoiceCompanyCode"]').val(''); |
|
|
|
$('input[name="depositBank"]').val(''); |
|
|
|
$('input[name="bankAccount"]').val(''); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 假设的加载客户编号列表函数 |
|
|
|
function loadInvoiceCompanyNames() { |
|
|
|
var enterpriseCode = $("#enterpriseCode").val(); |
|
|
|
var url = ctx + 'system/customer/getAllInvoiceCompanyNameByCode' + '?enterpriseCode=' + enterpriseCode; |
|
|
|
var tempInvoiceCompanyName = taxInvoice.invoiceCompanyName; |
|
|
|
|
|
|
|
$.ajax({ |
|
|
|
type: 'GET', // 请求类型 |
|
|
|
url: url, // 后端接口URL |
|
|
|
dataType: 'json', // 预期服务器返回的数据类型 |
|
|
|
success: function(data) { |
|
|
|
if (data && Array.isArray(data)) { |
|
|
|
var selectElement = $('#invoiceCompanyName'); // 获取开票公司名称下拉框元素 |
|
|
|
// 清空下拉框现有选项 |
|
|
|
selectElement.empty(); |
|
|
|
|
|
|
|
// 添加默认选项 |
|
|
|
if (tempInvoiceCompanyName) { |
|
|
|
selectElement.append('<option value="' + tempInvoiceCompanyName + '">' + tempInvoiceCompanyName + '</option>'); |
|
|
|
} |
|
|
|
|
|
|
|
// 遍历返回的数据,添加为下拉框的选项 |
|
|
|
$.each(data, function(index, item) { |
|
|
|
// 假设item有invoiceCompanyName属性,代表客户名称 |
|
|
|
selectElement.append('<option value="' + item.invoiceCompanyName + '">' + item.invoiceCompanyName + '</option>'); |
|
|
|
}); |
|
|
|
|
|
|
|
// 设置默认值 |
|
|
|
if (tempInvoiceCompanyName) { |
|
|
|
selectElement.val(tempInvoiceCompanyName); |
|
|
|
} |
|
|
|
} else { |
|
|
|
$.modal.errMsg("开票公司信息为空"); |
|
|
|
} |
|
|
|
}, |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</script> |
|
|
|
</body> |
|
|
|
</html> |