48V 750W electric bike 1000w 15AH hydraulic disc brake electric bike full suspension dirt mountain fat tire bicycle electric
-
Shopping CartQuantitySubtotal-
-
Detail
Important properties
Industry attributes
Speed level7-speedFrame materialAluminum AlloyTire size20 inchesVoltage48vpower supplyLithium batteryBraking systemDisc brakesBattery capacity48V15AHOther properties
Torque70-80 NmCharging time${item.title}${item.content}`) } function addProductTab(tabData,classStr) { if (!Array.isArray(tabData)) { console.error("tab data error"); return false; } // tabData.sort((a,b)=>a.weight - b.weight) tabData.forEach((item) => { var tabItem = renderTab(item,classStr); var beforeIndex = -1; $(".moi-tabs .moi-tabs-item").each(function(index,el){ var weight = parseInt($(el).attr("weight")) if($(el).attr("data-type") === "recent_orders"){ weight = 55 } if(item.weight > weight){ beforeIndex = index return false } }) if(beforeIndex === -1){ $("#product-tabs").append(tabItem); }else{ $(".moi-tabs .moi-tabs-item").eq(beforeIndex).before(tabItem); } tabItem.find(".moi-tabs-title").click(tabItemEvent) }); } // ===== SKU 总价:单价 * 数量,实时同步 ===== function syncSubtotal() { var subtotalNode = $("#product-subtotal"); if (!subtotalNode.length) return; var quantityInput = $("#product-tabs #mo-quantity .product-calculator-value"); var quantityVal = parseInt(quantityInput.val(), 10); var quantity = Number.isFinite(quantityVal) && quantityVal > 0 ? quantityVal : 1; var productDetailIns = window.curentProductDetail || null; var params = productDetailIns && productDetailIns.params ? productDetailIns.params : {}; var product = productDetailIns && productDetailIns.product ? productDetailIns.product : (window.cod_product || {}); var price = Number(params.price); if (!Number.isFinite(price)) { price = Number((product.variant && product.variant.price) || product.variant_price_min || 0); } subtotalNode.text(formatMoney(price * quantity, _GET_C_SETTING_("currency"))); } /** 规格/数量变更后重新拉取配送方式(与 codPage/modules/shopping.js 中 getShippings 逻辑一致) */ function refreshCodShippingsAfterProductChange() { if (typeof window.refreshCodShippings === "function") { window.refreshCodShippings(); } } // ===== 页面事件绑定(tab 点击、数量变化) ===== $("#product-tabs .moi-tabs-title").click(tabItemEvent) $("#product-tabs .moi-tabs-title").click(function () { }); $("#product-tabs #mo-quantity .product-calculator-handle").click(function () { if(product_detail_order.isDeleteProduct){ return; } setTimeout(function () { syncSubtotal(); // refreshCodShippingsAfterProductChange(); }, 0); }); $("#product-tabs #mo-quantity .product-calculator-value").on("input change", function () { syncSubtotal(); // refreshCodShippingsAfterProductChange(); }); moi.addEvent("countryChanged", function (detail) { // console.log("国家改变了", detail); }); moi.addEvent("productOptionChange", function (detail) { console.log("改变",detail.params); setProductDetailOrder({ product_id:detail.params.product_id, variant_id:detail.params.id, quantity:detail.params.quantity, available:detail.params.available, isDeleteProduct:detail.params.isDeleteProduct, }) var defalultBuyBottonNode=document.querySelector("#buynow-"+detail.params.product_id); //判断一次按钮是否存在 const isHasStock = _GET_C_SETTING_("product").variants.some((item) => item.available != 0); if(defalultBuyBottonNode){ if(detail.params.isDeleteProduct){ defalultBuyBottonNode.disabled=true; defalultBuyBottonNode.textContent=lang.account.wishlist.product_offline; }else{ if(product_detail_order.available==0){ if(!isHasStock){ defalultBuyBottonNode.disabled=true; defalultBuyBottonNode.textContent=lang.checkout.out_of_stock.toUpperCase(); }else{ if(storeConfig.checked_first_sku == 2 && product_detail_order.variant_id==0){ defalultBuyBottonNode.disabled=false; defalultBuyBottonNode.textContent=lang.product.buy_it_now.toUpperCase(); }else{ defalultBuyBottonNode.disabled=true; defalultBuyBottonNode.textContent=lang.checkout.out_of_stock.toUpperCase(); } } }else{ if(!detail.params.id){ defalultBuyBottonNode.disabled=true; defalultBuyBottonNode.textContent=lang.checkout.out_of_stock.toUpperCase(); }else{ defalultBuyBottonNode.disabled=false; defalultBuyBottonNode.textContent=lang.product.buy_it_now.toUpperCase(); } } } } syncSubtotal(); // refreshCodShippingsAfterProductChange(); }); // ===== 对外暴露:供外部动态控制 Tab ===== window["addProductTab"] = addProductTab window["changeProductTab"] = function(values){ var tabId = $(".moi-tabs-active").data("id"); var currentTab = values.find(item=>item.id == tabId); if(currentTab && !currentTab.display){ $("#product-tabs .moi-tabs-title").eq(0).click(); } // if($(".moi-tabs-active").attr("data-type") !== "detail"){ // $("#product-tabs .moi-tabs-title").eq(0).click(); // } values.forEach((item)=>{ if(item.display){ $("#tabs-"+item.id).show() }else{ $("#tabs-"+item.id).hide() } }) } // ===== 页面初始化:启动订单滚动、初始化总价、默认激活 Tab ===== $(function(){ setTimeout(syncSubtotal, 0); setTimeout(syncSubtotal, 200); // 不管移动端还是PC,默认全部展开 $("#product-tabs .moi-tabs-item").addClass("moi-tabs-active"); $(".moi-tabs-item[data-type='comment']").addClass("moi-tabs-active"); $(".cod-comments-accordion").addClass("is-open"); // 默认选中第一个可用的 SKU 规格 // 注意:shopProduct 内部如果有初始化逻辑,这里可做补充;或者将选择逻辑放到 productOptionChange/ready 事件中 // var checkSkuInterval = setInterval(function() { // var skuRows = $(".control-product_detail-sku_box .product-sku-values"); // if(skuRows.length > 0) { // clearInterval(checkSkuInterval); // // 如果已经有选中的 SKU,则不执行强制选中逻辑(尊重 product.js 的最低价/最高价/库存最多等逻辑) // if (skuRows.find(".product-sku-values-item-active").length > 0) { // return; // } // skuRows.each(function() { // var firstAvailable = $(this).find(".product-sku-values-item:not(.product-sku-values-item-disable)").eq(0); // if(firstAvailable.length && !firstAvailable.hasClass("product-sku-values-item-active")) { // firstAvailable.click(); // } // }); // } // }, 200); // setTimeout(function() { // clearInterval(checkSkuInterval); // }, 5000); }) })()