JOURNALSAY PVC Transparent A5/A6/A7 Planner Loose Leaf Binder Carry Travel Set Replaceable Inner Pages Office Stationery School Supplies

Transparent A5/A6A7 planner loose leaf binder

Style:  lattice
Specification:  A5
$3.29
$6.58
-50%
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":"085ec6cb-d6ae-4be9-8b91-d229076c9029","product_id":"10f6020f-092c-4fa9-a89c-f59dd33fc77d","title":"lattice-A5","weight_unit":"kg","inventory_quantity":1021,"sku":"32815773450-8","barcode":"","position":1,"option1":"lattice","option2":"A5","option3":"","note":"","image":{"src":"\/\/img.staticdj.com\/166b407b497e4e13c4a7a8aa12460d06.jpg","path":"166b407b497e4e13c4a7a8aa12460d06.jpg","width":1000,"height":1000,"alt":"JOURNALSAY PVC Transparent A5\/A6\/A7 Planner Loose Leaf Binder Carry Travel Set Replaceable Inner Pages Office Stationery School Supplies","aspect_ratio":1},"wholesale_price":[{"price":3.29,"min_quantity":1}],"weight":"0.1","compare_at_price":"6.58","price":"3.29","retail_price":"6.58","available":true,"url":"\/products\/journalsay-pvc-transparent-a5a6a7-planner-loose-leaf-binder-carry-travel-set-replaceable-inner-pages-office-stationery-school-supplies?variant=085ec6cb-d6ae-4be9-8b91-d229076c9029","available_quantity":1021,"options":[{"name":"style","value":"lattice"},{"name":"specification","value":"A5"}],"off_ratio":"50","flashsale_info":{"variant_id":"085ec6cb-d6ae-4be9-8b91-d229076c9029","product_id":"","quantity":0,"discount_id":"9a8295a9-21bf-4a65-b867-b6a199e908aa","limit_time":528039,"limit_buy":-1,"user_limit_buy":-1,"discount_sales":0,"discount_sales_rate":"0","discount_stock":1021,"ends_at":1734334199,"starts_at":1733731200,"allow_oversold":"uncheck","allocation_method":"none","price":"3.29","compare_at_price":"6.58","discount_price":"3.29","customary_saved_price":"3.29","customary_off_ratio":"50","discount_saved_price":"3.29","discount_off_ratio":"50","use_before_price":false,"before_price":"0","title":"","properties":"","color_setting_promotional_copy":"","discount_quantity":0,"is_need_split":false},"sales":10984}; // 上报 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(!true){ // 初始无货 按钮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\/5c385466ac825aa98c1cd91db00a9af1.jpg","path":"5c385466ac825aa98c1cd91db00a9af1.jpg","width":1000,"height":1000,"alt":"JOURNALSAY PVC Transparent A5\/A6\/A7 Planner Loose Leaf Binder Carry Travel Set Replaceable Inner Pages Office Stationery School Supplies","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);