<style>.chargeable-weight-calculator .inner-container { box-shadow: 0px 4px 12px -3px rgba(0, 0, 0, 0.05), 0px 2px 5px 0px rgba(0, 0, 0, 0.14); padding: 24px; } .chargeable-weight-calculator .category-selection { display: flex; position: relative; align-items: baseline; gap: 4px; } input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; } input[type="number"] { -moz-appearance: textfield; } h2.mode-selection-label, h2.category-label { font-size: 20px; font-weight: 500; margin-bottom: 15px; } .ups-checkbox-group label:before, .ups-radio-group label:before { content: ""; width: 1.5rem; height: 1.5rem; position: absolute; border: 0.0625rem solid #5f5753; background-color: #fff; left: 0; } .ups-radio-group .ups-radio-custom-label:before { border-radius: 50%; } .chargeable-weight-calculator .ups-radio-group label { display: flex; padding-left: 2rem; position: relative; } .chargeable-weight-calculator .ups-radio-group label .mode-label { width: 90%; } .chargeable-weight-calculator .ups-radio-group .ups-radio-custom:checked+label:before { border: 8px solid #0662BB; } .category-selection .category-btn-grp { display: flex; border: 1px solid #0662BB; border-radius: 30px; padding: 11px 2px; height: 48px; cursor: pointer; list-style-type: none; margin: 0; margin-bottom: 1rem; } .category-btn { border: none; border-radius: 30px; padding: 10px; background: transparent; font-weight: 400; color: #5f5753; } .category-active { color: #fff !important; background: #0662BB !important; } .chargeable-weight-calculator .mode-selection .radio-container .ups-form_group.ups-radio-group { flex-direction: row; } .mode-selection-container { margin-bottom: 50px; } .mode-selection { max-width: 24%; width: 100%; box-shadow: 0 3px 6px #00000029; padding: 15px 10px; border: 2px solid transparent; border-radius: 4px; font-family: 'UPSROBOTO'; font-weight: 500; } .mode-selection:has(input:checked) { border: 2px solid #0662BB; } .chargeable-weight-calculator .radio-container .ups-form_group.ups-radio-group { display: flex; flex-direction: row; gap: 1rem; } .radio-container .ups-form_group .ups-buttonList_wrapper label p { margin-bottom: 0; } .chargeable-weight-calculator .package-details { display: flex; position: relative; gap: 20px; } .chargeable-weight-calculator .package-details.errorMargin { margin-bottom: 30px; } .chargeable-weight-calculator .package-details .dropdown-container { max-width: 160px; width: 100%; } .chargeable-weight-calculator ul.input-controls-container { list-style-type: none; display: flex; padding-left: 0; gap: 8px; margin: 0; } .close-package-details.icon.ups-icon-close { position: absolute; right: -20px; top: 15px; cursor: pointer; } .scn-cta-preicon { border: 2px solid; padding: 0px 5px; border-radius: 50%; } .scn-cta-preicon:hover { text-decoration: none; } ul.result-calculation { list-style-type: none; display: flex; background: #f2f1ef; padding: 20px; margin-top: 2rem; border-radius: 4px; } li.value { width: 25%; } .value p { font-size: 16px; color: #5f5753; font-weight: 500; } .value h4 { font-size: 32px; font-weight: 400; color: #000; } .cargo-details, .shipment-details { display: none; width: 100%; } .is-visible { display: block !important; } .error-msg { color: #df2901; font-size: 14px; font-weight: 500; margin: 5px 0; display: none; } .chargeable-weight-calculator .ups-component.promo-teaser { padding-top: 1rem; padding-bottom: 1rem; } .disclaimer { margin-top: 10px; color: #757575; line-height: 16px; } .cross-icon { font-size: 12px; padding: 18px 0; } @media (max-width: 767px) { .chargeable-weight-calculator .radio-container .ups-form_group.ups-radio-group { flex-direction: column; } .mode-selection, .chargeable-weight-calculator .package-details .dropdown-container { max-width: 100%; } .chargeable-weight-calculator .category-selection, .chargeable-weight-calculator .package-details, .chargeable-weight-calculator ul.input-controls-container { flex-direction: column; } .close-package-details.icon.ups-icon-close { right: -20px; } ul.result-calculation { flex-wrap: wrap; } li.value { width: 50%; } } .ups-input_wrapper.ups-buttonList_wrapper.mode-selection { position: relative; font-family: 'roboto'; } input.ups-radio-custom { position: absolute; } .ups-form_group { position: relative; margin-bottom: 1rem; } .ups-form_group.ups-dropdown-control { position: relative; } .ups-dropdown-control label.ups-form_label { position: absolute; top: 0.125rem; font-size: 0.75rem; font-weight: 500; padding: 0; left: 0.75rem; color: #5f5753; z-index: 5; line-height: 1.5rem; } select.ups-dropdown { padding: 1.5rem 2rem 0.5rem 0.75rem; } .banner-wrapper { display: flex; background-image: linear-gradient(304.78deg, #326a9f -12.16%, #397ab7 61.1%); color: #fff; padding: 1.5rem 4rem; align-items: center; gap: 2rem; } .banner-header h2 { font-size: 2rem; } .banner-btn { width: 25%; text-align: right; } .ups-form_group.ups-input .ups-input_wrapper input { padding: 1.5rem 2rem 0.5rem 0.75rem; background: transparent; } .ups-form_group.ups-input .ups-input_wrapper label { position: absolute; color: var(--gray-1); inset-inline-start: .5rem; top: 2rem; transform: translateY(-50%); transition: all .3s; z-index: -1; } .ups-form_group.ups-input .ups-input_wrapper input:focus+label, .ups-form_group.ups-input .ups-input_wrapper input.has-value+label { top: .25rem; transform: none; font-size: .75rem; font-weight: 500; } </style>
<div class="chargeable-weight-calculator ups-container"><div class=inner-container><div class=mode-selection-container><h2 class=mode-selection-label>选择模式</h2><div class=radio-container><fieldset aria-label="Mode Selection"class="ups-form_group ups-radio-group"role=radiogroup><div class="ups-input_wrapper ups-buttonList_wrapper mode-selection"><input data-name=mode-selection-group name=mode-selection type=radio class="ups-analytics ups-radio-custom"id=iaf-mode value=iaf-mode checked> <label class=ups-radio-custom-label for=iaf-mode><div class=mode-label>国际空运<br><br><span class="dim iaf">1:6000</span></div><img alt=""src=https://www.ups.com/assets/resources/webcontent/supplychain/images/ups-international-shipping-plane-globe.svg style=width:56px></label></div><div class="ups-input_wrapper ups-buttonList_wrapper mode-selection"><input data-name=mode-selection-group name=mode-selection type=radio class="ups-analytics ups-radio-custom"id=naaf-mode value=naaf-mode> <label class=ups-radio-custom-label for=naaf-mode><div class=mode-label>北美空运<br><br><span class="dim naaf">1:5000</span></div><img alt=""src=https://www.ups.com/assets/resources/webcontent/supplychain/images/ups-international-shipping-plane-globe.svg style=width:56px></label></div><div class="ups-input_wrapper ups-buttonList_wrapper mode-selection"><input data-name=mode-selection-group name=mode-selection type=radio class="ups-analytics ups-radio-custom"id=express-mode value=express-mode> <label class=ups-radio-custom-label for=express-mode><div class=mode-label>快递<br><br><span class="dim express">1:5000</span></div><img alt=""src=https://www.ups.com/assets/resources/webcontent/supplychain/images/express-icon.svg style=width:56px></label></div><div class="ups-input_wrapper ups-buttonList_wrapper mode-selection"><input data-name=mode-selection-group name=mode-selection type=radio class="ups-analytics ups-radio-custom"id=oceanlcl-mode value=oceanlcl-mode> <label class=ups-radio-custom-label for=oceanlcl-mode><div class=mode-label>海运 LCL<br><br><span class="dim ocean">1:1000</span></div><img alt=""src=https://www.ups.com/assets/resources/webcontent/supplychain/images/ups-ocean-ship.svg style=width:56px></label></div></fieldset></div></div><div class=category-selection><h2 class=category-label>尺寸计算方式</h2><ul class=category-btn-grp><li><span id=cargo-details-btn class="category-btn category-active">货物详情</span><li><span id=shipment-details-btn class=category-btn>货件总数</span></ul></div><div class=calculator-details><div class="cargo-details is-visible"data-type=Cargo><div class=radio-container><fieldset aria-label="Unit Selection"class="ups-form_group ups-radio-group"role=radiogroup><div class="ups-input_wrapper ups-buttonList_wrapper"><input data-name=radio_group name=cargoDetails type=radio class="ups-analytics ups-radio-custom"id=radio-cargoDetails-0 value=KG_M checked> <label class="ups-radio-custom-label updateForm"for=radio-cargoDetails-0>公斤/厘米</label></div><div class="ups-input_wrapper ups-buttonList_wrapper"><input data-name=radio_group name=cargoDetails type=radio class="ups-analytics ups-radio-custom"id=radio-cargoDetails-1 value=LB_INCH> <label class="ups-radio-custom-label updateForm"for=radio-cargoDetails-1>磅/英寸</label></div></fieldset></div><div class=caculation-result-section><div class=cargo-details-package-container><div class=package-details id=cargo-package-details><input id=hiddenInput type=hidden class="validateKeypress hidden"><div class=dropdown-container><div class="ups-form_group ups-dropdown-control"data-plugin=formDropdown><label class=ups-form_label for=dropdown1>类型</label><div class="ups-input_wrapper ups-dropdown_wrapper"><select class=ups-dropdown name=selectCargoItems><option value=Loose/Boxes>散装盒子<option value=Pallets>托盘</select></div></div></div><ul class=input-controls-container><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Quantity data-name="Number of Pieces"name=cargo-quantity type=number class="ups-form_input validateKeypress validatekeydown"min=0 data-maxlength=999 data-type=quantity><label class=ups-form_label for=quantity>数量</label><span id=errorCargoQuantity class=error-msg>数量值应少于 9999</span></div></li><span class="icon cross-icon ups-icon-close"></span><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Weight data-name="Weight Per Piece"name=cargo-weight type=number class="ups-form_input validateKeypress validatekeydown"min=0 data-maxlength=99999 data-type=weight><label class=ups-form_label for=weight>重量(<span id=cargo-weight-unit class=cargo-weight-unit>公斤</span>)</label><span id=errorCargoWeight class=error-msg>重量值应少于 99999</span></div><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Length data-name="Input length"name=cargo-length type=number class="ups-form_input validateKeypress validatekeydown"min=0 data-maxlength=999 data-type=length><label class=ups-form_label for=length>长度(<span id=cargo-length-unit class=cargo-length-unit>厘米</span>)</label> <span id=errorCargoLength class=error-msg>长度值应少于 999</span></div></li><span class="icon cross-icon ups-icon-close"></span><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Width data-name="Input width"name=cargo-width type=number class="ups-form_input validateKeypress validatekeydown"min=0 data-maxlength=999 data-type=width><label class=ups-form_label for=width>宽度(<span id=cargo-width-unit class=cargo-width-unit>厘米</span>)</label> <span id=errorCargoWidth class=error-msg>宽度值应少于 999</span></div></li><span class="icon cross-icon ups-icon-close"></span><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=height data-name="Input height"name=cargo-height-kgcm type=number class="ups-form_input validateKeypress validatekeydown"min=0 data-maxlength=999 data-type=height><label class=ups-form_label for=height>高度(<span id=cargo-height-unit class=cargo-height-unit>厘米</span>)</label> <span id=errorCargoHeightKGCM class=error-msg>高度值应少于 999</span></div></ul></div></div></div><div class=add-item-cta><a class="ups-analytics ups-cta ups-cta-secondary"href=javascript:; onclick=addCargoItem()><span class=scn-cta-preicon>+</span> 添加其他货物项目</a></div><ul class=result-calculation><li class=value><p>总量<h4><span id=cargo-total-quantity>0</span></h4><li class=value><p>总体积<h4><span id=cargo-total-volume>0 </span><span id=cargo-total-volume-unit>立方米</span><sup></sup></h4><li class=value><p>总重<h4><span id=cargo-total-weight>0 </span><span id=cargo-total-weight-unit>公斤</span></h4><li class=value><p>体积重量<h4><span id=cargo-dimensional-weight>0 </span><span id=cargo-dimensional-weight-unit>公斤</span></h4><li class=value><p>预计计费重量<h4><span id=cargo-est-chargeable-weight>0 </span><span id=cargo-est-charge-weight-unit>公斤</span></h4></ul></div><div class=shipment-details><div class=radio-container><fieldset aria-label="Unit Selection"class="ups-form_group ups-radio-group"role=radiogroup><div class="ups-input_wrapper ups-buttonList_wrapper"><input data-name=radio_group name=shipmentDetails type=radio class="ups-analytics ups-radio-custom"id=radio-shipmentDetails-0 value=KG_M3 checked> <label class=ups-radio-custom-label for=radio-shipmentDetails-0>kg/m<sup>3</sup></label></div><div class="ups-input_wrapper ups-buttonList_wrapper"><input data-name=radio_group name=shipmentDetails type=radio class="ups-analytics ups-radio-custom"id=radio-shipmentDetails-1 value=LB_FT3 onclick=calculateShipmentTotalVolume(),calculateShipmentDimWeight(),calculateShipmentChargeableWeight()> <label class=ups-radio-custom-label for=radio-shipmentDetails-1>lb/ft<sup>3</sup></label></div></fieldset></div><div class=caculation-result-section><div class="ups-analytics shipment-details-package-container"><div class="package-details shipment"id=shipment-package-details><div class=dropdown-container><div class="ups-form_group ups-dropdown-control"data-plugin=formDropdown><label class=ups-form_label for=dropdown1>类型</label><div class="ups-input_wrapper ups-dropdown_wrapper"><select class=ups-dropdown name=selectCargoItems><option value=Loose/Boxes>散装盒子<option value=Pallets>托盘</select> </div></div></div><ul class=input-controls-container><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Quantity name=shipment-quantity type=number class=ups-form_input min=0 oninput=calculateShipmentTotalQuantity(),calculateShipmentTotalWeight() onkeypress=return/[0-9a-zA-Z]/i.test(event.key)><label class=ups-form_label for=quantity>总量</label><span id=errorShipmentQuantity class=error-msg>数量值应少于 999</span></div><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Weight name=shipment-weight type=number min=0 oninput=calculateShipmentTotalWeight() onkeypress=return/[0-9a-zA-Z]/i.test(event.key) id=ups-form_input><label class=ups-form_label for=weight>总重量(<span id=shipment-weight-unit>公斤</span>)</label><span id=errorShipmentWeight class=error-msg>重量值应少于 99999</span></div><li class="ups-form_group ups-input"data-plugin=inputControl><div class="ups-input_wrapper ups-text_wrapper"><input data-name=Volume name=shipment-volume type=number class=ups-form_input min=0 oninput=calculateShipmentTotalVolume(),calculateShipmentDimWeight(),calculateShipmentChargeableWeight() onkeypress=return/[0-9a-zA-Z]/i.test(event.key)><label class=ups-form_label for=volume>总体积(<span id=shipment-volume-unit>立方米</span><sup></sup>)</label><span id=errorShipmentVolume class=error-msg>体积应少于 999999999</span></div></ul></div></div></div><ul class=result-calculation><li class=value><p>总量<h4><span id=shipment-total-quantity>0</span></h4><li class=value><p>总体积<h4><span id=shipment-total-volume>0 </span><span id=shipment-total-volume-unit>立方米</span><sup></sup></h4><li class=value><p>总重<h4><span id=shipment-total-weight>0 </span><span id=shipment-total-weight-unit>公斤</span></h4><li class=value><p>体积重量<h4><span id=shipment-dimensional-weight>0 </span><span id=shipment-dimensional-weight-unit>公斤</span></h4><li class=value><p>预计计费重量<h4><span id=shipment-est-charge-weight>0 </span><span id=shipment-est-charge-weight-unit>公斤</span></h4></ul></div></div><div class=ups-banner id=chargeable-promo-banner><div class=banner-wrapper><div class=banner-body-container><div class=banner-header><h2>获取准确报价</h2></div><div class=banner-body-content><p>若要发运您的货件,请在 UPS<sup>®</sup> Forwarding Hub 发运平台输入您的货件详情,然后我们将传输尺寸信息。</div></div><div class=banner-btn><p><a class="ups-analytics ups-cta ups-cta-primary"href=https://scsapps.ups.com/forwardinghub/cn/zh/quotes/ aria-label="Get an Exact Quote"data-utg-link-name=Ship_Your_Freight data-utg-onsite-ad-position=1 id=submit target=_blank>发运您的货件<span class="icon ups-icon-right-arrow"aria-hidden=true></span></a></div></div></div><div class=ups-banner id=chargeable-promo-banner-ocean style=display:none><div class=banner-wrapper><div class=banner-body-container><div class=banner-header><h2>准备好发运您的海运货件了吗?</h2></div><div class=banner-body-content><p>若要发运您的货件,请在 UPS<sup>®</sup> Forwarding Hub 发运平台输入您的货件详情,然后我们将传输尺寸信息。</div></div><div class=banner-btn><p><a class="ups-analytics ups-cta ups-cta-primary"href=https://scsapps.ups.com/forwardinghub/cn/zh/quotes/ aria-label="Get an Exact Quote"data-utg-link-name=Ship_Your_Freight data-utg-onsite-ad-position=1 id=submit-ocean target=_blank>发运您的货件<span class="icon ups-icon-right-arrow"aria-hidden=true></span></a></div></div></div><div class=disclaimer><small><em>请注意:此计算器和培训内容仅供参考和估算值用途。UPS 不对计算器或培训内容的准确性作出任何陈述。若非 UPS 明确书面同意,否则该估算值在任何情况下均不对 UPS 具有约束力。实际重量和费用可能有所不同,并可能随时更改,恕不另行通知。</em></small></div></div></div>
<script>
$(".ups-radio-custom").change(function () {
if ($(this).parents(".cargo-details").hasClass('is-visible')) {
$(".validateKeypress.hidden:last-child").trigger('blur');
var parent = $(".validateKeypress.hidden:last").parents(".package-details");
$(this).focus();
calculateCargoDetails(parent);
}
});
let DIMFactor = 6000;
let selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value;
let selectedShipmentUnit = document.querySelector("input[name='shipmentDetails']:checked").value;
function cargoKGCM() {
if (selectedMode == "iaf-mode") {
DIMFactor = 6000;
} else if (selectedMode == "naaf-mode" || selectedMode == "express-mode") {
DIMFactor = 5000;
} else {
DIMFactor = 1000;
}
return DIMFactor;
}
function cargoLBIN() {
if (selectedMode == "iaf-mode") {
DIMFactor = 166;
} else if (selectedMode == "naaf-mode" || selectedMode == "express-mode") {
DIMFactor = 139;
} else {
DIMFactor = 40;
}
return DIMFactor;
}
function shipmentKGM() {
if (selectedMode == "iaf-mode") {
DIMFactor = 6000;
} else if (selectedMode == "naaf-mode" || selectedMode == "express-mode") {
DIMFactor = 5000;
} else {
DIMFactor = 1000;
}
return DIMFactor;
}
function shipmentLBFT() {
if (selectedMode == "iaf-mode") {
DIMFactor = 166;
} else if (selectedMode == "naaf-mode" || selectedMode == "express-mode") {
DIMFactor = 139;
} else {
DIMFactor = 40;
}
return DIMFactor;
}
function runDIMFunction() {
selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value;
selectedShipmentUnit = document.querySelector("input[name='shipmentDetails']:checked").value;
let selectedCategoryId = document.getElementsByClassName("category-active")[0].id;
let selectedUnit;
if (selectedCategoryId == "shipment-details-btn") {
selectedUnit = selectedShipmentUnit;
if (selectedShipmentUnit == "KG_M3") {
shipmentKGM();
} else if (selectedShipmentUnit == "LB_FT3") {
shipmentLBFT();
}
} else if (selectedCategoryId == "cargo-details-btn") {
selectedUnit = selectedCargoUnit;
if (selectedCargoUnit == "KG_M") {
cargoKGCM();
} else if (selectedCargoUnit == "LB_INCH") {
cargoLBIN();
}
}
}
function reCalculatedTargetvalue() {
let parent;
if ($("#cargo-details-btn").hasClass("category-active")) {
parent = $(".package-details:not(.shipment)")
calculateCargoDetails();
} else {
parent = $(".package-details.shipment")
}
}
let categoryBtn = document.getElementsByClassName("category-btn");
let categoryCargoDetails = document.getElementsByClassName("cargo-details");
let categoryShipmentDetails = document.getElementsByClassName("shipment-details");
let categoryActive = document.getElementsByClassName("category-active");
for (let j = 0; j < categoryBtn.length; j++) {
categoryBtn[j].onclick = function () {
for (element of categoryActive) {
element.classList.remove("category-active");
this.classList.add("category-active");
runDIMFunction();
}
if (j == 1) {
categoryCargoDetails[0].classList.remove("is-visible");
categoryShipmentDetails[0].classList.add("is-visible");
} else if (j == 0) {
categoryShipmentDetails[0].classList.remove("is-visible");
categoryCargoDetails[0].classList.add("is-visible");
}
let dimPermode = updateDIMonModes();
reCalculatedTargetvalue();
}
}
let modeSelection = document.getElementsByName("mode-selection");
let selectedMode = document.querySelector("input[name='mode-selection']:checked").value;
for (let i = 0; i < modeSelection.length; i++) {
modeSelection[i].onclick = function () {
selectedMode = document.querySelector("input[name='mode-selection']:checked").value;
selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value;
selectedShipmentUnit = document.querySelector("input[name='shipmentDetails']:checked").value;
if (selectedMode == "express-mode") {
document.getElementById("chargeable-promo-banner").style.display = "none"
document.getElementById("chargeable-promo-banner-ocean").style.display = "none"
runDIMFunction();
if ($(".category-btn.category-active").attr('id') == 'shipment-details-btn') {
calculateShipmentTotalVolume();
calculateShipmentDimWeight();
calculateShipmentChargeableWeight();
}
let dimPermode = updateDIMonModes();
reCalculatedTargetvalue()
} else if (selectedMode == "oceanlcl-mode") {
document.getElementById("chargeable-promo-banner").style.display = "none"
document.getElementById("chargeable-promo-banner-ocean").style.display = "block"
runDIMFunction();
if ($(".category-btn.category-active").attr('id') == 'shipment-details-btn') {
calculateShipmentTotalVolume();
calculateShipmentDimWeight();
calculateShipmentChargeableWeight();
}
let dimPermode = updateDIMonModes();
reCalculatedTargetvalue()
} else {
document.getElementById("chargeable-promo-banner").style.display = "block"
document.getElementById("chargeable-promo-banner-ocean").style.display = "none"
runDIMFunction();
if ($(".category-btn.category-active").attr('id') == 'shipment-details-btn') {
calculateShipmentTotalVolume();
calculateShipmentDimWeight();
calculateShipmentChargeableWeight();
}
let dimPermode = updateDIMonModes();
reCalculatedTargetvalue()
}
}
}
let cargoDetailsUnit = document.getElementsByName("cargoDetails");
for (let i = 0; i < cargoDetailsUnit.length; i++) {
cargoDetailsUnit[i].onclick = function () {
$(".package-details:not(.shipment)").each((index, element) => {
if (cargoDetailsUnit[i].value === "LB_INCH") {
$(element).find(".cargo-weight-unit").text("lb");
$(element).find(".cargo-length-unit").text("in");
$(element).find(".cargo-width-unit").text("in");
$(element).find(".cargo-height-unit").text("in");
document.getElementById("cargo-total-weight-unit").innerHTML = "lbs";
document.getElementById("cargo-total-volume-unit").innerHTML = "ft";
document.getElementById("cargo-est-charge-weight-unit").innerHTML = "lbs";
document.getElementById("cargo-dimensional-weight-unit").innerHTML = "lbs";
cargoLBIN();
} else if (cargoDetailsUnit[i].value === "KG_M") {
$(element).find(".cargo-weight-unit").text("kg");
$(element).find(".cargo-length-unit").text("cm");
$(element).find(".cargo-width-unit").text("cm");
$(element).find(".cargo-height-unit").text("cm");
document.getElementById("cargo-total-weight-unit").innerHTML = "kg";
document.getElementById("cargo-total-volume-unit").innerHTML = "m";
document.getElementById("cargo-est-charge-weight-unit").innerHTML = "kg";
document.getElementById("cargo-dimensional-weight-unit").innerHTML = "kg";
cargoKGCM();
}
})
let dimPermode = updateDIMonModes();
}
}
let shipmentTotalUnit = document.getElementsByName("shipmentDetails");
for (let i = 0; i < shipmentTotalUnit.length; i++) {
shipmentTotalUnit[i].onclick = function () {
if (shipmentTotalUnit[i].value === "LB_FT3") {
document.getElementById("shipment-weight-unit").innerHTML = " lb";
document.getElementById("shipment-volume-unit").innerHTML = " ft";
document.getElementById("shipment-total-weight-unit").innerHTML = " lb";
document.getElementById("shipment-total-volume-unit").innerHTML = " ft";
document.getElementById("shipment-est-charge-weight-unit").innerHTML = " lb";
document.getElementById("shipment-dimensional-weight-unit").innerHTML = " lb";
selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value;
selectedShipmentUnit = document.querySelector("input[name='shipmentDetails']:checked").value;
shipmentLBFT();
calculateShipmentTotalVolume();
calculateShipmentDimWeight();
calculateShipmentChargeableWeight();
} else if (shipmentTotalUnit[i].value === "KG_M3") {
document.getElementById("shipment-weight-unit").innerHTML = "kg";
document.getElementById("shipment-volume-unit").innerHTML = "m";
document.getElementById("shipment-total-weight-unit").innerHTML = "kg";
document.getElementById("shipment-total-volume-unit").innerHTML = "m";
document.getElementById("shipment-est-charge-weight-unit").innerHTML = "kg";
document.getElementById("shipment-dimensional-weight-unit").innerHTML = " kg";
selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value;
selectedShipmentUnit = document.querySelector("input[name='shipmentDetails']:checked").value;
shipmentKGM();
calculateShipmentTotalVolume();
calculateShipmentDimWeight();
calculateShipmentChargeableWeight();
}
let dimPermode = updateDIMonModes();
}
}
function addCargoItem() {
const cargoPackageDetailsID = "cargo-package-details";
let cargoPackageDetails = document.getElementById(cargoPackageDetailsID);
let clonedElement = cargoPackageDetails.cloneNode(true);
let newId = cargoPackageDetailsID + "_" + Date.now();
clonedElement.id = newId;
let closePackageDetails = document.createElement("div");
closePackageDetails.className = "close-package-details icon ups-icon-close";
/*-- $(clonedElement).find('.ups-form_group.ups-dropdown-control').formDropdown(); --*/
closePackageDetails.addEventListener("click", function () {
clonedElement.remove();
});
$(clonedElement).find('[data-type="width"]').val('');
$(clonedElement).find('[data-type="length"]').val('');
$(clonedElement).find('[data-type="height"]').val('');
$(clonedElement).find('[data-type="quantity"]').val('');
$(clonedElement).find('[data-type="weight"]').val('');
$(clonedElement).removeClass("valid");
$(clonedElement).find('.ups-form_group.ups-input').each((index, element) => {
/*-- $(element).inputControl(); --*/
$(element).find('.error-msg').hide();
});
$(clonedElement).find('#btn_dropdown_0').remove();
$(clonedElement).find('#listbox_dropdown_0').remove();
clonedElement.appendChild(closePackageDetails);
$(".cargo-details-package-container").append(clonedElement);
}
let shipmentTotalQuantity;
let shipmentQuantity = document.getElementsByName("shipment-quantity");
function calculateShipmentTotalQuantity() {
if (Number(shipmentQuantity[0].value) <= 999) {
shipmentTotalQuantity = Number(shipmentQuantity[0].value)
document.getElementById("shipment-total-quantity").innerHTML = shipmentTotalQuantity;
document.getElementById("errorShipmentQuantity").style.display = "none";
document.getElementById("errorShipmentQuantity").classList.remove('errorTrue')
} else {
document.getElementById("errorShipmentQuantity").style.display = "block";
document.getElementById("shipment-total-quantity").innerHTML = 0;
document.getElementById("errorShipmentQuantity").classList.add('errorTrue')
}
}
let shipmentTotalWeight;
let shipmentWeight = document.getElementsByName("shipment-weight");
function calculateShipmentTotalWeight() {
if (Number(shipmentWeight[0].value) <= 99999) {
shipmentTotalWeight = Number(shipmentWeight[0].value);
document.getElementById("shipment-total-weight").innerHTML = shipmentTotalWeight;
document.getElementById("errorShipmentWeight").style.display = "none";
document.getElementById("errorShipmentWeight").classList.remove('errorTrue')
} else {
document.getElementById("errorShipmentWeight").style.display = "block";
document.getElementById("shipment-total-weight").innerHTML = 0;
document.getElementById("errorShipmentWeight").classList.add('errorTrue')
}
}
let shipmentTotalVolume;
let shipmentVolume = document.getElementsByName("shipment-volume");
function calculateShipmentTotalVolume() {
if (Number(shipmentVolume[0].value) <= 999999999) {
shipmentTotalVolume = Number(shipmentVolume[0].value);
document.getElementById("shipment-total-volume").innerHTML = shipmentTotalVolume;
document.getElementById("errorShipmentVolume").style.display = "none"
document.getElementById("errorShipmentVolume").classList.remove('errorTrue')
} else {
document.getElementById("shipment-total-volume").innerHTML = 0;
document.getElementById("shipment-est-charge-weight").innerHTML = 0;
document.getElementById("errorShipmentVolume").style.display = "block"
document.getElementById("errorShipmentVolume").classList.add('errorTrue')
}
}
let shipmentDimWeight;
function calculateShipmentDimWeight() {
shipmentDimWeight = Number(shipmentTotalVolume / DIMFactor);
if (selectedShipmentUnit == "KG_M3") {
shipmentDimWeight = (shipmentDimWeight * 1000000).toFixed(2);
document.getElementById("shipment-dimensional-weight").innerHTML = shipmentDimWeight;
} else if (selectedShipmentUnit == "LB_FT3") {
shipmentDimWeight = (shipmentDimWeight * 1728).toFixed(2);
document.getElementById("shipment-dimensional-weight").innerHTML = shipmentDimWeight;
}
}
function calculateShipmentChargeableWeight() {
if (shipmentDimWeight > shipmentTotalWeight) {
document.getElementById("shipment-est-charge-weight").innerHTML = Number(shipmentDimWeight) || 0;
} else {
document.getElementById("shipment-est-charge-weight").innerHTML = Number(shipmentTotalWeight) || 0;
}
}
let cargoTotalQuantityGlobal = 0, cargoTotalQuantityShare = 0;
function calculateCargoTotalQuantity() {
let cargoQuantity = document.getElementsByName("cargo-quantity");
let cargoTotalQuantity = 0;
cargoQuantity.forEach(field => {
let value = parseFloat(field.value) || 0;
cargoTotalQuantity += value;
})
document.getElementById("cargo-total-quantity").innerHTML = Number(cargoTotalQuantity);
cargoTotalQuantityShare = cargoTotalQuantity;
}
let cargoTotalWeightGlobal = 0;
function calculateCargoTotalWeight() {
let cargoWeight = document.getElementsByName("cargo-weight");
let cargoTotalWeight = 0;
cargoWeight.forEach(field => {
let value = parseFloat(field.value) || 0;
cargoTotalWeight += value;
})
document.getElementById("cargo-total-weight").innerHTML = Number(cargoTotalWeight * cargoTotalQuantityShare);
cargoTotalQuantityGlobal = Number(cargoTotalWeight * cargoTotalQuantityShare);
}
let cargoDimWeight, cargoTotalVolume = 0;
cargoDimWeight = Number(cargoTotalVolume / DIMFactor);
let estCargoChargeableWeightCalculator = 0;
function calculateCargoChargeableWeight() {
if (cargoDimWeight > cargoTotalQuantityGlobal) {
document.getElementById("cargo-est-charge-weight").innerHTML = Number(cargoDimWeight);
} else {
document.getElementById("cargo-est-charge-weight").innerHTML = Number(cargoTotalQuantityGlobal);
}
}
const ajaxCall = (method, urls, data, redirect) => {
let url = urls;
const timestamp = new Date().getTime().toString();
const calculatetime = timestamp
.substr(timestamp.length - 6)
.split('')
.map(Number)
?.reduce(function (acc, val) {
return acc + val;
}, 0);
const scskey = btoa(
'2cb220c0-9972-41ed-bc6d-257433b6d0ae^' + timestamp + '|' + calculatetime
);
return $.ajax({
cache: true,
url: url,
method: method,
header: { 'SCS-API-KEY': scskey },
data: data,
beforeSend: function (jqXHR, settings) {
jqXHR.setRequestHeader('scs-api-key', scskey
);
},
success: function (data) {
if (data.isValid) {
window.open(redirect + data.result, "_blank");
}
}
});
};
function calculateVolumeTotal(fromUnit, toUnit, length, width, height) {
let convertedLength = length;
let convertedWidth = width;
let convertedHeight = height;
if (fromUnit && toUnit) {
convertedLength = getConvertedValue(convertedLength, fromUnit, toUnit);
convertedWidth = getConvertedValue(convertedWidth, fromUnit, toUnit);
convertedHeight = getConvertedValue(convertedHeight, fromUnit, toUnit);
}
return convertedLength * convertedWidth * convertedHeight;
}
function calculateActualWeight(
fromUnit,
toUnit,
numberOfUnits = 1,
weight,
totalWeight
) {
let calculatedWeight = 0;
if (numberOfUnits > 1) {
calculatedWeight = numberOfUnits * weight;
} else {
calculatedWeight = totalWeight;
}
if (fromUnit && toUnit) {
calculatedWeight = getConvertedValue(calculatedWeight, fromUnit, toUnit);
}
return calculatedWeight;
}
const unitFactors = {
kg: { lbs: 1 / 2.20462 },
lbs: { kg: 2.20462 },
in: {
ft: 12,
m: 39.37,
cm: 1 / 2.54
},
ft: { in: 1 / 12 },
m: {
in: 1 / 39.37,
cm: 1 / 100
},
cm: { m: 100 }
};
const volumetricWeightFactor = {
in: {
kg: 366,
lbs: 166
},
cm: {
kg: 6000,
lbs: 166
},
in_naaf: {
kg: 306,
lbs: 139
},
cm_naaf: {
kg: 5000,
lbs: 139
},
in_ocean: {
kg: 61,
lbs: 40
},
cm_ocean: {
kg: 1000,
lbs: 40
}
};
function getConvertedValue(value, fromUnit, toUnit) {
if (fromUnit && toUnit && fromUnit !== toUnit) {
return value / unitFactors[fromUnit][toUnit];
}
return value;
}
function calculateDimensionalWeightOnMode(fromUnit, toUnit, volume) {
let dimensionalWeight;
if (fromUnit === 'in' && toUnit === 'kg') {
dimensionalWeight = volume / volumetricWeightFactor.in.kg;
} else if (fromUnit === 'cm' && toUnit === 'kg') {
dimensionalWeight = volume / volumetricWeightFactor.cm.kg;
} else if (fromUnit === 'in' && toUnit === 'lbs') {
dimensionalWeight = volume / volumetricWeightFactor.in.lbs;
}
return dimensionalWeight;
}
function calculateDimensionalWeightOnOceanMode(fromUnit, toUnit, volume) {
let dimensionalWeight;
if (fromUnit === 'in' && toUnit === 'kg') {
dimensionalWeight = volume / volumetricWeightFactor.in_ocean.kg;
} else if (fromUnit === 'cm' && toUnit === 'kg') {
dimensionalWeight = volume / volumetricWeightFactor.cm_ocean.kg;
} else if (fromUnit === 'in' && toUnit === 'lbs') {
dimensionalWeight = volume / volumetricWeightFactor.in_ocean.lbs;
}
return dimensionalWeight;
}
function calculateDimensionalWeightForNaaf(fromUnit, toUnit, volume) {
let dimensionalWeight;
if (fromUnit === 'in' && toUnit === 'kg') {
dimensionalWeight = volume / volumetricWeightFactor.in_naaf.kg;
} else if (fromUnit === 'cm' && toUnit === 'kg') {
dimensionalWeight = volume / volumetricWeightFactor.cm_naaf.kg;
} else if (fromUnit === 'in' && toUnit === 'lbs') {
dimensionalWeight = volume / volumetricWeightFactor.in_naaf.lbs;
}
return dimensionalWeight;
}
const cubicMetersPerMetricTonDivisor = 1000;
function roundNumber(value, precision = 2) {
return Math.round(value * Math.pow(10, precision)) / Math.pow(10, precision);
}
$(document).on("blur", ".validateKeypress", function (e) {
const parent = $(this).parents('.package-details');
if ((!isNaN(parent.find('[data-type="width"]').val()) && parent.find('[data-type="width"]').val() > 0) &&
(!isNaN(parent.find('[data-type="height"]').val()) && parent.find('[data-type="height"]').val() > 0) &&
(!isNaN(parent.find('[data-type="length"]').val()) && parent.find('[data-type="length"]').val() > 0) &&
(!isNaN(parent.find('[data-type="quantity"]').val()) && parent.find('[data-type="quantity"]').val() > 0) &&
(!isNaN(parent.find('[data-type="weight"]').val()) && parent.find('[data-type="weight"]').val() > 0)) {
parent.addClass('valid')
} else {
parent.removeClass('valid')
}
calculateCargoDetails(parent);
});
function calculateCargoDetails(parent = null) {
var dimensionsUnit,
weightUnit,
dimensionalWeight,
dimensionalWeightUnit,
shipmentTypeVolumeDimensions,
dimensionalWeightUnitInSelUnit,
densityDimensionUnit, numOfPieces = 0, inputVolumeInOrCmCube = 0,
totalVolume = 0, totalActualWeightInKg, totalDensity, totalVolForDensity = 0,
displayActualWeight = 0, totalDimensioanlWeightInSelUnit, displayEstChargableWeight,
selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value;
if (selectedCargoUnit === 'LB_INCH') {
dimensionsUnit = {
from: 'in',
to: 'ft'
};
densityDimensionUnit = {
from: 'in',
to: 'm'
};
weightUnit = {
from: 'lbs',
to: 'kg'
};
dimensionalWeightUnit = {
from: 'in',
to: 'kg'
};
dimensionalWeightUnitInSelUnit = {
from: 'in',
to: 'lbs'
};
shipmentTypeVolumeDimensions = {
from: 'ft',
to: 'in'
};
} else if (selectedCargoUnit === 'KG_M') {
dimensionsUnit = {
from: 'cm',
to: 'm'
};
weightUnit = {
from: 'kg',
to: 'kg'
};
dimensionalWeightUnit = {
from: 'cm',
to: 'kg'
};
shipmentTypeVolumeDimensions = {
from: 'm',
to: 'cm'
};
}
let CargoParent = $(".package-details:not(.shipment)");
for (let i = 0; i < CargoParent.length; i++) {
if ($(CargoParent[i]).hasClass('valid')) {
const formControl = $(CargoParent[i]);
const length = +formControl.find('[data-type="length"]').val();
const width = +formControl.find('[data-type="width"]').val();
const height = +formControl.find('[data-type="height"]').val();
const inputWeightPerPiece = +formControl.find('[data-type="weight"]').val();
const inputPieces = +formControl.find('[data-type="quantity"]').val();
totalVolume +=
inputPieces *
calculateVolumeTotal(
dimensionsUnit.from,
dimensionsUnit.to,
length,
width,
height
);
if (selectedCargoUnit === 'LB_INCH') {
totalVolForDensity +=
inputPieces *
calculateVolumeTotal(
dimensionsUnit.from,
dimensionsUnit.to,
length,
width,
height
);
} else {
totalVolForDensity = totalVolume;
}
numOfPieces += inputPieces;
$("#cargo-total-volume").text(roundNumber(totalVolForDensity));
$("#cargo-total-quantity").text(roundNumber(numOfPieces));
displayActualWeight += calculateActualWeight(
'',
'',
inputPieces,
inputWeightPerPiece,
inputWeightPerPiece
);
const actualWeightInKg = displayActualWeight;
totalActualWeightInKg = actualWeightInKg;
$("#cargo-total-weight").text(roundNumber(totalActualWeightInKg));
actualWeightPerCubic = actualWeightInKg / totalVolForDensity;
totalDensity =
cubicMetersPerMetricTonDivisor / actualWeightPerCubic;
inputVolumeInOrCmCube += inputPieces * (length * width * height);
if (selectedMode == "naaf-mode" || selectedMode == "express-mode") {
dimensionalWeight = calculateDimensionalWeightForNaaf(
dimensionalWeightUnit.from,
dimensionalWeightUnit.to,
inputVolumeInOrCmCube
)
} else if (selectedMode == "iaf-mode") {
dimensionalWeight = calculateDimensionalWeightOnMode(
dimensionalWeightUnit.from,
dimensionalWeightUnit.to,
inputVolumeInOrCmCube
);
} else {
dimensionalWeight = calculateDimensionalWeightOnOceanMode(
dimensionalWeightUnit.from,
dimensionalWeightUnit.to,
inputVolumeInOrCmCube)
}
totalDimensioanlWeightInKg = dimensionalWeight;
if (selectedCargoUnit === 'LB_INCH') {
if (selectedMode == "naaf-mode" || selectedMode == "express-mode") {
dimensionalWeight = calculateDimensionalWeightForNaaf(
dimensionalWeightUnitInSelUnit.from,
dimensionalWeightUnitInSelUnit.to,
inputVolumeInOrCmCube
)
} else if (selectedMode == "iaf-mode") {
dimensionalWeight = calculateDimensionalWeightOnMode(
dimensionalWeightUnitInSelUnit.from,
dimensionalWeightUnitInSelUnit.to,
inputVolumeInOrCmCube
);
} else {
dimensionalWeight = calculateDimensionalWeightOnOceanMode(
dimensionalWeightUnitInSelUnit.from,
dimensionalWeightUnitInSelUnit.to,
inputVolumeInOrCmCube
);
}
totalDimensioanlWeightInSelUnit = dimensionalWeight;
} else if (selectedCargoUnit === 'KG_M') {
totalDimensioanlWeightInSelUnit =
totalDimensioanlWeightInKg;
}
$("#cargo-dimensional-weight").text(roundNumber(totalDimensioanlWeightInSelUnit));
displayEstChargableWeight = roundNumber(
calculateEstChargableWeight(
dimensionalWeight,
actualWeightInKg
)
);
$("#cargo-est-chargeable-weight").text(displayEstChargableWeight);
}
}
}
function calculateEstChargableWeight(dimensionalWeight, actualWeight) {
return dimensionalWeight > actualWeight ? dimensionalWeight : actualWeight;
}
$("#submit, #submit-ocean").click(function (e) {
e.preventDefault();
var shipmentTotalsWeightUnit, shipmentTotalsDimensionalUnit, shipmentTotalsChargableWeightUnit, manual_dimensions = [], manual_volume = [], isShipmentTotalsSelected = false, shipmentTotalsActiveUnit = selectedShipmentUnit;
const selectedCargoUnit = document.querySelector("input[name='cargoDetails']:checked").value
var selectedCategory = $(".category-btn.category-active");
if (selectedShipmentUnit == "KG_M3") {
shipmentTotalsWeightUnit = 'kg';
shipmentTotalsDimensionalUnit = 'm';
shipmentTotalsChargableWeightUnit = 'kg';
} else {
shipmentTotalsWeightUnit = 'lb';
shipmentTotalsDimensionalUnit = 'ft';
shipmentTotalsChargableWeightUnit = 'kg';
}
if ($(".category-btn.category-active").attr('id') == 'cargo-details-btn') {
if ($(".package-details:not(.valid):not(.shipment)").length > 0) {
return false;
}
const formControl = $(".package-details:not(.shipment)");
for (let i = 0; i < formControl.length; i++) {
let cargoOBJ = {
inputPieces: $($(formControl)[i]).find('[data-type="quantity"]').val(),
inputWeightPerPiece: $($(formControl)[i]).find('[data-type="weight"]').val(),
inputLength: $($(formControl)[i]).find('[data-type="length"]').val(),
inputWidth: $($(formControl)[i]).find('[data-type="width"]').val(),
inputHeight: $($(formControl)[i]).find('[data-type="height"]').val(),
inputType: $($(formControl)[i]).find('select[name="selectCargoItems"]').val()
}
manual_dimensions.push(cargoOBJ)
}
isShipmentTotalsSelected = false;
} else {
if ($(".package-details.shipment").find('.errorTrue').length > 0) {
return false;
}
manual_volume.push({
packageType: $(".package-details.shipment").find('select[name="selectCargoItems"]').val(),
totalQuantity: $(".package-details.shipment").find('input[name="shipment-quantity"]').val(),
totalWeight: $(".package-details.shipment").find('input[name="shipment-weight"]').val(),
totalVolume: $(".package-details.shipment").find('input[name="shipment-volume"]').val(),
});
isShipmentTotalsSelected = true;
}
var jsonObj = {
shippingMode: {
data: {
modeType: selectedMode == "oceanlcl-mode" ? 'ocean lcl' : 'air',
isSectionComplete: false
}
},
cargoDetails: {
data: {
shipmentTotalsActiveUnit,
activeUnit: selectedCargoUnit,
manual_dimensions,
manual_volume,
isShipmentTotalsSelected,
shipmentTotalsWeightUnit,
shipmentTotalsChargableWeightUnit,
shipmentTotalsDimensionalUnit
}
}
}
let jsonStr = JSON.stringify(jsonObj)
var encodeJsonObj = btoa(jsonStr);
ajaxCall("GET", "https://scsapps.ups.com/api/ufhapp/Marketing/QuoteTemplate?TemplateJson=" + encodeJsonObj, null, "https://scsapps.ups.com/forwardinghub/cn/zh/quotes/ngflow?marketingId=");
});
function validateInput(event, maxLength, allowDecimals = true) {
let input = event.target.value;
let key = event.key;
if (key === "ArrowUp" || key === "ArrowDown") {
return { action: false, event: 'keyboardIgnore' };
}
const regex = /^[0-9]$/;
const isNumber = regex.test(key);
const containsDecimal = input.includes('.');
if (!allowDecimals && key === '.') {
event.preventDefault();
return { action: false, event: 'allowDecimals' };
}
if (key === '.' && containsDecimal) {
event.preventDefault();
return { action: false, event: 'extraDecimals' };
}
let effectiveMaxLength = maxLength;
if (containsDecimal) {
effectiveMaxLength += 2;
}
if ((input.length >= effectiveMaxLength && input > Number($(event.target).data('maxlength'))) || input < 1) {
event.preventDefault();
return { action: false, event: 'maxLength' };
}
if (!isNumber || (key === '.' && !containsDecimal)) {
if (key === '.' && input.split('.').length > 1 && input.split('.')[1].length >= 2) {
event.preventDefault();
return { action: false, event: 'extraLength' };
}
return { action: true };
}
event.preventDefault();
return { action: false, event: 'exception' };;
}
$(document).on("keyup", ".validatekeydown", function (e) {
let response = {};
if ($(this).data('type') === 'length') {
response = validateInput(e, 5, true);
} else if ($(this).data('type') === 'width') {
response = validateInput(e, 5, true);
} else if ($(this).data('type') === 'height') {
response = validateInput(e, 5, true);
} else if ($(this).data('type') === 'quantity') {
response = validateInput(e, 3, false);
} else if ($(this).data('type') === 'weight') {
response = validateInput(e, 5, true);
}
let errorElm = $(this).parent('.ups-text_wrapper').find('.error-msg');
if (response.event === 'keyboardIgnore') {
e.stopImmediatePropagation();
} else if (!response.action) {
e.stopImmediatePropagation();
if (response.event === 'extraDecimals') {
errorElm.text($(this).data('name') + ' decimal is not allowed.');
} else if (response.event === 'allowDecimals') {
errorElm.text($(this).data('name') + ' only 1 decimal is allowed.');
} else if (response.event === 'maxLength' || response.event === 'extraLength') {
errorElm.text($(this).data('name') + ' should be less than ' + $(this).data('maxlength') + " & greater than 0.");
} else if (response.event === 'invalidNumber') {
errorElm.text($(this).data('name') + ' does not accept special characters or incorrect values.');
} else if (response.event === 'exception') {
errorElm.text('');
}
errorElm.show();
$(this).parents('.package-details').addClass('errorMargin')
} else {
errorElm.hide();
$(this).parents('.package-details').removeClass('errorMargin')
}
})
function updateDIMonModes() {
var DIMFactor;
let selectedCargoUnit = document.querySelector(".is-visible input[name='cargoDetails']:checked")?.value || document.querySelector(".is-visible input[name='shipmentDetails']:checked")?.value;
let selectedModeElement = document.querySelector("input[name='mode-selection']:checked");
let selectedMode = selectedModeElement.value;
if (selectedCargoUnit == "KG_M" || selectedCargoUnit == "KG_M3") {
$(".iaf.dim").text('1:6000');
$(".naaf.dim").text('1:5000');
$(".express.dim").text('1:5000');
$(".ocean.dim").text('1:1000');
} else {
$(".iaf.dim").text('166');
$(".naaf.dim").text('139');
$(".express.dim").text('139');
$(".ocean.dim").text('40');
}
}
$(".ups-form_group.ups-input .ups-input_wrapper input").on("change keyup paste", function(){
let closest = $(this).closest(".ups-form_group.ups-input");
closest.find("input").addClass("has-value");
})
</script>
什么是计费重量?
在货运过程中,您所支付费用的重量可能与货物的实际重量不符。原因是物流服务供应商在决定运价时,需要考虑重量和空间。为确定高效、公平的系统,物流供应商使用“计费重量”的概念。
计费重量为实际重量与体积重量中的较大者。 该系统有助于物流供应商高效管理器空间,并根据重量和体积为客户公平计费。为避免运费出现异常,我们的免费计费重量计算器工具可帮助您确定货件的计费重量。该计算器根据行业标准计算重量,但是实际计算可能视发运人而异。
实际重量与体积重量
实际重量: 这只是将货物放在秤上称重的重量,实际重量也可以称为毛重。
体积重量(容积重量): 这表示您货件的体积,或货件相对于其实际重量所占用的空间量。尺寸重量将体积转换为等效重量,确定货物所占立方空间的最小重量。计算此重量的方法因运输方式或贸易路线而异,使用的是尺寸因子。
承运人使用体积重量帮助管理尺寸和重量之间的平衡,装运集装箱时必须要考虑到这一点。
货件的成本根据实际重量或体积重量确定,以较大者为准。
如何计算体积重量
要计算尺寸重量,请测量货物,并将每个尺寸四舍五入到最接近的整数。然后,将其体积(单位 x 长度 x 宽度 x 高度)除以适当的尺寸因子,通常简称为“因子”。
您的尺寸因子取决于货物的运输方式和详细信息。若要立即开始,您可以在 UPS ® Forwarding Hub 上创建报价。输入货物规格,我们将为您计算尺寸重量。
计算: 测量货件尺寸:长、宽、高。
使用公式:(单位 x 长 x 宽 x 高)/尺寸系数
实例 – 运输枕头与螺母和螺栓
假设您要发运一个大件满箱枕头。实际重量较小,但是箱子很大。在此示例中,将使用体积重量来计算枕头所占用的空间。
另一方面,如果您运送一件小的满箱螺母和螺栓,实际重量较大,但箱子不会占用太多空间。在这种情况下,实际重量可能会高于体积重量,因此您需要支付相应费用。