JOURNALSAY Mini Transparent Cartoon Portable Kawaii ​Journal 3 Hole Binder

Color:  shui jing tian pin
$4.80
$10.00
-52%
Quantity
Visible only when the product is out of stock. Currently in preview mode.
Notify Me
(function(){ function $(selector){ return document.querySelector(selector); } const EMAIL_REG = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; // 获取dom数据 const doms = { button: $('#app-arrival-reminder-button'), previewBox: $('#app-arrival-reminder-preview-box'), toast: $('#app-arrival-reminder-toast'), lightbox: $('#arrival-lightbox'), datalist: $('#app-arrival-reminder-email-list'), imgRender: $('#app-arrival-reminder-product-image-render'), productVariant: $('#app-arrival-reminder-product-variant'), emailInput: $('#app-arrival-reminder-form .reminder-email-input'), emailWarn: $('#app-arrival-reminder-form .reminder-email-warn-wrap'), emailWarnText: $('#app-arrival-reminder-form .reminder-email-warn-text'), submitButton: $('#app-arrival-reminder-submit-button') }; // 选中的sku数据 let selectedVariant = {"id":"bd7316b9-d1c9-48b4-9eb3-3379dabbef99","product_id":"61956f7f-2e90-475a-86ba-15f44ec30d03","title":"shui jing tian pin","weight_unit":"kg","inventory_quantity":0,"sku":"HYB-YQRJ-04","barcode":"6938622735892","position":3,"option1":"shui jing tian pin","option2":"","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/ea62de2e8d9b87c896b718ed54bc118d.jpg","path":"ea62de2e8d9b87c896b718ed54bc118d.jpg","width":800,"height":800,"alt":"JOURNALSAY Mini Transparent Cartoon Portable Kawaii \u200bJournal 3 Hole Binder","aspect_ratio":1},"wholesale_price":[{"price":4.8,"min_quantity":1}],"weight":"0.04","compare_at_price":"10","price":"4.8","retail_price":"10","available":false,"url":"\/products\/mini-transparent-cartoon-portable-kawaii-journal-3-hole-binder?variant=bd7316b9-d1c9-48b4-9eb3-3379dabbef99","available_quantity":0,"options":[{"name":"Color","value":"shui jing tian pin"}],"off_ratio":52,"flashsale_info":[],"sales":454925}; // 上报 function reportData(params){ // 编辑/预览不上报 if(false){ return; } window.sa.track(params.event_name, { business_type: 'product_plugin', function_name: 'Back_in_Stock', plugin_name: "Back_in_Stock", template_name: "product", template_type: 1, module: "apps", module_type: "Back_in_Stock", event_info: JSON.stringify({ action_type: 'Back_in_Stock' }), ...params }); } // 按钮曝光上报 function buttonPVReport(){ reportData({ event_name: 'function_expose', event_type: 'expose', event_desc: '无货商品时触发' }); } // 弹窗曝光上报 function popupPVReport(){ reportData({ event_name: 'function_expose', event_type: 'popup_expose', event_desc: '弹窗曝光时触发' }); } // submit按钮点击上报 function submitClickReport(){ reportData({ event_name: 'function_click', event_type: 'popup_click', event_desc: '填入邮箱之后,点击notify 触发', event_info: JSON.stringify({ action_type: 'email_click' }), }); } // -----------------------初始化----------------- init(); // 初始化操作 function init(){ // 为确保window有后面添加的值例如window.sa 需要在DOMContentLoaded回调事件中执行逻辑 document.addEventListener("DOMContentLoaded", function() { // 设置邮件联想 setDataList(); if(!false){ // 初始无货 按钮pv事件埋点上报 buttonPVReport(); } }); } // 设置邮件联想 function setDataList(){ const customer_email = window.C_SETTINGS.customer.customer_email; if(customer_email){ const options = document.createElement('option'); options.setAttribute('value', customer_email); doms.datalist.appendChild(options); } } // -----------------------事件操作---------------- // 监听sku变化事件 document.addEventListener('dj.variantChange', variantChange); // 监听提醒按钮点击事件 doms.button.addEventListener('click', reminderButtonClick); // 监听提交按钮点击事件 doms.submitButton.addEventListener('click', submit); // 监听input元素的keydown事件 doms.emailInput.addEventListener('keydown', function(e) { // 判断是否按下了Enter键 if (e.keyCode === 13 || e.key === 'Enter') { submit(); } }); // 显示正常按钮 function showReminderButton(){ doms.button.classList.remove('app-arrival-hidden'); doms.previewBox.classList.add('app-arrival-preview-hidden'); buttonPVReport(); } // 展示预览按钮 function showPreviewButton(){ doms.button.classList.remove('app-arrival-hidden'); doms.previewBox.classList.remove('app-arrival-preview-hidden'); } // 隐藏按钮 function hiddenReminderButton(){ doms.button.classList.add('app-arrival-hidden'); doms.previewBox.classList.add('app-arrival-preview-hidden'); } // 提交数据, 请求接口 function submit(){ // 获取邮箱数据 const email = doms.emailInput.value.trim(); if(!email){ doms.emailWarnText.innerText = "Please enter your email address"; doms.emailWarn.classList.remove('app-arrival-hidden'); return; } if(!EMAIL_REG.test(email)){ doms.emailWarnText.innerText = "Please enter a valid email address"; doms.emailWarn.classList.remove('app-arrival-hidden'); return; } // 邮箱校验成功 doms.emailWarn.classList.add('app-arrival-hidden'); // 预览时不调接口 if(false){ SPZ.whenApiDefined(doms.toast).then(apis => { apis.showToast("Currently in preview mode, subscription is for testing only", 3000); }); return; } // 加入loading样式 doms.submitButton.classList.add('reminder-submit-button-loading'); // 提交数据请求接口 let quantity = 1; const quantityDom = $('#app-arrival-reminder-quantity-render ljs-quantity'); if(quantityDom){ quantity = Number(quantityDom.getAttribute('value')) || 1; } const params = { customer_email: email, product_num: quantity, product_id: selectedVariant.product_id, product_variant_id: selectedVariant.id }; fetch(`${window.C_SETTINGS.routes.root}/api/front/gobbler/v1/subscribe`, { method: 'POST', body: JSON.stringify(params), headers: { 'Content-Type': 'application/json' } }).then((res)=>res.json()).then((res)=>{ /* 后端错误提示 */ if(res.errors && res.errors.length){ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast(res.errors[0], 3000); }); return; } /* code * 0 SUCCESS 订阅成功 * 1 PRODUCT_OFFLINE 商品下架 * 2 INVENTORY_NOT_EMPTY 商品库存不为空 * 3 REPEAT_SUBSCRIBE 重复订阅 * 4 EMAIL_EMPTY 邮件为空 * 5 EMAIL_WRONG_FORMAT 邮件格式错误 * 99999 INVALID_PARAMS 其他参数错误 */ const codeMap = { SUCCESS: ()=>{ SPZ.whenApiDefined(doms.lightbox).then(apis=>{ apis.close(); }); SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Thank you for your subscription! We will notify you as soon as the product is back in stock!", 3000); }); }, INVENTORY_NOT_EMPTY: ()=>{ SPZ.whenApiDefined(doms.lightbox).then(apis=>{ apis.close(); }); SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Subscription failed. Product back in stock, please proceed to checkout.", 3000); }); setTimeout(()=>{ window.location.reload(); }, 3000); }, REPEAT_SUBSCRIBE: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("You've already subscribed to this product. We'll let you know as soon as it's back in stock. Feel free to explore our other products.", 3000); }); }, EMAIL_EMPTY: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Please enter your email address", 3000); }); }, EMAIL_WRONG_FORMAT: ()=>{ SPZ.whenApiDefined(doms.toast).then(apis=>{ apis.showToast("Please enter a valid email address", 3000); }); } }; codeMap.PRODUCT_OFFLINE = codeMap.SUCCESS; codeMap[res.code] && codeMap[res.code](); }).finally(()=>{ doms.submitButton.classList.remove('reminder-submit-button-loading'); }); // submit点击上报 submitClickReport(); } // 重新渲染dialog function refreshRenderDialog(){ console.log('selectedVariant', selectedVariant); const images = selectedVariant.image || {"src":"\/\/img.staticdj.com\/2c571d2c82034289f1c45f246f088d3d.jpg","path":"2c571d2c82034289f1c45f246f088d3d.jpg","width":800,"height":800,"alt":"JOURNALSAY Mini Transparent Cartoon Portable Kawaii \u200bJournal 3 Hole Binder","aspect_ratio":1}; const imagePosition = images.aspect_ratio > 1 ? 'left top' : 'center center'; // 重新渲染图片 SPZ.whenApiDefined(doms.imgRender).then((apis)=>{ apis.render({ images, imagePosition }); }); // 邮件错误提示置空 doms.emailWarn.classList.add('app-arrival-hidden'); // 重新渲染款式说明 if(selectedVariant.title){ doms.productVariant.innerText = selectedVariant.title.split('-').join('/'); } // 表单数据置空 doms.emailInput.value = ''; } // sku变化 单一款式不会触发 function variantChange(e){ const selected = e.detail.selected; // 子款式没变不执行操作 例如数量变化 if(selected.id === selectedVariant.id){ return; } selectedVariant = selected; console.log('selectedVariant', selectedVariant); // 数量变化 if(selected.available || selected.product_id === undefined){ // 有库存 编辑时展示预览按钮 否则隐藏按钮 if(false){ showPreviewButton(); }else { hiddenReminderButton(); } }else{ // 无库存 显示正常按钮 showReminderButton(); } } // 提醒按钮点击 function reminderButtonClick(){ refreshRenderDialog(); // 弹窗曝光上报 popupPVReport(); } document.body.appendChild(doms.toast); document.body.appendChild(doms.lightbox.parentElement); })();
Shipping
/** @private {string} */ class SpzCustomAnchorScroll extends SPZ.BaseElement { static deferredMount() { return false; } constructor(element) { super(element); /** @private {Element} */ this.scrollableContainer_ = null; } isLayoutSupported(layout) { return layout == SPZCore.Layout.LOGIC; } buildCallback() { this.viewport_ = this.getViewport(); this.initActions_(); } setTarget(containerId, targetId) { this.containerId = '#' + containerId; this.targetId = '#' + targetId; } scrollToTarget() { const container = document.querySelector(this.containerId); const target = container.querySelector(this.targetId); const {scrollTop} = container; const eleOffsetTop = this.getOffsetTop_(target, container); this.viewport_ .interpolateScrollIntoView_( container, scrollTop, scrollTop + eleOffsetTop ); } initActions_() { this.registerAction( 'scrollToTarget', (invocation) => this.scrollToTarget(invocation?.caller) ); this.registerAction( 'setTarget', (invocation) => this.setTarget(invocation?.args?.containerId, invocation?.args?.targetId) ); } /** * @param {Element} element * @param {Element} container * @return {number} * @private */ getOffsetTop_(element, container) { if (!element./*OK*/ getClientRects().length) { return 0; } const rect = element./*OK*/ getBoundingClientRect(); if (rect.width || rect.height) { return rect.top - container./*OK*/ getBoundingClientRect().top; } return rect.top; } } SPZ.defineElement('spz-custom-anchor-scroll', SpzCustomAnchorScroll); const STRENGTHEN_TRUST_URL = "/api/strengthen_trust/settings"; class SpzCustomStrengthenTrust extends SPZ.BaseElement { constructor(element) { super(element); this.renderElement_ = null; } isLayoutSupported(layout) { return layout == SPZCore.Layout.CONTAINER; } buildCallback() { this.xhr_ = SPZServices.xhrFor(this.win); const renderId = this.element.getAttribute('render-id'); SPZCore.Dom.waitForChild( document.body, () => !!document.getElementById(renderId), () => { this.renderElement_ = SPZCore.Dom.scopedQuerySelector( document.body, `#${renderId}` ); if (this.renderElement_) { this.render_(); } this.registerAction('track', (invocation) => { this.track_(invocation.args); }); } ); } render_() { this.fetchData_().then((data) => { if (!data) { return; } SPZ.whenApiDefined(this.renderElement_).then((apis) => { apis?.render(data); document.querySelector('#strengthen-trust-render-1539149753700').addEventListener('click',(event)=>{ if(event.target.nodeName == 'A'){ this.track_({type: 'trust_content_click'}); } }) }); }); } track_(data = {}) { const track = window.sa && window.sa.track; if (!track) { return; } track('trust_enhancement_event', data); } parseJSON_(string) { let result = {}; try { result = JSON.parse(string); } catch (e) {} return result; } fetchData_() { return this.xhr_ .fetchJson(STRENGTHEN_TRUST_URL) .then((responseData) => { if (!responseData || !responseData.data) { return null; } const data = responseData.data; const moduleSettings = (data.module_settings || []).reduce((result, moduleSetting) => { return result.concat(Object.assign(moduleSetting, { logos: (moduleSetting.logos || []).map((item) => { return moduleSetting.logos_type == 'custom' ? this.parseJSON_(item) : item; }) })); }, []); return Object.assign(data, { module_settings: moduleSettings, isEditor: window.self !== window.top, }); }); } } SPZ.defineElement('spz-custom-strengthen-trust', SpzCustomStrengthenTrust);