GMKtec NucBox G3 Plus Mini PC Intel® 12th Twin Lake N150
Space-saving. Lower power consumption. Ideal for multitasking, 4K streaming, light working, and smart digital solutions.
${function(){
const optName = "Variant";
const optionValue = data.originData.selectData ? data.originData.selectData[optName].value[0] : data.originData.value;
return `
Please select a Variant
`;
}()}
${function(){
const optName = "Color";
const optionValue = data.originData.selectData ? data.originData.selectData[optName].value[0] : data.originData.value;
return `
Please select a Color
`;
}()}
${function(){
const optName = "Power Plug Type";
const optionValue = data.originData.selectData ? data.originData.selectData[optName].value[0] : data.originData.value;
return `
Please select a Power Plug Type
`;
}()}
${function() {
const variantData = data.variant || {"id":"f80af01c-973f-48fe-bd07-e4359f825f05","product_id":"e44b55e8-163b-4188-b44b-82ccc7feeaee","title":"16+512GB-Grey-UK","weight_unit":"kg","inventory_quantity":0,"sku":"G3 PLUS-8-33K-EK2","barcode":"","position":1,"option1":"16+512GB","option2":"Grey","option3":"UK","note":"","image":null,"wholesale_price":[{"price":349.99,"min_quantity":1}],"weight":"3","compare_at_price":"0","price":"349.99","retail_price":"0","available":false,"url":"\/products\/nucbox-g3-plus-enhanced-performance-mini-pc-with-intel-n150-processor?variant=f80af01c-973f-48fe-bd07-e4359f825f05","available_quantity":0,"options":[{"name":"Variant","value":"16+512GB"},{"name":"Color","value":"Grey"},{"name":"Power Plug Type","value":"UK"}],"off_ratio":"0","flashsale_info":{"variant_id":"f80af01c-973f-48fe-bd07-e4359f825f05","product_id":"","quantity":0,"discount_id":"","limit_time":0,"limit_buy":0,"user_limit_buy":0,"discount_sales":0,"discount_sales_rate":"","discount_stock":0,"ends_at":0,"starts_at":0,"allow_oversold":"","allocation_method":"","price":"349.99","compare_at_price":"","discount_price":"349.99","customary_saved_price":"","customary_off_ratio":"","discount_saved_price":"","discount_off_ratio":"0","use_before_price":false,"before_price":"","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":5037};
const saveType = "amount";
const productSaveLabel = true;
return `
-
${saveType == 'percent' ? `-${variantData.off_ratio}%` : `-` }
`; }()}
const TAG = "spz-custom-product-automatic";
class SpzCustomProductAutomatic extends SPZ.BaseElement {
constructor(element) {
super(element);
this.variant_id = 'f80af01c-973f-48fe-bd07-e4359f825f05';
this.isRTL = SPZ.win.document.dir === 'rtl';
this.isAddingToCart_ = false; // å č“äøē¶ę
}
static deferredMount() {
return false;
}
buildCallback() {
this.action_ = SPZServices.actionServiceForDoc(this.element);
this.templates_ = SPZServices.templatesForDoc(this.element);
this.xhr_ = SPZServices.xhrFor(this.win);
this.setupAction_();
this.viewport_ = this.getViewport();
}
mountCallback() {
this.init();
// ēå¬äŗä»¶
this.bindEvent_();
}
async init() {
this.handleFitTheme();
const data = await this.getDiscountList();
this.renderApiData_(data);
}
async getDiscountList() {
const productId = 'e44b55e8-163b-4188-b44b-82ccc7feeaee';
const variantId = this.variant_id;
const productType = 'default';
const reqBody = {
product_id: productId,
variant_id: variantId,
discount_method: "DM_AUTOMATIC",
customer: {
customer_id: window.C_SETTINGS.customer.customer_id,
email: window.C_SETTINGS.customer.customer_email
},
product_type: productType
}
const url = `/api/storefront/promotion/display_setting/text/list`;
const data = await this.xhr_.fetchJson(url, {
method: "post",
body: reqBody
}).then(res => {
return res;
}).catch(err => {
this.setContainerDisabled(false);
})
return data;
}
async renderDiscountList() {
this.setContainerDisabled(true);
const data = await this.getDiscountList();
this.setContainerDisabled(false);
// éę°ęø²ę ęåØé®é¢å¤ē
this.renderApiData_(data);
}
clearDom() {
const children = this.element.querySelector('*:not(template)');
children && SPZCore.Dom.removeElement(children);
}
async renderApiData_(data) {
const parentDiv = document.querySelector('.automatic_discount_container');
const newTplDom = await this.getRenderTemplate(data);
if (parentDiv) {
parentDiv.innerHTML = '';
parentDiv.appendChild(newTplDom);
} else {
console.log('automatic_discount_container is null');
}
}
doRender_(data) {
const renderData = data || {};
return this.templates_
.findAndRenderTemplate(this.element, renderData)
.then((el) => {
this.clearDom();
this.element.appendChild(el);
});
}
async getRenderTemplate(data) {
const renderData = data || {};
return this.templates_
.findAndRenderTemplate(this.element, { ...renderData, isRTL: this.isRTL })
.then((el) => {
this.clearDom();
return el;
});
}
setContainerDisabled(isDisable) {
const automaticDiscountEl = document.querySelector('.automatic_discount_container_outer');
if(isDisable) {
automaticDiscountEl.setAttribute('disabled', '');
} else {
automaticDiscountEl.removeAttribute('disabled');
}
}
// ē»å®äŗä»¶
bindEvent_() {
window.addEventListener('click', (e) => {
let containerNodes = document.querySelectorAll(".automatic-container .panel");
let bool;
Array.from(containerNodes).forEach((node) => {
if(node.contains(e.target)){
bool = true;
}
})
// ęÆå¦popoveré¢ęæē¹å»čå“
if (bool) {
return;
}
if(e.target.classList.contains('drowdown-icon') || e.target.parentNode.classList.contains('drowdown-icon')){
return;
}
const nodes = document.querySelectorAll('.automatic-container');
Array.from(nodes).forEach((node) => {
node.classList.remove('open-dropdown');
})
// å
¼å®¹äø»é¢
this.toggleProductSticky(true);
})
// ēå¬åä½åå
document.addEventListener('dj.variantChange', async(event) => {
// éę°ęø²ę
const variant = event.detail.selected;
if (variant.product_id == 'e44b55e8-163b-4188-b44b-82ccc7feeaee' && variant.id != this.variant_id) {
this.variant_id = variant.id;
this.renderDiscountList();
}
});
}
// å
¼å®¹äø»é¢
handleFitTheme() {
// top å±ę§å½±åęåØ
let productInfoEl = null;
if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') {
productInfoEl = document.querySelector('.product-info-body .product-sticky-container');
} else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') {
productInfoEl = document.querySelector('.product__info-wrapper .properties-content');
}
if(productInfoEl){
productInfoEl.classList.add('force-top-auto');
}
}
// å
¼å®¹ wind/flash /hero äø»é¢ (stickyå±ę§å½±å popover å±ēŗ§å±ē¤ŗ, ä¼č¢«å
¶ä»å
ē“ č¦ē)
toggleProductSticky(isSticky) {
let productInfoEl = null;
if (window.SHOPLAZZA.theme.merchant_theme_name === 'Wind' || window.SHOPLAZZA.theme.merchant_theme_name === 'Flash') {
productInfoEl = document.querySelector('.product-info-body .product-sticky-container');
} else if (window.SHOPLAZZA.theme.merchant_theme_name === 'Hero') {
productInfoEl = document.querySelector('.product__info-wrapper .properties-content');
}
if(productInfoEl){
if(isSticky) {
// čæå评主é¢åęēstickyå±ę§å¼
productInfoEl.classList.remove('force-position-static');
return;
}
productInfoEl.classList.toggle('force-position-static');
}
}
setupAction_() {
this.registerAction('handleDropdown', (invocation) => {
const discount_id = invocation.args.discount_id;
const nodes = document.querySelectorAll('.automatic-container');
Array.from(nodes).forEach((node) => {
if(node.getAttribute('id') != `automatic-${discount_id}`) {
node.classList.remove('open-dropdown');
}
})
const $discount_item = document.querySelector(`#automatic-${discount_id}`);
$discount_item && $discount_item.classList.toggle('open-dropdown');
// å
¼å®¹äø»é¢
this.toggleProductSticky();
});
// å č“äŗä»¶
this.registerAction('handleAddToCart', (invocation) => {
// é»ę¢äŗä»¶åę³”
const event = invocation.event;
if (event) {
event.stopPropagation();
event.preventDefault();
}
// å¦ęę£åØå č“äøļ¼ē“ę„čæå
if (this.isAddingToCart_) {
return;
}
const quantity = invocation.args.quantity || 1;
this.addToCart(quantity);
});
}
// å č“ę¹ę³
async addToCart(quantity) {
// 设置å č“äøē¶ę
this.isAddingToCart_ = true;
const productId = 'e44b55e8-163b-4188-b44b-82ccc7feeaee';
const variantId = this.variant_id;
const url = '/api/cart';
const reqBody = {
product_id: productId,
variant_id: variantId,
quantity: quantity
};
try {
const data = await this.xhr_.fetchJson(url, {
method: 'POST',
body: reqBody
});
// 触åå č“ęåę示
this.triggerAddToCartToast_();
return data;
} catch (error) {
error.then(err=>{
this.showToast_(err?.message || err?.errors?.[0] || 'Unknown error');
})
} finally {
// ę 论ęå失蓄ļ¼é½éē½®å č“ē¶ę
this.isAddingToCart_ = false;
}
}
showToast_(message) {
const toastEl = document.querySelector("#apps-match-drawer-add_to_cart_toast");
if (toastEl) {
SPZ.whenApiDefined(toastEl).then((apis) => {
apis.showToast(message);
});
}
}
// 触åå č“ęåę示
triggerAddToCartToast_() {
// å¦ęäø»é¢ęčŖå·±ēå č“ę示ļ¼åäøę¾ē¤ŗ
const themeAddToCartToastEl = document.querySelector('#add-cart-event-proxy');
if (themeAddToCartToastEl) return;
// ę¾ē¤ŗåŗēØēå č“ęåę示
this.showToast_("Added successfully");
}
triggerEvent_(name, data) {
const event = SPZUtils.Event.create(this.win, `${ TAG }.${ name }`, data || {});
this.action_.trigger(this.element, name, event);
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.CONTAINER;
}
}
SPZ.defineElement(TAG, SpzCustomProductAutomatic);
class SpzCustomDiscountBundle extends SPZ.BaseElement {
constructor(element) {
super(element);
}
isLayoutSupported(layout) {
return layout == SPZCore.Layout.LOGIC;
}
mountCallback() {
// åäøé”µåÆč½ęå¤äøŖ block åčŖęø²ęę¬ snippetļ¼åƼč“é»č¾å
ē“ spz-custom-discount-toast(#appsAddCartToastFunc) éå¤ć
// ä»
äæē DOM äøē¬¬äøäøŖå®ä¾ļ¼å
¶ä½éå¤å®ä¾ē§»é¤čŖčŗ«ļ¼äæčÆé»č¾å
ē“ åå
¶ action å¼ēØ(appsAddCartToastFunc)åÆäøć
const funcs = document.querySelectorAll('#appsAddCartToastFunc');
if (funcs.length > 1 && this.element !== funcs[0]) {
this.element.remove();
return;
}
// å
Øå±ęę£ toast ēå¼¹åŗē¹åę£åØå¤äøŖęØ”ęæ/ē»ä»¶éļ¼å«å£°ęå¼ @atcErrorļ¼ļ¼ę ę³éäøåØå¼¹åŗååē½®ļ¼
// ę
ęč½½ę¶å¹ēå°å»éå¹¶ęå° bodyļ¼å č“ toast ę¹äøŗå¼¹åŗåęéå»éļ¼č§ showAddToCartToastļ¼
this.ensureSingleToastInBody_('cart_match_discount_toast_wrap');
}
unmountCallback() {}
// åäøé”µé¢åÆč½ęå¤äøŖ block åčŖęø²ęę¬ toast snippetļ¼å¦å详ē discount_automatic + č“ē©č½¦ę½å±éēęę£ęØŖå¹
ļ¼ļ¼
// åÆ¼č“ toast å¤å±åŗē°éå¤ idćéå¤ id äø getElementById/querySelector å SPZ åØä½å¼ēØé½åŖå½äøē¬¬äøäøŖļ¼
// äøč¢«å
³čæę½å±ēé£ä»½ä¼č¢«ę½å±ē transform/overflow č£åŖ/éä½ćčæéåØęč½½ę¶å¹ēå»éļ¼
// åŖäæēäøä»½ćē§»é¤å¤ä½ēļ¼å¹¶ęäæēēęå° bodyļ¼body ęÆ position:fixed ęå®å
Øēč½ē¹ļ¼éæå
被任ä½ē„å
č£åŖļ¼ćåÆåå¤č°ēØć
ensureSingleToastInBody_(id) {
const els = Array.from(document.querySelectorAll('#' + id));
if (!els.length) return;
els.slice(1).forEach((el) => el.remove());
const keep = els[0];
if (keep.parentNode !== document.body) {
document.body.appendChild(keep);
}
}
// äø»é¢č“ē©č½¦ę½å±ęÆå¦ęå¼
isInCartDrawer_() {
return !!document.querySelector('[data-section-type="cart_drawer"] spz-sidebar[open]');
}
setupAction_() {
this.registerAction('showAddToCartToast', () => {
// ę½å±å
å č“ļ¼äø»é¢ę¬å°±äøä¼ęå č“ęęļ¼ē»äøå¼¹ęä»¶čŖå·±ē toast
// éę½å±ļ¼äø»é¢ęå č“代ēå沿ēØäø»é¢å č“ęęļ¼å¦åęä»¶å
åŗ
const proxyEl = document.getElementById('add-cart-event-proxy');
const inDrawer = this.isInCartDrawer_();
if (!inDrawer && proxyEl) {
return;
}
// å¼¹åŗåęéå»éå¹¶ęå° bodyļ¼å¹ēļ¼ļ¼éæå
éå¤ id å½äøé对豔ę被ę½å±č£åŖ/éä½
this.ensureSingleToastInBody_('apps_add_cart_toast_wrap');
const toastEl = document.querySelector('#apps-match-drawer-add_to_cart_toast')
SPZ.whenApiDefined(toastEl).then((apis) => {
apis.showToast("Added successfully");
});
});
}
buildCallback() {
this.setupAction_();
};
}
SPZ.defineElement('spz-custom-discount-toast', SpzCustomDiscountBundle);
US Orders: No Import Fees
Product was out of stock.
Product is unavailable.