王晓迪
3 months ago
6 changed files with 710 additions and 53 deletions
@ -0,0 +1,566 @@ |
|||||
|
<!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="wrapper wrapper-content animated fadeInRight ibox-content"> |
||||
|
<form class="form-horizontal m" id="form-taxInvoice-USDAdd" th:object="${taxInvoice}"> |
||||
|
<input name="taxInvoiceId" th:field="*{taxInvoiceId}" type="hidden"> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">销售订单编号:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="salesOrderCode" th:field="*{salesOrderCode}" 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"> |
||||
|
<select name="salesOrderType" class="form-control m-b" th:with="type=${@dict.getType('sys_order_type')}" readonly> |
||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{salesOrderType}"></option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">报价币种:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<select name="commonCurrency" class="form-control m-b" th:with="type=${@dict.getType('sys_common_currency')}" readonly> |
||||
|
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{commonCurrency}"></option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">客户代码/ID:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="enterpriseCode" th:field="*{enterpriseCode}" 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="enterpriseName" th:field="*{enterpriseName}" 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="contactNumber" th:field="*{contactNumber}" 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="enterpriseAddress" th:field="*{enterpriseAddress}" 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"> |
||||
|
<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" 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" 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" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">税率:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<div class="input-group"> |
||||
|
<input name="taxRate" th:field="*{taxRate}" class="form-control" type="text" readonly> |
||||
|
<span class="input-group-addon">%</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label is-required" >发票种类:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_class')}"> |
||||
|
<input type="radio" th:id="${'taxInvoiceClass_' + dict.dictCode}" name="taxInvoiceClass" th:value="${dict.dictValue}" th:field="*{taxInvoiceClass}" required> |
||||
|
<label th:for="${'taxInvoiceClass_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label is-required">发票类型:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_type')}"> |
||||
|
<input type="radio" th:id="${'taxInvoiceType_' + dict.dictCode}" name="taxInvoiceType" th:value="${dict.dictValue}" th:field="*{taxInvoiceType}" required> |
||||
|
<label th:for="${'taxInvoiceType_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label is-required">发票抬头:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<div class="radio-box" th:each="dict : ${@dict.getType('tax_invoice_title')}"> |
||||
|
<input type="radio" th:id="${'taxInvoiceTitle_' + dict.dictCode}" name="taxInvoiceTitle" th:value="${dict.dictValue}" th:field="*{taxInvoiceTitle}" required> |
||||
|
<label th:for="${'taxInvoiceTitle_' + dict.dictCode}" th:text="${dict.dictLabel}"></label> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">邮箱:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="invoiceEmail" th:field="*{invoiceEmail}" 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="businessRemark" th:field="*{businessRemark}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<h4 class="font-weight-bold">开票物料</h4> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table-material"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<h4 class="font-weight-bold">开票历史</h4> |
||||
|
</div> |
||||
|
<div class="row"> |
||||
|
<div class="col-sm-12 select-table table-striped"> |
||||
|
<table id="bootstrap-table-history"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="container"> |
||||
|
<div class="row"> |
||||
|
<h4 class="font-weight-bold">开票额度</h4> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">不含税总价(美元):</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="noUsdSum" th:field="*{noUsdSum}" 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="usdTaxSum" th:field="*{usdTaxSum}" class="form-control" type="text" id="usdTaxSumInput" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">物料数合计:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="materialSum" th:field="*{materialSum}" 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="enterpriseSum" th:field="*{enterpriseSum}" 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"> |
||||
|
<div class="input-group"> |
||||
|
<input name="invoiceQuotaRatio" th:field="*{invoiceQuotaRatio}" class="form-control" type="text" id="invoiceQuotaRatioInput"> |
||||
|
<span class="input-group-addon">%</span> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">开票金额(美元):</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="invoiceAmountUsd" th:field="*{invoiceAmountUsd}" class="form-control" type="text" id="invoiceAmountUsdInput" readonly> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="form-group"> |
||||
|
<label class="col-sm-5 control-label">开票用途:</label> |
||||
|
<div class="col-sm-7"> |
||||
|
<input name="invoicePurpose" th:field="*{invoicePurpose}" class="form-control" type="text"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</form> |
||||
|
</div> |
||||
|
<th:block th:include="include :: footer" /> |
||||
|
<th:block th:include="include :: datetimepicker-js" /> |
||||
|
<script th:inline="javascript"> |
||||
|
|
||||
|
var materialProcessMethodDatas = [[${@dict.getType('processMethod')}]]; |
||||
|
var materialTypeDatas = [[${@category.getChildByCode('materialType')}]]; |
||||
|
var taxInvoiceStatusDatas = [[${@dict.getType('tax_invoice_status')}]]; |
||||
|
|
||||
|
var taxInvoice = [[${taxInvoice}]]; |
||||
|
|
||||
|
var prefix = ctx + "system/salesOrder" |
||||
|
$("#form-taxInvoice-USDAdd").validate({ |
||||
|
focusCleanup: true |
||||
|
}); |
||||
|
|
||||
|
function submitHandler() { |
||||
|
if ($.validate.form()) { |
||||
|
|
||||
|
//获取表单的数据 |
||||
|
const makeInvoiceRMBData = $('#form-taxInvoice-USDAdd').serializeArray().reduce((obj, item) => { |
||||
|
obj[item.name] = item.value; |
||||
|
return obj; |
||||
|
}, {}); |
||||
|
|
||||
|
var makeInvoiceMaterialTable = $("#bootstrap-table-material").bootstrapTable('getData'); |
||||
|
|
||||
|
//将makeInvoiceMaterialTable转换成和makeInvoiceRMBData一样的形式 |
||||
|
var makeInvoiceMaterialList = makeInvoiceMaterialTable.map(function (item) { |
||||
|
return { |
||||
|
invoiceMaterialId: item.invoiceMaterialId, |
||||
|
materialCode: item.materialCode, |
||||
|
materialName: item.materialName, |
||||
|
materialType: item.materialType, |
||||
|
materialProcessMethod: item.processMethod, |
||||
|
materialBrand:item.brand, |
||||
|
materialUnit: item.unit, |
||||
|
noTaxUsd: item.materialNoUsd, |
||||
|
taxUsd: item.materialUsd, |
||||
|
materialNum: item.materialNum, |
||||
|
outBoundQuantity: item.outBoundQuantity, |
||||
|
hasCheckNum: item.hasCheckNum, |
||||
|
refundsNum: item.refundsNum |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
const combinedData = Object.assign(makeInvoiceRMBData, { |
||||
|
invoiceMaterialList: makeInvoiceMaterialList |
||||
|
}); |
||||
|
|
||||
|
const jsonData = JSON.stringify(combinedData); |
||||
|
|
||||
|
$.operate.saveJson(prefix + "/makeInvoice",jsonData); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
|
||||
|
//开票物料 |
||||
|
$(function() { |
||||
|
var options = { |
||||
|
id: 'bootstrap-table-material', |
||||
|
url: prefix + "/getSalesOrderChildListByCode", |
||||
|
queryParams: function(params) { |
||||
|
return { |
||||
|
salesOrderCode: $("#salesOrderCode").val(), |
||||
|
} |
||||
|
}, |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
pagination: false, // 设置不分页 |
||||
|
modalName: "国税发票物料", |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
title: '国税发票物料ID', |
||||
|
field: 'invoiceMaterialId', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料编号', |
||||
|
field: 'materialCode', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料名称', |
||||
|
field: 'materialName', |
||||
|
}, |
||||
|
{ |
||||
|
field: 'materialType', |
||||
|
title: '物料类型', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectCategoryLabel(materialTypeDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料加工方式', |
||||
|
field: 'processMethod', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(materialProcessMethodDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料品牌', |
||||
|
field: 'brand', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料图片', |
||||
|
field: 'photourl', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料单位', |
||||
|
field: 'unit', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料描述', |
||||
|
field: 'describe', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料的数量', |
||||
|
field: 'materialNum', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料的含税单价(美元)', |
||||
|
field: 'materialUsd', |
||||
|
}, |
||||
|
{ |
||||
|
title: '物料的不含税单价(美元)', |
||||
|
field: 'materialNoUsd', |
||||
|
}, |
||||
|
{ |
||||
|
title: '已出库数量', |
||||
|
field: 'outBoundQuantity', |
||||
|
}, |
||||
|
{ |
||||
|
title: '已验收数', |
||||
|
field: 'hasCheckNum', |
||||
|
}, |
||||
|
{ |
||||
|
title: '退货数', |
||||
|
field: 'refundsNum', |
||||
|
}] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
//开票历史 |
||||
|
$(function() { |
||||
|
var options = { |
||||
|
id: 'bootstrap-table-history', |
||||
|
url: prefix + "/getInvoiceHistoryListBySalesOrderCode", |
||||
|
queryParams: function(params) { |
||||
|
return { |
||||
|
salesOrderCode: $("#salesOrderCode").val(), |
||||
|
} |
||||
|
}, |
||||
|
showSearch: false, |
||||
|
showRefresh: false, |
||||
|
showToggle: false, |
||||
|
showColumns: false, |
||||
|
pagination: false, // 设置不分页 |
||||
|
modalName: "国税发票历史记录", |
||||
|
columns: [{ |
||||
|
checkbox: true |
||||
|
}, |
||||
|
{ |
||||
|
title: '国税发票历史id', |
||||
|
field: 'invoiceHistoryId', |
||||
|
visible: false |
||||
|
}, |
||||
|
{ |
||||
|
title: '申请时间', |
||||
|
field: 'applyTime', |
||||
|
}, |
||||
|
{ |
||||
|
title: '国税发票单号', |
||||
|
field: 'taxInvoiceCode', |
||||
|
}, |
||||
|
{ |
||||
|
title: '开票额度比例', |
||||
|
field: 'invoiceQuotaRatio', |
||||
|
formatter: function (value,row,index){ |
||||
|
if (value == null || value == ''){ |
||||
|
return '/'; |
||||
|
}else{ |
||||
|
return value + "%"; |
||||
|
} |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '开票金额(美元)', |
||||
|
field: 'invoiceAmountUsd', |
||||
|
}, |
||||
|
|
||||
|
{ |
||||
|
title: '开票用途', |
||||
|
field: 'invoicePurpose', |
||||
|
}, |
||||
|
{ |
||||
|
title: '发票状态', //(0待审核、1待开具、2已开具、3审核拒绝) |
||||
|
field: 'taxInvoiceStatus', |
||||
|
formatter: function(value, row, index) { |
||||
|
return $.table.selectDictLabel(taxInvoiceStatusDatas, value); |
||||
|
} |
||||
|
}, |
||||
|
{ |
||||
|
title: '财务员', |
||||
|
field: 'financeMembers', |
||||
|
}, |
||||
|
{ |
||||
|
title: '操作', |
||||
|
align: 'center', |
||||
|
formatter: function(value, row, index) { |
||||
|
var actions = []; |
||||
|
actions.push('<a class="btn btn-success btn-xs " href="javascript:void(0)" onclick="$.operate.edit(\'' + row.invoiceHistoryId + '\')"><i class="fa fa-edit"></i>详情</a> '); |
||||
|
return actions.join(''); |
||||
|
} |
||||
|
}] |
||||
|
}; |
||||
|
$.table.init(options); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
//获取客户发票信息 |
||||
|
$(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("开票公司信息为空"); |
||||
|
} |
||||
|
}, |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
//通过监听额度比例输入框的值,动态计算开票金额 |
||||
|
$(document).ready(function() { |
||||
|
|
||||
|
var invoiceAmountUsdInput = $('#invoiceAmountUsdInput'); |
||||
|
var invoiceQuotaRatioInput = $('#invoiceQuotaRatioInput'); |
||||
|
var usdTaxSumInput = $('#usdTaxSumInput'); |
||||
|
|
||||
|
//监听开票额度比例输入框的变化 |
||||
|
invoiceQuotaRatioInput.on('input', function() { |
||||
|
var usdTaxSum = parseFloat(usdTaxSumInput.val()); |
||||
|
var invoiceQuotaRatio = parseFloat($(this).val()); |
||||
|
if (!isNaN(usdTaxSum) && !isNaN(invoiceQuotaRatio)) { |
||||
|
//计算开票金额 = 税前总额 * 开票比例 |
||||
|
var invoiceAmountUsd = usdTaxSum * (invoiceQuotaRatio / 100); |
||||
|
//更新开票金额输入框 |
||||
|
invoiceAmountUsdInput.val(invoiceAmountUsd.toFixed(2)); |
||||
|
} else { |
||||
|
invoiceAmountUsdInput.val(''); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
Loading…
Reference in new issue