計費重量計算器

請使用下方的計算器來算得適用於所有託運方式、承運人和國家的任何貨物的計費重量。

獲取報價

<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> 轉運中心託運平台中輸入您的貨件詳細資料,我們就會轉錄這些尺寸。</div></div><div class=banner-btn><p><a class="ups-analytics ups-cta ups-cta-primary"href=https://scsapps.ups.com/forwardinghub/hk/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> 轉運中心託運平台中輸入您的貨件詳細資料,我們就會轉錄這些尺寸。</div></div><div class=banner-btn><p><a class="ups-analytics ups-cta ups-cta-primary"href=https://scsapps.ups.com/forwardinghub/hk/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/hk/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 高)除以適當的尺寸因數 (dimensional factor),通常縮寫為尺寸因數 (dim factor)。

您的尺寸因數取決於您的運輸方式和細節。要立即開始,請在 UPS® Forwarding Hub 上創建報價。請輸入您的貨物規格,我們會為您計算。

計算:  測量貨物的尺寸:長、寬、高。
使用公式:(單位 x 長 x 寬 x 高)/尺寸因數

實例 – 運輸枕頭對比運輸螺母和螺栓

想像一下您要託運一個裝滿枕頭的大箱子。實際重量較輕,只是箱子很大。在這種情況下,將使用體積重量來計算枕頭所佔用的空間。

另一方面,如果您運送一個裝滿螺母和螺栓的小箱子,實際重量會很重,不過箱子只佔用一點空間。在這種情況下,實際重量很可能高於體積重量,因此需要您支付相應費用。

img-left

https://delivery-p55671-e392469.adobeaemcloud.com/adobe/assets/urn:aaid:aem:9fd2047f-0003-4a0c-baed-ba8b8814ca33

準備預訂貨運嗎?

在我們的 UPS Forwarding Hub 託運平台上,此計費重量計算器內置於快速報價步驟中。這只是我們與世界最大貨運代理商之一合作讓您更輕鬆快捷地在網上託運貨物的一種方式。

獲取空運或海運報價,開始使用我們的服務